QTfrontend/ui/widget/itemNum.h
changeset 6616 f77bb02b669f
parent 6153 3881126e06e8
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
    22 #ifndef _ITEM_NUM_INCLUDED
    22 #ifndef _ITEM_NUM_INCLUDED
    23 #define _ITEM_NUM_INCLUDED
    23 #define _ITEM_NUM_INCLUDED
    24 
    24 
    25 class ItemNum : public QFrame
    25 class ItemNum : public QFrame
    26 {
    26 {
    27   Q_OBJECT
    27         Q_OBJECT
    28 
    28 
    29   public:
    29     public:
    30     void setInfinityState(bool value);
    30         void setInfinityState(bool value);
    31     void setEnabled(bool value);
    31         void setEnabled(bool value);
    32     unsigned char getItemsNum() const;
    32         unsigned char getItemsNum() const;
    33     void setItemsNum(const unsigned char num);
    33         void setItemsNum(const unsigned char num);
    34 
    34 
    35   private:
    35     private:
    36     QImage m_im;
    36         QImage m_im;
    37     QImage m_img;
    37         QImage m_img;
    38     bool infinityState;
    38         bool infinityState;
    39     bool enabled;
    39         bool enabled;
    40 
    40 
    41   protected:
    41     protected:
    42     ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8);
    42         ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8);
    43     virtual QSize sizeHint () const;
    43         virtual QSize sizeHint () const;
    44     virtual ~ItemNum()=0;
    44         virtual ~ItemNum()=0;
    45 
    45 
    46     bool nonInteractive;
    46         bool nonInteractive;
    47     unsigned char minItems;
    47         unsigned char minItems;
    48     unsigned char maxItems;
    48         unsigned char maxItems;
    49     unsigned char numItems;
    49         unsigned char numItems;
    50 
    50 
    51     // from QWidget
    51         // from QWidget
    52     virtual void mousePressEvent ( QMouseEvent * event );
    52         virtual void mousePressEvent ( QMouseEvent * event );
    53     virtual void wheelEvent ( QWheelEvent * event );
    53         virtual void wheelEvent ( QWheelEvent * event );
    54     virtual void paintEvent(QPaintEvent* event);
    54         virtual void paintEvent(QPaintEvent* event);
    55 
    55 
    56     // to be implemented in child
    56         // to be implemented in child
    57     virtual void incItems()=0;
    57         virtual void incItems()=0;
    58     virtual void decItems()=0;
    58         virtual void decItems()=0;
    59 };
    59 };
    60 
    60 
    61 #endif // _ITEM_NUM_INCLUDED
    61 #endif // _ITEM_NUM_INCLUDED