src/hbcore/gui/hbtoolbutton.h
changeset 34 ed14f46c0e55
parent 1 f7ac710697a9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    30 #include <hbabstractbutton.h>
    30 #include <hbabstractbutton.h>
    31 #include <hbicon.h>
    31 #include <hbicon.h>
    32 
    32 
    33 class HbAction;
    33 class HbAction;
    34 class HbToolButtonPrivate;
    34 class HbToolButtonPrivate;
       
    35 
    35 class HbStyleOptionToolButton;
    36 class HbStyleOptionToolButton;
    36 
    37 
    37 class HB_CORE_EXPORT HbToolButton : public HbAbstractButton
    38 class HB_CORE_EXPORT HbToolButton : public HbAbstractButton
    38 {
    39 {
    39     Q_OBJECT
    40     Q_OBJECT
    40     Q_PROPERTY( HbIcon background READ background WRITE setBackground )
    41     Q_PROPERTY( HbIcon background READ background WRITE setBackground )
    41     Q_PROPERTY( ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle )
       
    42     Q_ENUMS(ToolButtonStyle)
       
    43 
    42 
    44 public:
    43 public:
    45     enum ToolButtonStyle {
       
    46         ToolButtonIcon        = 0x1,
       
    47         ToolButtonText        = 0x2,
       
    48         ToolButtonTextAndIcon = 0x3
       
    49     };
       
    50 
       
    51     explicit HbToolButton( QGraphicsItem *parent = 0 );
    44     explicit HbToolButton( QGraphicsItem *parent = 0 );
    52     explicit HbToolButton( HbAction *action, QGraphicsItem *parent = 0 );
    45     explicit HbToolButton( HbAction *action, QGraphicsItem *parent = 0 );
    53     virtual ~HbToolButton();
    46     virtual ~HbToolButton();
    54 
    47 
    55     HbAction *action() const;
    48     HbAction *action() const;
    56     void setAction( HbAction *action );
    49     void setAction( HbAction *action );
    57 
    50 
    58     HbIcon background() const;
    51     HbIcon background() const;
    59     void setBackground( const HbIcon &background );
    52     void setBackground( const HbIcon &background );
    60 
    53 
    61     ToolButtonStyle toolButtonStyle() const;
       
    62     void setToolButtonStyle( ToolButtonStyle style );
       
    63 
       
    64     QGraphicsItem *primitive( HbStyle::Primitive primitive ) const;
       
    65 
    54 
    66     enum { Type = Hb::ItemType_ToolButton };
    55     enum { Type = Hb::ItemType_ToolButton };
    67     int type() const { return Type; }
    56     int type() const { return Type; }
    68 
    57 
    69 public slots:
    58 public slots:
    71 
    60 
    72 signals:
    61 signals:
    73     void triggered( HbAction *action );
    62     void triggered( HbAction *action );
    74 
    63 
    75 protected:
    64 protected:
       
    65     friend class HbToolBar;
       
    66 
    76     HbToolButton( HbToolButtonPrivate &dd, QGraphicsItem *parent );
    67     HbToolButton( HbToolButtonPrivate &dd, QGraphicsItem *parent );
    77 
       
    78     void initStyleOption( HbStyleOptionToolButton *option );
       
    79     void resizeEvent( QGraphicsSceneResizeEvent *event );
    68     void resizeEvent( QGraphicsSceneResizeEvent *event );
    80     void nextCheckState();
    69     void nextCheckState();
       
    70     void checkStateSet();
    81     bool event( QEvent *event );
    71     bool event( QEvent *event );
    82     void polish(HbStyleParameters &params);
    72     void polish(HbStyleParameters &params);
    83     bool sceneEvent(QEvent *event);
    73     bool sceneEvent(QEvent *event);
       
    74     void initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive);
       
    75 
    84 
    76 
    85 private:
    77 private:
    86     Q_DECLARE_PRIVATE_D( d_ptr, HbToolButton )
    78     Q_DECLARE_PRIVATE_D( d_ptr, HbToolButton )
    87     Q_DISABLE_COPY(HbToolButton)
    79     Q_DISABLE_COPY(HbToolButton)
    88 
    80