Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into SolveSpace
[modules/shaper.git] / src / XGUI / XGUI_Command.h
index 8f1caf154ac41a4790b07bb487840fb8c7fb2efa..dbd45b43207d969a93b67916a3768bdffbe04d12 100644 (file)
@@ -1,22 +1,44 @@
 #ifndef XGUI_Command_H
 #define XGUI_Command_H
 
+#include "XGUI.h"
 #include <QWidgetAction>
 
 #define MIN_BUTTON_HEIGHT 18
 #define MIN_BUTTON_WIDTH 40
 
-
-class XGUI_Command : public QWidgetAction
+/**\class XGUI_Command
+ * \ingroup GUI
+ * \brief Represents a command item in the application menu (Workbench)
+ */
+class XGUI_EXPORT XGUI_Command: public QWidgetAction
 {
-    Q_OBJECT
+Q_OBJECT
 public:
-    XGUI_Command(QObject * parent);
-    XGUI_Command(const QIcon& icon, const QString& text, QObject* parent);
-    ~XGUI_Command();
+  XGUI_Command(const QString& theId, QObject * parent, bool isCheckable = false);
+  XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent, bool isCheckable = false);
+  ~XGUI_Command();
+
+  //VSV: Don't use this method for compatibility with SALOME. Use the construction below
+  /*virtual QString id() const
+  {
+    return data().toString();
+  }*/
+
+  const QStringList& unblockableCommands() const;
+  void setUnblockableCommands(const QStringList& myUnblockableCommands);
+
+  //! Connect the command to a slot
+  virtual void connectTo(const QObject* theResiver, const char* theSlot);
 
 protected:
-    virtual QWidget* createWidget(QWidget* theParent);
+  //! Creates a command representation widget dependently on parent widget type
+  virtual QWidget* createWidget(QWidget* theParent);
+
+private:
+  bool myCheckable;
+  //! List of Ids of commands which WILL NOT be blocked when the command is on.
+  QStringList myUnblockableCommands;
 };
 
-#endif
\ No newline at end of file
+#endif