Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StandardApp_Module Class Referenceabstract

#include <StandardApp_Module.hxx>

Inheritance diagram for StandardApp_Module:
Inheritance graph

Public Slots

bool deactivateModule (SUIT_Study *)
 
bool activateModule (SUIT_Study *)
 

Public Member Functions

 StandardApp_Module ()
 
void initialize (CAM_Application *)
 
QString engineIOR () const
 
virtual void windows (QMap< int, int > &theMap) const
 
int createStandardAction (const QString &label, QObject *slotobject, const char *slotmember, const QString &iconName=QString(), const QString &tooltip=QString(), const int identifier=ACTIONID_UNDEFINED)
 
void addActionInToolbar (int actionId)
 Integrate the action in the default toolbar. More...
 
void addActionInMenubar (int actionId, int menuId=-1)
 Integrate action in the specified menu. More...
 
void addActionInPopupMenu (int actionId, const QString &menus="", const QString &rule="client='ObjectBrowser'")
 Add the specified action as an item in the popup menu, with the specified visible rule. More...
 
- Public Member Functions inherited from SalomeApp_Module
 SalomeApp_Module (const QString &)
 
virtual ~SalomeApp_Module ()
 
SalomeApp_ApplicationgetApp () const
 
virtual void storeVisualParameters (int savePoint)
 Virtual public. More...
 
virtual void restoreVisualParameters (int savePoint)
 Virtual public. More...
 
virtual LightApp_SelectioncreateSelection () const
 
- Public Member Functions inherited from LightApp_Module
 LightApp_Module (const QString &)
 
virtual ~LightApp_Module ()
 
virtual void viewManagers (QStringList &) const
 
virtual void contextMenuPopup (const QString &, QMenu *, QString &)
 
virtual void createPreferences ()
 
LightApp_ApplicationgetApp () const
 
virtual void update (const int)
 Update something in accordance with update flags. More...
 
virtual void updateObjBrowser (bool=true, SUIT_DataObject *=0)
 
virtual void selectionChanged ()
 
virtual void preferencesChanged (const QString &, const QString &)
 
virtual void message (const QString &)
 
virtual void studyActivated ()
 
virtual LightApp_Displayerdisplayer ()
 
virtual bool canCopy () const
 
virtual bool canPaste () const
 
virtual bool isDraggable (const SUIT_DataObject *) const
 
virtual bool isDropAccepted (const SUIT_DataObject *) const
 
virtual void dropObjects (const DataObjectList &, SUIT_DataObject *, const int, Qt::DropAction)
 
virtual void copy ()
 Copies the current selection into clipboard. More...
 
virtual void paste ()
 Pastes the current data in the clipboard. More...
 
virtual bool renameAllowed (const QString &) const
 Return true if object can be renamed. More...
 
virtual bool renameObject (const QString &, const QString &)
 Return true if rename operation finished successfully, false otherwise. More...
 
virtual void updateModuleVisibilityState ()
 
- Public Member Functions inherited from CAM_Module
 CAM_Module ()
 Default constructor. More...
 
 CAM_Module (const QString &)
 Constructor. More...
 
virtual ~CAM_Module ()
 Destructor. More...
 
QString name () const
 Get module (internal) name. More...
 
QString moduleName () const
 Get module title (user name) More...
 
virtual QPixmap moduleIcon () const
 Get module icon. More...
 
virtual QString iconName () const
 Get module icon's name. More...
 
CAM_DataModeldataModel () const
 Get data model. More...
 
CAM_Applicationapplication () const
 Get application. More...
 
virtual void updateCommandsStatus ()
 Update menu/toolbar actions. More...
 
virtual void putInfo (const QString &, const int=-1)
 Put the text message into the status bar of the application main window. More...
 
bool isActiveModule () const
 Check if the module is active. More...
 
virtual void setMenuShown (const bool)
 Show/hide all module's menus. More...
 
void setMenuShown (QAction *, const bool)
 Show/hide specified menu item. More...
 
