Salome HOME
NRI : Merge from Event_Server. ( GEOM requires KERNEL Event_Server branch waiting...
authornri <nri@opencascade.com>
Fri, 30 Apr 2004 11:47:15 +0000 (11:47 +0000)
committernri <nri@opencascade.com>
Fri, 30 Apr 2004 11:47:15 +0000 (11:47 +0000)
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h

index 961533df5f2db559da432cfad7b373a332a9eb76..ed8e12e72cf294d42c8c5cef946b4a9829ea81b0 100644 (file)
@@ -58,10 +58,9 @@ typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&,
 // function : GeometryGUI()
 // purpose  : Constructor
 //=======================================================================
-GeometryGUI::GeometryGUI() :
-  QObject()
-{
-}
+GeometryGUI::GeometryGUI( const QString& theName, QObject* theParent ) :
+  SALOMEGUI( theName, theParent )
+{}
 
 
 //=======================================================================
@@ -530,7 +529,7 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr
 // function : activeStudyChanged()
 // purpose  : static
 //=================================================================================
-void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
+bool GeometryGUI::ActiveStudyChanged(QAD_Desktop* parent)
 {
   GeometryGUI::GetOrCreateGeometryGUI(parent); 
 
@@ -563,7 +562,7 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
   // PAL5356: update VTK selection
   ::UpdateVtkSelection(parent);
 
-  return;
+  return true;
 }
 
 
@@ -589,49 +588,23 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI
 }
 
 
-//=================================================================================
-// EXPORTED METHODS
-//=================================================================================
-extern "C"
+void GeometryGUI::SupportedViewType(int* buffer, int bufferSize)
 {
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {return GeometryGUI::OnGUIEvent(theCommandID, parent);}
-
-  bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {return GeometryGUI::OnKeyPress(pe, parent, studyFrame);}
-
-  bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {return GeometryGUI::OnMousePress(pe, parent, studyFrame);}
-
-  bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {return GeometryGUI::OnMouseMove(pe, parent, studyFrame);}
-
-  bool SetSettings(QAD_Desktop* parent)
-  {return GeometryGUI::SetSettings(parent);}
-
-  bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext,
-                    const QString & theParent, const QString & theObject)
-  {return GeometryGUI::CustomPopup(parent, popup, theContext, theParent, theObject);}
-
-  void definePopup(QString & theContext, QString & parent, QString & theObject)
-  {GeometryGUI::DefinePopup(theContext, parent, theObject);}
-  
-  bool activeStudyChanged(QAD_Desktop* parent)
-  {GeometryGUI::activeStudyChanged(parent);}
-
-  void buildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
-  {GeometryGUI::BuildPresentation(theIO);}
+  if(!buffer || !bufferSize) return;
+  buffer[0] = (int)VIEW_OCC;
+  if (--bufferSize) buffer[1] = (int)VIEW_VTK;
+}
 
-  void supportedViewType(int* buffer, int bufferSize)
-  {
-    if(!buffer || !bufferSize) return;
-    buffer[0] = (int)VIEW_OCC;
-    if (--bufferSize) buffer[1] = (int)VIEW_VTK;
-  }
+void GeometryGUI::Deactivate()
+{
+  if ( GeomGUI )
+    GeomGUI->EmitSignalCloseAllDialogs();
+}
 
-  void deactivate()
-  {
-    if ( GeomGUI )
-      GeomGUI->EmitSignalCloseAllDialogs();
+static GeometryGUI aGUI("");
+extern "C"
+{
+  Standard_EXPORT SALOMEGUI* GetComponentGUI() {
+    return &aGUI;
   }
 }
index dd133add00a47904bb455d68e856c270db56d1f7..06649f6226f723d8552b4a2b3597109eda8726d1 100644 (file)
 #ifndef GEOMETRYGUI_H
 #define GEOMETRYGUI_H
 
+#include "SALOMEGUI.h"
 #include "GEOMContext.h"
 
 //=================================================================================
 // class    : GeometryGUI
 // purpose  :
 //=================================================================================
-class GeometryGUI : public QObject
+class GeometryGUI : public SALOMEGUI
 {
   Q_OBJECT /* for QT compatibility */
 
 public :
-    GeometryGUI();
-    ~GeometryGUI();
-
-    static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop);
-
-    /* Managed by IAPP */
-    Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
-    Standard_EXPORT static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-    Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-    Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
-    Standard_EXPORT static bool SetSettings(QAD_Desktop* parent);
-    Standard_EXPORT static void activeStudyChanged(QAD_Desktop* parent);
-    Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
-    Standard_EXPORT static void DefinePopup(QString & theContext, QString & theParent, QString & theObject);
-    Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
-                                           const QString& theParent, const QString& theObject);
-
+  GeometryGUI( const QString& name = "", QObject* parent = 0 );
+  ~GeometryGUI();
+  
+  static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop);
+  
+  /* Managed by IAPP */
+  virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
+  virtual bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
+  virtual bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
+  virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
+  virtual bool SetSettings(QAD_Desktop* parent);
+  virtual bool ActiveStudyChanged(QAD_Desktop* parent);
+  virtual void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
+  virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject);
+  virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
+                          const QString& theParent, const QString& theObject);
+  virtual void SupportedViewType (int* buffer, int bufferSize);
+  virtual void Deactivate        ();
 };
 
 #endif