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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : GeometryGUI.h
25 // Author : Lucien PIGNOLONI
32 #include "SalomeApp_Module.h"
35 #include "GEOM_Client.hxx"
36 #include "SALOME_InteractiveObject.hxx"
38 #include "SALOMEDSClient.hxx"
47 #include "SALOMEconfig.h"
48 #include CORBA_CLIENT_HEADER(SALOMEDS)
51 #include <SALOME_WNT.hxx>
53 #define SALOME_WNT_EXPORT
57 //#include <SALOME_WNT.hxx>
59 //#define SALOME_WNT_EXPORT
62 #if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
63 #define GEOMGUI_WNT_EXPORT __declspec( dllexport )
65 #define GEOMGUI_WNT_EXPORT
68 typedef QMap<QString, GEOMGUI*> GUIMap;
72 class GEOMGUI_OCCSelector;
73 class SalomeApp_VTKSelector;
74 class SUIT_ViewManager;
76 //=================================================================================
77 // class : GeometryGUI
79 //=================================================================================
80 class GEOMGUI_WNT_EXPORT GeometryGUI : public SalomeApp_Module
91 virtual void initialize( CAM_Application* );
92 virtual QString engineIOR() const;
94 static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
96 static GEOM::GEOM_Gen_var GetGeomGen();// { return GeometryGUI::myComponentGeom; }
98 static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
99 static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
101 GEOM_Client& GetShapeReader() { return myShapeReader; }
102 Standard_CString& GetFatherior() { return myFatherior; }
103 //void SetState( const int state ) { myState = state; }
104 //int GetState() const { return myState; }
106 // Get active dialog box
107 QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
108 // Set active dialog box
109 void SetActiveDialogBox( QDialog* aDlg );
111 // Non modal dialog boxes management
112 void EmitSignalDeactivateDialog();
113 void EmitSignalCloseAllDialogs();
114 void EmitSignalDefaultStepValueChanged( double newVal );
116 void OnGUIEvent( int id );
118 virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
119 virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
120 virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
122 // virtual bool SetSettings();
123 // virtual void SupportedViewType ( int* buffer, int bufferSize );
124 virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
126 // virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject);
127 // virtual bool CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
128 // const QString& theParent, const QString& theObject );
130 // The Working Plane management
131 void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
132 gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }
133 void ActiveWorkingPlane();
135 virtual void windows( QMap<int, int>& ) const;
136 virtual void viewManagers( QStringList& ) const;
138 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
139 virtual void createPreferences();
140 virtual void preferencesChanged( const QString&, const QString& );
144 virtual bool deactivateModule( SUIT_Study* );
145 virtual bool activateModule( SUIT_Study* );
149 void onViewManagerAdded( SUIT_ViewManager* );
150 void onViewManagerRemoved( SUIT_ViewManager* );
151 void onWindowActivated( SUIT_ViewWindow* );
154 void SignalDeactivateActiveDialog();
155 void SignalCloseAllDialogs();
156 void SignalDefaultStepValueChanged( double newVal );
159 virtual SalomeApp_Selection* createSelection() const;
162 GEOMGUI* getLibrary( const QString& libraryName );
163 void createGeomAction( const int id, const QString& po_id,
164 const QString& icon_id = QString(""),
165 const int key = 0, const bool toggle = false );
166 void createPopupItem( const int, const QString& clients, const QString& types,
167 const bool isSingle = false, const int isVisible = -1,
168 const bool isExpandAll = false, const bool isOCC = false,
169 const int parentId = -1 );
172 static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!
174 GUIMap myGUIMap; // GUI libraries map
175 QDialog* myActiveDialogBox; // active dialog box
176 GEOM_Client myShapeReader; // geom shape reader
177 Standard_CString myFatherior;
178 int myState; // identify a method
179 gp_Ax3 myWorkingPlane;
180 QMap<int,QString> myRules; // popup rules
182 QPtrList<GEOMGUI_OCCSelector> myOCCSelectors;
183 QPtrList<SalomeApp_VTKSelector> myVTKSelectors;