1 // GEOM GEOMGUI : GUI for Geometry 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.org
24 // File : GroupGUI.cxx
25 // Author : Sergey ANIKIN
30 #include "GroupGUI_GroupDlg.h"
32 #include "GEOMImpl_Types.hxx"
34 #include "SALOMEGUI_QtCatchCorbaException.hxx"
35 #include "QAD_Desktop.h"
36 #include "QAD_MessageBox.h"
38 GroupGUI* GroupGUI::myGUIObject = 0;
40 //=======================================================================
41 // function : GetGroupGUI()
42 // purpose : Get the only GroupGUI object [ static ]
43 //=======================================================================
44 GroupGUI* GroupGUI::GetGroupGUI()
46 if ( myGUIObject == 0 )
47 myGUIObject = new GroupGUI();
52 //=======================================================================
53 // function : GroupGUI()
54 // purpose : Constructor
55 //=======================================================================
62 //=======================================================================
63 // function : ~GroupGUI()
64 // purpose : Destructor
65 //=======================================================================
71 //=======================================================================
72 // function : OnGUIEvent()
74 //=======================================================================
75 bool GroupGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent )
77 GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
79 SALOME_Selection* Sel = SALOME_Selection::Selection(
80 QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
84 if ( QAD_Application::getDesktop()->getActiveStudy()->isLocked() ) {
85 QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
86 QObject::tr("WRN_WARNING"),
87 QObject::tr("WRN_STUDY_LOCKED"),
88 QObject::tr("BUT_OK") );
92 switch ( theCommandID ) {
94 aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, parent, "", Sel );
98 if ( Sel->IObjectCount() == 1 ) {
99 Standard_Boolean aResult = Standard_False;
100 GEOM::GEOM_Object_var anObj =
101 GEOMBase::ConvertIOinGEOMObject( Sel->firstIObject(), aResult );
103 if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) {
104 aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, parent, "", Sel );
108 QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
115 parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
125 //=====================================================================================
127 //=====================================================================================
132 return GroupGUI::GetGroupGUI();