src/hbwidgets/dataform/hbdataformviewitem_p.h
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 3 11d3954df52a
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    32 #include "hbabstractviewitem_p.h"
    32 #include "hbabstractviewitem_p.h"
    33 
    33 
    34 class HbPushButton;
    34 class HbPushButton;
    35 class HbRadioButtonList;
    35 class HbRadioButtonList;
    36 class HbLabel;
    36 class HbLabel;
    37 class HbListDialog;
    37 class HbSelectionDialog;
    38 class HbAction;
    38 class HbAction;
       
    39 class HbDialog;
       
    40 class HbListWidget;
       
    41 class QGraphicsLinearLayout;
       
    42 class QItemSelection;
    39 
    43 
    40 QT_FORWARD_DECLARE_CLASS(QGraphicsLinearLayout)
    44 QT_FORWARD_DECLARE_CLASS(QGraphicsLinearLayout)
    41 
    45 
    42 /*
    46 /*
    43 HbToggleItem holds a HbPushButton and toggles the text whenever user clicks on it . 
    47 HbToggleItem holds a HbPushButton and toggles the text whenever user clicks on it . 
    61 signals:
    65 signals:
    62     void valueChanged(QPersistentModelIndex, QVariant);
    66     void valueChanged(QPersistentModelIndex, QVariant);
    63 
    67 
    64 private:
    68 private:
    65     HbPushButton* mButton;
    69     HbPushButton* mButton;
    66     //CRC: we can have thse variables in some common base class
       
    67     HbDataFormViewItem* mViewItem;
    70     HbDataFormViewItem* mViewItem;
    68     HbDataFormModelItem* mModelItem;
    71     HbDataFormModelItem* mModelItem;
    69     HbDataFormModel * mModel;
    72     HbDataFormModel * mModel;
    70 };
    73 };
    71 
    74 
    75     Q_OBJECT
    78     Q_OBJECT
    76 
    79 
    77 public:
    80 public:
    78     HbRadioItem( QGraphicsItem* parent = 0 );
    81     HbRadioItem( QGraphicsItem* parent = 0 );
    79     ~HbRadioItem( );
    82     ~HbRadioItem( );
    80     HbWidget* contentWidget( );
    83     HbWidget* createRadioButton( );
       
    84     void initilizeButton();
    81 
    85 
    82     //void setItemEnabled(bool enable);
    86     //void setItemEnabled(bool enable);
    83 
    87 
    84 protected:
    88 protected:
    85     virtual bool event( QEvent * e ); 
    89     virtual bool event( QEvent * e ); 
    86 
    90 
    87 public slots:
    91 public slots:
    88     void itemSelected( int index );
    92     void updateModel( int index );
    89     void buttonClicked();
    93     void buttonClicked();
       
    94     void dialogClosed(HbAction* action);
       
    95     void makeEmbedded();
       
    96     void makePopup();
       
    97     void changeMode();
       
    98     void selectItem();
       
    99     void resetSelection();
    90 signals:
   100 signals:
    91     void valueChanged(QPersistentModelIndex, QVariant);
   101     void valueChanged(QPersistentModelIndex, QVariant);
    92 
   102 
    93 private:
   103 private:
    94     HbRadioButtonList* mRadioButton;
   104     HbRadioButtonList* mRadioButtonList;
    95     HbPushButton* mButton;
   105     HbPushButton* mButton;
    96     bool mButtonVisible;
       
    97     QStringList mItems;
   106     QStringList mItems;
    98     int mSelected;
       
    99     HbDataFormViewItem *mViewItem;
   107     HbDataFormViewItem *mViewItem;
   100     HbDataFormModelItem* mModelItem;
   108     HbDataFormModelItem* mModelItem;
   101     HbDataFormModel * mModel;
   109     HbDataFormModel * mModel;
       
   110     HbDialog *mDialog;
       
   111     QGraphicsLinearLayout* layout;
       
   112     bool mPopup;
       
   113     int mSelected;
   102 };
   114 };
   103 
   115 
   104 //multi selectio item class declaration
   116 //multi selectio item class declaration
   105 class HbMultiSelectionItem : public HbWidget
   117 class HbMultiSelectionItem : public HbWidget
   106 {
   118 {
   107     Q_OBJECT
   119     Q_OBJECT
   108 
   120 
   109 public:
   121 public:
   110     HbMultiSelectionItem( QGraphicsItem* parent = 0 );
   122     HbMultiSelectionItem( QGraphicsItem* parent = 0 );
   111     ~HbMultiSelectionItem( );
   123     ~HbMultiSelectionItem( );
   112     HbWidget* contentWidget( ) const;
       
   113 
   124 
   114 protected:
   125 protected:
   115     virtual bool event( QEvent * e ); 
   126     virtual bool event( QEvent * e ); 
   116 
   127 
   117 public slots:
   128 public slots:
   118     void launchMultiSelectionList( );
   129     void launchMultiSelectionList( );
   119     void dialogClosed(HbAction*);
   130     void dialogClosed(HbAction*);
   120 
   131     void updateModel( const QItemSelection & selected, const QItemSelection &deselected );
       
   132     void makeEmbedded();
       
   133     void makePopup();
       
   134     void changeMode();
       
   135     void makeSelection();
   121 signals:
   136 signals:
   122     void valueChanged(QPersistentModelIndex, QVariant);
   137     void valueChanged(QPersistentModelIndex, QVariant);
   123 
   138 
   124 private:
   139 private:
   125     HbPushButton* mButton;
   140 
   126     QStringList mItems;
   141     QStringList mItems;
   127     QList<int> mSelectedItems;
   142     QList<QVariant> mSelectedItems;
   128     HbDataFormViewItem *mViewItem;
   143     HbDataFormViewItem *mViewItem;
   129     HbDataFormModelItem* mModelItem;
   144     HbDataFormModelItem* mModelItem;
   130     HbDataFormModel * mModel;
   145     HbDataFormModel * mModel;
   131     HbListDialog* mQuery;
   146     HbSelectionDialog* mSelectionDialog;
       
   147     HbPushButton* mButton;
       
   148     HbListWidget *mMultiListWidget;
       
   149     QGraphicsLinearLayout* layout;
   132 
   150 
   133 };
   151 };
   134 
   152 
   135 
   153 
   136 class HbDataFormViewItemPrivate : public HbAbstractViewItemPrivate
   154 class HbDataFormViewItemPrivate : public HbAbstractViewItemPrivate
   156 
   174 
   157     void setIcon( const QString &label );
   175     void setIcon( const QString &label );
   158     QString icon( ) const;
   176     QString icon( ) const;
   159     void setDescription( const QString& description );
   177     void setDescription( const QString& description );
   160     QString description() const;
   178     QString description() const;
   161     void updateLabel(const QString& label);
   179     void updateData();
   162 
   180 
   163     void setEnabled(bool enabled);
   181     void setEnabled(bool enabled);
   164 public:
   182 public:
   165     static HbDataFormViewItemPrivate *d_ptr(HbDataFormViewItem *item) {
   183     static HbDataFormViewItemPrivate *d_ptr(HbDataFormViewItem *item) {
   166         Q_ASSERT(item);
   184         Q_ASSERT(item);
   175     HbWidget *mContentWidget;
   193     HbWidget *mContentWidget;
   176     QGraphicsItem *mBackgroundItem;
   194     QGraphicsItem *mBackgroundItem;
   177     QGraphicsItem *mLabelItem;
   195     QGraphicsItem *mLabelItem;
   178     QGraphicsItem *mIconItem;
   196     QGraphicsItem *mIconItem;
   179     QGraphicsItem *mDescriptionItem;
   197     QGraphicsItem *mDescriptionItem;
   180     QVariant mCurrentValue;//CRC why is this required
       
   181     bool mSetAllProperty;
   198     bool mSetAllProperty;
   182     HbDataFormModel* mModel;
   199     HbDataFormModel* mModel;
   183     HbDataFormModelItem *mModelItem;
   200     HbDataFormModelItem *mModelItem;
   184     QString mDescription;
   201     QString mDescription;
   185 };
   202 };