From: vsr Date: Thu, 2 Mar 2006 13:36:44 +0000 (+0000) Subject: * add methods to get default menu group() and to clear given menu X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de8fdb4e740205d456f4db139745d7c0cbaa4a82;p=modules%2Fgui.git * add methods to get default menu group() and to clear given menu --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 4385a6def..67f222687 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -939,6 +939,24 @@ bool SalomePyQt::dumpView( const QString& filename ) return ProcessEvent( new TDumpViewEvent( filename ) ); } +/*! + SalomePyQt::defaultMenuGroup + Returns default menu group +*/ +class TDefMenuGroupEvent: public SALOME_Event { +public: + typedef int TResult; + TResult myResult; + TDefMenuGroupEvent() : myResult( -1 ) {} + virtual void Execute() { + myResult = SALOME_PYQT_Module::defaultMenuGroup(); + } +}; +int SalomePyQt::defaultMenuGroup() +{ + return ProcessEvent( new TDefMenuGroupEvent() ); +} + /*! SalomePyQt::createTool These methods allow operating with the toolbars: @@ -1253,3 +1271,32 @@ int SalomePyQt::actionId( const QtxAction* a ) { return ProcessEvent( new TActionIdEvent( a ) ); } + +/*! + SalomePyQt::clearMenu + Clears given menu (recursively if necessary) +*/ +class TClearMenuEvent: public SALOME_Event { +public: + typedef bool TResult; + TResult myResult; + int myId; + int myMenu; + bool myRemoveActions; + TClearMenuEvent( const int id, const int menu, const bool removeActions ) + : myResult( false ), myId( id ), myMenu( menu ), myRemoveActions( removeActions ) {} + virtual void Execute() { + if ( SalomeApp_Application* anApp = getApplication() ) { + SALOME_PYQT_Module* module = SALOME_PYQT_Module::getInitModule(); + if ( !module ) + module = dynamic_cast( anApp->activeModule() ); + if ( module ) + myResult = module->clearMenu( myId, myMenu, myRemoveActions ); + } + } +}; +bool SalomePyQt::clearMenu( const int id, const int menu, const bool removeActions ) +{ + return ProcessEvent( new TClearMenuEvent( id, menu, removeActions ) ); +} + diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index b623cc14f..a3022cb2a 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -102,6 +102,8 @@ public: static bool dumpView( const QString& ); + static int defaultMenuGroup(); + static int createTool( const QString& ); static int createTool( const int, const int, const int = -1 ); static int createTool( const int, const QString&, const int = -1 ); @@ -130,6 +132,9 @@ public: static QtxAction* action( const int ); static int actionId( const QtxAction* ); + static bool clearMenu( const int = 0, const int = 0, + const bool = true ); + static void addSetting ( const QString&, const QString&, const double ); static void addSetting ( const QString&, const QString&, const int ); static void addSetting ( const QString&, const QString&, const QString& ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 5fa6e87fa..813a9d710 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -81,6 +81,8 @@ public: static bool dumpView( const QString& ); + static int defaultMenuGroup(); + static int createTool( const QString& ); static int createTool( const int, const int, int = -1 ); static int createTool( const int, const QString&, int = -1 ); @@ -109,13 +111,16 @@ public: static QtxAction* action( const int ); static int actionId( const QtxAction* ); + static bool clearMenu( int = 0, int = 0, + bool = true ); + static void addSetting ( const QString&, const QString&, const double ); static void addSetting ( const QString&, const QString&, const int /Constrained/ ); static void addSetting ( const QString&, const QString&, const QString& ); static void addSetting ( const QString&, const QString&, const QColor& ); static int integerSetting( const QString&, const QString&, int = 0 ); static double doubleSetting ( const QString&, const QString&, int = 0 ); - static bool boolSetting ( const QString&, const QString&, bool = 0 ); + static bool boolSetting ( const QString&, const QString&, bool = false ); static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ); static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ); static void removeSetting ( const QString&, const QString& ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip index dbf98f4e5..c7371eb24 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip @@ -81,6 +81,8 @@ public: static bool dumpView( const QString& ); + static int defaultMenuGroup(); + static int createTool( const QString& ); static int createTool( const int, const int, const int = -1 ); static int createTool( const int, const QString&, const int = -1 ); @@ -99,7 +101,6 @@ public: const int = -1, const int = -1 ); static int createMenu( QtxAction*, const QString&, const int = -1, const int = -1, const int = -1 ); - static QtxAction* createSeparator(); static QtxAction* createAction( const int, const QString&, @@ -109,13 +110,16 @@ public: static QtxAction* action( const int ); static int actionId( const QtxAction* ); + static bool clearMenu( const int = 0, const int = 0, + const bool = true ); + static void addSetting ( const QString&, const QString&, const double ); static void addSetting ( const QString&, const QString&, const int /Constrained/ ); static void addSetting ( const QString&, const QString&, const QString& ); static void addSetting ( const QString&, const QString&, const QColor& ); static int integerSetting( const QString&, const QString&, const int = 0 ); static double doubleSetting ( const QString&, const QString&, const int = 0 ); - static bool boolSetting ( const QString&, const QString&, const bool = 0 ); + static bool boolSetting ( const QString&, const QString&, const bool = false ); static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ); static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ); static void removeSetting ( const QString&, const QString& );