ganeswidgets/inc/hgindexfeedback_p.h
changeset 0 89c329efa980
child 1 e48454f237ca
equal deleted inserted replaced
-1:000000000000 0:89c329efa980
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HGINDEXFEEDBACKPRIVATE_H
       
    19 #define HGINDEXFEEDBACKPRIVATE_H
       
    20 
       
    21 #include "hgindexfeedback.h"
       
    22 #include <hbwidget_p.h>
       
    23 
       
    24 #define HB_INDEXFEEDBACK_TYPE "indexfeedback"
       
    25 #define EFFECT_IFAPPEAR "appear"
       
    26 #define EFFECT_IFDISAPPEAR "disappear"
       
    27 
       
    28 QT_BEGIN_NAMESPACE
       
    29 class QGraphicsWidget;
       
    30 class QGraphicsItem;
       
    31 class QRectF;
       
    32 class QItemSelectionModel;
       
    33 QT_END_NAMESPACE
       
    34 
       
    35 class HgIndexFeedbackPrivate : public HbWidgetPrivate
       
    36 {
       
    37     Q_DECLARE_PUBLIC( HgIndexFeedback )
       
    38 
       
    39 public:
       
    40     HgIndexFeedbackPrivate();
       
    41     virtual ~HgIndexFeedbackPrivate();
       
    42     void init();
       
    43 
       
    44     void showIndexFeedback();
       
    45     void updateIndex();
       
    46 
       
    47     void scrollBarPressed();
       
    48     void scrollBarReleased();
       
    49 
       
    50     void connectScrollBarToIndexFeedback(HbScrollBar* scrollBar);
       
    51     void disconnectItemView();
       
    52     void connectModelToIndexFeedback(QItemSelectionModel* model);
       
    53 
       
    54     void _q_scrollPositionChanged(qreal value, Qt::Orientation orientation);
       
    55     void _q_hideIndexFeedback();
       
    56     void _q_itemViewDestroyed();
       
    57     void _q_hideIndexFeedbackNow();
       
    58     void _q_currentModelIndexChanged(const QModelIndex& current, const QModelIndex& previous);
       
    59 
       
    60     void updatePrimitives();
       
    61     void createPrimitives();
       
    62 
       
    63     void calculatePopupRects();
       
    64     qreal textHeight() const;
       
    65     qreal textWidth() const;
       
    66 
       
    67     QString displayText(const QVariant &data) const;
       
    68 
       
    69 public:
       
    70     int mIndexFeedbackPressTimeout;
       
    71     int mIndexFeedbackDwellTimeout;
       
    72     int mIndexFeedbackReleaseTimeout;
       
    73     HgWidget::IndexFeedbackPolicy mIndexFeedbackPolicy;
       
    74 
       
    75     // TODO::The values are storred here is a work around for a bug in hbscrollbar.
       
    76     // the bug is that the value changed signal is emitted when the thumb
       
    77     // is pressed, and again when it is released, regaurdless of if there was a value change.
       
    78     // once that bug is fixed, this should be removed.
       
    79     qreal mScrollBarValue;
       
    80 
       
    81     QTimer *mIndexFeedbackTimer;
       
    82     QTimer *mDisappearTimer;
       
    83 
       
    84     QString mPopupContent;
       
    85     QGraphicsItem *mTextItem;
       
    86     QGraphicsItem *mPopupItem;
       
    87 
       
    88     QRectF mPopupTextRect;
       
    89     QRectF mPopupBackgroundRect;
       
    90     QRectF mItemViewContentsRect;
       
    91 
       
    92     qreal mOneCharHeight;
       
    93     qreal mThreeCharHeight;
       
    94     qreal mThreeCharWidth;
       
    95     qreal mStringOffset;
       
    96 
       
    97     HgWidget* mWidget;
       
    98     QList<QGraphicsItem*> mPopupItemList;
       
    99     bool mScrollBarPressed;
       
   100 };
       
   101 
       
   102 #endif //HBINDEXFEEDBACKPRIVATE_H