Salome HOME
Do not use align to the left in the page group box widget.
[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   QIcon icon; //!< action's icon
32   QString text; //!< action's text
33   QString iconText; //!< action's descriptive icon text
34   QString iconFile; //!< path to icon's file. Can not be initialized from QAction
35   QString toolTip; //!< action's tooltip
36   // QString statusTip;
37   // QString whatsThis;
38   QKeySequence shortcut; //!< action's primary shortcut key
39   QFont font; //!< action's text font
40
41  public:
42   //! Default constructor, \sa initDefault
43   ModuleBase_ActionInfo();
44   //! Initializes structure with default values, except text
45   ModuleBase_ActionInfo(const QString &text);
46   //! Initializes structure with default values, except icon and text
47   ModuleBase_ActionInfo(const QIcon &icon, const QString &text);
48   virtual ~ModuleBase_ActionInfo();
49
50   //! Fills itself with info from given \param theAction
51   void initFrom(QAction* theAction);
52   //! Fills itself with info from given \param theFeatureMessage
53   void initFrom(std::shared_ptr<Config_FeatureMessage> theFeatureMessage);
54   //! Creates new QAction with given parent and data initialized from this structure
55   //! \param theParent - parent of created action
56   QAction* makeAction(QObject* theParent = 0);
57
58  protected:
59   //! Initializes structure with default values, like QAction()
60   void initDefault();
61 };
62
63 typedef ModuleBase_ActionInfo ActionInfo;
64
65 #endif /* XGUI_ACTIONINFO_H_ */