getDesktop() method is changed: now it is NOT virtual, it is implemented in GEOMBase_Helper and removed from all successors.

This commit is contained in:
asv 2005-08-02 12:45:47 +00:00
parent 694a9aaaee
commit c03f2eac0d
12 changed files with 21 additions and 56 deletions

View File

@ -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<SUIT_Desktop*>( 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<SUIT_Desktop*>( parentWidget() );
}

View File

@ -74,8 +74,6 @@ protected:
void closeEvent( QCloseEvent* e );
virtual SUIT_Desktop* getDesktop() const;
private :
void Init();
void enterEvent(QEvent* e);

View File

@ -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<SUIT_Desktop*>(parentWidget())
//================================================================
SUIT_Desktop* GEOMBase_Helper::getDesktop() const
{
return myDesktop;
}

View File

@ -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;
};

View File

@ -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<SUIT_Desktop*>( 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<SUIT_Desktop*>( parentWidget() );
}

View File

@ -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 !!!

View File

@ -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<SUIT_Desktop*>( 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<SUIT_Desktop*>( parentWidget() );
}

View File

@ -74,8 +74,6 @@ protected:
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual SUIT_Desktop* getDesktop() const;
protected:
QPushButton* mySelBtn;

View File

@ -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<SUIT_Desktop*>( 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<SUIT_Desktop*>( parentWidget() );
}

View File

@ -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:

View File

@ -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<SUIT_Desktop*>( 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<SUIT_Desktop*>( parentWidget() );
}

View File

@ -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 :