Salome HOME
Selection priority in Sketch, clear selection when sketch goes from entity to neutral...
[modules/shaper.git] / src / ModuleBase / ModuleBase_ActionInfo.h
1 /*
2  * ActionInfo.h
3  *
4  *  Created on: Feb 4, 2015
5  *      Author: sbh
6  */
7
8 #ifndef MODULEBASE_ACTIONINFO_H_
9 #define MODULEBASE_ACTIONINFO_H_
10
11 #include <ModuleBase.h>
12 #include <Config_FeatureMessage.h>
13
14 #include <QAction>
15 #include <QIcon>
16 #include <QKeySequence>
17 #include <QFont>
18
19 #include <memory>
20
21 /*!
22  * Structure to pass info about QActions, AppElements_Commands, etc.
23  */
24 struct MODULEBASE_EXPORT ModuleBase_ActionInfo
25 {
26   QString id; //!< action's (command) id
27   bool checkable; //!< action's checkable state
28   bool checked; //!< action's checked state
29   bool enabled; //!< action's enabled state
30   bool visible; //!< action's visibility state
31   bool modal;   //!< = true if the acton is a modal dialog box else property panel (==false by default)
32   QIcon icon; //!< action's icon
33   QString text; //!< action's text
34   QString iconText; //!< action's descriptive icon text
35   QString iconFile; //!< path to icon's file. Can not be initialized from QAction
36   QString toolTip; //!< action's tooltip
37   // QString statusTip;
38   // QString whatsThis;
39   QKeySequence shortcut; //!< action's primary shortcut key
40   QFont font; //!< action's text font
41
42  public:
43   //! Default constructor, \sa initDefault
44   ModuleBase_ActionInfo();
45   //! Initializes structure with default values, except text
46   ModuleBase_ActionInfo(const QString &text);
47   //! Initializes structure with default values, except icon and text
48   ModuleBase_ActionInfo(const QIcon &icon, const QString &text);
49   virtual ~ModuleBase_ActionInfo();
50
51   //! Fills itself with info from given \param theAction
52   void initFrom(QAction* theAction);
53   //! Fills itself with info from given \param theFeatureMessage
54   void initFrom(std::shared_ptr<Config_FeatureMessage> theFeatureMessage);
55
56  protected:
57   //! Initializes structure with default values, like QAction()
58   void initDefault();
59 };
60
61 typedef ModuleBase_ActionInfo ActionInfo;
62
63 #endif /* XGUI_ACTIONINFO_H_ */