ginebra2/ActionButtonSnippet.h
changeset 6 1c3b8676e58c
parent 5 0f2326c2a325
equal deleted inserted replaced
5:0f2326c2a325 6:1c3b8676e58c
    27 #include "ActionButton.h"
    27 #include "ActionButton.h"
    28 
    28 
    29 namespace GVA {
    29 namespace GVA {
    30 
    30 
    31 
    31 
       
    32 
    32   class ActionButtonSnippet : public ChromeSnippet
    33   class ActionButtonSnippet : public ChromeSnippet
    33   {
    34   {
    34     Q_OBJECT
    35     Q_OBJECT
    35     public:
    36     public:
    36        ActionButtonSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    37        ActionButtonSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    37        virtual ~ActionButtonSnippet() {;}
    38        virtual ~ActionButtonSnippet() {;}
       
    39        static ActionButtonSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
    38        QAction * getDefaultAction();
    40        QAction * getDefaultAction();
    39        void setDefaultAction( QAction * action, QEvent::Type triggerOn = QEvent::GraphicsSceneMouseRelease );
    41        void setDefaultAction( QAction * action, bool triggerOnDown =false, bool triggerOnUp=true);
    40        QIcon icon();
    42        QIcon icon();
    41        bool isChecked();
    43        bool isChecked();
    42        void setActive( bool active );
    44        void setActive( bool active );
       
    45        void setActiveOnPress( bool );
    43 
    46 
    44     public slots:
    47     public slots:
    45        void setIcon( const QString & icon );
    48        void setIcon( const QString & icon );
    46        void setDisabledIcon( const QString & icon );
    49        void setDisabledIcon( const QString & icon );
    47        void setSelectedIcon( const QString & icon );
       
    48        void setActiveIcon( const QString & icon );
    50        void setActiveIcon( const QString & icon );
    49        void connectAction ( const QString & action, const QString & view, const QString & inputEvent = "Up" );
    51        void connectAction( const QString & action, const QString & view, bool onDown = false, bool onUp = true);
       
    52 
    50        void setEnabled( bool enabled );
    53        void setEnabled( bool enabled );
    51        void setLatched( bool latched );
       
    52        void setInputEvent( const QString & inputEvent );
       
    53        void updateButtonState(bool state);
    54        void updateButtonState(bool state);
    54 
    55 
    55        
       
    56     signals:
       
    57        void activated();
       
    58        void contextMenuEvent();
       
    59   };
    56   };
    60 }
    57 }
    61 
    58 
    62 #endif // ACTIONBUTTONSNIPPET_H
    59 #endif // ACTIONBUTTONSNIPPET_H