src/hbwidgets/sliders/hbslidercontrol_p.h
changeset 0 16d8024aca5e
child 1 f7ac710697a9
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 HBSLIDERCONTROL_H
       
    27 #define HBSLIDERCONTROL_H
       
    28 
       
    29 #include "hbglobal.h"
       
    30 #include "hbnamespace_p.h"
       
    31 #include "hbabstractslidercontrol.h"
       
    32 
       
    33 class HbStyleOptionSlider;
       
    34 class HbSliderControlPrivate;
       
    35 
       
    36 QT_BEGIN_NAMESPACE
       
    37 class QStyleOptionSlider;
       
    38 QT_END_NAMESPACE
       
    39 
       
    40 class HB_AUTOTEST_EXPORT HbSliderControl : public HbAbstractSliderControl
       
    41 {
       
    42     Q_OBJECT
       
    43 
       
    44 public:
       
    45     explicit HbSliderControl(QGraphicsItem *parent = 0);
       
    46     explicit HbSliderControl(Qt::Orientation orientation, QGraphicsItem *parent = 0);
       
    47     virtual  ~HbSliderControl();
       
    48 
       
    49     enum SnappingMode {
       
    50         NoSnapping,
       
    51         MajorTickSnapping,
       
    52         MinorTickSnapping
       
    53     };
       
    54 
       
    55     Hb::SliderTickPositions tickPosition() const;
       
    56     void setTickPosition(Hb::SliderTickPositions position);
       
    57 
       
    58     int majorTickInterval() const;
       
    59     void setMajorTickInterval(int interval);
       
    60 
       
    61     int minorTickInterval() const;
       
    62     void setMinorTickInterval(int interval);
       
    63 
       
    64     void setMajorTickLabels(const QStringList &majorTickLabels);
       
    65     QStringList majorTickLabels() const;
       
    66 
       
    67     void setMinorTickLabels(const QStringList &minorTickLabels);
       
    68     QStringList minorTickLabels() const;
       
    69 
       
    70     SnappingMode snappingMode() const;
       
    71     void setSnappingMode(SnappingMode mode);
       
    72 
       
    73     enum { Type = HbPrivate::ItemType_SliderControl };
       
    74     int type() const { return Type; }
       
    75 
       
    76     void setToolTipVisible(bool );
       
    77     bool isToolTipVisible()const;
       
    78 
       
    79     void setToolTipAlignment(Qt:: Alignment);
       
    80     Qt:: Alignment toolTipAlignment() const;
       
    81     void setSliderPosition(int);
       
    82     void setHandleIcon(const QString &handleIcon);
       
    83     QString handleIcon() const;
       
    84 
       
    85     void setHandleItem(QGraphicsItem *handleItem);
       
    86     QGraphicsItem *handleItem() const;
       
    87 
       
    88     void setHandleVisible(bool);
       
    89     bool handleVisible() const;
       
    90 
       
    91 
       
    92     void updateSliderPosToTick();
       
    93 
       
    94     void setPreviousValue(bool , int );
       
    95 
       
    96     void enableTrackEventHandling(bool enable = true);
       
    97     bool isTrackEventHandlingEnabled ( );
       
    98 
       
    99     void setTrackFilled(bool trackVisible );
       
   100     bool isTrackFilled() const;
       
   101 
       
   102 public slots:
       
   103     void updateTheme();
       
   104     void updatePrimitives();
       
   105     void showToolTip();
       
   106  
       
   107 private slots:
       
   108 
       
   109     void hideToolTip();
       
   110 
       
   111 protected:
       
   112     HbSliderControl(HbSliderControlPrivate &dd,QGraphicsItem *parent);
       
   113     virtual void changeEvent(QEvent *event);
       
   114     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
       
   115     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
       
   116     bool sceneEventFilter(QGraphicsItem *obj,QEvent *event);
       
   117     virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
       
   118     virtual QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
       
   119     void releasedOutside(bool);
       
   120 
       
   121     void initStyleOption(HbStyleOptionSlider *option) const;
       
   122 
       
   123     virtual void sliderChange(SliderChange change);
       
   124     QVariant itemChange(GraphicsItemChange change, const QVariant &value);
       
   125     virtual bool sceneEvent(QEvent *event);
       
   126     virtual void polish( HbStyleParameters& params );
       
   127 
       
   128 signals:
       
   129     void releasedOutside( );
       
   130 
       
   131 private:
       
   132     Q_DECLARE_PRIVATE_D(d_ptr, HbSliderControl)
       
   133     Q_DISABLE_COPY(HbSliderControl)
       
   134     friend class HbSliderHandle;
       
   135     friend class HbSliderTickmarks;
       
   136     friend class HbSliderTickmarksLabel;
       
   137 };
       
   138 
       
   139 #endif // HBSLIDERCONTROL_H