+
+
+
+/*!
+ Called when <OK> button is clicked, validates data and closes dialog
+*/
+void VisuGUI_ScalarBarDlg::accept()
+{
+ if (myScalarPane->check()) QDialog::accept();
+}
+
+
+
+
+
+//#######################################################################################
+
+
+
+
+
+VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg(QWidget* parent) :
+ QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setName( "VisuGUI_TextPrefDlg" );
+ setCaption( tr("TIT_TEXT_PREF") );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QGroupBox* aTitleGrp = new QGroupBox( this );
+ aTitleGrp->setTitle(tr("LBL_TITLE"));
+ aTitleGrp->setColumnLayout(0, Qt::Vertical );
+ QGridLayout* aTitleLayout = new QGridLayout( aTitleGrp->layout() );
+ aTitleLayout->setSpacing( 6 );
+ aTitleLayout->setMargin( 3 );
+
+ myTitleEdt = new QLineEdit(aTitleGrp);
+ aTitleLayout->addMultiCellWidget(myTitleEdt, 0, 0, 0, 4);
+
+ QStrList aFontsLst;
+ aFontsLst.append("Arial");
+ aFontsLst.append("Courier");
+ aFontsLst.append("Times");
+
+ myTitColor = new QToolButton(aTitleGrp);
+ connect( myTitColor, SIGNAL(clicked()), this, SLOT(setTitleColor()) );
+ aTitleLayout->addWidget(myTitColor, 1, 0);
+
+ myTitFontCombo = new QComboBox(aTitleGrp);
+ myTitFontCombo->insertStrList(aFontsLst);
+ aTitleLayout->addWidget(myTitFontCombo, 1, 1);
+
+ myTitBoldChk = new QCheckBox(tr("LBL_BOLD"), aTitleGrp);
+ aTitleLayout->addWidget(myTitBoldChk, 1, 2);
+
+ myTitItalicChk = new QCheckBox(tr("LBL_ITALIC"), aTitleGrp);
+ aTitleLayout->addWidget(myTitItalicChk, 1, 3);
+
+ myTitShadowChk = new QCheckBox(tr("LBL_SHADOW"), aTitleGrp);
+ aTitleLayout->addWidget(myTitShadowChk, 1, 4);
+
+ TopLayout->addWidget( aTitleGrp );
+
+ QGroupBox* aLabelsGrp = new QGroupBox( this );
+ aLabelsGrp->setTitle(tr("LBL_LABELS"));
+ aLabelsGrp->setColumnLayout(0, Qt::Vertical );
+ QGridLayout* aLabelLayout = new QGridLayout( aLabelsGrp->layout() );
+ aLabelLayout->setSpacing( 6 );
+ aLabelLayout->setMargin( 3 );
+
+ myLblColor = new QToolButton(aLabelsGrp);
+ connect( myLblColor, SIGNAL(clicked()), this, SLOT(setLabelColor()) );
+ aLabelLayout->addWidget(myLblColor, 0, 0);
+
+ myLblFontCombo = new QComboBox(aLabelsGrp);
+ myLblFontCombo->insertStrList(aFontsLst);
+ aLabelLayout->addWidget(myLblFontCombo, 0, 1);
+
+ myLblBoldChk = new QCheckBox(tr("LBL_BOLD"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblBoldChk, 0, 2);
+
+ myLblItalicChk = new QCheckBox(tr("LBL_ITALIC"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblItalicChk, 0, 3);
+
+ myLblShadowChk = new QCheckBox(tr("LBL_SHADOW"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblShadowChk, 0, 4);
+
+ TopLayout->addWidget( aLabelsGrp );
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+void VisuGUI_TextPrefDlg::setTitleColor() {
+ QColor aColor = QColorDialog::getColor( getTitleColor(), this );
+ if (aColor.isValid()) setTitleColor(aColor);
+}
+
+void VisuGUI_TextPrefDlg::setLabelColor() {
+ QColor aColor = QColorDialog::getColor( getLabelColor(), this );
+ if (aColor.isValid()) setLabelColor(aColor);
+}
+
+
+
+#define GETFONT(FuncName, Control) \
+int VisuGUI_TextPrefDlg::FuncName() \
+{ \
+ switch (Control->currentItem()) { \
+ case 0: return VTK_ARIAL; \
+ case 1: return VTK_COURIER; \
+ case 2: return VTK_TIMES; \
+ } \
+}
+
+#define SETFONT(FuncName, Control) \
+void VisuGUI_TextPrefDlg::FuncName(int theFont) \
+{ \
+ switch (theFont) { \
+ case VTK_ARIAL: Control->setCurrentItem(0); break; \
+ case VTK_COURIER: Control->setCurrentItem(1); break; \
+ case VTK_TIMES: Control->setCurrentItem(2); break; \
+ } \
+}
+
+GETFONT(getTitleFont, myTitFontCombo);
+SETFONT(setTitleFont, myTitFontCombo);
+
+GETFONT(getLabelFont, myLblFontCombo);
+SETFONT(setLabelFont, myLblFontCombo);
+
+#undef GETFONT
+#undef SETFONT