Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_Command.h
1 #ifndef XGUI_Command_H
2 #define XGUI_Command_H
3
4 #include <QWidgetAction>
5
6 #define MIN_BUTTON_HEIGHT 18
7 #define MIN_BUTTON_WIDTH 40
8
9 /**\class XGUI_Command
10  * \ingroup GUI
11  * \brief Represents a command item in the application menu (Workbench)
12  */
13 class XGUI_Command: public QWidgetAction
14 {
15 Q_OBJECT
16 public:
17   XGUI_Command(const QString& theId, QObject * parent);
18   XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent);
19   ~XGUI_Command();
20
21   //! Returns true if the command is enabled
22   virtual bool enabled() const;
23
24   //! Set the command enabled
25   virtual void enable();
26
27   //! Set the command disabled
28   virtual void disable();
29
30   //! Returns Id of the command
31   virtual QString getId() const
32   {
33     return myId;
34   }
35
36   //! Connect the command to a slot
37   virtual void connectTo(const QObject* theResiver, const char* theSlot);
38
39 protected:
40   //! Creates a command representation widget dependently on parent widget type
41   virtual QWidget* createWidget(QWidget* theParent);
42
43 private:
44   QString myId;
45 };
46
47 #endif