1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/***************************************************************************
rattribdialog.cpp - description
-------------------
begin : Tue Sep 28 1999
copyright : (C) 1999 by Andreas Mustun
email : andrew@ribbonsoft.com
***************************************************************************/
#include "rattribdialog.h"
#include "rlabel.h"
#include "rconfig.h"
/**
* Constructor
*/
RAttribDialog::RAttribDialog(const char* _caption,
const char* _label,
QWidget* _parent)
:QDialog(_parent, _caption, true, WStyle_NormalBorder)
{
setCaption(_caption);
setFixedSize(DEF_ATTRIBDLG_WIDTH, DEF_ATTRIBDLG_HEIGHT+20);
// Create label:
//
lText = new RLabel(_label, this, "ltext");
lText->setAlignment(AlignCenter);
if(lText->sizeHint().width()+20>DEF_ATTRIBDLG_WIDTH) {
setFixedWidth(lText->sizeHint().width()+20);
}
if(lText->sizeHint().height()+70>DEF_ATTRIBDLG_HEIGHT) {
setFixedHeight(lText->sizeHint().height()+70);
}
lText->setGeometry(10, 10, width()-10, 30);
// Create labels:
//
RLabel* lab = new RLabel(RMES(425), this);
lab->setGeometry(10, 60, (width()-20)/3, 20);
lab = new RLabel(RMES(426), this);
lab->setGeometry(10+(width()-20)/3, 60, (width()-20)/3, 20);
lab = new RLabel(RMES(427), this);
lab->setGeometry(10+(width()-20)/3*2, 60, (width()-20)/3, 20);
// Create comboboxes:
//
cbColor = new RComboBox(false, this, "color");
cbColor->fillInColors();
cbColor->insertItem(RMES(443));
cbColor->setEditText(RMES(443));
QToolTip::add(cbColor, RMES(425));
cbColor->setGeometry(10, 80, (width()-20)/3, 20);
cbWidth = new RComboBox(false, this, "width");
cbWidth->fillInWidths();
cbWidth->insertItem(RMES(443));
cbWidth->setEditText(RMES(443));
QToolTip::add(cbWidth, RMES(426));
cbWidth->setGeometry(10+(width()-20)/3, 80, (width()-20)/3, 20);
cbStyle = new RComboBox(false, this, "width");
cbStyle->fillInStyles();
cbStyle->insertItem(RMES(443));
cbStyle->setEditText(RMES(443));
QToolTip::add(cbStyle, RMES(427));
cbStyle->setGeometry(10+(width()-20)/3*2, 80, (width()-20)/3, 20);
// Create buttons:
//
bOk = new QPushButton(RMES(46), this);
bOk->setGeometry(width()-150, 110, 70, 20);
bOk->setAccel(Key_Return);
connect(bOk, SIGNAL(clicked()), SLOT(accept()));
bCancel = new QPushButton(RMES(47), this);
bCancel->setGeometry(width()-80, 110, 70, 20);
bCancel->setAccel(Key_Escape);
connect(bCancel, SIGNAL(clicked()), SLOT(reject()));
/*
bHelp = new QPushButton(RMES(48), this);
bHelp->setGeometry(10+(width()-20)/3*2, 110, (width()-20)/3, 20);
bHelp->setAccel(Key_F1);
*/
}
/**
* Destructor
*/
RAttribDialog::~RAttribDialog()
{
}
// Get the chosen color or -1 if no color was chosen:
//
int
RAttribDialog::getColor()
{
if(cbColor) {
if(cbColor->currentText().isNull()) {
return cbColor->currentItem();
}
}
return -1;
}
// Get the chosen width or -1 if no width was chosen:
//
int
RAttribDialog::getWidth()
{
if(cbWidth) {
if(cbWidth->currentText().isNull()) {
return cbWidth->currentItem();
}
}
return -1;
}
// Get the chosen style or -1 if no style was chosen:
//
int
RAttribDialog::getStyle()
{
if(cbStyle) {
if(cbStyle->currentText().isNull()) {
return cbStyle->currentItem();
}
}
return -1;
}
|