1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : VisuGUI_CursorDlg.cxx
25 // Author : Laurent CORNABE & Hubert ROLLAND
32 #include "VisuGUI_CursorDlg.h"
34 #include "SUIT_Session.h"
35 #include "SUIT_MessageBox.h"
36 #include "SUIT_ResourceMgr.h"
38 #include "LightApp_Application.h"
45 VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
46 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
49 setName( "VisuGUI_CursorDlg" );
51 setSizeGripEnabled( TRUE );
53 QGridLayout* TopLayout = new QGridLayout( this );
54 TopLayout->setSpacing( 6 );
55 TopLayout->setMargin( 11 );
57 TopGroupBox = new QGroupBox( this, "TopGroupBox" );
58 TopGroupBox->setColumnLayout(0, Qt::Vertical );
59 TopGroupBox->layout()->setSpacing( 0 );
60 TopGroupBox->layout()->setMargin( 0 );
61 QGridLayout* TopGroupBoxLayout = new QGridLayout( TopGroupBox->layout() );
62 TopGroupBoxLayout->setAlignment( Qt::AlignTop );
63 TopGroupBoxLayout->setSpacing( 6 );
64 TopGroupBoxLayout->setMargin( 11 );
66 Comment1 = new QLabel( tr( "TextLabel1" ), TopGroupBox, "Comment1" );
67 Comment1->setAlignment( QLabel::AlignCenter );
68 TopGroupBoxLayout->addWidget( Comment1, 0, 0 );
70 Comment2 = new QLabel( tr( "TextLabel2" ), TopGroupBox, "Comment2" );
71 Comment2->setAlignment( QLabel::AlignCenter );
72 TopGroupBoxLayout->addWidget( Comment2, 1, 0 );
74 SpinBox1 = new QSpinBox( 1, 100, 1, TopGroupBox, "SpinBox1" );
75 SpinBox1->setValue( 100 );
76 SpinBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
77 SpinBox1->setMinimumSize( 70, 0 );
78 QHBoxLayout* SLayout = new QHBoxLayout;
79 SLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
80 SLayout->addWidget( SpinBox1 );
81 SLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
82 TopGroupBoxLayout->addLayout( SLayout, 2, 0 );
84 GroupButtons = new QGroupBox (this, "GroupButtons");
85 GroupButtons->setGeometry(QRect(10, 10, 281, 48));
86 GroupButtons->setColumnLayout(0, Qt::Vertical);
87 GroupButtons->layout()->setSpacing(0);
88 GroupButtons->layout()->setMargin(0);
89 QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout());
90 GroupButtonsLayout->setAlignment(Qt::AlignTop);
91 GroupButtonsLayout->setSpacing(6);
92 GroupButtonsLayout->setMargin(11);
94 buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk");
95 buttonOk->setAutoDefault(TRUE);
96 buttonOk->setDefault(TRUE);
97 GroupButtonsLayout->addWidget(buttonOk, 0, 0);
99 GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
101 buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel");
102 buttonCancel->setAutoDefault(TRUE);
103 GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
105 buttonHelp = new QPushButton(tr("&Help") , GroupButtons, "buttonHelp");
106 buttonHelp->setAutoDefault(TRUE);
107 GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
109 TopLayout->addWidget(TopGroupBox, 0, 0);
110 TopLayout->addWidget(GroupButtons, 1, 0);
112 // signals and slots connections
113 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
114 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
115 connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
121 VisuGUI_CursorDlg::~VisuGUI_CursorDlg()
129 void VisuGUI_CursorDlg::onHelp()
131 QString aHelpFileName = "/files/changing_visualization_parameters_of_the_presenetation.htm#Width";
132 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
134 VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
135 app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
138 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
139 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
140 arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
141 QObject::tr("BUT_OK"));