src/hbwidgets/popups/hbsliderpopup.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 HB_SLIDERPOPUP_H
       
    27 #define HB_SLIDERPOPUP_H
       
    28 
       
    29 #include <hbslider.h>
       
    30 #include <hbdialog.h>
       
    31 #include <QList>
       
    32 
       
    33 class HbSliderPopupPrivate;
       
    34 
       
    35 class HB_WIDGETS_EXPORT HbSliderPopup : public HbDialog
       
    36 {
       
    37     Q_OBJECT
       
    38     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
       
    39     Q_PROPERTY(int  minimum READ minimum WRITE setMinimum)
       
    40     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
       
    41     Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
       
    42     Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
       
    43     Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition)
       
    44     Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
       
    45     Q_PROPERTY(int value READ value WRITE setValue USER true)
       
    46     Q_PROPERTY(Hb::SliderTickPositions tickPosition  READ tickPosition WRITE setTickPosition)
       
    47     Q_PROPERTY(int majorTickInterval READ majorTickInterval WRITE setMajorTickInterval)
       
    48     Q_PROPERTY(int minorTickInterval READ minorTickInterval WRITE setMinorTickInterval)
       
    49     Q_PROPERTY(QStringList majorTickLabels READ majorTickLabels WRITE setMajorTickLabels)
       
    50     Q_PROPERTY(QStringList minorTickLabels READ minorTickLabels WRITE setMinorTickLabels)
       
    51     Q_PROPERTY(QString text READ text WRITE setText)
       
    52     Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
       
    53     Q_PROPERTY(bool toolTipVisible READ isToolTipVisible WRITE setToolTipVisible)
       
    54     Q_PROPERTY(Qt::Alignment toolTipAlignment READ toolTipAlignment WRITE setToolTipAlignment)
       
    55     Q_PROPERTY(bool trackFilled READ isTrackFilled WRITE setTrackFilled)
       
    56     Q_PROPERTY(QList<QVariant> sliderElements READ sliderElements WRITE setSliderElements);
       
    57     Q_PROPERTY(QMap elementIcons READ elementIcons WRITE setElementIcons);
       
    58  
       
    59  public:
       
    60     explicit HbSliderPopup(QGraphicsItem *parent = 0);
       
    61     explicit HbSliderPopup(Qt::Orientation orientation, QGraphicsItem *parent = 0);
       
    62     virtual ~HbSliderPopup();
       
    63 
       
    64     bool invertedAppearance() const;
       
    65     void setInvertedAppearance(bool inverted);
       
    66 
       
    67     int maximum() const;
       
    68     void setMaximum(int max);
       
    69 
       
    70     int minimum() const;
       
    71     void setMinimum(int min);
       
    72 
       
    73     void setRange(int min, int max);
       
    74     Qt::Orientation orientation() const;
       
    75 
       
    76     int pageStep() const;
       
    77     void setPageStep(int step);
       
    78 
       
    79     int singleStep() const;
       
    80     void setSingleStep(int step);
       
    81 
       
    82     int sliderPosition() const;
       
    83     void setSliderPosition(int pos);
       
    84 
       
    85     bool hasTracking() const;
       
    86     void setTracking(bool enable);
       
    87 
       
    88     Hb::SliderTickPositions tickPosition() const;
       
    89     void setTickPosition(Hb::SliderTickPositions position);
       
    90 
       
    91     HbSlider::SnappingMode snappingMode() const;  
       
    92     void setSnappingMode(HbSlider::SnappingMode mode);
       
    93 
       
    94     HbIcon icon(HbSlider::SliderElement element) const;
       
    95     void setIcon(HbSlider::SliderElement element, const HbIcon &icon);
       
    96 
       
    97     void setElementIcon(HbSlider::SliderElement element, const HbIcon &icon);
       
    98     HbIcon elementIcon(HbSlider::SliderElement element) const; 
       
    99 
       
   100     QList<HbSlider::SliderElement> elements() const;
       
   101     void setElements(const QList<HbSlider::SliderElement> &elements);
       
   102 
       
   103     QMap<QString,QVariant> elementIcons( )const;
       
   104     void setElementIcons(const QMap<QString,QVariant> &elements);
       
   105 
       
   106     void setSliderElements(const QList<QVariant> &elements);
       
   107     QList<QVariant> sliderElements() const;
       
   108 
       
   109     int majorTickInterval() const;
       
   110     void setMajorTickInterval(int interval);
       
   111 
       
   112     int minorTickInterval() const;
       
   113     void setMinorTickInterval(int interval);
       
   114 
       
   115     QStringList majorTickLabels() const;
       
   116     void setMajorTickLabels(const QStringList &majorTickLabels);
       
   117 
       
   118     QStringList minorTickLabels() const;    
       
   119     void setMinorTickLabels(const QStringList &minorTickLabels);
       
   120 
       
   121     int value() const;
       
   122     QString text() const;
       
   123 
       
   124     void setToolTipAlignment(Qt:: Alignment);
       
   125     Qt:: Alignment toolTipAlignment() const;
       
   126 
       
   127     virtual void setToolTipVisible(bool);
       
   128     bool isToolTipVisible();
       
   129 
       
   130     void setTrackFilled(bool trackVisible = true );
       
   131     bool isTrackFilled() const;
       
   132 
       
   133     virtual QGraphicsItem * primitive(HbStyle::Primitive primitive) const;
       
   134 
       
   135     enum { Type = Hb::ItemType_SliderPopup };
       
   136     int type() const { return Type; }
       
   137 
       
   138 public slots:
       
   139     void setValue(int value);
       
   140     void setText(const QString &text);
       
   141     void setOrientation(Qt::Orientation orientation);
       
   142     void updatePrimitives();
       
   143 
       
   144 signals:
       
   145     void valueChanged(int value);
       
   146     void sliderPressed();
       
   147     void sliderReleased();
       
   148     void sliderMoved(int value);
       
   149     void rangeChanged(int min, int max);
       
   150     void iconPressed();
       
   151     void iconReleased();
       
   152     void iconClicked();
       
   153     void textClicked();
       
   154 
       
   155 protected:
       
   156     HbSliderPopup(HbSliderPopupPrivate &dd, QGraphicsItem *parent);
       
   157 
       
   158 private:
       
   159     Q_DECLARE_PRIVATE_D(d_ptr, HbSliderPopup)
       
   160     Q_DISABLE_COPY(HbSliderPopup)
       
   161     Q_PRIVATE_SLOT(d_func(), void _q_valueChanged(int val ))
       
   162 
       
   163 };
       
   164 
       
   165 
       
   166 #endif // HB_SLIDERPOPUP_H