Salome HOME
Merge with PAL/SALOME 2.1.0d
[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                                   QAD_ViewFrame*  = 0 );
95   virtual void SupportedViewType (int* buffer, int bufferSize);
96   virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject);
97   virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
98                            const QString& theParent, const QString& theObject);
99
100   // The Working Plane management
101   void SetWorkingPlane(gp_Ax3 WorkingPlane) { myWorkingPlane = WorkingPlane; };
102   gp_Ax3 GetWorkingPlane() { return myWorkingPlane; };
103   void ActiveWorkingPlane();
104
105 signals :
106   void SignalDeactivateActiveDialog();
107   void SignalCloseAllDialogs();
108   void SignalDefaultStepValueChanged( double newVal );
109
110 private:
111   static GeometryGUI* myContext;         // the only GeometryGUI object
112
113   GUIMap              myGUIMap;          // GUI libraries map
114   QDialog*            myActiveDialogBox; // active dialog box
115   GEOM_Client         myShapeReader;     // geom shape reader
116   Standard_CString    myFatherior;
117   GEOM::GEOM_Gen_var  myComponentGeom;   // GEOM engine
118   int                 myState;           // identify a method
119   gp_Ax3              myWorkingPlane;
120 };
121
122 #endif
123