src/gui/styles/qcommonstyle_p.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QCOMMONSTYLE_P_H
       
    43 #define QCOMMONSTYLE_P_H
       
    44 
       
    45 #include "qcommonstyle.h"
       
    46 #include "qstyle_p.h"
       
    47 
       
    48 #include "qstyleoption.h"
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 //
       
    53 //  W A R N I N G
       
    54 //  -------------
       
    55 //
       
    56 // This file is not part of the Qt API.  It exists for the convenience
       
    57 // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp.  This header
       
    58 // file may change from version to version without notice, or even be removed.
       
    59 //
       
    60 // We mean it.
       
    61 //
       
    62 
       
    63 class QStringList;
       
    64 
       
    65 #ifdef Q_WS_X11
       
    66 class QIconTheme
       
    67 {
       
    68 public:
       
    69     QIconTheme(QHash <int, QString> dirList, QStringList parents) :
       
    70           _dirList(dirList), _parents(parents), _valid(true){ }
       
    71     QIconTheme() : _valid(false){ }
       
    72 
       
    73     QHash <int, QString> dirList() {return _dirList;}
       
    74     QStringList parents() {return _parents;}
       
    75     bool isValid() {return _valid;}
       
    76 
       
    77 private:
       
    78     QHash <int, QString> _dirList;
       
    79     QStringList _parents;
       
    80     bool _valid;
       
    81 };
       
    82 #endif
       
    83 
       
    84 // Private class
       
    85 class QCommonStylePrivate : public QStylePrivate
       
    86 {
       
    87     Q_DECLARE_PUBLIC(QCommonStyle)
       
    88 public:
       
    89     inline QCommonStylePrivate()
       
    90 #ifndef QT_NO_ITEMVIEWS
       
    91     : cachedOption(0)
       
    92 #endif
       
    93     { }
       
    94 
       
    95 #ifndef QT_NO_ITEMVIEWS
       
    96     ~QCommonStylePrivate()
       
    97     {
       
    98         delete cachedOption;
       
    99     }
       
   100     void viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const;
       
   101     void viewItemLayout(const QStyleOptionViewItemV4 *opt,  QRect *checkRect,
       
   102                         QRect *pixmapRect, QRect *textRect, bool sizehint) const;
       
   103     QSize viewItemSize(const QStyleOptionViewItemV4 *option, int role) const;
       
   104 
       
   105     mutable QRect decorationRect, displayRect, checkRect;
       
   106     mutable QStyleOptionViewItemV4 *cachedOption;
       
   107     bool isViewItemCached(const QStyleOptionViewItemV4 &option) const {
       
   108         return cachedOption && (option.rect == cachedOption->rect
       
   109                && option.direction == cachedOption->direction
       
   110                && option.state == cachedOption->state
       
   111                && option.displayAlignment == cachedOption->displayAlignment
       
   112                && option.decorationAlignment == cachedOption->decorationAlignment
       
   113                && option.decorationPosition == cachedOption->decorationPosition
       
   114                && option.decorationSize == cachedOption->decorationSize
       
   115                && option.font == cachedOption->font
       
   116                && option.features == cachedOption->features
       
   117                && option.widget == cachedOption->widget
       
   118                && option.index == cachedOption->index
       
   119                && option.icon.isNull() == cachedOption->icon.isNull()
       
   120                && option.text == cachedOption->text
       
   121                && option.viewItemPosition == cachedOption->viewItemPosition);
       
   122     }
       
   123 #endif
       
   124     mutable QIcon tabBarcloseButtonIcon;
       
   125 #ifndef QT_NO_TABBAR
       
   126     void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const;
       
   127 #endif
       
   128 };
       
   129 
       
   130 QT_END_NAMESPACE
       
   131 
       
   132 #endif //QCOMMONSTYLE_P_H