]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_Dialog.cxx
Salome HOME
*** empty log message ***
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Dialog.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : SMESHGUI_Dialog.cxx
25 //  Author : Alexander SOLOVYOV
26 //  Module : SMESH
27 //  $Header$
28
29 #include <SMESHGUI_Dialog.h>
30 #include <SMESH_Type.h>
31 #include <SUIT_Session.h>
32 #include <SalomeApp_Application.h>
33
34 //=================================================================================
35 // function : SMESHGUI_Dialog
36 // purpose  : Constructor
37 //=================================================================================
38 SMESHGUI_Dialog::SMESHGUI_Dialog( const bool modal, const bool allowResize, const int flags )
39 : SalomeApp_Dialog( desktop(), "", modal, allowResize, flags )
40 {
41   int pr = prefix( "SMESH" );
42   typeName( pr + MESH ) = tr( "DLG_MESH" );
43   typeName( pr + HYPOTHESIS ) = tr( "DLG_HYPO" );
44   typeName( pr + ALGORITHM ) = tr( "DLG_ALGO" );
45 }
46
47 //=================================================================================
48 // function : ~SMESHGUI_Dialog
49 // purpose  : Destructor
50 //=================================================================================
51 SMESHGUI_Dialog::~SMESHGUI_Dialog()
52 {
53 }
54
55 //=================================================================================
56 // function : show
57 // purpose  :
58 //=================================================================================
59 void SMESHGUI_Dialog::show()
60 {
61   adjustSize();
62   SUIT_Desktop *PP = desktop();
63   int x = abs( PP->x() + PP->size().width() - size().width() - 10 ),
64       y = abs( PP->y() + PP->size().height() - size().height() - 10 );
65   move(x, y);
66   SalomeApp_Dialog::show();
67 }
68
69 //=================================================================================
70 // function : setContentActive
71 // purpose  :
72 //=================================================================================
73 void SMESHGUI_Dialog::setContentActive( const bool active ) const
74 {
75   mainFrame()->setEnabled( active );
76 }
77
78 //=================================================================================
79 // function : desktop
80 // purpose  :
81 //=================================================================================
82 SUIT_Desktop* SMESHGUI_Dialog::desktop() const
83 {
84   SUIT_Desktop* d = 0;
85   SUIT_Session* s = SUIT_Session::session();
86   if( s )
87   {
88     SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( s->activeApplication() );
89     if( app )
90       d = app->desktop();
91   }
92   return d;
93 }
94
95 //=======================================================================
96 // name    : prefix
97 // Purpose : Get prefix for module types
98 //=======================================================================
99 int SMESHGUI_Dialog::prefix( const QString& name )
100 {
101   if( name == "GEOM" )
102     return 100;
103   else if( name == "SMESH" )
104     return 200;
105   else if( name == "SMESH element" )
106     return 300;
107   else
108     return 0;
109 }