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.com
22 // File : GroupGUI.cxx
23 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
27 #include "GroupGUI_GroupDlg.h"
29 #include <GeometryGUI.h>
31 #include <GEOMImpl_Types.hxx>
33 #include <SUIT_Session.h>
34 #include <SUIT_Desktop.h>
35 #include <SUIT_MessageBox.h>
36 #include <SalomeApp_Application.h>
37 #include <SalomeApp_Study.h>
38 #include <LightApp_SelectionMgr.h>
40 //=======================================================================
41 // function : GroupGUI()
42 // purpose : Constructor
43 //=======================================================================
44 GroupGUI::GroupGUI( GeometryGUI* parent )
49 //=======================================================================
50 // function : ~GroupGUI()
51 // purpose : Destructor
52 //=======================================================================
58 //=======================================================================
59 // function : OnGUIEvent()
61 //=======================================================================
62 bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
64 SalomeApp_Application* app = getGeometryGUI()->getApp();
65 if ( !app ) return false;
67 getGeometryGUI()->EmitSignalDeactivateDialog();
71 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
72 if ( !appStudy ) return false;
73 _PTR(Study) aStudy = appStudy->studyDS();
75 if ( aStudy->GetProperties()->IsLocked() ) {
76 SUIT_MessageBox::warning( parent,
78 tr( "WRN_STUDY_LOCKED" ) );
82 switch ( theCommandID ) {
84 case 8001: // CREATE GROUP
85 aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, getGeometryGUI(), parent );
87 case 801: // EDIT GROUP
92 LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
94 aSelMgr->selectedObjects( aList );
96 if ( aList.Extent() == 1 ) {
97 Standard_Boolean aResult = Standard_False;
98 GEOM::GEOM_Object_var anObj =
99 GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult );
101 if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) {
102 aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, getGeometryGUI(), parent );
106 SUIT_MessageBox::warning( parent, tr( "WRN_WARNING" ), tr( "NO_GROUP" ) );
110 app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
115 aDlg->updateGeometry();
116 aDlg->resize( aDlg->minimumSize() );
123 //=====================================================================================
125 //=====================================================================================
129 __declspec( dllexport )
131 GEOMGUI* GetLibGUI( GeometryGUI* p )
133 return new GroupGUI( p );