Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qdrawutil.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QDRAWUTIL_H
0005 #define QDRAWUTIL_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qnamespace.h>
0009 #include <QtCore/qstring.h> // char*->QString conversion
0010 #include <QtCore/qmargins.h>
0011 #include <QtGui/qpixmap.h>
0012 QT_BEGIN_NAMESPACE
0013 
0014 
0015 class QPainter;
0016 class QPalette;
0017 class QPoint;
0018 class QColor;
0019 class QBrush;
0020 class QRect;
0021 
0022 //
0023 // Standard shade drawing
0024 //
0025 
0026 Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
0027                               const QPalette &pal, bool sunken = true,
0028                               int lineWidth = 1, int midLineWidth = 0);
0029 
0030 Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
0031                               const QPalette &pal, bool sunken = true,
0032                               int lineWidth = 1, int midLineWidth = 0);
0033 
0034 Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
0035                               const QPalette &pal, bool sunken = false,
0036                               int lineWidth = 1, int midLineWidth = 0,
0037                               const QBrush *fill = nullptr);
0038 
0039 Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r,
0040                               const QPalette &pal, bool sunken = false,
0041                               int lineWidth = 1, int midLineWidth = 0,
0042                               const QBrush *fill = nullptr);
0043 
0044 Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
0045                                const QPalette &pal, bool sunken = false,
0046                                int lineWidth = 1, const QBrush *fill = nullptr);
0047 
0048 Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r,
0049                                const QPalette &pal, bool sunken = false,
0050                                int lineWidth = 1, const QBrush *fill = nullptr);
0051 
0052 Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
0053                               const QPalette &pal, bool sunken = false,
0054                               const QBrush *fill = nullptr);
0055 
0056 Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r,
0057                               const QPalette &pal, bool sunken = false,
0058                               const QBrush *fill = nullptr);
0059 
0060 Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
0061                               const QPalette &pal, bool sunken = false,
0062                              const QBrush *fill = nullptr);
0063 
0064 Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r,
0065                               const QPalette &pal, bool sunken = false,
0066                              const QBrush *fill = nullptr);
0067 
0068 Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
0069                               int lineWidth = 1, const QBrush *fill = nullptr);
0070 
0071 Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
0072                               int lineWidth = 1, const QBrush *fill = nullptr);
0073 
0074 Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h,
0075                               qreal rx, qreal ry, const QColor &, int lineWidth = 1,
0076                               const QBrush *fill = nullptr);
0077 
0078 inline void qDrawPlainRoundedRect(QPainter *painter, const QRect& rect, qreal rx, qreal ry,
0079                                   const QColor &lineColor, int lineWidth = 1,
0080                                   const QBrush *fill = nullptr)
0081 {
0082     qDrawPlainRoundedRect(painter, rect.x(), rect.y(), rect.width(), rect.height(),
0083                           rx, ry, lineColor, lineWidth, fill);
0084 }
0085 
0086 
0087 struct QTileRules
0088 {
0089     inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
0090             : horizontal(horizontalRule), vertical(verticalRule) {}
0091     inline QTileRules(Qt::TileRule rule = Qt::StretchTile)
0092             : horizontal(rule), vertical(rule) {}
0093     Qt::TileRule horizontal;
0094     Qt::TileRule vertical;
0095 };
0096 
0097 #ifndef Q_QDOC
0098 // For internal use only.
0099 namespace QDrawBorderPixmap
0100 {
0101     enum DrawingHint
0102     {
0103         OpaqueTopLeft = 0x0001,
0104         OpaqueTop = 0x0002,
0105         OpaqueTopRight = 0x0004,
0106         OpaqueLeft = 0x0008,
0107         OpaqueCenter = 0x0010,
0108         OpaqueRight = 0x0020,
0109         OpaqueBottomLeft = 0x0040,
0110         OpaqueBottom = 0x0080,
0111         OpaqueBottomRight = 0x0100,
0112         OpaqueCorners = OpaqueTopLeft | OpaqueTopRight | OpaqueBottomLeft | OpaqueBottomRight,
0113         OpaqueEdges = OpaqueTop | OpaqueLeft | OpaqueRight | OpaqueBottom,
0114         OpaqueFrame = OpaqueCorners | OpaqueEdges,
0115         OpaqueAll = OpaqueCenter | OpaqueFrame
0116     };
0117 
0118     Q_DECLARE_FLAGS(DrawingHints, DrawingHint)
0119 }
0120 #endif
0121 
0122 Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter,
0123                                     const QRect &targetRect,
0124                                     const QMargins &targetMargins,
0125                                     const QPixmap &pixmap,
0126                                     const QRect &sourceRect,
0127                                     const QMargins &sourceMargins,
0128                                     const QTileRules &rules = QTileRules()
0129 #ifndef Q_QDOC
0130                                     , QDrawBorderPixmap::DrawingHints hints = QDrawBorderPixmap::DrawingHints()
0131 #endif
0132                                     );
0133 
0134 inline void qDrawBorderPixmap(QPainter *painter,
0135                                            const QRect &target,
0136                                            const QMargins &margins,
0137                                            const QPixmap &pixmap)
0138 {
0139     qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
0140 }
0141 
0142 QT_END_NAMESPACE
0143 
0144 #endif // QDRAWUTIL_H