src/hbwidgets/widgets/hbcheckbox.h
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 3 11d3954df52a
equal deleted inserted replaced
9:730c025d4b77 15:f378acbc9cfb
    34 
    34 
    35 class HB_WIDGETS_EXPORT HbCheckBox : public HbAbstractButton
    35 class HB_WIDGETS_EXPORT HbCheckBox : public HbAbstractButton
    36 {
    36 {
    37     Q_OBJECT
    37     Q_OBJECT
    38     Q_PROPERTY( QString text READ text WRITE setText )
    38     Q_PROPERTY( QString text READ text WRITE setText )
    39     Q_PROPERTY(bool tristate READ isTristate WRITE setTristate)
    39     Q_PROPERTY( bool tristate READ isTristate WRITE setTristate )
    40     Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState)
    40     Q_PROPERTY( Qt::CheckState checkState READ checkState WRITE setCheckState )
    41 
    41 
    42 public:
    42 public:
    43 
    43 
    44     explicit HbCheckBox( QGraphicsItem *parent = 0 );
    44     explicit HbCheckBox( QGraphicsItem *parent = 0 );
    45     explicit HbCheckBox( const QString &text, QGraphicsItem *parent = 0 );
    45     explicit HbCheckBox( const QString &text, QGraphicsItem *parent = 0 );
    46     virtual ~HbCheckBox();  
    46     virtual ~HbCheckBox( );  
    47 
    47 
    48     enum { Type = Hb::ItemType_CheckBox };
    48     enum { 
    49     int type() const { return Type; }
    49         Type = Hb::ItemType_CheckBox 
       
    50     };
       
    51     int type() const {
       
    52         return Type;
       
    53     }
    50 
    54 
    51     void setText( const QString &text );
    55     void setText( const QString &text );
    52     QString text( ) const;
    56     QString text( ) const;
    53 
    57 
    54     void setTristate( bool isTristate = true );
    58     void setTristate( bool isTristate = true );
    55     bool isTristate( ) const;
    59     bool isTristate( ) const;
    56 
    60 
    57     Qt::CheckState checkState( ) const;
    61     Qt::CheckState checkState( ) const;
    58 
    62 
    59     virtual QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
    63     virtual QGraphicsItem *primitive( HbStyle::Primitive primitive ) const;
    60 
    64 
    61 public slots:
    65 public slots:
    62 
    66 
    63     void setCheckState( Qt::CheckState state );
    67     void setCheckState( Qt::CheckState state );
    64     virtual void updatePrimitives();
    68     virtual void updatePrimitives();
    65 
    69 
    66 protected:
    70 protected:
       
    71 
    67     void initStyleOption( HbStyleOptionCheckBox *option ) const;
    72     void initStyleOption( HbStyleOptionCheckBox *option ) const;
    68     void resizeEvent(QGraphicsSceneResizeEvent *event);
    73     void resizeEvent( QGraphicsSceneResizeEvent *event );
    69 
    74 
    70     virtual bool hitButton( const QPointF &pos ) const;
    75     virtual bool hitButton( const QPointF &pos ) const;
    71     virtual void checkStateSet( );
    76     virtual void checkStateSet( );
    72     virtual void nextCheckState( );
    77     virtual void nextCheckState( );
    73 #ifndef HB_GESTURE_FW
    78 #ifndef HB_GESTURE_FW
    74     void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
    79     void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
    75     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    80     void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
    76 #endif
    81 #endif
       
    82 
    77 #ifdef HB_GESTURE_FW
    83 #ifdef HB_GESTURE_FW
    78     virtual void gestureEvent(QGestureEvent *event);
    84     virtual void gestureEvent( QGestureEvent *event );
    79 #endif
    85 #endif
    80     void keyPressEvent(QKeyEvent *keyEvent);
    86     void keyPressEvent( QKeyEvent *keyEvent );
    81     QVariant itemChange( GraphicsItemChange change, const QVariant &value );
    87     QVariant itemChange( GraphicsItemChange change, const QVariant &value );
    82 
    88 
    83 signals:
    89 signals:
       
    90 
    84     void stateChanged ( int state );
    91     void stateChanged ( int state );
    85 
    92 
    86 private:
    93 private:
    87     Q_DECLARE_PRIVATE_D(d_ptr, HbCheckBox)
    94 
    88     Q_DISABLE_COPY(HbCheckBox)
    95     Q_DECLARE_PRIVATE_D( d_ptr, HbCheckBox )
       
    96     Q_DISABLE_COPY( HbCheckBox )
    89     
    97     
    90 
    98 
    91 };
    99 };
    92 
   100 
    93 #endif  //HBCHECKBOX_H
   101 #endif  //HBCHECKBOX_H