QtGui/qdrawutil.h Source File

qdrawutil.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 QDRAWUTIL_H
43 #define QDRAWUTIL_H
44 
45 #include <QtCore/qnamespace.h>
46 #include <QtCore/qstring.h> // char*->QString conversion
47 #include <QtCore/qmargins.h>
48 #include <QtGui/qpixmap.h>
50 
52 
53 QT_MODULE(Gui)
54 
55 class QPainter;
56 #ifndef QT3_SUPPORT
57 class QColorGroup;
58 #endif
59 class QPalette;
60 class QPoint;
61 class QColor;
62 class QBrush;
63 class QRect;
64 
65 //
66 // Standard shade drawing
67 //
68 
69 Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
70  const QPalette &pal, bool sunken = true,
71  int lineWidth = 1, int midLineWidth = 0);
72 
73 Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
74  const QPalette &pal, bool sunken = true,
75  int lineWidth = 1, int midLineWidth = 0);
76 
77 Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
78  const QPalette &pal, bool sunken = false,
79  int lineWidth = 1, int midLineWidth = 0,
80  const QBrush *fill = 0);
81 
82 Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r,
83  const QPalette &pal, bool sunken = false,
84  int lineWidth = 1, int midLineWidth = 0,
85  const QBrush *fill = 0);
86 
87 Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
88  const QPalette &pal, bool sunken = false,
89  int lineWidth = 1, const QBrush *fill = 0);
90 
91 Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r,
92  const QPalette &pal, bool sunken = false,
93  int lineWidth = 1, const QBrush *fill = 0);
94 
95 Q_GUI_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
96  const QPalette &pal, bool sunken = false,
97  const QBrush *fill = 0);
98 
99 Q_GUI_EXPORT void qDrawWinButton(QPainter *p, const QRect &r,
100  const QPalette &pal, bool sunken = false,
101  const QBrush *fill = 0);
102 
103 Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
104  const QPalette &pal, bool sunken = false,
105  const QBrush *fill = 0);
106 
107 Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r,
108  const QPalette &pal, bool sunken = false,
109  const QBrush *fill = 0);
110 
111 Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
112  int lineWidth = 1, const QBrush *fill = 0);
113 
114 Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
115  int lineWidth = 1, const QBrush *fill = 0);
116 
117 
118 #ifdef QT3_SUPPORT
119 //
120 // Use QStyle::itemRect(), QStyle::drawItem() and QStyle::drawArrow() instead.
121 //
122 Q_GUI_EXPORT QT3_SUPPORT QRect qItemRect(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
123  int flags, bool enabled,
124  const QPixmap *pixmap, const QString& text, int len=-1);
125 
126 Q_GUI_EXPORT QT3_SUPPORT void qDrawItem(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
127  int flags, const QPalette &pal, bool enabled,
128  const QPixmap *pixmap, const QString& text,
129  int len=-1, const QColor* penColor = 0);
130 
131 Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down,
132  int x, int y, int w, int h,
133  const QPalette &pal, bool enabled);
134 #endif
135 
137 {
138  inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
139  : horizontal(horizontalRule), vertical(verticalRule) {}
141  : horizontal(rule), vertical(rule) {}
144 };
145 
146 #ifndef Q_QDOC
147 // For internal use only.
149 {
151  {
152  OpaqueTopLeft = 0x0001,
153  OpaqueTop = 0x0002,
154  OpaqueTopRight = 0x0004,
155  OpaqueLeft = 0x0008,
156  OpaqueCenter = 0x0010,
157  OpaqueRight = 0x0020,
159  OpaqueBottom = 0x0080,
165  };
166 
167  Q_DECLARE_FLAGS(DrawingHints, DrawingHint)
168 }
169 #endif
170 
171 Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter,
172  const QRect &targetRect,
173  const QMargins &targetMargins,
174  const QPixmap &pixmap,
175  const QRect &sourceRect,
176  const QMargins &sourceMargins,
177  const QTileRules &rules = QTileRules()
178 #ifndef Q_QDOC
179  , QDrawBorderPixmap::DrawingHints hints = 0
180 #endif
181  );
182 
183 inline void qDrawBorderPixmap(QPainter *painter,
184  const QRect &target,
185  const QMargins &margins,
186  const QPixmap &pixmap)
187 {
188  qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
189 }
190 
192 
194 
195 #endif // QDRAWUTIL_H
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
GLdouble GLdouble GLdouble r
Definition: GLee.h:1189
GLenum GLint GLint y
Definition: GLee.h:876
ArrowType
Definition: qnamespace.h:1126
#define QT_END_NAMESPACE
Definition: qglobal.h:128
QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
Definition: qdrawutil.h:138
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
GLXFBConfig Pixmap pixmap
Definition: GLee.h:10237
Definition: qcolor.h:67
Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, const QBrush *fill=0)
Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, int lineWidth=1, int midLineWidth=0, const QBrush *fill=0)
Definition: qpoint.h:53
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
GLenum GLint x
Definition: GLee.h:876
Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, const QRect &sourceRect, const QMargins &sourceMargins, const QTileRules &rules=QTileRules(), QDrawBorderPixmap::DrawingHints hints=0)
Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth=1, const QBrush *fill=0)
Definition: qrect.h:58
GLfloat GLfloat p
Definition: GLee.h:5416
Qt::TileRule vertical
Definition: qdrawutil.h:143
int int int int int int h
Definition: GLee.h:10534
QRect rect() const
QTileRules(Qt::TileRule rule=Qt::StretchTile)
Definition: qdrawutil.h:140
Definition: qbrush.h:76
Qt::TileRule horizontal
Definition: qdrawutil.h:142
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
GLenum GLsizei len
Definition: GLee.h:2695
Q_GUI_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
#define QT_END_HEADER
Definition: qglobal.h:142
Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken=true, int lineWidth=1, int midLineWidth=0)
TileRule
Definition: qnamespace.h:198