Changeset 561 for trunk/src/gui/styles/qgtkpainter.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/styles/qgtkpainter.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 109 109 QRect pixmapRect(0, 0, rect.width(), rect.height()); \ 110 110 { \ 111 GdkPixmap *pixmap = QGtk ::gdk_pixmap_new((GdkDrawable*)(m_window->window), \111 GdkPixmap *pixmap = QGtk::gdk_pixmap_new((GdkDrawable*)(m_window->window), \ 112 112 rect.width(), rect.height(), -1); \ 113 113 if (!pixmap) \ 114 114 return; \ 115 style = QGtk ::gtk_style_attach (style, m_window->window); \116 QGtk ::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true, \115 style = QGtk::gtk_style_attach (style, m_window->window); \ 116 QGtk::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true, \ 117 117 0, 0, rect.width(), rect.height()); \ 118 118 draw_func; \ 119 GdkPixbuf *imgb = QGtk ::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\119 GdkPixbuf *imgb = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\ 120 120 if (!imgb) \ 121 121 return; \ 122 imgb = QGtk ::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \122 imgb = QGtk::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \ 123 123 rect.width(), rect.height()); \ 124 uchar* bdata = (uchar*)QGtk ::gdk_pixbuf_get_pixels(imgb); \124 uchar* bdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgb); \ 125 125 if (m_alpha) { \ 126 QGtk ::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height()); \126 QGtk::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height()); \ 127 127 draw_func; \ 128 GdkPixbuf *imgw = QGtk ::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect. \128 GdkPixbuf *imgw = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect. \ 129 129 width(), rect.height()); \ 130 130 if (!imgw) \ 131 131 return; \ 132 imgw = QGtk ::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0, \132 imgw = QGtk::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0, \ 133 133 rect.width(), rect.height()); \ 134 uchar* wdata = (uchar*)QGtk ::gdk_pixbuf_get_pixels(imgw); \134 uchar* wdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgw); \ 135 135 cache = renderTheme(bdata, wdata, rect); \ 136 QGtk ::gdk_pixbuf_unref(imgw); \136 QGtk::gdk_pixbuf_unref(imgw); \ 137 137 } else { \ 138 138 cache = renderTheme(bdata, 0, rect); \ 139 139 } \ 140 QGtk ::gdk_drawable_unref(pixmap); \141 QGtk ::gdk_pixbuf_unref(imgb); \140 QGtk::gdk_drawable_unref(pixmap); \ 141 QGtk::gdk_pixbuf_unref(imgb); \ 142 142 } 143 143 144 144 QGtkPainter::QGtkPainter(QPainter *_painter) 145 : m_window(QGtk ::gtkWidget(QLatin1String("GtkWindow")))145 : m_window(QGtk::gtkWidget(QLatin1String("GtkWindow"))) 146 146 , m_painter(_painter) 147 147 , m_alpha(true) … … 186 186 QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size) 187 187 { 188 GtkStyle *style = QGtk ::gtkStyle();189 GtkIconSet* iconSet = QGtk ::gtk_icon_factory_lookup_default (iconName);190 GdkPixbuf* icon = QGtk ::gtk_icon_set_render_icon(iconSet,188 GtkStyle *style = QGtk::gtkStyle(); 189 GtkIconSet* iconSet = QGtk::gtk_icon_factory_lookup_default (iconName); 190 GdkPixbuf* icon = QGtk::gtk_icon_set_render_icon(iconSet, 191 191 style, 192 192 GTK_TEXT_DIR_LTR, … … 195 195 NULL, 196 196 "button"); 197 uchar* data = (uchar*)QGtk ::gdk_pixbuf_get_pixels(icon);198 int width = QGtk ::gdk_pixbuf_get_width(icon);199 int height = QGtk ::gdk_pixbuf_get_height(icon);197 uchar* data = (uchar*)QGtk::gdk_pixbuf_get_pixels(icon); 198 int width = QGtk::gdk_pixbuf_get_width(icon); 199 int height = QGtk::gdk_pixbuf_get_height(icon); 200 200 QImage converted(width, height, QImage::Format_ARGB32); 201 201 uchar* tdata = (uchar*)converted.bits(); … … 209 209 } 210 210 211 QGtk ::gdk_pixbuf_unref(icon);211 QGtk::gdk_pixbuf_unref(icon); 212 212 213 213 // should we free iconset? … … 241 241 242 242 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 243 DRAW_TO_CACHE(QGtk ::gtk_paint_box_gap (style,243 DRAW_TO_CACHE(QGtk::gtk_paint_box_gap (style, 244 244 pixmap, 245 245 state, … … 306 306 307 307 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 308 DRAW_TO_CACHE(QGtk ::gtk_paint_box (style,308 DRAW_TO_CACHE(QGtk::gtk_paint_box (style, 309 309 pixmap, 310 310 state, … … 357 357 + hLineExtras + pmKey; 358 358 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 359 DRAW_TO_CACHE(QGtk ::gtk_paint_hline (style,359 DRAW_TO_CACHE(QGtk::gtk_paint_hline (style, 360 360 pixmap, 361 361 state, … … 384 384 gtkWidget) + vLineExtras +pmKey; 385 385 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 386 DRAW_TO_CACHE(QGtk ::gtk_paint_vline (style,386 DRAW_TO_CACHE(QGtk::gtk_paint_vline (style, 387 387 pixmap, 388 388 state, … … 411 411 gtkWidget) + QString::number(expander_state) + pmKey; 412 412 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 413 DRAW_TO_CACHE(QGtk ::gtk_paint_expander (style, pixmap,413 DRAW_TO_CACHE(QGtk::gtk_paint_expander (style, pixmap, 414 414 state, NULL, 415 415 gtkWidget, part, … … 434 434 QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + pmKey; 435 435 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 436 DRAW_TO_CACHE(QGtk ::gtk_paint_focus (style, pixmap, state, NULL,436 DRAW_TO_CACHE(QGtk::gtk_paint_focus (style, pixmap, state, NULL, 437 437 gtkWidget, 438 438 part, … … 459 459 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; 460 460 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 461 DRAW_TO_CACHE(QGtk ::gtk_paint_resize_grip (style, pixmap, state,461 DRAW_TO_CACHE(QGtk::gtk_paint_resize_grip (style, pixmap, state, 462 462 NULL, gtkWidget, 463 463 part, edge, 0, 0, … … 489 489 int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0; 490 490 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 491 DRAW_TO_CACHE(QGtk ::gtk_paint_arrow (style, pixmap, state, shadow,491 DRAW_TO_CACHE(QGtk::gtk_paint_arrow (style, pixmap, state, shadow, 492 492 >kCliprect, 493 493 gtkWidget, … … 516 516 + QString::number(orientation); 517 517 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 518 DRAW_TO_CACHE(QGtk ::gtk_paint_handle (style,518 DRAW_TO_CACHE(QGtk::gtk_paint_handle (style, 519 519 pixmap, 520 520 state, … … 544 544 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; 545 545 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 546 DRAW_TO_CACHE(QGtk ::gtk_paint_slider (style,546 DRAW_TO_CACHE(QGtk::gtk_paint_slider (style, 547 547 pixmap, 548 548 state, … … 575 575 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; 576 576 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 577 DRAW_TO_CACHE(QGtk ::gtk_paint_shadow(style, pixmap, state, shadow, NULL,577 DRAW_TO_CACHE(QGtk::gtk_paint_shadow(style, pixmap, state, shadow, NULL, 578 578 gtkWidget, part, 0, 0, rect.width(), rect.height())); 579 579 if (m_usePixmapCache) … … 594 594 QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; 595 595 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 596 DRAW_TO_CACHE(QGtk ::gtk_paint_flat_box (style,596 DRAW_TO_CACHE(QGtk::gtk_paint_flat_box (style, 597 597 pixmap, 598 598 state, … … 623 623 624 624 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 625 DRAW_TO_CACHE(QGtk ::gtk_paint_extension (style, pixmap, state, shadow,625 DRAW_TO_CACHE(QGtk::gtk_paint_extension (style, pixmap, state, shadow, 626 626 NULL, gtkWidget, 627 627 (gchar*)part, 0, 0, … … 652 652 int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0; 653 653 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 654 DRAW_TO_CACHE(QGtk ::gtk_paint_option(style, pixmap,654 DRAW_TO_CACHE(QGtk::gtk_paint_option(style, pixmap, 655 655 state, shadow, 656 656 >kCliprect, … … 684 684 int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0; 685 685 if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { 686 DRAW_TO_CACHE(QGtk ::gtk_paint_check (style,686 DRAW_TO_CACHE(QGtk::gtk_paint_check (style, 687 687 pixmap, 688 688 state,
Note:
See TracChangeset
for help on using the changeset viewer.