src/hbwidgets/sliders/hbprogressbar.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 
       
    27 #ifndef HB_PROGRESSBAR_H
       
    28 #define HB_PROGRESSBAR_H
       
    29 
       
    30 #include <hbwidget.h>
       
    31 
       
    32 class HbProgressBarPrivate;
       
    33 
       
    34 class HB_WIDGETS_EXPORT HbProgressBar : public HbWidget
       
    35 {
       
    36     Q_OBJECT
       
    37     Q_ENUMS(ProgressBarType)
       
    38     Q_PROPERTY(int progressValue READ progressValue WRITE setProgressValue)
       
    39     Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
       
    40     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
       
    41     Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
       
    42     Q_PROPERTY(QString minText READ minText WRITE setMinText)
       
    43     Q_PROPERTY(QString maxText READ maxText WRITE setMaxText)
       
    44     Q_PROPERTY(bool minMaxTextVisible READ isMinMaxTextVisible WRITE setMinMaxTextVisible)
       
    45     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
       
    46 	Q_PROPERTY(Qt::Alignment minMaxTextAlignment READ minMaxTextAlignment WRITE setMinMaxTextAlignment)
       
    47 
       
    48 public:
       
    49     enum ProgressBarType {SimpleProgressBar, RatingProgressBar };
       
    50 
       
    51     explicit HbProgressBar(ProgressBarType type = SimpleProgressBar, QGraphicsItem *parent = 0);
       
    52     explicit HbProgressBar(QGraphicsItem *parent);
       
    53     ~HbProgressBar();    
       
    54 
       
    55     bool invertedAppearance() const;
       
    56     void setInvertedAppearance(bool inverted);
       
    57 
       
    58     int maximum() const;
       
    59     int minimum() const;
       
    60     int progressValue() const;
       
    61     
       
    62     void setRange ( int minimum, int maximum );
       
    63 
       
    64     void setMinText(const QString &text);
       
    65     QString minText() const;
       
    66 	
       
    67     void setMaxText(const QString &text);
       
    68     QString maxText() const;
       
    69 
       
    70     void setMinMaxTextVisible(bool visible);
       
    71     bool isMinMaxTextVisible() const;
       
    72 
       
    73 	void setMinMaxTextAlignment(Qt::Alignment alignment);
       
    74     Qt::Alignment minMaxTextAlignment() const;
       
    75 
       
    76     Qt::Orientation orientation() const;
       
    77 
       
    78     enum { Type = Hb::ItemType_ProgressBar };
       
    79     int type() const { return Type; }  
       
    80 
       
    81     QGraphicsItem* primitive(HbStyle::Primitive primitive) const; 
       
    82 	
       
    83 public slots:
       
    84     void setProgressValue(int value);
       
    85     void setMaximum(int maximum);
       
    86     void setMinimum(int minimum);
       
    87     void setOrientation(Qt::Orientation orientation);
       
    88     void updatePrimitives();
       
    89 
       
    90 signals:
       
    91     void valueChanged(int value);
       
    92 
       
    93 protected:
       
    94     HbProgressBar(HbProgressBarPrivate &dd, ProgressBarType type=SimpleProgressBar, QGraphicsItem *parent = 0);
       
    95     HbProgressBar(HbProgressBarPrivate &dd, QGraphicsItem *parent);
       
    96     virtual void initStyleOption(HbStyleOption *option) const;
       
    97     void closeEvent ( QCloseEvent * event );
       
    98     QVariant itemChange(GraphicsItemChange change, const QVariant &value);
       
    99     void changeEvent(QEvent *event);
       
   100 
       
   101 private:    
       
   102     Q_DECLARE_PRIVATE_D( d_ptr, HbProgressBar )
       
   103     Q_DISABLE_COPY( HbProgressBar )
       
   104 
       
   105 #ifdef HB_EFFECTS
       
   106     Q_PRIVATE_SLOT(d_func(), void _q_delayedHide(HbEffect::EffectStatus status))
       
   107 #endif
       
   108 
       
   109 };
       
   110 
       
   111 #endif  //HB_PROGRESSBAR_H
       
   112