src/hbwidgets/widgets/hblabel.h
changeset 0 16d8024aca5e
child 6 c3690ec91ef8
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 HBLABEL_H
       
    27 #define HBLABEL_H
       
    28 
       
    29 #include <hbwidget.h>
       
    30 
       
    31 class HbLabelPrivate;
       
    32 class HbStyleOptionLabel;
       
    33 QT_BEGIN_NAMESPACE
       
    34 class QGraphicsItem;
       
    35 QT_END_NAMESPACE
       
    36 
       
    37 class HB_WIDGETS_EXPORT HbLabel: public HbWidget
       
    38 {
       
    39     Q_OBJECT
       
    40 
       
    41     Q_PROPERTY(QString plainText READ plainText WRITE setPlainText)
       
    42     Q_PROPERTY(QString html READ html WRITE setHtml)
       
    43     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
       
    44     Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
       
    45     Q_PROPERTY(Hb::TextWrapping textWrapping READ textWrapping WRITE setTextWrapping)
       
    46     Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
       
    47     Q_PROPERTY(HbIcon icon READ icon WRITE setIcon)
       
    48     Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
       
    49 
       
    50 public:
       
    51 
       
    52     explicit HbLabel (QGraphicsItem *parent = 0);
       
    53     explicit HbLabel (const QString &displayText, QGraphicsItem *parent = 0);
       
    54     virtual ~HbLabel ();
       
    55 
       
    56     QString plainText() const;
       
    57     QString html() const;
       
    58 
       
    59     void setElideMode(Qt::TextElideMode elideMode);
       
    60     Qt::TextElideMode elideMode() const;
       
    61 
       
    62     void setTextWrapping(Hb::TextWrapping mode);
       
    63     Hb::TextWrapping textWrapping() const;
       
    64 
       
    65     void setIcon(const HbIcon &icon);
       
    66     HbIcon icon() const;
       
    67 
       
    68     void setAspectRatioMode(Qt::AspectRatioMode mode);
       
    69     Qt::AspectRatioMode aspectRatioMode() const;
       
    70 
       
    71     void setAlignment(Qt::Alignment alignment);
       
    72     Qt::Alignment alignment() const;
       
    73 
       
    74     void setTextColor( const QColor &textColor );
       
    75     QColor textColor() const;
       
    76 
       
    77     bool isEmpty() const;
       
    78 
       
    79     virtual QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
       
    80 
       
    81     enum {Type = Hb::ItemType_Label};
       
    82     int type() const;
       
    83 
       
    84 public slots:
       
    85     void setPlainText(const QString &text);
       
    86     void setHtml(const QString &text);
       
    87     void setNumber(int number);
       
    88     void setNumber(qreal number);
       
    89     virtual void updatePrimitives();
       
    90     void clear();
       
    91 
       
    92 protected:
       
    93     HbLabel(HbLabelPrivate &dd, QGraphicsItem *parent);
       
    94 
       
    95     void initStyleOption(HbStyleOptionLabel *option) const;
       
    96 
       
    97 private:
       
    98     Q_DECLARE_PRIVATE_D(d_ptr, HbLabel)
       
    99     Q_DISABLE_COPY(HbLabel)
       
   100 };
       
   101 
       
   102 #endif // HBLABEL_H