app/tsrc/unittest_mpmtpinfolink/stub/src/hblabel.cpp
changeset 37 eb79a7c355bf
equal deleted inserted replaced
36:a0afa279b8fe 37:eb79a7c355bf
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: HbLabel stub for testing MpMtpInfoLink
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QGraphicsSceneMouseEvent>
       
    19 
       
    20 #include "stub/inc/hblabel.h"
       
    21 
       
    22 
       
    23 /*!
       
    24     Constructs the label
       
    25  */
       
    26 HbLabel::HbLabel() 
       
    27 {
       
    28     mText = QString();
       
    29     mHtmlText = QString();
       
    30     mTextWrapping = Hb::TextNoWrap;
       
    31 }
       
    32 
       
    33 /*!
       
    34     Label destructor.
       
    35  */
       
    36 HbLabel::~HbLabel ()
       
    37 {
       
    38 }
       
    39 
       
    40 /*!
       
    41     Sets the text wrapping mode to \a mode.
       
    42     \param mode - wrapping mode
       
    43 
       
    44     \sa Hb::TextWrapping
       
    45  */
       
    46 void HbLabel::setTextWrapping(Hb::TextWrapping mode)
       
    47 {
       
    48     mTextWrapping = mode;
       
    49 }
       
    50 
       
    51 /*!
       
    52     \return the label's current text wrapping mode.
       
    53     Default value is NoWrap.
       
    54 
       
    55     \sa setTextWrapping()
       
    56  */
       
    57 Hb::TextWrapping HbLabel::textWrapping() const
       
    58 {
       
    59     return mTextWrapping;
       
    60 }
       
    61 
       
    62 /*!
       
    63     Sets the label contents to plain text containing \a text. Any previous content is cleared.
       
    64     \param text - the plain text that is shown in the label.
       
    65 
       
    66     \sa setHtml()
       
    67  */
       
    68 void HbLabel::setPlainText(const QString &text)
       
    69 {
       
    70     mText = text;
       
    71 }
       
    72 
       
    73 /*!
       
    74     Sets the label contents to html text containing \a text. Any previous content is cleared.
       
    75     \param text - the html text that is shown in the label.
       
    76 
       
    77     \sa setPlainText()
       
    78  */
       
    79 void HbLabel::setHtml(const QString &text)
       
    80 {
       
    81     mHtmlText = text;
       
    82 }
       
    83 
       
    84 /*!
       
    85     Plain text accessor. Returns empty string if not set.
       
    86  */
       
    87 QString HbLabel::plainText() const
       
    88 {
       
    89     return mText;
       
    90 }
       
    91 
       
    92 /*!
       
    93     Rich text text accessor. Returns empty string if not set.
       
    94  */
       
    95 QString HbLabel::html() const
       
    96 {
       
    97     return mHtmlText;
       
    98 }
       
    99 
       
   100 /*!
       
   101     Fake widget rectangle accessor.
       
   102  */
       
   103 QRectF HbLabel::boundingRect()
       
   104 {
       
   105     return QRectF(10, 10, 10, 10);
       
   106 }
       
   107