void setMenuShown (const int, const bool)
 Show/hide specified menu item. More...
 
virtual void setToolShown (const bool)
 Show/hide all module's toolbars. More...
 
void setToolShown (QAction *, const bool)
 Show/hide specified toolbar item. More...
 
void setToolShown (const int, const bool)
 Show/hide specified toolbar item. More...
 
virtual bool activateOperation (int actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId)
 Activate GUI operation of module by its ID. This method is called from CAM_Application::startOperation(). More...
 
virtual bool activateOperation (const QString &actionId, const QString &pluginName)
 Activate GUI operation of module by its ID and pluginName. This method is called from CAM_Application::startOperation(). More...
 
QtxActionMenuMgrmenuMgr () const
 Get menu manager. More...
 
QtxActionToolMgrtoolMgr () const
 Get toolbar manager. More...
 
virtual QActionaction (const int) const
 Get action by specified id. More...
 
virtual int actionId (const QAction *) const
 Get action ID. More...
 
virtual QActioncreateAction (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. More...
 
virtual QActioncreateAction (const int, const QString &, const QIcon &, const QString &, const QString &, const QKeySequence &, QObject *=0, const bool=false, QObject *=0, const char *=0, const QString &=QString())
 Create new instance of QtxAction and register action with specified id. More...
 
QtxActionGroupcreateActionGroup (const int, const bool=true)
 Create new action group. More...
 
int createTool (const QString &, const QString &=QString())
 Create toolbar with speicifed name. More...
 
int createTool (const int, const int, const int=-1)
 Add toolbar item. More...
 
int createTool (const int, const QString &, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const int, const int=-1, const int=-1)
 Add toolbar item. More...
 
int createTool (QAction *, const QString &, const int=-1, const int=-1)
 Add toolbar item. More...
 
int createMenu (const QString &, const int, const int=-1, const int=-1, const int=-1, QMenu *=0)
 Create menu or submenu. More...
 
int createMenu (const QString &, const QString &, const int=-1, const int=-1, const int=-1)
 Create menu or submenu. More...
 
int createMenu (const int, const int, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (const int, const QString &, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const int, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 
int createMenu (QAction *, const QString &, const int=-1, const int=-1, const int=-1)
 Add menu item. More...
 

Protected Types

enum  DockLayoutType { DOCKLAYOUT_BOTTOM_HLARGE, DOCKLAYOUT_LEFT_VLARGE }
 

Protected Slots

void OnTest ()
 

Protected Member Functions

virtual void createModuleWidgets ()
 
virtual void createModuleActions ()
 
void createStudyComponent (SUIT_Study *)
 
virtual bool createStudyComponentAtActivation ()
 
virtual
Engines::EngineComponent_ptr 
getEngine () const =0
 
virtual QString studyIconName ()
 
QIcon createIcon (const QString &iconName)
 
int newActionId ()
 
virtual void setDockLayout (DockLayoutType layoutType)
 
virtual void unsetDockLayout ()
 
- Protected Member Functions inherited from SalomeApp_Module
virtual CAM_DataModelcreateDataModel ()
 
virtual void extractContainers (const SALOME_ListIO &, SALOME_ListIO &) const
 
- Protected Member Functions inherited from LightApp_Module
virtual QtxPopupMgrpopupMgr ()
 
LightApp_Preferencespreferences () const
 
virtual bool reusableOperation (const int id)
 
int addPreference (const QString &label)
 
int addPreference (const QString &label, const int pId, const int type=LightApp_Preferences::Auto, const QString &section=QString(), const QString &param=QString())
 
QVariant preferenceProperty (const int, const QString &) const
 
void setPreferenceProperty (const int, const QString &, const QVariant &)
 
void startOperation (const int)
 Starts operation with given identifier. More...
 
virtual LightApp_OperationcreateOperation (const int) const
 Creates operation with given identifier. More...
 
virtual void updateControls ()
 Updates controls. More...
 
virtual bool isSelectionCompatible ()
 If return false, selection will be cleared at module activation. More...
 
LightApp_Operationoperation (const int) const
 Returns instance of operation by its id; if there is no operation corresponding to this id, null pointer is returned. More...
 
- Protected Member Functions inherited from CAM_Module
void setName (const QString &)
 Set module (internal) name. More...
 
virtual void setModuleName (const QString &)
 Set module title (user name) More...
 
int registerAction (const int, QAction *)
 Register action in the internal action map. More...
 
bool unregisterAction (const int)
 Unregister action from the internal action map. More...
 
bool unregisterAction (QAction *)
 Unregister action from the internal action map. More...
 
virtual bool abortAllOperations ()
 

Protected Attributes

SUIT_ResourceMgr_resourceMgr
 
int _defaultMenuId
 
int _defaultToolbarId
 

Static Protected Attributes

static int ACTIONID_DEFAULT_INIT_VALUE = 910
 
static int ACTIONID_UNDEFINED = -1
 

Private Attributes

int _actionId_internalCount
 
Qt::DockWidgetArea _areaAtBottomLeftCorner
 
Qt::DockWidgetArea _areaAtBottomRightCorner
 

Additional Inherited Members

- Static Public Member Functions inherited from CAM_Module
static QActionseparator ()
 Create separator action. More...
 

Detailed Description

This class is provided as the base class for the standard gui part of a SALOME module. To define a gui part, you just have to implement the virtual functions:

  • getEngine() to specify the engine component associated to this module
  • createModuleActions(...) to specify the action functions
  • createModuleWidgets(...) to specify special additionnal widgets

The gui part of a SALOME module is an extension of the SALOME client Application for this module. Technically speaking, it consists in a plugin that provides a derived class of CAM_Module (provided by the GUI module).

A standard gui is the standard design for most of SALOME module (object browser on the left, viewer on the rigth, python console on the bottom, and toolbox in the toolbar with standard definition of the tool function). This standard design suggests also to specify the engine associated to the module by implementing the virtual pure function getEngine(). The engine of a module is the SALOME component that is associated to the study component for this module, and generally which is responsible for the persistency functions or data management for the module.

See a use case example in the test module Xsalome provided by the test package (tst/module/gui/Xsalome.hxx and tst/module/gui/factory.cxx in the XSALOME library).

Member Enumeration Documentation

Enumerator
DOCKLAYOUT_BOTTOM_HLARGE 
DOCKLAYOUT_LEFT_VLARGE 

Constructor & Destructor Documentation

StandardApp_Module::StandardApp_Module ( )

Member Function Documentation

void StandardApp_Module::addActionInMenubar ( int  actionId,
int  menuId = -1 
)

If the menu is not specified, then it is integrated into the menu associated to the SALOME module.

References _defaultMenuId, CAM_Module::action(), CAM_Module::createMenu(), and UNSPECIFIED_INT.

void StandardApp_Module::addActionInPopupMenu ( int  actionId,
const QString &  menus = "",
const QString &  rule = "client='ObjectBrowser'" 
)
void StandardApp_Module::addActionInToolbar ( int  actionId)
QIcon StandardApp_Module::createIcon ( const QString &  iconName)
protected
void StandardApp_Module::createModuleActions ( )
protectedvirtual

This function can be used to defined the list of actions for this module GUI. It can be redefined in a specialized version of this class. Depending on wether you use the method "createStandardAction" or not, the actions will be automatically plugged in the toolbar and the menu associated to the module.

References CAM_Module::actionId(), addActionInToolbar(), createStandardAction(), and OnTest().

void StandardApp_Module::createModuleWidgets ( )
protectedvirtual

This function can be used to create additionnal widget for this module GUI (e.g. docked widget). It can be redefined in a specialized version of this class.

int StandardApp_Module::createStandardAction ( const QString &  label,
QObject slotobject,
const char *  slotmember,
const QString &  iconName = QString(),
const QString &  tooltip = QString(),
const int  identifier = ACTIONID_UNDEFINED 
)

This function creates an action and connects it to a button in the toolbar and to an item in the menu associated to this module. This function applies a common and standard procedure with a maximum of default values. If no identifier is specified, then a static internal counter is used to associate an identifier to the created action. In any case, the action identifier is returned.

Note that the action (object of type QAction) can be retrieved using the method "QAction * action(int identifier)" of the super class.

References CAM_Module::action(), ACTIONID_UNDEFINED, CAM_Module::createAction(), createIcon(), SalomeApp_Module::getApp(), and newActionId().

void StandardApp_Module::createStudyComponent ( SUIT_Study theStudy)
protected

This creates a root entry in the active study for this module, i.e a SComponent with the name of the module and the icon specified for the module. This component is associated to the engine (return by getEngine()) if the engine is a SALOMEDS::Driver.

References getEngine(), SUIT_Study::id(), CAM_Module::moduleName(), SalomeApp_Application::namingService(), QCHARSTAR, and studyIconName().

bool StandardApp_Module::createStudyComponentAtActivation ( )
protectedvirtual

This function should be implemented in a specialized class and must return true if you want to automatically create a study component for this module at activation step (when you first load the module for a given study). The default function return true.

bool StandardApp_Module::deactivateModule ( SUIT_Study theStudy)
slot
QString StandardApp_Module::engineIOR ( ) const
virtual

engineIOR() should be a pure virtual method, to avoid logical errors!
Implementation in derived classes can return the following values:
module`s engine IOR - means that this is a standard SALOME module with a CORBA engine

  • "" (empty string) - means that this not correct SALOME module

Implements SalomeApp_Module.

References SalomeApp_Module::getApp(), getEngine(), and SalomeApp_Application::orb().

virtual Engines::EngineComponent_ptr StandardApp_Module::getEngine ( ) const
protectedpure virtual
int StandardApp_Module::newActionId ( )
protected
void StandardApp_Module::OnTest ( )
protectedslot

References engineIOR(), and QCHARSTAR.

void StandardApp_Module::setDockLayout ( DockLayoutType  layoutType)
protectedvirtual

This can be used to switch the layout of main application dockwidgets to one of the predefined configuration (see enum DockLayoutType). When a layout is set, the previous layout is memorized and can be restored using the unsetDockLayout function (1 step undo). It is typically to be used in the functions activateModule to setup the layout and deactivateModule to unset the layout, i.e. restore to the previous state.

References _areaAtBottomLeftCorner, _areaAtBottomRightCorner, SUIT_Application::desktop(), DOCKLAYOUT_LEFT_VLARGE, and SalomeApp_Module::getApp().

QString StandardApp_Module::studyIconName ( )
protectedvirtual

This specifies the filename for the icon to be used for the study component associated to the module. Note that this icon could be different than the module icon which is defined by the SalomeApp.xml file dedicated to this module (see the shared resources folder dedicated to the module) and which is used for the toolbar of the SALOME application.

References CAM_Module::iconName().

void StandardApp_Module::unsetDockLayout ( )
protectedvirtual

This function restores the layout state that was previously in place before the last setDockLayout call.

References _areaAtBottomLeftCorner, _areaAtBottomRightCorner, SUIT_Application::desktop(), and SalomeApp_Module::getApp().

void StandardApp_Module::windows ( QMap< int, int > &  ) const
virtual

Member Data Documentation

int StandardApp_Module::_actionId_internalCount
private
Qt::DockWidgetArea StandardApp_Module::_areaAtBottomLeftCorner
private
Qt::DockWidgetArea StandardApp_Module::_areaAtBottomRightCorner
private
int StandardApp_Module::_defaultMenuId
protected
int StandardApp_Module::_defaultToolbarId
protected
SUIT_ResourceMgr* StandardApp_Module::_resourceMgr
protected
int StandardApp_Module::ACTIONID_DEFAULT_INIT_VALUE = 910
staticprotected
int StandardApp_Module::ACTIONID_UNDEFINED = -1
staticprotected

The documentation for this class was generated from the following files: