Changeset 846 for trunk/src/gui/styles/qgtkstyle.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/styles/qgtkstyle.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 68 68 #include <QtGui/QCheckBox> 69 69 #include <QtGui/QTreeView> 70 #include <QtGui/QStyledItemDelegate> 70 71 #include <qpixmapcache.h> 71 72 #undef signals // Collides with GTK stymbols … … 223 224 if (d->isThemeAvailable()) { 224 225 GtkStyle *style = d->gtkStyle(); 225 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));226 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 226 227 GtkWidget *gtkEntry = d->getTextColorWidget(); 227 228 GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg; 229 QColor bg, base, text, fg, highlight, highlightText; 228 GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg; 229 QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt; 230 230 gdkBg = style->bg[GTK_STATE_NORMAL]; 231 231 gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL]; … … 237 237 gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED]; 238 238 gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED]; 239 240 // The ACTIVE base color is really used for inactive windows 241 gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE]; 242 gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE]; 243 239 244 bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); 240 245 text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); … … 243 248 highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8); 244 249 highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8); 250 inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8); 251 inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8); 245 252 246 253 palette.setColor(QPalette::HighlightedText, highlightText); 254 255 247 256 palette.setColor(QPalette::Light, bg.lighter(125)); 248 257 palette.setColor(QPalette::Shadow, bg.darker(130)); … … 254 263 255 264 QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box 256 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));265 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 257 266 GdkColor *gtkAltBase = NULL; 258 267 d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); … … 279 288 palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight); 280 289 palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText); 290 291 palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt); 292 palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight); 293 281 294 style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", 282 295 d->gtk_window_get_type()); … … 326 339 qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames; 327 340 qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory; 341 qApp->installEventFilter(&d->filter); 328 342 } 329 343 } … … 346 360 qt_filedialog_open_filenames_hook = 0; 347 361 qt_filedialog_existing_directory_hook = 0; 362 qApp->removeEventFilter(&d->filter); 348 363 } 349 364 } … … 422 437 423 438 case PM_ButtonShiftHorizontal: { 424 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));439 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 425 440 guint horizontal_shift; 426 441 d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); … … 429 444 430 445 case PM_ButtonShiftVertical: { 431 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));446 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 432 447 guint vertical_shift; 433 448 d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); … … 439 454 440 455 case PM_MenuPanelWidth: { 441 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));456 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 442 457 guint horizontal_padding = 0; 443 458 // horizontal-padding is used by Maemo to get thicker borders … … 496 511 case PM_SliderThickness: 497 512 case PM_SliderControlThickness: { 498 GtkWidget *gtkScale = d->gtkWidget( QLS("GtkHScale"));513 GtkWidget *gtkScale = d->gtkWidget("GtkHScale"); 499 514 gint val; 500 515 d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); … … 507 522 gint sliderLength; 508 523 gint trough_border; 509 GtkWidget *hScrollbar = d->gtkWidget( QLS("GtkHScrollbar"));524 GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar"); 510 525 d->gtk_widget_style_get(hScrollbar, 511 526 "trough-border", &trough_border, … … 520 535 case PM_SliderLength: 521 536 gint val; 522 d->gtk_widget_style_get(d->gtkWidget( QLS("GtkHScale")), "slider-length", &val, NULL);537 d->gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); 523 538 return val; 524 539 … … 527 542 case PM_IndicatorWidth: 528 543 case PM_IndicatorHeight: { 529 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));544 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 530 545 gint size, spacing; 531 546 d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); … … 534 549 535 550 case PM_MenuBarVMargin: { 536 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));551 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 537 552 return qMax(0, gtkMenubar->style->ythickness); 538 553 } … … 540 555 { 541 556 gint spacing = 3; 542 GtkWidget *gtkScrollWindow = d->gtkWidget( QLS("GtkScrolledWindow"));557 GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); 543 558 Q_ASSERT(gtkScrollWindow); 544 559 d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); … … 547 562 case PM_SubMenuOverlap: { 548 563 gint offset = 0; 549 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));564 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 550 565 d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); 551 566 return offset; … … 588 603 if (d->isKDE4Session()) 589 604 return QCleanlooksStyle::styleHint(hint, option, widget, returnData); 590 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));605 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 591 606 GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; 592 607 g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL); … … 611 626 612 627 case SH_ComboBox_Popup: { 613 GtkWidget *gtkComboBox = d->gtkWidget( QLS("GtkComboBox"));628 GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox"); 614 629 gboolean appears_as_list; 615 630 d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); … … 635 650 scrollbars_within_bevel = true; 636 651 else if (!d->gtk_check_version(2, 12, 0)) { 637 GtkWidget *gtkScrollWindow = d->gtkWidget( QLS("GtkScrolledWindow"));652 GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); 638 653 d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); 639 654 } … … 691 706 const int pmSize = 64; 692 707 const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); 693 const QString pmKey = Q String(QLS("windowframe %0")).arg(option->state);708 const QString pmKey = QLatin1Literal("windowframe") % HexString<uint>(option->state); 694 709 695 710 QPixmap pixmap; … … 713 728 "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); 714 729 if (style) 715 gtkFramePainter.paintShadow(d->gtkWidget( QLS("GtkFrame")), "viewport", pmRect,730 gtkFramePainter.paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, 716 731 option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 717 732 shadow_type, style); … … 740 755 741 756 case PE_PanelTipLabel: { 742 GtkWidget *gtkWindow = d->gtkWidget( QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed757 GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed 743 758 style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", 744 759 d->gtk_window_get_type()); … … 755 770 } 756 771 GtkShadowType shadow_type; 757 GtkWidget *gtkStatusbarFrame = d->gtkWidget( QLS("GtkStatusbar.GtkFrame"));772 GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); 758 773 d->gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL); 759 774 gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, … … 764 779 case PE_IndicatorHeaderArrow: 765 780 if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { 766 GtkWidget *gtkTreeHeader = d->gtkWidget( QLS("GtkTreeView.GtkButton"));781 GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton"); 767 782 GtkStateType state = gtkPainter.gtkState(option); 768 783 style = gtkTreeHeader->style; … … 770 785 QRect r = header->rect; 771 786 QImage arrow; 787 // This sorting indicator inversion is intentional, and follows the GNOME HIG. 788 // See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable 772 789 if (header->sortIndicator & QStyleOptionHeader::SortUp) 773 790 type = GTK_ARROW_UP; … … 787 804 QRect frameRect = option->rect.adjusted(1, 1, -1, -2); 788 805 789 if (qobject_cast<const QTabBar*>(widget)) 790 frameRect.adjust(-1, 1, 1, 1); 791 792 gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); 806 if (qobject_cast<const QTabBar*>(widget)) { 807 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 808 style = gtkPainter.getStyle(gtkNotebook); 809 gtkPainter.paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style); 810 } else { 811 gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style); 812 } 793 813 } 794 814 break; … … 802 822 GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; 803 823 GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; 804 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));824 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 805 825 806 826 GtkStateType state = GTK_STATE_NORMAL; … … 814 834 } 815 835 break; 836 837 case PE_PanelItemViewRow: 838 // This primitive is only used to draw selection behind selected expander arrows. 839 // We try not to decorate the tree branch background unless you inherit from StyledItemDelegate 840 // The reason for this is that a lot of code that relies on custom item delegates will look odd having 841 // a gradient on the branch but a flat shaded color on the item itself. 842 QCommonStyle::drawPrimitive(element, option, painter, widget); 843 if (!option->state & State_Selected) { 844 break; 845 } else { 846 if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) { 847 if (!qobject_cast<QStyledItemDelegate*>(view->itemDelegate())) 848 break; 849 } 850 } // fall through 851 816 852 case PE_PanelItemViewItem: 817 853 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { 818 if (vopt->state & State_Selected) { 819 QLinearGradient gradient; 820 gradient.setStart(option->rect.left(), option->rect.top()); 821 gradient.setFinalStop(option->rect.left(), option->rect.bottom()); 822 gradient.setColorAt(0, option->palette.highlight().color().lighter(105)); 823 gradient.setColorAt(0.5, option->palette.highlight().color().lighter(101)); 824 gradient.setColorAt(0.51, option->palette.highlight().color().darker(101)); 825 gradient.setColorAt(1, option->palette.highlight().color().darker(105)); 826 painter->fillRect(option->rect, gradient); 827 } else { 828 if (vopt->backgroundBrush.style() != Qt::NoBrush) { 829 QPointF oldBO = painter->brushOrigin(); 830 painter->setBrushOrigin(vopt->rect.topLeft()); 831 painter->fillRect(vopt->rect, vopt->backgroundBrush); 832 painter->setBrushOrigin(oldBO); 854 uint resolve_mask = vopt->palette.resolve(); 855 if (vopt->backgroundBrush.style() != Qt::NoBrush 856 || (resolve_mask & (1 << QPalette::Base))) 857 { 858 QPointF oldBO = painter->brushOrigin(); 859 painter->setBrushOrigin(vopt->rect.topLeft()); 860 painter->fillRect(vopt->rect, vopt->backgroundBrush); 861 painter->setBrushOrigin(oldBO); 862 if (!(option->state & State_Selected)) 863 break; 864 } 865 if (GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView")) { 866 const char *detail = "cell_even_ruled"; 867 if (vopt && vopt->features & QStyleOptionViewItemV2::Alternate) 868 detail = "cell_odd_ruled"; 869 bool isActive = option->state & State_Active; 870 QString key; 871 if (isActive ) { 872 // Required for active/non-active window appearance 873 key = QLS("a"); 874 GTK_WIDGET_SET_FLAGS(gtkTreeView, GTK_HAS_FOCUS); 833 875 } 876 bool isEnabled = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled)); 877 gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect, 878 option->state & State_Selected ? GTK_STATE_SELECTED : 879 isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 880 GTK_SHADOW_OUT, gtkTreeView->style, key); 881 if (isActive ) 882 GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS); 834 883 } 835 884 } … … 838 887 { 839 888 const int margin = 6; 840 GtkWidget *gtkSeparator = d->gtkWidget( QLS("GtkToolbar.GtkSeparatorToolItem"));889 GtkWidget *gtkSeparator = d->gtkWidget("GtkToolbar.GtkSeparatorToolItem"); 841 890 if (option->state & State_Horizontal) { 842 891 const int offset = option->rect.width()/2; … … 858 907 859 908 case PE_IndicatorToolBarHandle: { 860 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));909 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 861 910 GtkShadowType shadow_type; 862 911 d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); … … 906 955 907 956 QColor arrowColor = option->palette.buttonText().color(); 908 GtkWidget *gtkArrow = d->gtkWidget( QLS("GtkArrow"));957 GtkWidget *gtkArrow = d->gtkWidget("GtkArrow"); 909 958 GdkColor color = fromQColor(arrowColor); 910 959 d->gtk_widget_modify_fg (gtkArrow, state, &color); … … 922 971 923 972 case PE_PanelMenu: { 924 GtkWidget *gtkMenu = d->gtkWidget( QLS("GtkMenu"));973 GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); 925 974 gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons 926 975 gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString()); … … 934 983 // This is only used by floating tool bars 935 984 if (qobject_cast<const QToolBar *>(widget)) { 936 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));985 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 937 986 gtkPainter.paintBox( gtkMenubar, "toolbar", option->rect, 938 987 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); … … 943 992 944 993 case PE_FrameLineEdit: { 945 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));994 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 946 995 947 996 … … 977 1026 case PE_PanelLineEdit: 978 1027 if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) { 979 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));1028 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 980 1029 if (panel->lineWidth > 0) 981 1030 proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); … … 995 1044 case PE_FrameTabWidget: 996 1045 if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) { 997 GtkWidget *gtkNotebook = d->gtkWidget( QLS("GtkNotebook"));1046 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 998 1047 style = gtkPainter.getStyle(gtkNotebook); 999 1048 gtkPainter.setAlphaSupport(false); … … 1043 1092 if (option->state & State_On || option->state & State_Sunken) 1044 1093 state = GTK_STATE_ACTIVE; 1045 GtkWidget *gtkButton = d->gtkWidget(isTool ? QLS("GtkToolButton.GtkButton") : QLS("GtkButton"));1094 GtkWidget *gtkButton = isTool ? d->gtkWidget("GtkToolButton.GtkButton") : d->gtkWidget("GtkButton"); 1046 1095 gint focusWidth, focusPad; 1047 1096 gboolean interiorFocus = false; … … 1099 1148 shadow = GTK_SHADOW_OUT; 1100 1149 1101 GtkWidget *gtkRadioButton = d->gtkWidget( QLS("GtkRadioButton"));1150 GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); 1102 1151 gint spacing; 1103 1152 d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); … … 1106 1155 // ### Note: Ubuntulooks breaks when the proper widget is passed 1107 1156 // Murrine engine requires a widget not to get RGBA check - warnings 1108 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1157 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1109 1158 QString key(QLS("radiobutton")); 1110 1159 if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag … … 1134 1183 int spacing; 1135 1184 1136 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1185 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1137 1186 QString key(QLS("checkbutton")); 1138 1187 if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag … … 1162 1211 = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) { 1163 1212 QRect tabRect = tbb->rect; 1164 QRegion region(tabRect);1165 1213 painter->save(); 1166 1214 painter->setPen(QPen(option->palette.dark().color().dark(110), 0)); … … 1244 1292 alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline); 1245 1293 1246 QPalette palette = option->palette;1247 1248 1294 switch (control) { 1249 1295 … … 1276 1322 if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { 1277 1323 // Draw prelight background 1278 GtkWidget *gtkCheckButton = d->gtkWidget( QLS("GtkCheckButton"));1324 GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); 1279 1325 1280 1326 if (option->state & State_MouseOver) { … … 1332 1378 bool isEnabled = (comboBox->state & State_Enabled); 1333 1379 bool focus = isEnabled && (comboBox->state & State_HasFocus); 1334 QColor buttonShadow = option->palette.dark().color();1335 1380 GtkStateType state = gtkPainter.gtkState(option); 1336 1381 int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); 1337 QPixmap cache;1338 QString pixmapName;1339 1382 QStyleOptionComboBox comboBoxCopy = *comboBox; 1340 1383 comboBoxCopy.rect = option->rect; … … 1344 1387 QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, 1345 1388 SC_ComboBoxArrow, widget); 1346 QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,1347 SC_ComboBoxEditField, widget);1348 1389 1349 1390 GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? 1350 1391 GTK_SHADOW_IN : GTK_SHADOW_OUT; 1351 QString comboBoxPath = QLS(comboBox->editable ? "GtkComboBoxEntry" :"GtkComboBox");1392 const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox"); 1352 1393 1353 1394 // We use the gtk widget to position arrows and separators for us … … 1357 1398 d->gtk_widget_size_allocate(gtkCombo, &geometry); 1358 1399 1359 QString buttonPath = comboBoxPath + QLS(".GtkToggleButton"); 1400 QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") 1401 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); 1360 1402 GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); 1361 1403 d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); … … 1366 1408 if (comboBox->editable || appears_as_list) { 1367 1409 GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; 1368 Q String entryPath = QLS(comboBox->editable ? "GtkComboBoxEntry.GtkEntry" :"GtkComboBox.GtkFrame");1410 QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); 1369 1411 GtkWidget *gtkEntry = d->gtkWidget(entryPath); 1370 1412 d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); … … 1392 1434 gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, 1393 1435 option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 1394 GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus));1436 GTK_SHADOW_NONE, gtkEntry->style, entryPath.toString() + QString::number(focus)); 1395 1437 } 1396 1438 1397 1439 gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, 1398 GTK_SHADOW_IN, gtkEntry->style, entryPath +1440 GTK_SHADOW_IN, gtkEntry->style, entryPath.toString() + 1399 1441 QString::number(focus) + QString::number(comboBox->editable) + 1400 1442 QString::number(option->direction)); … … 1412 1454 buttonState = GTK_STATE_PRELIGHT; 1413 1455 1414 QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y,1415 gtkToggleButton->allocation.width, gtkToggleButton->allocation.height);1416 1417 1456 Q_ASSERT(gtkToggleButton); 1418 1457 gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState, 1419 shadow, gtkToggleButton->style, buttonPath +1458 shadow, gtkToggleButton->style, buttonPath.toString() + 1420 1459 QString::number(focus) + QString::number(option->direction)); 1421 1460 if (focus) … … 1430 1469 buttonRect, state, 1431 1470 shadow, gtkToggleButton->style, 1432 buttonPath + QString::number(focus));1471 buttonPath.toString() + QString::number(focus)); 1433 1472 if (focus) 1434 1473 GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS); 1435 1474 1475 1436 1476 // Draw the separator between label and arrows 1437 QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator"); 1477 QHashableLatin1Literal vSeparatorPath = comboBox->editable 1478 ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator") 1479 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator"); 1438 1480 1439 1481 if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) { … … 1445 1487 gtkCachedPainter.paintVline( gtkVSeparator, "vseparator", 1446 1488 vLineRect, state, gtkVSeparator->style, 1447 0, vLineRect.height(), 0, vSeparatorPath );1489 0, vLineRect.height(), 0, vSeparatorPath.toString()); 1448 1490 1449 1491 … … 1470 1512 state = GTK_STATE_NORMAL; 1471 1513 1472 QString arrowPath = comboBoxPath + QLS(appears_as_list ? ".GtkToggleButton.GtkArrow" 1473 : ".GtkToggleButton.GtkHBox.GtkArrow"); 1514 QHashableLatin1Literal arrowPath(""); 1515 if (comboBox->editable) { 1516 if (appears_as_list) 1517 arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); 1518 else 1519 arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow"); 1520 } else { 1521 if (appears_as_list) 1522 arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkArrow"); 1523 else 1524 arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); 1525 } 1474 1526 1475 1527 GtkWidget *gtkArrow = d->gtkWidget(arrowPath); … … 1498 1550 if (sunken) { 1499 1551 int xoff, yoff; 1500 GtkWidget *gtkButton = d->gtkWidget(comboBoxPath + QLS(".GtkToggleButton")); 1552 const QHashableLatin1Literal toggleButtonPath = comboBox->editable 1553 ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") 1554 : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); 1555 1556 GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath); 1501 1557 d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); 1502 1558 d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); … … 1510 1566 gtkCachedPainter.paintArrow( gtkArrow, "arrow", arrowRect, 1511 1567 GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, TRUE, 1512 style, arrowPath + QString::number(option->direction));1568 style, arrowPath.toString() + QString::number(option->direction)); 1513 1569 } 1514 1570 } … … 1571 1627 QStyleOptionToolButton label = *toolbutton; 1572 1628 label.state = bflags; 1573 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkToolButton.GtkButton"));1629 GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); 1574 1630 QPalette pal = toolbutton->palette; 1575 1631 if (option->state & State_Enabled && … … 1606 1662 case CC_ScrollBar: 1607 1663 if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { 1608 GtkWidget *gtkHScrollBar = d->gtkWidget( QLS("GtkHScrollbar"));1609 GtkWidget *gtkVScrollBar = d->gtkWidget( QLS("GtkVScrollbar"));1664 GtkWidget *gtkHScrollBar = d->gtkWidget("GtkHScrollbar"); 1665 GtkWidget *gtkVScrollBar = d->gtkWidget("GtkVScrollbar"); 1610 1666 1611 1667 // Fill background in case the scrollbar is partially transparent … … 1622 1678 gboolean trough_under_steppers = true; 1623 1679 gboolean trough_side_details = false; 1680 gboolean activate_slider = false; 1624 1681 gboolean stepper_size = 14; 1625 1682 gint trough_border = 1; … … 1629 1686 "trough-side-details", &trough_side_details, 1630 1687 "trough-under-steppers", &trough_under_steppers, 1688 "activate-slider", &activate_slider, 1631 1689 "stepper-size", &stepper_size, NULL); 1632 1690 } … … 1674 1732 if (!(option->state & State_Enabled)) 1675 1733 state = GTK_STATE_INSENSITIVE; 1734 else if (activate_slider && 1735 option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider)) 1736 state = GTK_STATE_ACTIVE; 1676 1737 else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider)) 1677 1738 state = GTK_STATE_PRELIGHT; … … 1752 1813 if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 1753 1814 1754 GtkWidget *gtkSpinButton = d->gtkWidget( 1755 spinBox->buttonSymbols == QAbstractSpinBox::NoButtons ? 1756 QLS("GtkEntry") : 1757 QLS("GtkSpinButton")); 1815 GtkWidget *gtkSpinButton = spinBox->buttonSymbols == QAbstractSpinBox::NoButtons 1816 ? d->gtkWidget("GtkEntry") 1817 : d->gtkWidget("GtkSpinButton"); 1758 1818 bool isEnabled = (spinBox->state & State_Enabled); 1759 1819 bool hover = isEnabled && (spinBox->state & State_MouseOver); … … 1907 1967 case CC_Slider: 1908 1968 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { 1909 GtkWidget *hScaleWidget = d->gtkWidget( QLS("GtkHScale"));1910 GtkWidget *vScaleWidget = d->gtkWidget( QLS("GtkVScale"));1969 GtkWidget *hScaleWidget = d->gtkWidget("GtkHScale"); 1970 GtkWidget *vScaleWidget = d->gtkWidget("GtkVScale"); 1911 1971 1912 1972 QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); 1913 1973 QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); 1914 QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);1915 1974 1916 1975 bool horizontal = slider->orientation == Qt::Horizontal; 1917 1976 bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; 1918 1977 bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; 1919 QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight); 1920 1921 QPixmap cache; 1978 1922 1979 QBrush oldBrush = painter->brush(); 1923 1980 QPen oldPen = painter->pen(); … … 1928 1985 highlightAlpha.setAlpha(80); 1929 1986 1987 QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? 1988 GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); 1930 1989 GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget; 1931 1990 style = scaleWidget->style; … … 1961 2020 1962 2021 if (horizontal) { 1963 upperGroove.setLeft(handle.center().x()); 1964 lowerGroove.setRight(handle.center().x()); 2022 if (slider->upsideDown) { 2023 lowerGroove.setLeft(handle.center().x()); 2024 upperGroove.setRight(handle.center().x()); 2025 } else { 2026 upperGroove.setLeft(handle.center().x()); 2027 lowerGroove.setRight(handle.center().x()); 2028 } 1965 2029 } else { 1966 upperGroove.setBottom(handle.center().y()); 1967 lowerGroove.setTop(handle.center().y()); 2030 if (!slider->upsideDown) { 2031 lowerGroove.setBottom(handle.center().y()); 2032 upperGroove.setTop(handle.center().y()); 2033 } else { 2034 upperGroove.setBottom(handle.center().y()); 2035 lowerGroove.setTop(handle.center().y()); 2036 } 1968 2037 } 1969 2038 … … 2098 2167 case CE_ProgressBarLabel: 2099 2168 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2100 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2169 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2101 2170 if (!gtkProgressBar) 2102 2171 return; … … 2201 2270 ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); 2202 2271 2203 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));2272 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 2204 2273 QPalette pal = button->palette; 2205 2274 int labelState = GTK_STATE_INSENSITIVE; … … 2222 2291 2223 2292 // Draw prelight background 2224 GtkWidget *gtkRadioButton = d->gtkWidget( QLS("GtkRadioButton"));2293 GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); 2225 2294 2226 2295 if (option->state & State_MouseOver) { … … 2290 2359 2291 2360 if (!cb->currentText.isEmpty() && !cb->editable) { 2292 GtkWidget *gtkCombo = d->gtkWidget( QLS("GtkComboBox"));2361 GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); 2293 2362 QPalette pal = cb->palette; 2294 2363 int labelState = GTK_STATE_INSENSITIVE; … … 2367 2436 if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { 2368 2437 Q_UNUSED(header); 2369 GtkWidget *gtkTreeView = d->gtkWidget( QLS("GtkTreeView"));2438 GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); 2370 2439 // Get the middle column 2371 2440 GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); … … 2388 2457 2389 2458 case CE_SizeGrip: { 2390 GtkWidget *gtkStatusbar = d->gtkWidget( QLS("GtkStatusbar.GtkFrame"));2459 GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame"); 2391 2460 QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness); 2392 2461 gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, … … 2400 2469 2401 2470 case CE_MenuBarEmptyArea: { 2402 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));2471 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 2403 2472 GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency 2404 2473 painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); … … 2423 2492 2424 2493 if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { 2425 GtkWidget *gtkMenubarItem = d->gtkWidget( QLS("GtkMenuBar.GtkMenuItem"));2426 GtkWidget *gtkMenubar = d->gtkWidget( QLS("GtkMenuBar"));2494 GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem"); 2495 GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); 2427 2496 2428 2497 style = gtkMenubarItem->style; … … 2480 2549 2481 2550 case CE_Splitter: { 2482 GtkWidget *gtkWindow = d->gtkWidget( QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed2551 GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed 2483 2552 gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE, 2484 2553 !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, … … 2500 2569 rect.adjust(0, 0, 1, 0); 2501 2570 2502 GtkWidget *gtkToolbar = d->gtkWidget( QLS("GtkToolbar"));2571 GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); 2503 2572 GtkShadowType shadow_type = GTK_SHADOW_NONE; 2504 2573 d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); … … 2519 2588 const int windowsItemVMargin = 26; // menu item ver text margin 2520 2589 const int windowsRightBorder = 15; // right border on windows 2521 GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem")) :2522 d->gtkWidget( QLS("GtkMenu.GtkMenuItem"));2590 GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget("GtkMenu.GtkCheckMenuItem") : 2591 d->gtkWidget("GtkMenu.GtkMenuItem"); 2523 2592 2524 2593 style = gtkPainter.getStyle(gtkMenuItem); 2525 QColor borderColor = option->palette.background().color().darker(160);2526 2594 QColor shadow = option->palette.dark().color(); 2527 2595 2528 2596 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { 2529 GtkWidget *gtkMenuSeparator = d->gtkWidget( QLS("GtkMenu.GtkSeparatorMenuItem"));2597 GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); 2530 2598 painter->setPen(shadow.lighter(106)); 2531 2599 gboolean wide_separators = 0; … … 2571 2639 2572 2640 gint checkSize; 2573 d->gtk_widget_style_get(d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);2641 d->gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); 2574 2642 2575 2643 int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); … … 2748 2816 // Arrow 2749 2817 if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow 2750 QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),2751 proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));2752 2818 2753 2819 QFontMetrics fm(menuitem->font); … … 2782 2848 case CE_PushButton: 2783 2849 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { 2784 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));2850 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 2785 2851 proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); 2786 2852 QStyleOptionButton subopt = *btn; … … 2808 2874 case CE_TabBarTabShape: 2809 2875 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { 2810 GtkWidget *gtkNotebook = d->gtkWidget( QLS("GtkNotebook"));2876 GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); 2811 2877 style = gtkPainter.getStyle(gtkNotebook); 2812 2878 … … 2875 2941 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2876 2942 Q_UNUSED(bar); 2877 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2943 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2878 2944 GtkStateType state = gtkPainter.gtkState(option); 2879 2945 gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style); … … 2885 2951 if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) { 2886 2952 GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; 2887 GtkWidget *gtkProgressBar = d->gtkWidget( QLS("GtkProgressBar"));2953 GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); 2888 2954 style = gtkProgressBar->style; 2889 2955 gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); … … 3043 3109 case CC_SpinBox: 3044 3110 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 3045 GtkWidget *gtkSpinButton = d->gtkWidget( QLS("GtkSpinButton"));3111 GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton"); 3046 3112 int center = spinbox->rect.height() / 2; 3047 3113 int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0; … … 3096 3162 if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { 3097 3163 // We employ the gtk widget to position arrows and separators for us 3098 QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox");3099 GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);3164 GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") 3165 : d->gtkWidget("GtkComboBox"); 3100 3166 d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); 3101 3167 GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; 3102 3168 d->gtk_widget_size_allocate(gtkCombo, &geometry); 3103 3169 int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); 3104 QString arrowPath = comboBoxPath + QLS(".GtkToggleButton"); 3105 3106 if (!box->editable && !appears_as_list) 3107 arrowPath += QLS(".GtkHBox.GtkArrow"); 3170 QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); 3171 if (!box->editable) { 3172 if (appears_as_list) 3173 arrowPath = "GtkComboBox.GtkToggleButton"; 3174 else 3175 arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; 3176 } 3108 3177 3109 3178 GtkWidget *arrowWidget = d->gtkWidget(arrowPath); … … 3164 3233 case CT_ToolButton: 3165 3234 if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { 3166 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkToolButton.GtkButton"));3235 GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); 3167 3236 newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness); 3168 3237 if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { … … 3182 3251 3183 3252 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { 3184 GtkWidget *gtkMenuSeparator = d->gtkWidget( QLS("GtkMenu.GtkSeparatorMenuItem"));3253 GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); 3185 3254 GtkRequisition sizeReq = {0, 0}; 3186 3255 d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); … … 3189 3258 } 3190 3259 3191 GtkWidget *gtkMenuItem = d->gtkWidget( QLS("GtkMenu.GtkCheckMenuItem"));3260 GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem"); 3192 3261 GtkStyle* style = gtkMenuItem->style; 3193 3262 … … 3211 3280 case CT_SpinBox: 3212 3281 // QSpinBox does some nasty things that depends on CT_LineEdit 3213 newSize = size + QSize(0, -d->gtkWidget( QLS("GtkSpinButton"))->style->ythickness * 2);3282 newSize = size + QSize(0, -d->gtkWidget("GtkSpinButton")->style->ythickness * 2); 3214 3283 break; 3215 3284 3216 3285 case CT_PushButton: 3217 3286 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { 3218 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));3287 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 3219 3288 gint focusPadding, focusWidth; 3220 3289 d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); … … 3224 3293 newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); 3225 3294 3226 GtkWidget *gtkButtonBox = d->gtkWidget( QLS("GtkHButtonBox"));3295 GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox"); 3227 3296 gint minWidth = 85, minHeight = 0; 3228 3297 d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, … … 3237 3306 3238 3307 case CT_Slider: { 3239 GtkWidget *gtkSlider = d->gtkWidget( QLS("GtkHScale"));3308 GtkWidget *gtkSlider = d->gtkWidget("GtkHScale"); 3240 3309 newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness); 3241 3310 } … … 3243 3312 3244 3313 case CT_LineEdit: { 3245 GtkWidget *gtkEntry = d->gtkWidget( QLS("GtkEntry"));3314 GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); 3246 3315 newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness); 3247 3316 } … … 3254 3323 case CT_ComboBox: 3255 3324 if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { 3256 GtkWidget *gtkCombo = d->gtkWidget( QLS("GtkComboBox"));3325 GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); 3257 3326 QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); 3258 3327 newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness); … … 3409 3478 case SE_PushButtonContents: 3410 3479 if (!d->gtk_check_version(2, 10, 0)) { 3411 GtkWidget *gtkButton = d->gtkWidget( QLS("GtkButton"));3480 GtkWidget *gtkButton = d->gtkWidget("GtkButton"); 3412 3481 GtkBorder *border = 0; 3413 3482 d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.