From 711b7eb31640b919f91427479eb4ffbcfaf3a444 Mon Sep 17 00:00:00 2001 From: smh Date: Wed, 31 Mar 2004 12:10:27 +0000 Subject: [PATCH] Base class for all component GUI added: SALOMEGUI --- src/VISUGUI/VisuGUI.cxx | 67 +++++++++++++++++++++++++++++++++-------- src/VISUGUI/VisuGUI.h | 34 +++++++++++---------- 2 files changed, 73 insertions(+), 28 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 36e79fe1..f9438ddf 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -164,7 +164,7 @@ private: QFont font; }; -static VisuGUI MYVISUGUI; +static VisuGUI MYVISUGUI(""); VisuGUI *visuGUI = &MYVISUGUI; VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){ @@ -335,7 +335,8 @@ void RepaintCurrentView(){ } -VisuGUI::VisuGUI(){ +VisuGUI::VisuGUI( const QString& theName, QObject* theParent ) +: SALOMEGUI( theName, theParent ) { mySelectionDlg = 0; } @@ -655,6 +656,22 @@ bool VisuGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) return true; } +//=========================================================================== +// CanProcessEvent +//=========================================================================== +bool VisuGUI::CanProcessEvent(SALOME_Event* se) +{ +// return ( se && se->getType() > VISU_FIRST_EVENT && se->getType() < VISU_LAST_EVENT ); + return true; +} + +//=========================================================================== +// ProcessEvent +//=========================================================================== +bool VisuGUI::ProcessEvent(SALOME_Event* se) +{ + return true; +} void VisuGUI::SelectionInfo() { if (mySelectionDlg) { @@ -788,10 +805,10 @@ CREATEPRESENTATION(VisuGUI::CreateStreamLines); //===================================================================================== -// function : setSettings() +// function : SetSettings() // purpose : //===================================================================================== -bool VisuGUI::setSettings(QAD_Desktop* parent) +bool VisuGUI::SetSettings(QAD_Desktop* parent) { int anId = 53; QMenuData* pp; @@ -3104,47 +3121,68 @@ void VisuGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) END_OF("VisuGUI::BuildPresentation"); } + +//=========================================================================== +// SupportedViewType +//=========================================================================== +void VisuGUI::SupportedViewType(int* buffer, int bufferSize) +{ + if (!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_VTK; + if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D; +} + extern "C" { + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + if ( !visuGUI ) + visuGUI = new VisuGUI( "" ); + return visuGUI; + } + +//*************************************** +// san - obsolete code - TO BE REMOVED! +// No extern "C" fucntions below will be necessary! +//************************************** bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) { //if(MYDEBUG) MESSAGE("VisuGUI::OnGUIEvent "<< theCommandID); - return VisuGUI::OnGUIEvent(theCommandID, parent); + return visuGUI->OnGUIEvent(theCommandID, parent); } bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { if(MYDEBUG) MESSAGE("VisuGUI::OnKeyPress "); - return VisuGUI::OnKeyPress (pe, parent, studyFrame); + return visuGUI->OnKeyPress (pe, parent, studyFrame); } bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { //if(MYDEBUG) MESSAGE("VisuGUI::OnMousePress "); - return VisuGUI::OnMousePress (pe, parent, studyFrame); + return visuGUI->OnMousePress (pe, parent, studyFrame); } bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { //if(MYDEBUG) MESSAGE("VisuGUI::OnMouseMove "); - return VisuGUI::OnMouseMove (pe, parent, studyFrame); + return visuGUI->OnMouseMove (pe, parent, studyFrame); } bool SetSettings ( QAD_Desktop* parent ) { - return VisuGUI::setSettings( parent ); + return visuGUI->SetSettings( parent ); } bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, const QString & theParent, const QString & theObject ) { - return VisuGUI::CustomPopup( parent, popup, theContext, theParent, theObject ); + return visuGUI->CustomPopup( parent, popup, theContext, theParent, theObject ); } void definePopup ( QString & theContext, QString & theParent, QString & theObject ) { - VisuGUI::DefinePopup( theContext, theParent, theObject ); + visuGUI->DefinePopup( theContext, theParent, theObject ); } bool activeStudyChanged ( QAD_Desktop* parent ) @@ -3153,7 +3191,7 @@ extern "C" } void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) { - VisuGUI::BuildPresentation(theIO); + visuGUI->BuildPresentation(theIO); } void supportedViewType(int* buffer, int bufferSize) @@ -3164,6 +3202,11 @@ extern "C" } } +//*************************************** +// san - temporary code - TO BE REMOVED! +// No extern "C" fucntions will be necessary! +//************************************** + ////////////////////////////////////////////////////////////////////////////////// //////////////// CHANGE ACTOR COLOR //////////////////////// diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index ec5677ec..d301e1e3 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -54,6 +54,8 @@ class vtkRenderer; #include #include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOMEGUI.h" + namespace VISU{ class VISU_Gen_i; @@ -78,11 +80,11 @@ namespace VISU{ // ====================================================================== // -class VisuGUI : public QObject{ +class VisuGUI : public SALOMEGUI{ Q_OBJECT; public: - VisuGUI(); - ~VisuGUI(); + VisuGUI( const QString&, QObject* = 0 ); + virtual ~VisuGUI(); static VISU::VISU_Gen_i* GetVisuGen(); @@ -177,27 +179,31 @@ class VisuGUI : public QObject{ // ---------------------------------------- // All method of standard EXPORT // ---------------------------------------- - Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - Standard_EXPORT static bool setSettings(QAD_Desktop* parent); - Standard_EXPORT static void DefinePopup(QString & theContext, + virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + virtual bool CanProcessEvent(SALOME_Event* se); + virtual bool ProcessEvent(SALOME_Event* se); + virtual bool SetSettings(QAD_Desktop* parent); + virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject ) ; - Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent, + virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, const QString & theParent, const QString & theObject); - Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); - Standard_EXPORT static bool OnMousePress(QMouseEvent* pe , + virtual void BuildPresentation(const Handle(SALOME_InteractiveObject)&); + virtual bool OnMousePress(QMouseEvent* pe , QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe , + virtual bool OnMouseMove(QMouseEvent* pe , QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe, + virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - public slots: + virtual void SupportedViewType (int* buffer, int bufferSize); + +public slots: void ImportTablesFromFile(); void ExportTableToFile(); @@ -267,10 +273,6 @@ private : QDialog* myActiveDialogBox; int myState ; VisuGUI_SelectionDlg* mySelectionDlg; - -signals: - void SignalDeactivateActiveDialog(); - void SignalCloseAllDialogs(); }; #endif -- 2.39.2