]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Code unification by template usage
authorsmh <smh@opencascade.com>
Tue, 20 Apr 2004 05:48:50 +0000 (05:48 +0000)
committersmh <smh@opencascade.com>
Tue, 20 Apr 2004 05:48:50 +0000 (05:48 +0000)
src/VISU_I/VISU_ViewManager_i.cc

index 6a3de0d8b350f573707d205d29fede04051f01a8..b2964382aa78104b73422497248c75a72e07a287 100644 (file)
@@ -43,7 +43,7 @@
 #include "VISU_ScalarBarActor.hxx"
 #include "VISU_Actor.h"
 
-#include "VISU_Event.h"
+#include "SALOME_Event.hxx"
 
 #include "QAD_Application.h"
 #include "QAD_Desktop.h"
@@ -80,68 +80,8 @@ static int MYDELAY = 1;
 
 namespace VISU{
   //===========================================================================
-  template<class TObject, typename TResult = void>
-  class TMemFunEvent: public SALOME_Event{
-  public:
-    typedef TResult (TObject::* TAction)();
-    TMemFunEvent(TObject* theObject, TAction theAction):
-      myObject(theObject),
-      myAction(theAction)
-    {}
-    virtual bool Execute(){
-      (myObject->*myAction)();
-      return true; 
-    }
-  private:
-    TObject* myObject;
-    TAction myAction;
-  };
-  typedef TMemFunEvent<QAD_StudyFrame> TFrameActionEvent;
-  
+  typedef TVoidMemFunEvent<QAD_StudyFrame> TFrameActionEvent;
 
-  template<class TObject, typename TArg, typename TStoreArg = TArg, typename TResult = void>
-  class TMemFun1ArgEvent: public SALOME_Event{
-  public:
-    typedef TResult (TObject::* TAction)(TArg);
-    TMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg):
-      myObject(theObject),
-      myAction(theAction),
-      myArg(theArg)
-    {}
-    virtual bool Execute(){
-      (myObject->*myAction)(myArg);
-      return true; 
-    }
-  private:
-    TObject* myObject;
-    TAction myAction;
-    TStoreArg myArg;
-  };
-  
-
-  template<class TObject, typename TArg, typename TArg1, 
-          typename TStoreArg = TArg, typename TStoreArg1 = TArg1, 
-          typename TResult = void>
-  class TMemFun2ArgEvent: public SALOME_Event{
-  public:
-    typedef TResult (TObject::* TAction)(TArg,TArg1);
-    TMemFun2ArgEvent(TObject* theObject, TAction theAction, TArg theArg, TArg1 theArg1):
-      myObject(theObject),
-      myAction(theAction),
-      myArg(theArg),
-      myArg1(theArg1)
-    {}
-    virtual bool Execute(){
-      (myObject->*myAction)(myArg,myArg1);
-      return true; 
-    }
-  private:
-    TObject* myObject;
-    TAction myAction;
-    TStoreArg myArg;
-    TStoreArg1 myArg1;
-  };
-  
   template<class TObject>
   class TSetBackgroundEvent: public SALOME_Event{
     TObject* myView;
@@ -549,7 +489,7 @@ namespace VISU{
 
 
   void XYPlot_i::Update() {
-    ProcessVoidEvent(new TMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
+    ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::Repaint));
   }
 
 
@@ -563,7 +503,7 @@ namespace VISU{
 
 
   void XYPlot_i::SetTitle(const char* theTitle){
-    ProcessVoidEvent(new TMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
                     (myStudyFrame,&QAD_StudyFrame::setCaption,QString(theTitle)));
   }
   char* XYPlot_i::GetTitle() {
@@ -572,7 +512,7 @@ namespace VISU{
 
 
   void XYPlot_i::SetSubTitle(const char* theTitle){
-    ProcessVoidEvent(new TMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
                     (myView,&Plot2d_ViewFrame::setTitle,QString(theTitle)));
   }
   char* XYPlot_i::GetSubTitle() {
@@ -581,7 +521,7 @@ namespace VISU{
 
 
   void XYPlot_i::SetCurveType(VISU::XYPlot::CurveType theType){
-    ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+    ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
                     (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
   }
   VISU::XYPlot::CurveType XYPlot_i::GetCurveType(){
@@ -590,7 +530,7 @@ namespace VISU{
 
 
   void XYPlot_i::SetMarkerSize(CORBA::Long theSize){
-    ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+    ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
                     (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
   }
   CORBA::Long XYPlot_i::GetMarkerSize(){
@@ -703,7 +643,7 @@ namespace VISU{
 
 
   void XYPlot_i::ShowLegend(CORBA::Boolean theShowing){
-    ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
+    ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
                     (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
   }
 
@@ -801,12 +741,12 @@ namespace VISU{
 
 
   void XYPlot_i::EraseAll() {
-    ProcessVoidEvent(new TMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::EraseAll));
+    ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::EraseAll));
   }
 
 
   void XYPlot_i::FitAll() {
-    ProcessVoidEvent(new TMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::fitAll));
+    ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::fitAll));
   }
 
 
@@ -850,7 +790,7 @@ namespace VISU{
 
 
   void TableView_i::SetTitle(const char* theTitle){
-    ProcessVoidEvent(new TMemFun1ArgEvent<SALOMEGUI_TableDlg,const QString&,QString>
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<SALOMEGUI_TableDlg,const QString&,QString>
                     (myView,&SALOMEGUI_TableDlg::setCaption,QString(theTitle)));
   }
 
@@ -1114,7 +1054,7 @@ namespace VISU{
 
   //-------------------- View interface --------------------
   void View3D_i::SetTitle(const char* theTitle){
-    ProcessVoidEvent(new TMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
+    ProcessVoidEvent(new TVoidMemFun1ArgEvent<QAD_StudyFrame,const QString&,QString>
                     (myStudyFrame,&QAD_StudyFrame::setTitle,QString(theTitle)));
   }
   char* View3D_i::GetTitle() {
@@ -1213,7 +1153,7 @@ namespace VISU{
 
   //-------------------- View3D interface --------------------
   void View3D_i::FitAll() { 
-    ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFitAll));
+    ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFitAll));
     Update();
   }
 
@@ -1221,22 +1161,22 @@ namespace VISU{
   void View3D_i::SetView(VISU::View3D::ViewType theType) {
     switch(theType){
     case VISU::View3D::FRONT : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFront));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewFront));
       break;
     case VISU::View3D::BACK : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBack));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBack));
       break;
     case VISU::View3D::LEFT : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewLeft));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewLeft));
       break;
     case VISU::View3D::RIGHT : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewRight));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewRight));
       break;
     case VISU::View3D::TOP : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewTop));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewTop));
       break;
     case VISU::View3D::BOTTOM : 
-      ProcessVoidEvent(new TMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBottom));
+      ProcessVoidEvent(new TVoidMemFunEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),&VTKViewer_ViewFrame::onViewBottom));
       break;
     }
     Update();