]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_Dialog.cxx
Salome HOME
3666b7c4669d7fb4b03a1f96673590fd0a6d2e8c
[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 <SMESHGUI_Operation.h>
31 #include <SMESH_Type.h>
32 #include <SUIT_Session.h>
33 #include <SalomeApp_Application.h>
34
35 //=================================================================================
36 // function : SMESHGUI_Dialog
37 // purpose  : Constructor
38 //=================================================================================
39 SMESHGUI_Dialog::SMESHGUI_Dialog( const bool modal, const bool allowResize, const int flags )
40 : SalomeApp_Dialog( desktop(), "", modal, allowResize, flags )
41 {
42   int prefix = SMESHGUI_Operation::prefix( "SMESH" );
43   typeName( prefix + MESH ) = tr( "DLG_MESH" );
44   typeName( prefix + HYPOTHESIS ) = tr( "DLG_HYPO" );
45   typeName( prefix + ALGORITHM ) = tr( "DLG_ALGO" );
46 }
47
48 //=================================================================================
49 // function : ~SMESHGUI_Dialog
50 // purpose  : Destructor
51 //=================================================================================
52 SMESHGUI_Dialog::~SMESHGUI_Dialog()
53 {
54 }
55
56 //=================================================================================
57 // function : show
58 // purpose  :
59 //=================================================================================
60 void SMESHGUI_Dialog::show()
61 {
62   adjustSize();
63   SUIT_Desktop *PP = desktop();
64   int x = abs( PP->x() + PP->size().width() - size().width() - 10 ),
65       y = abs( PP->y() + PP->size().height() - size().height() - 10 );
66   move(x, y);
67   SalomeApp_Dialog::show();
68 }
69
70 //=================================================================================
71 // function : setContentActive
72 // purpose  :
73 //=================================================================================
74 void SMESHGUI_Dialog::setContentActive( const bool active ) const
75 {
76   mainFrame()->setEnabled( active );
77 }
78
79 //=================================================================================
80 // function : desktop
81 // purpose  :
82 //=================================================================================
83 SUIT_Desktop* SMESHGUI_Dialog::desktop() const
84 {
85   SUIT_Desktop* d = 0;
86   SUIT_Session* s = SUIT_Session::session();
87   if( s )
88   {
89     SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( s->activeApplication() );
90     if( app )
91       d = app->desktop();
92   }
93   return d;
94 }