]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Command.h
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 "XGUI.h"
5 #include <QWidgetAction>
6 #include <QPushButton>
7
8 #define MIN_BUTTON_HEIGHT 25
9 #define MIN_BUTTON_WIDTH 60
10
11 class XGUI_EXPORT XGUI_MenuButton: public QPushButton
12 {
13   Q_OBJECT
14  public:
15   XGUI_MenuButton(const QIcon & icon, const QString & text, QWidget * parent = 0);
16
17 // protected:
18 //  virtual void enterEvent(QEvent * event);
19 //  virtual void leaveEvent(QEvent * event);
20
21 };
22
23 /**\class XGUI_Command
24  * \ingroup GUI
25  * \brief Represents a command item in the application menu (Workbench)
26  */
27 class XGUI_EXPORT XGUI_Command: public QWidgetAction
28 {
29 Q_OBJECT
30 public:
31   XGUI_Command(const QString& theId, QObject * parent, bool isCheckable = false);
32   XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent, bool isCheckable = false);
33   ~XGUI_Command();
34
35   //VSV: Don't use this method for compatibility with SALOME. Use the construction below
36   /*virtual QString id() const
37   {
38     return data().toString();
39   }*/
40
41   const QStringList& nestedCommands() const;
42   void setNestedCommands(const QStringList& myUnblockableCommands);
43
44   //! Connect the command to a slot
45   virtual void connectTo(const QObject* theResiver, const char* theSlot);
46
47 protected:
48   //! Creates a command representation widget dependently on parent widget type
49   virtual QWidget* createWidget(QWidget* theParent);
50
51 private:
52   bool myCheckable;
53   //! List of Ids of commands which WILL NOT be blocked when the command is on.
54   QStringList myNestedCommands;
55 };
56
57 #endif