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