]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMGUI/GeometryGUI.h
Salome HOME
43a850bc533946edf050f71b3815e632cfff66cb
[modules/geom.git] / src / GEOMGUI / GeometryGUI.h
1 //  GEOM GEOMGUI : GUI for Geometry 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   : GeometryGUI.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef GEOMETRYGUI_H
30 #define GEOMETRYGUI_H
31
32 #include "SALOMEGUI.h"
33
34 #include "GEOMGUI.h"
35 #include "GEOM_Client.hxx"
36 #include "SALOME_InteractiveObject.hxx"
37 #include <qmap.h>
38
39 #include "gp_Ax3.hxx"
40
41 typedef QMap<QString, GEOMGUI*> GUIMap;
42
43 class QDialog;
44 class QPopupMenu;
45
46 //=================================================================================
47 // class    : GeometryGUI
48 // purpose  :
49 //=================================================================================
50 class GeometryGUI : public SALOMEGUI
51 {
52   Q_OBJECT;
53
54 protected:
55   // Constructor
56   GeometryGUI(); // hide constructor to avoid direct creation
57   // get or load GUI library by name
58   GEOMGUI* getLibrary( const QString& libraryName );
59
60 public:
61   // Destructor
62   ~GeometryGUI();
63
64   // Get the only GeometryGUI object
65   static GeometryGUI*         GetGeomGUI();
66
67   static CORBA::ORB_var       GetORB();
68
69   GEOM::GEOM_Gen_ptr          GetGeomGen()        { return myComponentGeom; }
70   GEOM_Client&                GetShapeReader()    { return myShapeReader; }
71   Standard_CString&           GetFatherior()      { return myFatherior; }
72   void                        SetState( const int state ) { myState = state; }
73   int                         GetState() const    { return myState; }
74   
75   // Get active dialog box
76   QDialog*                    GetActiveDialogBox(){ return myActiveDialogBox; }
77   // Set active dialog box
78   void                        SetActiveDialogBox( QDialog* aDlg );
79
80   // Non modal dialog boxes management
81   void                        EmitSignalDeactivateDialog();
82   void                        EmitSignalCloseAllDialogs();
83   void                        EmitSignalDefaultStepValueChanged( double newVal );
84
85   // The following methods are called from IAPP
86   virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
87   virtual bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
88   virtual bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
89   virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
90   virtual bool SetSettings(QAD_Desktop* parent);
91   virtual bool ActiveStudyChanged(QAD_Desktop* parent);
92   virtual void Deactivate();
93   virtual void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
94   virtual void SupportedViewType (int* buffer, int bufferSize);
95   virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject);
96   virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
97                            const QString& theParent, const QString& theObject);
98
99   // The Working Plane management
100   void SetWorkingPlane(gp_Ax3 WorkingPlane) { myWorkingPlane = WorkingPlane; };
101   gp_Ax3 GetWorkingPlane() { return myWorkingPlane; };
102   void ActiveWorkingPlane();
103
104 signals :
105   void SignalDeactivateActiveDialog();
106   void SignalCloseAllDialogs();
107   void SignalDefaultStepValueChanged( double newVal );
108
109 private:
110   static GeometryGUI* myContext;         // the only GeometryGUI object
111
112   GUIMap              myGUIMap;          // GUI libraries map
113   QDialog*            myActiveDialogBox; // active dialog box
114   GEOM_Client         myShapeReader;     // geom shape reader
115   Standard_CString    myFatherior;
116   GEOM::GEOM_Gen_var  myComponentGeom;   // GEOM engine
117   int                 myState;           // identify a method
118   gp_Ax3              myWorkingPlane;
119 };
120
121 #endif
122