5 #ifndef XGUI_ACTIONSMGR_H_
6 #define XGUI_ACTIONSMGR_H_
13 #include <QStringList>
14 #include <QKeySequence>
18 class XGUI_OperationMgr;
21 class XGUI_EXPORT XGUI_ActionsMgr : public QObject
26 XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
27 virtual ~XGUI_ActionsMgr();
29 //! Add a command in the manager.
30 //! Please note that nested commands in the Salome mode (No XGUI_Command, pure QActions)
31 //! won't be extracted and should be added manually using the addNestedCommands method.
32 void addCommand(QAction* theCmd);
33 //! Sets relation between the command (with given Id) and it's nested actions.
34 void addNestedCommands(const QString& theId, const QStringList& theCommands);
36 QStringList nestedCommands(const QString& theId) const;
38 bool isNested(const QString& theId) const;
40 QKeySequence registerShortcut(const QString& theKeySequence);
43 //! Update workbench actions according to OperationMgr state:
44 //! No active operations: all actions but nested are available
45 //! There is active operation: current operation + it's nested
46 //! are enabled, all the rest is disabled. All active commands is checked.
48 //! Sets all commands checked if it's operation is active.
49 void updateCheckState();
52 //! Sets all actions to isEnabled state.
53 void setAllEnabled(bool isEnabled);
54 //! Sets all nested actions to isEnabled state for the command with given ID.
55 //! If ID is empty - all nested actions will be affected.
56 void setNestedCommandsEnabled(bool isEnabled, const QString& theParent = QString());
57 //! Sets the action with theId to theChecked state.
58 void setActionChecked(const QString& theId, const bool theChecked);
59 //! Sets the action with theId to theEnabled state.
60 void setActionEnabled(const QString& theId, const bool theEnabled);
63 QMap<QString, QAction*> myActions;
64 QMap<QString, QStringList> myNestedActions;
65 QList<QKeySequence> myShortcuts;
67 XGUI_Workshop* myWorkshop;
68 XGUI_OperationMgr* myOperationMgr;
71 #endif /* XGUI_ACTIONSMGR_H_ */