src/hbcore/style/hbstyleoptionlistviewitem.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
     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 HbCore 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 #include "hbstyleoptionlistviewitem_p.h"
       
    27 
       
    28 /*
       
    29     \class HbStyleOptionListViewItem
       
    30     \brief HbStyleOptionListViewItem has the style component for list view item primitives
       
    31 */
       
    32 
       
    33 
       
    34 /*
       
    35     \var HbStyleOptionListViewItem::content
       
    36 
       
    37     This variable holds content (if any) that is set as item's data. 
       
    38     The content is always a single item even if respective role in the model 
       
    39     would be a list. 
       
    40 
       
    41     Default value is NULL variant.
       
    42 
       
    43     \sa HbStyleOptionListViewItem::primaryText
       
    44 */
       
    45 
       
    46 /*
       
    47     \var HbStyleOptionListViewItem::role
       
    48 
       
    49     Defines role of an model item, from which content is read.
       
    50     Default value Qt::DisplayRole.
       
    51 
       
    52     \sa HbStyleOptionListViewItem::content
       
    53 */
       
    54 
       
    55 /*
       
    56     \var HbStyleOptionListViewItem::index
       
    57 
       
    58     This variable holds index of the primitive item required by css/xml layouting, when
       
    59     there may be several items with same name prefix e.g. "text-2".
       
    60 
       
    61     The itemNameIndex value is incremented by 1 before using it in HbStyle. 
       
    62     Thus itemNameIndex value 0 produces item name "text-1".
       
    63 
       
    64     When index is 1, style option includes secondary text.
       
    65 
       
    66     Default value is 0.
       
    67 */
       
    68 
       
    69 /*
       
    70     \var HbStyleOptionListViewItem::minimumLines
       
    71 
       
    72     This variable holds minimum count of lines reserved for secondary text (i.e. when index is 1).
       
    73     Minimum row count for secondary text can be set using HbListViewItem::setSecondaryTextRowCount(). 
       
    74     If minimum and maximum row counts are not set by application, default value is used.
       
    75 
       
    76     For other texts default value is always used. When default value is set, minimum count of lines are read from .css file during layouting the view item.
       
    77     If multilineSecondaryTextSupported is false and text is secondary text, minimum and maximum line counts are forced to 1. 
       
    78     These values cannot be overridden from .css during layouting.
       
    79 
       
    80     Default value is -1. 
       
    81 
       
    82     \sa HbStyleOptionListViewItem::index
       
    83     \sa HbStyleOptionListViewItem::multilineSecondaryTextSupported
       
    84     \sa HbListViewItem::setSecondaryTextRowCount()
       
    85 */
       
    86 
       
    87 /*
       
    88     \var HbStyleOptionListViewItem::maximumLines
       
    89 
       
    90     This variable holds minimum count of lines reserved for secondary text (i.e. when index is 1).
       
    91     Maximum row count for secondary text can be set using HbListViewItem::setSecondaryTextRowCount().
       
    92     If minimum and maximum row counts are not set by application, default value is used.
       
    93 
       
    94     For other texts default value is always used. When default value is set, maximum count of lines are read from .css file during layouting the view item.
       
    95     If multilineSecondaryTextSupported is false and text is secondary text, minimum and maximum line counts are forced to 1. 
       
    96     Then these values cannot be overridden from .css during layouting.
       
    97 
       
    98     Default value is -1. 
       
    99 
       
   100     \sa HbStyleOptionListViewItem::index
       
   101     \sa HbStyleOptionListViewItem::multilineSecondaryTextSupported
       
   102     \sa HbListViewItem::setSecondaryTextRowCount()
       
   103 */
       
   104 
       
   105 /*
       
   106     \var HbStyleOptionListViewItem::multilineSecondaryTextSupported
       
   107 
       
   108     This variable holds whether multine line secondary text is supported. 
       
   109 
       
   110     Default value is true. 
       
   111 
       
   112     \sa HbStyleOptionListViewItem::minimumLines
       
   113     \sa HbStyleOptionListViewItem::maximumLines
       
   114     \sa HbListViewItem::setSecondaryTextRowCount()
       
   115 */
       
   116 
       
   117 HbStyleOptionListViewItem::HbStyleOptionListViewItem() :
       
   118     HbStyleOptionAbstractViewItem(),
       
   119     role(Qt::DisplayRole),
       
   120     index(0),
       
   121     minimumLines(-1),
       
   122     maximumLines(-1),
       
   123     multilineSecondaryTextSupported(true)
       
   124 {
       
   125     type = Type;
       
   126     version = Version;
       
   127 }
       
   128 
       
   129 HbStyleOptionListViewItem::HbStyleOptionListViewItem(const HbStyleOptionListViewItem &other) :
       
   130     HbStyleOptionAbstractViewItem(other),
       
   131     content(other.content),
       
   132     role(Qt::DisplayRole),
       
   133     index(other.index),
       
   134     minimumLines(other.minimumLines),
       
   135     maximumLines(other.maximumLines)
       
   136 {
       
   137     type = Type;
       
   138     version = Version;
       
   139 }
       
   140 
       
   141 HbStyleOptionListViewItem::~HbStyleOptionListViewItem()
       
   142 {
       
   143 }