summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawutil.h
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-04-29 15:55:57 (GMT)
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-04-29 16:01:12 (GMT)
commit65e0d7c3b63fc4c1d7df7603b926ca013794b321 (patch)
tree80bdffda10fcc2f6bc06b137ad10667c04be2691 /src/gui/painting/qdrawutil.h
parentfa80385e0082fa9012ec08134a381e29b020c48f (diff)
downloadQt-65e0d7c3b63fc4c1d7df7603b926ca013794b321.zip
Qt-65e0d7c3b63fc4c1d7df7603b926ca013794b321.tar.gz
Qt-65e0d7c3b63fc4c1d7df7603b926ca013794b321.tar.bz2
Add qDrawBorderPixmap() function, Qt::TileRules enum, QMargins struct and QTileRules struct.
Implements a function to allow drawing CSS3-like border-images (also known as nine-grid images). Next step will be to convert the CSS-style code to use this function for drawing border-images. Task-number: none Reviewed-by: jbache
Diffstat (limited to 'src/gui/painting/qdrawutil.h')
-rw-r--r--src/gui/painting/qdrawutil.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 14901f3..08fa1ab 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -133,6 +133,42 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU
const QPalette &pal, bool enabled);
#endif
+struct Q_GUI_EXPORT QMargins
+{
+ inline QMargins(int margin = 0)
+ : top(margin),
+ left(margin),
+ bottom(margin),
+ right(margin) {}
+ inline QMargins(int topMargin, int leftMargin, int bottomMargin, int rightMargin)
+ : top(topMargin),
+ left(leftMargin),
+ bottom(bottomMargin),
+ right(rightMargin) {}
+ int top;
+ int left;
+ int bottom;
+ int right;
+};
+
+struct Q_GUI_EXPORT QTileRules
+{
+ inline QTileRules(Qt::TileRule horizontalRule = Qt::Stretch,
+ Qt::TileRule verticalRule = Qt::Stretch)
+ : horizontal(horizontalRule),
+ vertical(verticalRule) {}
+ Qt::TileRule horizontal;
+ Qt::TileRule vertical;
+};
+
+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());
+
+Q_GUI_EXPORT inline void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
+{
+ qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
+}
+
QT_END_NAMESPACE
QT_END_HEADER