X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Command.h;h=380b64ae4b8ce90eb1761995cc724d67dc5f81ca;hb=d86c77d1c6210bbe04fbc3e5b00f9e212e1ec930;hp=e3759a4aa922644f588a1d1c61d465f7fcd99137;hpb=cea3f78cfb7c796ba5be6bc9ee21e930abe14021;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Command.h b/src/XGUI/XGUI_Command.h index e3759a4aa..380b64ae4 100644 --- a/src/XGUI/XGUI_Command.h +++ b/src/XGUI/XGUI_Command.h @@ -1,34 +1,54 @@ #ifndef XGUI_Command_H #define XGUI_Command_H -#include "XGUI_Interfaces.h" - +#include "XGUI.h" #include #define MIN_BUTTON_HEIGHT 18 #define MIN_BUTTON_WIDTH 40 - -class XGUI_Command : public QWidgetAction, public IFeatureMenu +/**\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(const QString& theId, QObject * parent); - XGUI_Command(const QString& theId, 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(); + + //! Returns true if the command is enabled + virtual bool enabled() const; + + //! Set the command enabled + virtual void enable(); + + //! Set the command disabled + virtual void disable(); + + //! Returns Id of the command + virtual QString id() const + { + return myId; + } - virtual bool enabled() const; - virtual void enable(); - virtual void disable(); - virtual QString getId() const { return myId; } + const QStringList& unblockableCommands() const; + void setUnblockableCommands(const QStringList& myUnblockableCommands); - virtual void connectTo(const QObject* theResiver, const char* theSlot); + //! 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: - QString myId; + QString myId; + 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