1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
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
|
---|