Base implementation of the module in the CAM application architecture. More...
#include <CAM_Module.h>

Public Slots | |
| virtual bool | activateModule (SUIT_Study *) |
| Activate module. | |
| virtual bool | deactivateModule (SUIT_Study *) |
| Deactivate module. | |
| virtual void | connectToStudy (CAM_Study *) |
| Connect data model of the module to the active study. | |
| virtual void | studyClosed (SUIT_Study *) |
| Called when study is closed. | |
| virtual void | studyChanged (SUIT_Study *, SUIT_Study *) |
| Called when study is changed (obsolete). | |
| virtual void | onApplicationClosed (SUIT_Application *) |
| Called when application is closed. | |
Public Member Functions | |
| CAM_Module () | |
| Default constructor. | |
| CAM_Module (const QString &) | |
| Constructor. | |
| virtual | ~CAM_Module () |
| Destructor. | |
| virtual void | initialize (CAM_Application *) |
| Initialize module. | |
| QString | name () const |
| Get module (internal) name. | |
| QString | moduleName () const |
| Get module title (user name) | |
| virtual QPixmap | moduleIcon () const |
| Get module icon. | |
| virtual QString | iconName () const |
| Get module icon's name. | |
| CAM_DataModel * | dataModel () const |
| Get data model. | |
| CAM_Application * | application () const |
| Get application. | |
| virtual void | contextMenuPopup (const QString &, QMenu *, QString &) |
| Create context popup menu. | |
| virtual void | updateCommandsStatus () |
| Update menu/toolbar actions. | |
| virtual void | putInfo (const QString &, const int=-1) |
| Put the text message into the status bar of the application main window. | |
| bool | isActiveModule () const |
| Check if the module is active. | |
| virtual void | setMenuShown (const bool) |
| Show/hide all module's menus. | |
| void | setMenuShown (QAction *, const bool) |
| Show/hide specified menu item. | |
| void | setMenuShown (const int, const bool) |
| Show/hide specified menu item. | |
| virtual void | setToolShown (const bool) |
| Show/hide all module's toolbars. | |
| void | setToolShown (QAction *, const bool) |
| Show/hide specified toolbar item. | |
| void | setToolShown (const int, const bool) |
| Show/hide specified toolbar item. | |
Protected Member Functions | |
| virtual bool | isSelectionCompatible () |
| If return false, selection will be cleared at module activation. | |
| virtual CAM_DataModel * | createDataModel () |
| Create data model. | |
| void | setName (const QString &) |
| Set module (internal) name. | |
| virtual void | setModuleName (const QString &) |
| Set module title (user name) | |
| QtxActionMenuMgr * | menuMgr () const |
| Get menu manager. | |
| QtxActionToolMgr * | toolMgr () const |
| Get toolbar manager. | |
| int | createTool (const QString &) |
| Create toolbar with speicifed name. | |
| int | createTool (const int, const int, const int=-1) |
| Add toolbar item. | |
| int | createTool (const int, const QString &, const int=-1) |
| Add toolbar item. | |
| int | createTool (QAction *, const int, const int=-1, const int=-1) |
| Add toolbar item. | |
| int | createTool (QAction *, const QString &, const int=-1, const int=-1) |
| Add toolbar item. | |
| int | createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1) |
| Create menu or submenu. | |
| int | createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1) |
| Create menu or submenu. | |
| int | createMenu (const int, const int, const int=-1, const int=-1) |
| Add menu item. | |
| int | createMenu (const int, const QString &, const int=-1, const int=-1) |
| Add menu item. | |
| int | createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1) |
| Add menu item. | |
| int | createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1) |
| Add menu item. | |
| QAction * | action (const int) const |
| Get action by specified id. | |
| int | actionId (const QAction *) const |
| Get action ID. | |
| int | registerAction (const int, QAction *) |
| Register action in the internal action map. | |
| bool | unregisterAction (const int) |
| Unregister action from the internal action map. | |
| bool | unregisterAction (QAction *) |
| Unregister action from the internal action map. | |
| QAction * | createAction (const int, const QString &, const QIcon &, const QString &, const QString &, const int, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString()) |
| Create new instance of QtxAction and register action with specified id. | |
Static Protected Member Functions | |
| static QAction * | separator () |
| Create separator action. | |
Private Slots | |
| void | onInfoChanged (QString) |
| Restore message info. | |
Private Attributes | |
| CAM_Application * | myApp |
| parent application object | |
| QString | myName |
| module title (user name) | |
| QPixmap | myIcon |
| module icon | |
| QString | myInfo |
| latest info message | |
| CAM_DataModel * | myDataModel |
| data model | |
| QMap< int, QAction * > | myActionMap |
| menu actions | |
| bool | myMenuShown |
| menu shown flag | |
| bool | myToolShown |
| tool shown flag | |
Friends | |
| class | CAM_Application |
Provides support of menu/toolbars management.
| CAM_Module::CAM_Module | ( | ) |
Creates unnamed module.
| CAM_Module::CAM_Module | ( | const QString & | name | ) |
Creates module with the specified name.
| name | module name |
| CAM_Module::~CAM_Module | ( | ) | [virtual] |
Destroy data model.
References myDataModel.
| void CAM_Module::initialize | ( | CAM_Application * | app | ) | [virtual] |
This method is usually called when the module is created (for example, on the module library loading). Successor classes can use this method to create menu/toolbar actions and perform other module initialization.
| app | parent application object |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References myApp, onApplicationClosed(), onInfoChanged(), and SUIT_Session.session().
| QString CAM_Module::name | ( | ) | const |
| QString CAM_Module::moduleName | ( | ) | const |
| QPixmap CAM_Module::moduleIcon | ( | ) | const [virtual] |
References application(), iconName(), QtxResourceMgr.loadPixmap(), myIcon, name(), and SUIT_Application.resourceMgr().
| QString CAM_Module::iconName | ( | ) | const [virtual] |
This function is used to get module icon's file name. Default implementation returns empty string.
References application(), CAM_Application.moduleIcon(), and name().
| CAM_DataModel * CAM_Module::dataModel | ( | ) | const |
Creates data model, if it is not yet created.
References createDataModel(), CAM_DataModel.initialize(), and myDataModel.
| CAM_Application * CAM_Module::application | ( | ) | const |
References myApp.
| void CAM_Module::contextMenuPopup | ( | const QString & | type, |
| QMenu * | menu, | ||
| QString & | title | ||
| ) | [virtual] |
| type | popup menu context |
| menu | popup menu |
| title | popup menu title, which can be set by the module if required |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
| void CAM_Module::updateCommandsStatus | ( | ) | [virtual] |
| void CAM_Module::putInfo | ( | const QString & | msg, |
| const int | msec = -1 |
||
| ) | [virtual] |
If msec > 0, the message will be shown msec milliseconds. If msec < 0, the message will be constantly displayed until module is active.
| msg | text message |
| msec | message displaying duration in milliseconds |
References application(), myInfo, and SUIT_Application.putInfo().
| bool CAM_Module::isActiveModule | ( | ) | const |
true if module is active. References CAM_Application.activeModule(), and application().
| void CAM_Module::setMenuShown | ( | const bool | on | ) | [virtual] |
| on | if true, show menus, otherwise, hide all menus |
References QtxActionMgr.actionId(), QtxActionMgr.isUpdatesEnabled(), menuMgr(), myActionMap, myMenuShown, separator(), QtxActionMenuMgr.setShown(), QtxActionMgr.setUpdatesEnabled(), and QtxActionMgr.update().
| void CAM_Module::setMenuShown | ( | QAction * | a, |
| const bool | on | ||
| ) |
| a | action |
| on | if true, show menu item, otherwise, hide it |
References actionId(), menuMgr(), and QtxActionMenuMgr.setShown().
| void CAM_Module::setMenuShown | ( | const int | id, |
| const bool | on | ||
| ) |
| id | menu item ID |
| on | if true, show menu item, otherwise, hide it |
References action(), and setMenuShown().
| void CAM_Module::setToolShown | ( | const bool | on | ) | [virtual] |
| on | if true, show toolbars, otherwise, hide all toolbars |
References QtxActionMgr.actionId(), QtxActionMgr.isUpdatesEnabled(), myActionMap, myToolShown, separator(), QtxActionToolMgr.setShown(), QtxActionMgr.setUpdatesEnabled(), toolMgr(), and QtxActionMgr.update().
| void CAM_Module::setToolShown | ( | QAction * | a, |
| const bool | on | ||
| ) |
| a | action |
| on | if true, show toolbar item, otherwise, hide it |
References actionId(), QtxActionToolMgr.setShown(), and toolMgr().
| void CAM_Module::setToolShown | ( | const int | id, |
| const bool | on | ||
| ) |
| id | toolbar item ID |
| on | if true, show toolbar item, otherwise, hide it |
References action(), and setToolShown().
| bool CAM_Module::activateModule | ( | SUIT_Study * | ) | [virtual, slot] |
This method is called when the user activates module. Successor classes can use this method to customize module activation process, for example, to show own menus, toolbars, etc.
Default implementation always returns true.
true if module is activated successfully. Reimplemented in LightApp_Module, SALOME_PYQT_Module, SALOME_PYQT_ModuleLight, and SalomeApp_Module.
| bool CAM_Module::deactivateModule | ( | SUIT_Study * | ) | [virtual, slot] |
This method is called when the user deactivates module. Successor classes can use this method to customize module deactivation process, for example, to hide own menus, toolbars, etc.
Default implementation always returns true.
true if module is deactivated successfully. Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
| void CAM_Module::connectToStudy | ( | CAM_Study * | camStudy | ) | [virtual, slot] |
| camStudy | CAM study object |
References SUIT_Study.application(), CAM_Study.containsDataModel(), CAM_Study.insertDataModel(), and CAM_Application.modules().
| void CAM_Module::studyClosed | ( | SUIT_Study * | study | ) | [virtual, slot] |
Removes data model from the study.
| study | study being closed |
Reimplemented in SalomeApp_Module.
References CAM_DataModel.close(), CAM_Study.containsDataModel(), dataModel(), and CAM_Study.removeDataModel().
| void CAM_Module::studyChanged | ( | SUIT_Study * | , |
| SUIT_Study * | |||
| ) | [virtual, slot] |
Default implementation does nothing.
| oldStudy | old study |
| newStudy | new study |
| void CAM_Module::onApplicationClosed | ( | SUIT_Application * | theApp | ) | [virtual, slot] |
Nullify application pointer if the application is being closed.
| theApp | application |
References myApp.
| void CAM_Module::onInfoChanged | ( | QString | txt | ) | [private, slot] |
Restores constant text message when previous information status message is removed.
| txt | previous message (being removed) |
References application(), isActiveModule(), myInfo, and SUIT_Application.putInfo().
| bool CAM_Module::isSelectionCompatible | ( | ) | [protected, virtual] |
Reimplemented in LightApp_Module.
| CAM_DataModel * CAM_Module::createDataModel | ( | ) | [protected, virtual] |
Reimplemented in LightApp_Module, SALOME_PYQT_Module, SALOME_PYQT_ModuleLight, and SalomeApp_Module.
| void CAM_Module::setName | ( | const QString & | name | ) | [protected] |
| name | new module name |
| void CAM_Module::setModuleName | ( | const QString & | name | ) | [protected, virtual] |
| name | new module title |
| QtxActionMenuMgr * CAM_Module::menuMgr | ( | ) | const [protected] |
References application(), SUIT_Application.desktop(), and SUIT_Desktop.menuMgr().
| QtxActionToolMgr * CAM_Module::toolMgr | ( | ) | const [protected] |
References application(), SUIT_Application.desktop(), and SUIT_Desktop.toolMgr().
| int CAM_Module::createTool | ( | const QString & | name | ) | [protected] |
If the toolbar has been already created, its ID is just returned.
| name | toolbar name |
Reimplemented in SALOME_PYQT_ModuleLight.
References QtxActionToolMgr.createToolBar(), myToolShown, and toolMgr().
| int CAM_Module::createTool | ( | const int | id, |
| const int | tBar, | ||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action with id identifier to the toolbar manager. It is assumed that action has been already registered.
Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
If idx < 0, the action is added to the end of the toolbar.
| id | action ID |
| tBar | toolbar ID |
| idx | action index (desired position in the toolbar) |
Reimplemented in SALOME_PYQT_ModuleLight.
References action(), QtxActionToolMgr.insert(), myToolShown, setToolShown(), and toolMgr().
| int CAM_Module::createTool | ( | const int | id, |
| const QString & | tBar, | ||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action with id identifier to the toolbar manager. It is assumed that action has been already registered.
Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
If idx < 0, the action is added to the end of the toolbar.
| id | action ID |
| tBar | toolbar name |
| idx | action index (desired position in the toolbar) |
Reimplemented in SALOME_PYQT_ModuleLight.
References action(), QtxActionToolMgr.insert(), myToolShown, setToolShown(), and toolMgr().
| int CAM_Module::createTool | ( | QAction * | a, |
| const int | tBar, | ||
| const int | id = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action to the toolbar manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
If id < 0, the action ID is generated automatically.
If idx < 0, the action is added to the end of the toolbar.
| a | action |
| tBar | toolbar ID |
| id | requested action ID |
| idx | action index (desired position in the toolbar) |
Reimplemented in SALOME_PYQT_ModuleLight.
References QtxActionToolMgr.insert(), myToolShown, registerAction(), setToolShown(), and toolMgr().
| int CAM_Module::createTool | ( | QAction * | a, |
| const QString & | tBar, | ||
| const int | id = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action to the toolbar manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
If id < 0, the action ID is generated automatically.
If idx < 0, the action is added to the end of the toolbar.
| a | action |
| tBar | toolbar name |
| id | requested action ID |
| idx | action index (desired position in the toolbar) |
Reimplemented in SALOME_PYQT_ModuleLight.
References QtxActionToolMgr.insert(), myToolShown, registerAction(), setToolShown(), and toolMgr().
| int CAM_Module::createMenu | ( | const QString & | subMenu, |
| const int | menu, | ||
| const int | id = -1, |
||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Create main menu or popup submenu and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If id < 0, the menu ID is generated automatically. If menu has been already created previously, its ID is just returned.
The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the menu/submenu is added to the end of the menu group.
| subMenu | subMenu name |
| menu | parent menu ID |
| id | requested menu ID |
| group | menu group ID |
| idx | menu item index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References QtxActionMenuMgr.insert(), and menuMgr().
| int CAM_Module::createMenu | ( | const QString & | subMenu, |
| const QString & | menu, | ||
| const int | id = -1, |
||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Create main menu or popup submenu and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If id < 0, the menu ID is generated automatically. If menu has been already created previously, its ID is just returned.
The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the menu/submenu is added to the end of the menu group.
| subMenu | subMenu name |
| menu | parent menu name(s) |
| id | requested menu ID |
| group | menu group ID |
| idx | menu item index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References QtxActionMenuMgr.insert(), and menuMgr().
| int CAM_Module::createMenu | ( | const int | id, |
| const int | menu, | ||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action with id identifier to the menu manager. It is assumed that action has been already registered.
Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.
| id | action ID |
| menu | menu ID |
| group | menu group ID |
| idx | action index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References action(), QtxActionMenuMgr.insert(), menuMgr(), myMenuShown, and setMenuShown().
| int CAM_Module::createMenu | ( | const int | id, |
| const QString & | menu, | ||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action with id identifier to the menu manager. It is assumed that action has been already registered.
Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If action has been already added previously, its ID is just returned.
The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.
| id | action ID |
| menu | menu name(s) |
| group | menu group ID |
| idx | action index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References action(), QtxActionMenuMgr.insert(), menuMgr(), myMenuShown, and setMenuShown().
| int CAM_Module::createMenu | ( | QAction * | a, |
| const int | menu, | ||
| const int | id = -1, |
||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action to the menu manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If id < 0, the action ID is generated automatically.
If action has been already added previously, its ID is just returned.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.
| a | action |
| menu | menu ID |
| id | requested action ID |
| group | menu group ID |
| idx | action index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References QtxActionMenuMgr.insert(), menuMgr(), myMenuShown, registerAction(), and setMenuShown().
| int CAM_Module::createMenu | ( | QAction * | a, |
| const QString & | menu, | ||
| const int | id = -1, |
||
| const int | group = -1, |
||
| const int | idx = -1 |
||
| ) | [protected] |
Insert action to the menu manager and register it with specified id. Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If id < 0, the action ID is generated automatically.
If action has been already added previously, its ID is just returned.
The menu parameter represents the menu name - it could be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If menu doesn't exist, it is created automatically.
Parameter idx defines the index of the menu item in the menu group which is defined by the group. If idx < 0, the action is added to the end of the menu group.
| a | action |
| menu | menu name(s) |
| id | requested action ID |
| group | menu group ID |
| idx | action index (desired position in the menu group) |
Reimplemented in LightApp_Module, and SALOME_PYQT_ModuleLight.
References QtxActionMenuMgr.insert(), menuMgr(), myMenuShown, registerAction(), and setMenuShown().
| QAction * CAM_Module::separator | ( | ) | [static, protected] |
Separator action can be used in menus or toolbars.
Reimplemented in SALOME_PYQT_ModuleLight.
| QAction * CAM_Module::action | ( | const int | id | ) | const [protected] |
| id | action ID |
Reimplemented in SALOME_PYQT_ModuleLight.
References test_table.a, and myActionMap.
| int CAM_Module::actionId | ( | const QAction * | a | ) | const [protected] |
| a | action |
Reimplemented in SALOME_PYQT_ModuleLight.
References test_table.a, and myActionMap.
| int CAM_Module::registerAction | ( | const int | id, |
| QAction * | a | ||
| ) | [protected] |
If action has been already added previously, its ID is just returned. If id < 0, the action ID is generated automatically.
| id | action required ID |
| a | action |
References test_table.a, application(), SUIT_Application.desktop(), menuMgr(), myActionMap, QtxActionMgr.registerAction(), and toolMgr().
| bool CAM_Module::unregisterAction | ( | const int | id | ) | [protected] |
| bool CAM_Module::unregisterAction | ( | QAction * | a | ) | [protected] |
| a | action |
true on success or false if action is in use References actionId(), QtxActionMgr.actionId(), menuMgr(), toolMgr(), and QtxActionMgr.unRegisterAction().
| QAction * CAM_Module::createAction | ( | const int | id, |
| const QString & | text, | ||
| const QIcon & | icon, | ||
| const QString & | menu, | ||
| const QString & | tip, | ||
| const int | key, | ||
| QObject * | parent = 0, |
||
| const bool | toggle = false, |
||
| QObject * | reciever = 0, |
||
| const char * | member = 0, |
||
| const QString & | shortcutAction = QString() |
||
| ) | [protected] |
Resulting action ID may differ from the requested one. This can happen if requested ID is already in use.
If id < 0, the action ID is generated automatically.
| id | required action ID |
| text | tooltip text |
| icon | action icon |
| menu | menu text |
| tip | status bar tip |
| key | keyboard accelerator |
| parent | parent object |
| toggle | if true, the action will be toggled |
| reciever | action activation signal receiver object |
| member | action activation signal receiver slot |
References test_table.a, and registerAction().
friend class CAM_Application [friend] |
CAM_Application* CAM_Module.myApp [private] |
QString CAM_Module.myName [private] |
QPixmap CAM_Module.myIcon [private] |
QString CAM_Module.myInfo [private] |
CAM_DataModel* CAM_Module.myDataModel [private] |
QMap<int, QAction*> CAM_Module.myActionMap [private] |
bool CAM_Module.myMenuShown [private] |
bool CAM_Module.myToolShown [private] |