Qt 4.8
qgtkpainter_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
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 <QtGui/QCleanlooksStyle>
60 #include <QtGui/QPainter>
61 #include <QtGui/QPalette>
62 #include <QtGui/QFont>
63 #include <private/qgtkstyle_p.h>
64 
66 
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;
117  bool m_alpha;
122 
123 };
124 
126 
127 #endif
128 
129 #endif // QGTKPAINTER_H
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
static int pmKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
void setClipRect(const QRect &rect)
Definition: qgtkpainter_p.h:76
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail)
void paintExpander(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey=QString())
void paintFocus(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, const QString &pmKey=QString())
void paintShadow(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &pmKey=QString())
void paintHandle(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style)
void paintFlatBox(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &=QString())
void paintArrow(GtkWidget *gtkWidget, const gchar *part, const QRect &arrowrect, GtkArrowType arrow_type, GtkStateType state, GtkShadowType shadow, gboolean fill, GtkStyle *style, const QString &pmKey=QString())
QPainter * m_painter
static QPixmap getIcon(const char *iconName, GtkIconSize size=GTK_ICON_SIZE_BUTTON)
void paintResizeGrip(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GdkWindowEdge edge, GtkStyle *style, const QString &pmKey=QString())
The QString class provides a Unicode character string.
Definition: qstring.h:83
void setFlipHorizontal(bool value)
Definition: qgtkpainter_p.h:77
GtkStateType gtkState(const QStyleOption *option)
void paintSlider(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, GtkOrientation orientation, const QString &pmKey=QString())
void paintBox(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &pmKey=QString())
void paintExtention(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkPositionType gap_pos, GtkStyle *style)
void setUsePixmapCache(bool value)
Definition: qgtkpainter_p.h:79
void setFlipVertical(bool value)
Definition: qgtkpainter_p.h:78
unsigned char uchar
Definition: qglobal.h:994
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail)
GtkStyle * getStyle(GtkWidget *gtkWidget)
void setAlphaSupport(bool value)
Definition: qgtkpainter_p.h:75
QPixmap renderTheme(uchar *bdata, uchar *wdata, const QRect &)
Definition: qgtkpainter.cpp:79
void paintHline(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, int x1, int x2, int y, const QString &pmKey=QString())
QRect m_cliprect
bool m_usePixmapCache
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QGtkPainter(QPainter *painter)
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
GtkWidget * m_window
void paintVline(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, int y1, int y2, int x, const QString &pmKey=QString())
void paintBoxGap(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkPositionType gap_side, gint x, gint width, GtkStyle *style)