From: asv Date: Tue, 2 Aug 2005 12:45:47 +0000 (+0000) Subject: getDesktop() method is changed: now it is NOT virtual, it is implemented in GEOMBase_... X-Git-Tag: T_3_0_2a1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c03f2eac0d732fd4f0569229bffb41ad44b0b0bd;p=modules%2Fgeom.git getDesktop() method is changed: now it is NOT virtual, it is implemented in GEOMBase_Helper and removed from all successors. --- diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 0ac078075..8224cc581 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -62,7 +62,8 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) - :EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), GEOMBase_Helper(), myIsAllAdded( false ), + :EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myIsAllAdded( false ), + GEOMBase_Helper( dynamic_cast( parent ) ), myGeometryGUI( GUI ) { myGeometryGUI->SetActiveDialogBox(this); @@ -1396,15 +1397,6 @@ bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, return true; } -//================================================================================= -// function : getDesktop() -// purpose : -//================================================================================= -SUIT_Desktop* EntityGUI_SketcherDlg::getDesktop() const -{ - return dynamic_cast( parentWidget() ); -} - diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 4fc1149d5..2546a5fe2 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -74,8 +74,6 @@ protected: void closeEvent( QCloseEvent* e ); - virtual SUIT_Desktop* getDesktop() const; - private : void Init(); void enterEvent(QEvent* e); diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 8809a521c..c1824cacc 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -92,8 +92,8 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine() // Function : GEOMBase_Helper // Purpose : //================================================================ -GEOMBase_Helper::GEOMBase_Helper() - : myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) +GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) + : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) { } @@ -963,3 +963,12 @@ Handle(SALOME_InteractiveObject) GEOMBase_Helper::lastIObject() return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)(); } +//================================================================ +// Function : getDesktop +// Purpose : Returns myDesktop field. Initialized in constructor, usually as dynamic_cast(parentWidget()) +//================================================================ +SUIT_Desktop* GEOMBase_Helper::getDesktop() const +{ + return myDesktop; +} + diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index 1667958df..ac07a3ede 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -58,7 +58,7 @@ class TColStd_MapOfInteger; class GEOMBase_Helper { public: - GEOMBase_Helper(); + GEOMBase_Helper( SUIT_Desktop* ); virtual ~GEOMBase_Helper(); protected: @@ -171,7 +171,7 @@ protected: bool IsPreview() {return isPreview;} GEOM_Displayer* getDisplayer(); - virtual SUIT_Desktop* getDesktop() const = 0; + SUIT_Desktop* getDesktop() const; private: char* getEntry ( GEOM::GEOM_Object_ptr ) const; @@ -188,6 +188,7 @@ private: QString myPrefix; bool isPreview; SALOME_ListIO mySelected; + SUIT_Desktop* myDesktop; }; diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index b2242cc24..a1a656ee0 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -44,7 +44,8 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, bool modal, WFlags fl) -:DlgRef_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), GEOMBase_Helper() + :DlgRef_Skeleton_QTD( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ) { if (!name) setName("GEOMBase_Skeleton"); @@ -215,12 +216,3 @@ int GEOMBase_Skeleton::getConstructorId() const return GroupConstructors->id( GroupConstructors->selected() ); return -1; } - -//================================================================================= -// function : getDesktop() -// purpose : -//================================================================================= -SUIT_Desktop* GEOMBase_Skeleton::getDesktop() const -{ - return dynamic_cast( parentWidget() ); -} diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index a6ca50f01..a4ae0b4da 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -60,7 +60,6 @@ protected: void initName( const char* thePrefix = 0 ); // initialize "Name" field with a string "thePrefix_X" (Vertex_3) virtual const char* getNewObjectName() const; // returns contents of "Name" field int getConstructorId() const; // returns id of a selected "constructor" radio button or '-1' in case of error - virtual SUIT_Desktop* getDesktop() const; QLineEdit* myEditCurrentArgument; /* Current LineEdit */ GEOMBase* myGeomBase; // SAN -- TO BE REMOVED !!! diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index 85eac7a0a..4e89cddc8 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -56,6 +56,7 @@ MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, const char* name ) : MeasureGUI_Skeleton_QTD( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( GUI ) { @@ -341,11 +342,3 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation() return getGeomEngine()->GetIMeasureOperations( getStudyId() ); } -//================================================================================= -// function : getDesktop() -// purpose : -//================================================================================= -SUIT_Desktop* MeasureGUI_Skeleton::getDesktop() const -{ - return dynamic_cast( parentWidget() ); -} diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h index 8d3236814..bcf601a1e 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -74,8 +74,6 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual SUIT_Desktop* getDesktop() const; - protected: QPushButton* mySelBtn; diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx index 7d2c88288..add5736ac 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx @@ -60,6 +60,7 @@ RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent ) : QDialog( theParent, "RepairGUI_FreeBoundDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( theParent ) ), myGeomGUI ( theGUI ) { setCaption( tr( "CAPTION" ) ); @@ -277,14 +278,5 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects ) return result; } -//================================================================================= -// function : getDesktop() -// purpose : -//================================================================================= -SUIT_Desktop* RepairGUI_FreeBoundDlg::getDesktop() const -{ - return dynamic_cast( parentWidget() ); -} - diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.h b/src/RepairGUI/RepairGUI_FreeBoundDlg.h index cdf07980e..e317cc3a7 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.h +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.h @@ -67,7 +67,6 @@ private: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool execute( ObjectList& objects ); virtual bool isValid( QString& ); - virtual SUIT_Desktop* getDesktop() const; private: diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx index fef1a3ac0..96b5c2a1e 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx @@ -67,6 +67,7 @@ using namespace std; RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) :QDialog( parent, "RepairGUI_FreeBoundDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + GEOMBase_Helper( dynamic_cast( parent ) ), myGeomGUI( GUI ) { myDisplayer = 0; @@ -327,11 +328,3 @@ void RepairGUI_FreeFacesDlg::onSetEditCurrentArgument() onSelectionDone(); } -//================================================================================= -// function : getDesktop() -// purpose : -//================================================================================= -SUIT_Desktop* RepairGUI_FreeFacesDlg::getDesktop() const -{ - return dynamic_cast( parentWidget() ); -} diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.h b/src/RepairGUI/RepairGUI_FreeFacesDlg.h index 80845f1d6..f42589b24 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.h +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.h @@ -55,7 +55,6 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& objects ); - virtual SUIT_Desktop* getDesktop() const; private :