1 // SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_Dialog.cxx
25 // Author : Alexander SOLOVYOV
29 #include <SMESHGUI_Dialog.h>
30 #include <SMESH_Type.h>
31 #include <SUIT_Session.h>
32 #include <SalomeApp_Application.h>
34 //=================================================================================
35 // function : SMESHGUI_Dialog
36 // purpose : Constructor
37 //=================================================================================
38 SMESHGUI_Dialog::SMESHGUI_Dialog( QWidget* parent, const bool modal,
39 const bool allowResize, const int flags )
40 : LightApp_Dialog( parent == 0 ? desktop() : parent, "", modal, allowResize, flags )
42 int pr = prefix( "SMESH" );
43 typeName( pr + MESH ) = tr( "DLG_MESH" );
44 typeName( pr + HYPOTHESIS ) = tr( "DLG_HYPO" );
45 typeName( pr + ALGORITHM ) = tr( "DLG_ALGO" );
46 setButtonText(1, "A&pply and Close"); //rename OK to Apply and Close
48 setButtonPosition( Right, Close );
51 //=================================================================================
52 // function : ~SMESHGUI_Dialog
53 // purpose : Destructor
54 //=================================================================================
55 SMESHGUI_Dialog::~SMESHGUI_Dialog()
59 //=================================================================================
62 //=================================================================================
63 void SMESHGUI_Dialog::show()
66 LightApp_Dialog::show();
69 //=================================================================================
70 // function : setContentActive
72 //=================================================================================
73 void SMESHGUI_Dialog::setContentActive( const bool active )
75 mainFrame()->setEnabled( active );
76 setButtonEnabled( active, OK );
77 setButtonEnabled( active, Apply );
78 setButtonEnabled( active, Cancel );
79 setButtonEnabled( active, Close );
80 setButtonEnabled( active, Help );
83 //=================================================================================
86 //=================================================================================
87 SUIT_Desktop* SMESHGUI_Dialog::desktop() const
90 SUIT_Session* s = SUIT_Session::session();
93 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( s->activeApplication() );
100 //=======================================================================
102 // Purpose : Get prefix for module types
103 //=======================================================================
104 int SMESHGUI_Dialog::prefix( const QString& name )
108 else if( name == "SMESH" )
110 else if( name == "SMESH element" )
116 //=======================================================================
117 // name : resourceMgr
118 // Purpose : Gets resource manager
119 //=======================================================================
120 SUIT_ResourceMgr* SMESHGUI_Dialog::resourceMgr()
122 return SUIT_Session::session()->resourceMgr();