src/gui/styles/qgtkpainter_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 QGTKPAINTER_H
       
    43 #define QGTKPAINTER_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include <QtCore/qglobal.h>
       
    57 #if !defined(QT_NO_STYLE_GTK)
       
    58 
       
    59 #include "gtksymbols_p.h"
       
    60 #include <QtGui/QCleanlooksStyle>
       
    61 #include <QtGui/QPainter>
       
    62 #include <QtGui/QPalette>
       
    63 #include <QtGui/QFont>
       
    64 
       
    65 QT_BEGIN_NAMESPACE
       
    66 
       
    67 class QGtkPainter
       
    68 {
       
    69 
       
    70 public:
       
    71     QGtkPainter(QPainter *painter);
       
    72     GtkStyle *getStyle(GtkWidget *gtkWidget);
       
    73     GtkStateType gtkState(const QStyleOption *option);
       
    74 
       
    75     void setAlphaSupport(bool value) { m_alpha = value; }
       
    76     void setClipRect(const QRect &rect) { m_cliprect = rect; }
       
    77     void setFlipHorizontal(bool value) { m_hflipped = value; }
       
    78     void setFlipVertical(bool value) { m_vflipped = value; }
       
    79     void setUsePixmapCache(bool value) { m_usePixmapCache = value; }
       
    80 
       
    81     void paintBoxGap(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
       
    82                      GtkStateType state, GtkShadowType shadow, GtkPositionType gap_side, gint x,
       
    83                      gint width, GtkStyle *style);
       
    84     void paintBox(GtkWidget *gtkWidget, const gchar* part,
       
    85                   const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style,
       
    86                   const QString &pmKey = QString());
       
    87     void paintHline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
       
    88                     int x1, int x2, int y, const QString &pmKey = QString());
       
    89     void paintVline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
       
    90                     int y1, int y2, int x, const QString &pmKey = QString());
       
    91     void paintExpander(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state,
       
    92                        GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey = QString());
       
    93     void paintFocus(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
       
    94                     const QString &pmKey = QString());
       
    95     void paintResizeGrip(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
       
    96                          GdkWindowEdge edge, GtkStyle *style, const QString &pmKey = QString());
       
    97     void paintArrow(GtkWidget *gtkWidget, const gchar* part, const QRect &arrowrect, GtkArrowType arrow_type, GtkStateType state, GtkShadowType shadow,
       
    98                     gboolean fill, GtkStyle *style, const QString &pmKey = QString());
       
    99     void paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
       
   100                      GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style);
       
   101     void paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
       
   102                      GtkStyle *style, GtkOrientation orientation, const QString &pmKey = QString());
       
   103     void paintShadow(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
       
   104                      GtkStyle *style, const QString &pmKey = QString());
       
   105     void paintFlatBox(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString & = QString());
       
   106     void paintExtention(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
       
   107                         GtkPositionType gap_pos, GtkStyle *style);
       
   108     void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
       
   109     void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
       
   110 
       
   111     static QPixmap getIcon(const char* iconName, GtkIconSize size = GTK_ICON_SIZE_BUTTON);
       
   112 private:
       
   113     QPixmap renderTheme(uchar *bdata, uchar *wdata, const QRect&);
       
   114 
       
   115     GtkWidget *m_window;
       
   116     QPainter *m_painter;
       
   117     bool m_alpha;
       
   118     bool m_hflipped;
       
   119     bool m_vflipped;
       
   120     bool m_usePixmapCache;
       
   121     QRect m_cliprect;
       
   122 
       
   123 };
       
   124 
       
   125 QT_END_NAMESPACE
       
   126 
       
   127 #endif //!defined(QT_NO_STYLE_QGTK)
       
   128 
       
   129 #endif // QGTKPAINTER_H