src/hbwidgets/itemviews/hbindexfeedback_p.h
changeset 0 16d8024aca5e
child 28 b7da29130b0e
child 34 ed14f46c0e55
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #ifndef HBINDEXFEEDBACKPRIVATE_H
       
    27 #define HBINDEXFEEDBACKPRIVATE_H
       
    28 
       
    29 //
       
    30 //  W A R N I N G
       
    31 //  -------------
       
    32 //
       
    33 // This file is not part of the Qt API.  It exists purely as an
       
    34 // implementation detail.  This header file may change from version to
       
    35 // version without notice, or even be removed.
       
    36 //
       
    37 // We mean it.
       
    38 //
       
    39 
       
    40 #include "hbindexfeedback.h"
       
    41 #include <hbwidget_p.h>
       
    42 
       
    43 #define HB_INDEXFEEDBACK_TYPE "indexfeedback"
       
    44 #define EFFECT_IFAPPEAR "appear"
       
    45 #define EFFECT_IFDISAPPEAR "disappear"
       
    46 
       
    47 QT_BEGIN_NAMESPACE
       
    48 class QGraphicsWidget;
       
    49 class QGraphicsItem;
       
    50 class QRectF;
       
    51 QT_END_NAMESPACE
       
    52 
       
    53 class HbIndexFeedbackPrivate : public HbWidgetPrivate
       
    54 {
       
    55     Q_DECLARE_PUBLIC( HbIndexFeedback )
       
    56 
       
    57 public:
       
    58     HbIndexFeedbackPrivate();
       
    59     virtual ~HbIndexFeedbackPrivate();
       
    60     void init();
       
    61 
       
    62     void showIndexFeedback();
       
    63 
       
    64     void scrollBarPressed();
       
    65     void scrollBarReleased();
       
    66 
       
    67     void connectScrollBarToIndexFeedback(HbScrollBar* scrollBar);
       
    68     void disconnectItemView();
       
    69 
       
    70     void _q_scrollPositionChanged(qreal value, Qt::Orientation orientation);
       
    71     void _q_hideIndexFeedback();
       
    72     void _q_itemViewDestroyed();
       
    73     void _q_hideIndexFeedbackNow();
       
    74 
       
    75     void updatePrimitives();
       
    76     void createPrimitives();
       
    77 
       
    78     void calculatePopupRects();
       
    79     qreal textHeight() const;
       
    80     qreal textWidth() const;
       
    81 
       
    82     QString displayText(const QVariant &data) const;
       
    83 
       
    84 public:
       
    85     int mIndexFeedbackPressTimeout;
       
    86     int mIndexFeedbackDwellTimeout;
       
    87     int mIndexFeedbackReleaseTimeout;
       
    88     HbIndexFeedback::IndexFeedbackPolicy mIndexFeedbackPolicy;
       
    89 
       
    90     // TODO::The values are storred here is a work around for a bug in hbscrollbar.
       
    91     // the bug is that the value changed signal is emitted when the thumb
       
    92     // is pressed, and again when it is released, regaurdless of if there was a value change.
       
    93     // once that bug is fixed, this should be removed.
       
    94     qreal mVerticalScrollBarValue;
       
    95     qreal mHorizontalScrollBarValue;
       
    96 
       
    97     QTimer *mIndexFeedbackTimer;
       
    98     QTimer *mDisappearTimer;
       
    99 
       
   100     QString mPopupContent;
       
   101     QGraphicsItem *mTextItem;
       
   102     QGraphicsItem *mPopupItem;
       
   103 
       
   104     HbAbstractItemView *mItemView;
       
   105 
       
   106     QRectF mPopupTextRect;
       
   107     QRectF mPopupBackgroundRect;
       
   108     QRectF mItemViewContentsRect;
       
   109 
       
   110     qreal mOneCharHeight;
       
   111     qreal mThreeCharHeight;
       
   112     qreal mThreeCharWidth;
       
   113     qreal mStringOffset;
       
   114 
       
   115     QList<QGraphicsItem*> mPopupItemList;
       
   116 };
       
   117 
       
   118 #endif //HBINDEXFEEDBACKPRIVATE_H