43 #if !defined(QT_NO_STYLE_GTK) 45 #include <private/qapplication_p.h> 46 #include <QtCore/QLibrary> 47 #include <QtCore/QSettings> 48 #include <QtGui/QDialogButtonBox> 49 #include <QtGui/QStatusBar> 50 #include <QtGui/QLineEdit> 51 #include <QtGui/QWidget> 52 #include <QtGui/QListView> 53 #include <QtGui/QApplication> 54 #include <QtGui/QStyleOption> 55 #include <QtGui/QPushButton> 56 #include <QtGui/QPainter> 57 #include <QtGui/QMainWindow> 58 #include <QtGui/QToolBar> 59 #include <QtGui/QHeaderView> 60 #include <QtGui/QMenuBar> 61 #include <QtGui/QComboBox> 62 #include <QtGui/QSpinBox> 63 #include <QtGui/QScrollBar> 64 #include <QtGui/QAbstractButton> 65 #include <QtGui/QToolButton> 66 #include <QtGui/QGroupBox> 67 #include <QtGui/QRadioButton> 68 #include <QtGui/QCheckBox> 69 #include <QtGui/QTreeView> 70 #include <QtGui/QStyledItemDelegate> 72 #undef signals // Collides with GTK stymbols 73 #include <private/qgtkpainter_p.h> 74 #include <private/qstylehelper_p.h> 75 #include <private/qgtkstyle_p.h> 76 #include <private/qcleanlooksstyle_p.h> 151 const int maxFactor = 100;
153 tmp.
setRed((tmp.
red() * factor) / maxFactor + (colorB.
red() * (maxFactor - factor)) / maxFactor);
154 tmp.
setGreen((tmp.
green() * factor) / maxFactor + (colorB.
green() * (maxFactor - factor)) / maxFactor);
155 tmp.
setBlue((tmp.
blue() * factor) / maxFactor + (colorB.
blue() * (maxFactor - factor)) / maxFactor);
162 retval.red = color.
red() * 255;
163 retval.green = color.
green() * 255;
164 retval.blue = color.
blue() * 255;
230 if (
d->isThemeAvailable()) {
231 GtkStyle *style =
d->gtkStyle();
232 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
233 GtkWidget *gtkEntry =
d->getTextColorWidget();
234 GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
235 QColor bg,
base,
text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
236 gdkBg = style->bg[GTK_STATE_NORMAL];
237 gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
241 gdkBase = gtkEntry->style->base[GTK_STATE_NORMAL];
242 gdkText = gtkEntry->style->text[GTK_STATE_NORMAL];
243 gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
244 gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED];
247 gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE];
248 gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE];
250 bg =
QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
251 text =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
252 fg =
QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8);
253 base =
QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8);
254 highlight =
QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8);
255 highlightText =
QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8);
256 inactiveHighlight =
QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8);
257 inactiveHighlightedTExt =
QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8);
271 GtkWidget *gtkTreeView =
d->gtkWidget(
"GtkTreeView");
272 GdkColor *gtkAltBase = NULL;
273 d->gtk_widget_style_get(gtkTreeView,
"odd-row-color", >kAltBase, NULL);
275 alternateRowColor =
QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8);
276 d->gdk_color_free(gtkAltBase);
293 highlightText.
setHsv(highlightText.
hue(), 0, highlightText.
value(), highlightText.
alpha());
300 style =
d->gtk_rc_get_style_by_paths(
d->gtk_settings_get_default(),
"gtk-tooltips",
"GtkWindow",
301 d->gtk_window_get_type());
303 gdkText = style->fg[GTK_STATE_NORMAL];
304 text =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
321 if (!
d->isThemeAvailable())
341 d->applyCustomPaletteHash();
342 if (!
d->isKDE4Session()) {
347 qApp->installEventFilter(&
d->filter);
363 && !
d->isKDE4Session()) {
368 qApp->removeEventFilter(&
d->filter);
381 if (!
d->isThemeAvailable())
383 if (qobject_cast<QAbstractButton*>(widget)
385 || qobject_cast<QComboBox*>(widget)
387 || qobject_cast<QScrollBar*>(widget)
389 || qobject_cast<QAbstractSpinBox*>(widget)
391 || qobject_cast<QHeaderView*>(widget))
393 else if (
QTreeView *tree = qobject_cast<QTreeView *> (widget))
414 if (!
d->isThemeAvailable())
419 if (qobject_cast<const QFrame*>(widget)) {
420 if (GtkStyle *style =
421 d->gtk_rc_get_style_by_paths(
d->gtk_settings_get_default(),
422 "*.GtkScrolledWindow",
423 "*.GtkScrolledWindow",
424 d->gtk_window_get_type()))
425 return qMax(style->xthickness, style->ythickness);
445 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
446 guint horizontal_shift;
447 d->gtk_widget_style_get(gtkButton,
"child-displacement-x", &horizontal_shift, NULL);
448 return horizontal_shift;
452 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
453 guint vertical_shift;
454 d->gtk_widget_style_get(gtkButton,
"child-displacement-y", &vertical_shift, NULL);
455 return vertical_shift;
462 GtkWidget *gtkMenu =
d->gtkWidget(
"GtkMenu");
463 guint horizontal_padding = 0;
465 if (!
d->gtk_check_version(2, 10, 0))
466 d->gtk_widget_style_get(gtkMenu,
"horizontal-padding", &horizontal_padding, NULL);
467 int padding = qMax<int>(gtkMenu->style->xthickness, horizontal_padding);
473 GtkSettings *settings =
d->gtk_settings_get_default();
474 gchararray icon_sizes;
475 g_object_get(settings,
"gtk-icon-sizes", &icon_sizes, NULL);
479 foreach (
const QString &value, values) {
484 retVal = iconSize.
split(splitChar)[0].toInt();
519 GtkWidget *gtkScale =
d->gtkWidget(
"GtkHScale");
521 d->gtk_widget_style_get(gtkScale,
"slider-width", &val, NULL);
523 return val + 2*gtkScale->style->ythickness;
530 GtkWidget *hScrollbar =
d->gtkWidget(
"GtkHScrollbar");
531 d->gtk_widget_style_get(hScrollbar,
532 "trough-border", &trough_border,
533 "slider-width", &sliderLength,
535 return sliderLength + trough_border*2;
543 d->gtk_widget_style_get(
d->gtkWidget(
"GtkHScale"),
"slider-length", &val, NULL);
550 GtkWidget *gtkCheckButton =
d->gtkWidget(
"GtkCheckButton");
552 d->gtk_widget_style_get(gtkCheckButton,
"indicator-spacing", &spacing,
"indicator-size", &size, NULL);
553 return size + 2 * spacing;
557 GtkWidget *gtkMenubar =
d->gtkWidget(
"GtkMenuBar");
558 return qMax(0, gtkMenubar->style->ythickness);
563 GtkWidget *gtkScrollWindow =
d->gtkWidget(
"GtkScrolledWindow");
565 d->gtk_widget_style_get(gtkScrollWindow,
"scrollbar-spacing", &spacing, NULL);
570 GtkWidget *gtkMenu =
d->gtkWidget(
"GtkMenu");
571 d->gtk_widget_style_get(gtkMenu,
"horizontal-offset", &offset, NULL);
588 if (!
d->isThemeAvailable())
595 gboolean alternateOrder = 0;
596 GtkSettings *settings =
d->gtk_settings_get_default();
597 g_object_get(settings,
"gtk-alternative-button-order", &alternateOrder, NULL);
609 if (
d->isKDE4Session())
611 GtkWidget *gtkToolbar =
d->gtkWidget(
"GtkToolbar");
612 GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
613 g_object_get(gtkToolbar,
"toolbar-style", &toolbar_style, NULL);
614 switch (toolbar_style) {
615 case GTK_TOOLBAR_TEXT:
617 case GTK_TOOLBAR_BOTH:
619 case GTK_TOOLBAR_BOTH_HORIZ:
621 case GTK_TOOLBAR_ICONS:
634 GtkWidget *gtkComboBox =
d->gtkWidget(
"GtkComboBox");
635 gboolean appears_as_list;
636 d->gtk_widget_style_get((GtkWidget*)gtkComboBox,
"appears-as-list", &appears_as_list, NULL);
637 return appears_as_list ? 0 : 1;
648 GtkSettings *settings =
d->gtk_settings_get_default();
649 g_object_get(settings,
"gtk-menu-popup-delay", &delay, NULL);
654 gboolean scrollbars_within_bevel =
false;
656 scrollbars_within_bevel =
true;
657 else if (!
d->gtk_check_version(2, 12, 0)) {
658 GtkWidget *gtkScrollWindow =
d->gtkWidget(
"GtkScrolledWindow");
659 d->gtk_widget_style_get(gtkScrollWindow,
"scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
661 return !scrollbars_within_bevel;
665 static bool buttonsHaveIcons =
d->getGConfBool(
QLS(
"/desktop/gnome/interface/buttons_have_icons"));
666 return buttonsHaveIcons;
670 gboolean underlineShortcut =
true;
671 if (!
d->gtk_check_version(2, 12, 0)) {
672 GtkSettings *settings =
d->gtk_settings_get_default();
673 g_object_get(settings,
"gtk-enable-mnemonics", &underlineShortcut, NULL);
675 return underlineShortcut;
693 if (!
d->isThemeAvailable()) {
698 GtkStyle* style =
d->gtkStyle();
703 if (widget && widget->
inherits(
"QComboBoxPrivateContainer")){
712 const int pmSize = 64;
721 pixmap =
QPixmap(pmSize, pmSize);
727 GtkShadowType shadow_type = GTK_SHADOW_NONE;
729 shadow_type = GTK_SHADOW_IN;
731 shadow_type = GTK_SHADOW_OUT;
733 GtkStyle *style =
d->gtk_rc_get_style_by_paths(
d->gtk_settings_get_default(),
734 "*.GtkScrolledWindow",
"*.GtkScrolledWindow",
d->gtk_window_get_type());
736 gtkFramePainter.
paintShadow(
d->gtkWidget(
"GtkFrame"),
"viewport", pmRect,
743 const int rw = rect.
width() - border;
744 const int rh = rect.
height() - border;
745 const int pw = pmRect.
width() - border;
746 const int ph = pmRect.
height() - border;
763 GtkWidget *gtkWindow =
d->gtkWidget(
"GtkWindow");
764 style =
d->gtk_rc_get_style_by_paths(
d->gtk_settings_get_default(),
"gtk-tooltips",
"GtkWindow",
765 d->gtk_window_get_type());
766 gtkPainter.
paintFlatBox(gtkWindow,
"tooltip", option->
rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style);
777 GtkShadowType shadow_type;
778 GtkWidget *gtkStatusbarFrame =
d->gtkWidget(
"GtkStatusbar.GtkFrame");
779 d->gtk_widget_style_get(gtkStatusbarFrame->parent,
"shadow-type", &shadow_type, NULL);
780 gtkPainter.
paintShadow(gtkStatusbarFrame,
"frame", option->
rect, GTK_STATE_NORMAL,
781 shadow_type, gtkStatusbarFrame->style);
786 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
787 GtkWidget *gtkTreeHeader =
d->gtkWidget(
"GtkTreeView.GtkButton");
788 GtkStateType state = gtkPainter.
gtkState(option);
789 style = gtkTreeHeader->style;
790 GtkArrowType
type = GTK_ARROW_UP;
797 type = GTK_ARROW_DOWN;
800 GTK_SHADOW_NONE,
FALSE, style);
805 if (!widget || qobject_cast<const QAbstractItemView*>(widget))
811 if (qobject_cast<const QTabBar*>(widget)) {
812 GtkWidget *gtkNotebook =
d->gtkWidget(
"GtkNotebook");
813 style = gtkPainter.
getStyle(gtkNotebook);
814 gtkPainter.
paintFocus(gtkNotebook,
"tab", frameRect.
adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style);
816 gtkPainter.
paintFocus(NULL,
"tab", frameRect, GTK_STATE_ACTIVE, style);
824 rect =
QRect(0, 0, 12, 12);
827 GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED;
828 GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED;
829 GtkWidget *gtkTreeView =
d->gtkWidget(
"GtkTreeView");
831 GtkStateType state = GTK_STATE_NORMAL;
833 state = GTK_STATE_INSENSITIVE;
835 state = GTK_STATE_PRELIGHT;
837 gtkPainter.
paintExpander(gtkTreeView,
"treeview", rect, state,
838 option->
state &
State_Open ? openState : closedState , gtkTreeView->style);
851 if (
const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) {
852 if (!qobject_cast<QStyledItemDelegate*>(view->itemDelegate()))
859 uint resolve_mask = vopt->palette.resolve();
865 painter->
fillRect(vopt->rect, vopt->backgroundBrush);
870 if (GtkWidget *gtkTreeView =
d->gtkWidget(
"GtkTreeView")) {
871 const char *detail =
"cell_even_ruled";
873 detail =
"cell_odd_ruled";
879 GTK_WIDGET_SET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
884 isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
885 GTK_SHADOW_OUT, gtkTreeView->style, key);
887 GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
893 const int margin = 6;
894 GtkWidget *gtkSeparator =
d->gtkWidget(
"GtkToolbar.GtkSeparatorToolItem");
896 const int offset = option->
rect.
width()/2;
899 gtkPainter.
paintVline( gtkSeparator,
"vseparator",
900 rect, GTK_STATE_NORMAL, gtkSeparator->style,
906 gtkPainter.
paintHline( gtkSeparator,
"hseparator",
907 rect, GTK_STATE_NORMAL, gtkSeparator->style,
914 GtkWidget *gtkToolbar =
d->gtkWidget(
"GtkToolbar");
915 GtkShadowType shadow_type;
916 d->gtk_widget_style_get(gtkToolbar,
"shadow-type", &shadow_type, NULL);
921 GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, gtkToolbar->style);
931 GtkArrowType
type = GTK_ARROW_UP;
936 type = GTK_ARROW_DOWN;
940 type = GTK_ARROW_LEFT;
944 type = GTK_ARROW_RIGHT;
951 int border = (size > 9) ? (size/4) : 0;
952 int bsx = 0, bsy = 0;
957 QRect arrowRect = option->
rect.
adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy);
958 GtkShadowType shadow = option->
state &
State_Sunken ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
959 GtkStateType state = gtkPainter.
gtkState(option);
962 GtkWidget *gtkArrow =
d->gtkWidget(
"GtkArrow");
964 d->gtk_widget_modify_fg (gtkArrow, state, &color);
965 gtkPainter.
paintArrow(gtkArrow,
"button", arrowRect,
966 type, state, shadow,
FALSE, gtkArrow->style,
969 d->gtk_widget_modify_fg (gtkArrow, state, NULL);
978 GtkWidget *gtkMenu =
d->gtkWidget(
"GtkMenu");
980 gtkPainter.
paintBox(gtkMenu,
"menu", option->
rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style,
QString());
989 if (qobject_cast<const QToolBar *>(widget)) {
990 GtkWidget *gtkMenubar =
d->gtkWidget(
"GtkMenuBar");
991 gtkPainter.
paintBox( gtkMenubar,
"toolbar", option->
rect,
992 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
994 GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
999 GtkWidget *gtkEntry =
d->gtkWidget(
"GtkEntry");
1002 gboolean interior_focus;
1003 gint focus_line_width;
1005 d->gtk_widget_style_get(gtkEntry,
1006 "interior-focus", &interior_focus,
1007 "focus-line-width", &focus_line_width, NULL);
1010 g_object_set_data(G_OBJECT(gtkEntry),
"transparent-bg-hint", GINT_TO_POINTER(
TRUE));
1013 rect.
adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width);
1016 GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
1018 GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
1019 GTK_SHADOW_IN, gtkEntry->style,
1023 GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
1024 GTK_SHADOW_IN, gtkEntry->style,
QLS(
"GtkEntryShadowIn"));
1027 GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
1032 if (
const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1033 GtkWidget *gtkEntry =
d->gtkWidget(
"GtkEntry");
1034 if (panel->lineWidth > 0)
1037 QRect textRect = option->
rect.
adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness,
1038 -gtkEntry->style->xthickness, -gtkEntry->style->ythickness);
1044 gtkPainter.
paintFlatBox( gtkEntry,
"entry_bg", textRect,
1045 option->
state &
State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntry->style);
1051 GtkWidget *gtkNotebook =
d->gtkWidget(
"GtkNotebook");
1052 style = gtkPainter.
getStyle(gtkNotebook);
1054 GtkShadowType shadow = GTK_SHADOW_OUT;
1055 GtkStateType state = GTK_STATE_NORMAL;
1059 GtkPositionType frameType = GTK_POS_TOP;
1065 gapStart = tabframe->selectedTabRect.left();
1066 gapSize = tabframe->selectedTabRect.width();
1069 gapStart = tabframe->selectedTabRect.y();
1070 gapSize = tabframe->selectedTabRect.height();
1072 gtkPainter.
paintBoxGap(gtkNotebook,
"notebook", option->
rect, state, shadow, frameType,
1073 gapStart, gapSize, style);
1078 gtkPainter.
paintBox(gtkNotebook,
"notebook", option->
rect, state, shadow, style);
1084 bool isDefault =
false;
1086 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton*>(option))
1096 GtkStateType state = gtkPainter.
gtkState(option);
1098 state = GTK_STATE_ACTIVE;
1099 GtkWidget *gtkButton = isTool ?
d->gtkWidget(
"GtkToolButton.GtkButton") :
d->gtkWidget(
"GtkButton");
1100 gint focusWidth, focusPad;
1101 gboolean interiorFocus =
false;
1102 d->gtk_widget_style_get (gtkButton,
1103 "focus-line-width", &focusWidth,
1104 "focus-padding", &focusPad,
1105 "interior-focus", &interiorFocus, NULL);
1107 style = gtkButton->style;
1114 GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
1115 gtkPainter.
paintBox(gtkButton,
"buttondefault", buttonRect, state, GTK_SHADOW_IN,
1123 GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_FOCUS);
1127 buttonRect = buttonRect.
adjusted(focusWidth, focusWidth, -focusWidth, -focusWidth);
1130 GTK_SHADOW_IN : GTK_SHADOW_OUT;
1132 gtkPainter.
paintBox(gtkButton,
"button", buttonRect, state, shadow,
1135 GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
1137 GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
1142 GtkShadowType shadow = GTK_SHADOW_OUT;
1143 GtkStateType state = gtkPainter.
gtkState(option);
1146 state = GTK_STATE_ACTIVE;
1149 shadow = GTK_SHADOW_ETCHED_IN;
1151 shadow = GTK_SHADOW_IN;
1153 shadow = GTK_SHADOW_OUT;
1155 GtkWidget *gtkRadioButton =
d->gtkWidget(
"GtkRadioButton");
1157 d->gtk_widget_style_get(gtkRadioButton,
"indicator-spacing", &spacing, NULL);
1162 GtkWidget *gtkCheckButton =
d->gtkWidget(
"GtkCheckButton");
1166 GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
1168 gtkPainter.
paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, key);
1170 GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
1175 GtkShadowType shadow = GTK_SHADOW_OUT;
1176 GtkStateType state = gtkPainter.
gtkState(option);
1179 state = GTK_STATE_ACTIVE;
1182 shadow = GTK_SHADOW_ETCHED_IN;
1184 shadow = GTK_SHADOW_IN;
1186 shadow = GTK_SHADOW_OUT;
1190 GtkWidget *gtkCheckButton =
d->gtkWidget(
"GtkCheckButton");
1194 GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
1200 d->gtk_widget_style_get(gtkCheckButton,
"indicator-spacing", &spacing, NULL);
1204 gtkPainter.
paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtkCheckButton->style,
1207 GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
1212 #ifndef QT_NO_TABBAR 1216 = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
1217 QRect tabRect = tbb->rect;
1220 switch (tbb->shape) {
1231 painter->
drawLine(tbb->rect.left(), tbb->rect.bottom(),
1252 #endif // QT_NO_TABBAR 1271 if (!
d->isThemeAvailable()) {
1276 GtkStyle* style =
d->gtkStyle();
1302 if (
const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
1309 GdkColor gdkBg = style->bg[GTK_STATE_SELECTED];
1310 QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
1317 #ifndef QT_NO_GROUPBOX 1322 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
1329 GtkWidget *gtkCheckButton =
d->gtkWidget(
"GtkCheckButton");
1332 QRect bgRect = textRect | checkBoxRect;
1334 GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkCheckButton->style);
1337 if (!groupBox->text.isEmpty()) {
1338 int alignment = int(groupBox->textAlignment);
1341 QColor textColor = groupBox->textColor;
1342 int labelState = GTK_STATE_INSENSITIVE;
1347 GdkColor gdkText = gtkCheckButton->style->fg[labelState];
1348 textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
1349 painter->
setPen(textColor);
1356 gtkPainter.
paintFocus( NULL,
"tab", textRect.
adjusted(-4, -1, 0, -3), GTK_STATE_ACTIVE, style);
1362 box.QStyleOption::operator=(*groupBox);
1363 box.
rect = checkBoxRect;
1370 #endif // QT_NO_GROUPBOX 1372 #ifndef QT_NO_COMBOBOX 1377 if (
const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1378 bool sunken = comboBox->state &
State_On;
1385 GtkStateType state = gtkPainter.
gtkState(option);
1396 GTK_SHADOW_IN : GTK_SHADOW_OUT;
1400 GtkWidget *gtkCombo =
d->gtkWidget(comboBoxPath);
1402 d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
1403 d->gtk_widget_size_allocate(gtkCombo, &geometry);
1407 GtkWidget *gtkToggleButton =
d->gtkWidget(buttonPath);
1408 d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
1409 if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
1411 GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
1413 if (comboBox->editable || appears_as_list) {
1414 GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
1416 GtkWidget *gtkEntry =
d->gtkWidget(entryPath);
1417 d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
1428 int xt = gtkEntry->style->xthickness;
1429 int yt = gtkEntry->style->ythickness;
1433 GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
1439 gtkCachedPainter.
paintFlatBox(gtkEntry,
"entry_bg", contentRect,
1444 gtkCachedPainter.
paintShadow(gtkEntry, comboBox->editable ?
"entry" :
"frame", frameRect, frameState,
1445 GTK_SHADOW_IN, gtkEntry->style, entryPath.
toString() +
1449 GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
1452 GtkStateType buttonState = GTK_STATE_NORMAL;
1455 buttonState = GTK_STATE_INSENSITIVE;
1457 buttonState = GTK_STATE_ACTIVE;
1459 buttonState = GTK_STATE_PRELIGHT;
1462 gtkCachedPainter.
paintBox( gtkToggleButton,
"button", arrowButtonRect, buttonState,
1463 shadow, gtkToggleButton->style, buttonPath.
toString() +
1466 GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
1472 GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
1473 gtkCachedPainter.
paintBox(gtkToggleButton,
"button",
1475 shadow, gtkToggleButton->style,
1478 GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
1486 if (GtkWidget *gtkVSeparator =
d->gtkWidget(vSeparatorPath)) {
1487 QRect vLineRect(gtkVSeparator->allocation.x,
1488 gtkVSeparator->allocation.y,
1489 gtkVSeparator->allocation.width,
1490 gtkVSeparator->allocation.height);
1492 gtkCachedPainter.
paintVline( gtkVSeparator,
"vseparator",
1493 vLineRect, state, gtkVSeparator->style,
1497 gint interiorFocus =
true;
1498 d->gtk_widget_style_get(gtkToggleButton,
"interior-focus", &interiorFocus, NULL);
1499 int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
1500 int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
1502 gtkCachedPainter.
paintFocus(gtkToggleButton,
"button",
1505 gtkToggleButton->style);
1511 state = GTK_STATE_INSENSITIVE;
1513 state = GTK_STATE_ACTIVE;
1515 state = GTK_STATE_PRELIGHT;
1517 state = GTK_STATE_NORMAL;
1520 if (comboBox->editable) {
1521 if (appears_as_list)
1526 if (appears_as_list)
1532 GtkWidget *gtkArrow =
d->gtkWidget(arrowPath);
1535 QRect arrowWidgetRect;
1537 if (gtkArrow && !
d->gtk_check_version(2, 12, 0)) {
1538 d->gtk_widget_style_get(gtkArrow,
"arrow-scaling", &scale, NULL);
1539 d->gtk_widget_style_get(gtkCombo,
"arrow-size", &minSize, NULL);
1542 arrowWidgetRect =
QRect(gtkArrow->allocation.x, gtkArrow->allocation.y,
1543 gtkArrow->allocation.width, gtkArrow->allocation.height);
1544 style = gtkArrow->style;
1549 int arrowSize =
qMax(
qMin(rect.
height() - gtkCombo->style->ythickness * 2, minSize),
1551 QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale));
1561 GtkWidget *gtkButton =
d->gtkWidget(toggleButtonPath);
1562 d->gtk_widget_style_get(gtkButton,
"child-displacement-x", &xoff, NULL);
1563 d->gtk_widget_style_get(gtkButton,
"child-displacement-y", &yoff, NULL);
1564 arrowRect = arrowRect.
adjusted(xoff, yoff, xoff, yoff);
1571 gtkCachedPainter.
paintArrow( gtkArrow,
"arrow", arrowRect,
1572 GTK_ARROW_DOWN, state, GTK_SHADOW_NONE,
TRUE,
1579 #endif // QT_NO_COMBOBOX 1580 #ifndef QT_NO_TOOLBUTTON 1584 = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
1585 QRect button, menuarea;
1594 State mflags = bflags;
1601 }
else if (toolbutton->state & State_MouseOver) {
1610 tool.
palette = toolbutton->palette;
1615 tool.
state = bflags;
1622 int popupArrowSize = drawMenuArrow ? 7 : 0;
1626 fr.QStyleOption::operator=(*toolbutton);
1633 label.
state = bflags;
1634 GtkWidget *gtkButton =
d->gtkWidget(
"GtkToolButton.GtkButton");
1635 QPalette pal = toolbutton->palette;
1638 GdkColor gdkText = gtkButton->style->fg[GTK_STATE_PRELIGHT];
1639 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
1643 label.
rect = button.
adjusted(style->xthickness, style->ythickness,
1644 -style->xthickness - popupArrowSize, -style->ythickness);
1648 tool.
rect = menuarea;
1649 tool.
state = mflags;
1655 }
else if (drawMenuArrow) {
1656 QRect ir = toolbutton->rect;
1658 newBtn.
rect =
QRect(ir.
right() - popupArrowSize - style->xthickness - 3, ir.
height()/2 - 1, popupArrowSize, popupArrowSize);
1664 #endif // QT_NO_TOOLBUTTON 1665 #ifndef QT_NO_SCROLLBAR 1668 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1669 GtkWidget *gtkHScrollBar =
d->gtkWidget(
"GtkHScrollbar");
1670 GtkWidget *gtkVScrollBar =
d->gtkWidget(
"GtkVScrollbar");
1675 QRect rect = scrollBar->rect;
1681 GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
1682 style = scrollbarWidget->style;
1683 gboolean trough_under_steppers =
true;
1684 gboolean trough_side_details =
false;
1685 gboolean activate_slider =
false;
1686 gboolean stepper_size = 14;
1687 gint trough_border = 1;
1688 if (!
d->gtk_check_version(2, 10, 0)) {
1689 d->gtk_widget_style_get((GtkWidget*)(scrollbarWidget),
1690 "trough-border", &trough_border,
1691 "trough-side-details", &trough_side_details,
1692 "trough-under-steppers", &trough_under_steppers,
1693 "activate-slider", &activate_slider,
1694 "stepper-size", &stepper_size, NULL);
1696 if (trough_under_steppers) {
1697 scrollBarAddLine.
adjust(trough_border, trough_border, -trough_border, -trough_border);
1698 scrollBarSubLine.
adjust(trough_border, trough_border, -trough_border, -trough_border);
1699 scrollBarSlider.
adjust(horizontal ? -trough_border : 0, horizontal ? 0 : -trough_border,
1700 horizontal ? trough_border : 0, horizontal ? 0 : trough_border);
1708 if (scrollBar->minimum == scrollBar->maximum)
1710 if (scrollBar->sliderPosition == scrollBar->maximum)
1712 else if (scrollBar->sliderPosition > scrollBar->minimum)
1713 fakePos = maximum - 1;
1716 GtkRange *range = (GtkRange*)(horizontal ? gtkHScrollBar : gtkVScrollBar);
1717 GtkAdjustment *adjustment = 0;
1719 if (
d->gtk_adjustment_configure)
1720 adjustment =
d->gtk_range_get_adjustment(range);
1722 d->gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0);
1724 adjustment = (GtkAdjustment*)
d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
1725 d->gtk_range_set_adjustment(range, adjustment);
1729 GtkStateType state = GTK_STATE_ACTIVE;
1732 state = GTK_STATE_INSENSITIVE;
1734 if (trough_under_steppers)
1735 grooveRect = option->
rect;
1737 gtkPainter.
paintBox( scrollbarWidget,
"trough", grooveRect, state, GTK_SHADOW_IN, style);
1742 GtkStateType state = GTK_STATE_NORMAL;
1745 state = GTK_STATE_INSENSITIVE;
1746 else if (activate_slider &&
1748 state = GTK_STATE_ACTIVE;
1750 state = GTK_STATE_PRELIGHT;
1752 GtkShadowType shadow = GTK_SHADOW_OUT;
1754 if (trough_under_steppers) {
1756 scrollBarSlider.
adjust(trough_border, 0, -trough_border, 0);
1758 scrollBarSlider.
adjust(0, trough_border, 0, -trough_border);
1761 gtkPainter.
paintSlider( scrollbarWidget,
"slider", scrollBarSlider, state, shadow, style,
1763 horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
QString(
QLS(
"%0%1")).arg(fakePos).arg(maximum));
1767 gtkVScrollBar->allocation.y = scrollBarAddLine.
top();
1768 gtkVScrollBar->allocation.height = scrollBarAddLine.
height() - rect.
height() + 6;
1769 gtkHScrollBar->allocation.x = scrollBarAddLine.
right();
1770 gtkHScrollBar->allocation.width = scrollBarAddLine.
width() - rect.
width();
1772 GtkShadowType shadow = GTK_SHADOW_OUT;
1773 GtkStateType state = GTK_STATE_NORMAL;
1776 state = GTK_STATE_INSENSITIVE;
1778 state = GTK_STATE_ACTIVE;
1779 shadow = GTK_SHADOW_IN;
1782 state = GTK_STATE_PRELIGHT;
1784 gtkPainter.
paintBox( scrollbarWidget,
1785 horizontal ?
"hscrollbar" :
"vscrollbar", scrollBarAddLine,
1786 state, shadow, style,
QLS(
"add"));
1788 gtkPainter.
paintArrow( scrollbarWidget, horizontal ?
"hscrollbar" :
"vscrollbar", scrollBarAddLine.
adjusted(4, 4, -4, -4),
1789 horizontal ? (reverse ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT) :
1790 GTK_ARROW_DOWN, state, GTK_SHADOW_NONE,
FALSE, style);
1794 gtkVScrollBar->allocation.y = 0;
1795 gtkVScrollBar->allocation.height = scrollBarSubLine.
height();
1796 gtkHScrollBar->allocation.x = 0;
1797 gtkHScrollBar->allocation.width = scrollBarSubLine.
width();
1799 GtkShadowType shadow = GTK_SHADOW_OUT;
1800 GtkStateType state = GTK_STATE_NORMAL;
1803 state = GTK_STATE_INSENSITIVE;
1805 shadow = GTK_SHADOW_IN;
1806 state = GTK_STATE_ACTIVE;
1809 state = GTK_STATE_PRELIGHT;
1811 gtkPainter.
paintBox(scrollbarWidget, horizontal ?
"hscrollbar" :
"vscrollbar", scrollBarSubLine,
1812 state, shadow, style,
QLS(
"sub"));
1814 gtkPainter.
paintArrow(scrollbarWidget, horizontal ?
"hscrollbar" :
"vscrollbar", scrollBarSubLine.
adjusted(4, 4, -4, -4),
1815 horizontal ? (reverse ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT) :
1816 GTK_ARROW_UP, state, GTK_SHADOW_NONE,
FALSE, style);
1821 #endif //QT_NO_SCROLLBAR 1822 #ifndef QT_NO_SPINBOX 1825 if (
const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1828 ?
d->gtkWidget(
"GtkEntry")
1829 :
d->gtkWidget(
"GtkSpinButton");
1833 bool upIsActive = (spinBox->activeSubControls ==
SC_SpinBoxUp);
1834 bool downIsActive = (spinBox->activeSubControls ==
SC_SpinBoxDown);
1839 QRect upRect, downRect, buttonRect;
1859 buttonRect = upRect | downRect;
1866 if (spinBox->frame) {
1867 GtkStateType state = gtkPainter.
gtkState(option);
1870 state = GTK_STATE_INSENSITIVE;
1872 state = GTK_STATE_NORMAL;
1873 else if (state == GTK_STATE_PRELIGHT)
1874 state = GTK_STATE_NORMAL;
1876 style = gtkPainter.
getStyle(gtkSpinButton);
1883 GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
1891 gtkPainter.
paintFlatBox(gtkSpinButton,
"entry_bg", editArea.
adjusted(style->xthickness, style->ythickness,
1892 -style->xthickness, -style->ythickness),
1894 GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style,
key);
1896 gtkPainter.
paintShadow(gtkSpinButton,
"entry", editArea, state, GTK_SHADOW_IN, gtkSpinButton->style, key);
1898 gtkPainter.
paintBox(gtkSpinButton,
"spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key);
1902 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key);
1903 else if (upIsActive && sunken)
1904 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key);
1905 else if (upIsActive && hover)
1906 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key);
1908 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
1911 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key);
1912 else if (downIsActive && sunken)
1913 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key);
1914 else if (downIsActive && hover)
1915 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key);
1917 gtkPainter.
paintBox( gtkSpinButton,
"spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
1920 GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
1925 int centerX = upRect.
center().
x();
1926 int centerY = upRect.
center().
y();
1929 if (spinBox->activeSubControls ==
SC_SpinBoxUp && sunken) {
1930 painter->
drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
1931 painter->
drawLine(1 + centerX, 1 + centerY - 2, 1 + centerX, 1 + centerY + 2);
1934 painter->
drawLine(centerX - 2, centerY, centerX + 2, centerY);
1935 painter->
drawLine(centerX, centerY - 2, centerX, centerY + 2);
1937 centerX = downRect.
center().
x();
1938 centerY = downRect.
center().
y();
1941 painter->
drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
1943 painter->
drawLine(centerX - 2, centerY, centerX + 2, centerY);
1947 int size =
d->getSpinboxArrowSize();
1948 int w = size / 2 - 1;
1951 QRect arrowRect(0, 0, w, h);
1954 GtkStateType state = GTK_STATE_NORMAL;
1957 state = GTK_STATE_INSENSITIVE;
1959 gtkPainter.
paintArrow( gtkSpinButton,
"spinbutton", arrowRect, GTK_ARROW_UP, state,
1960 GTK_SHADOW_NONE,
FALSE, style);
1965 state = GTK_STATE_INSENSITIVE;
1967 gtkPainter.
paintArrow( gtkSpinButton,
"spinbutton", arrowRect, GTK_ARROW_DOWN, state,
1968 GTK_SHADOW_NONE,
FALSE, style);
1973 #endif // QT_NO_SPINBOX 1975 #ifndef QT_NO_SLIDER 1978 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1979 GtkWidget *hScaleWidget =
d->gtkWidget(
"GtkHScale");
1980 GtkWidget *vScaleWidget =
d->gtkWidget(
"GtkVScale");
1998 GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
1999 GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
2000 style = scaleWidget->style;
2004 GtkRange *range = (GtkRange*)scaleWidget;
2005 GtkAdjustment *adjustment = 0;
2006 if (
d->gtk_adjustment_configure)
2007 adjustment =
d->gtk_range_get_adjustment(range);
2009 d->gtk_adjustment_configure(adjustment,
2010 slider->sliderPosition,
2017 adjustment = (GtkAdjustment*)
d->gtk_adjustment_new(slider->sliderPosition,
2023 d->gtk_range_set_adjustment(range, adjustment);
2027 d->gtk_range_set_inverted(range, !horizontal);
2028 d->gtk_widget_style_get(scaleWidget,
"trough-border", &outerSize, NULL);
2031 GtkStateType state = gtkPainter.
gtkState(option);
2032 int focusFrameMargin = 2;
2033 QRect grooveRect = option->
rect.
adjusted(focusFrameMargin, outerSize + focusFrameMargin,
2034 -focusFrameMargin, -outerSize - focusFrameMargin);
2036 gboolean trough_side_details =
false;
2037 if (!
d->gtk_check_version(2, 10, 0))
2038 d->gtk_widget_style_get((GtkWidget*)(scaleWidget),
"trough-side-details", &trough_side_details, NULL);
2040 if (!trough_side_details) {
2041 gtkPainter.
paintBox( scaleWidget,
"trough", grooveRect, state,
2042 GTK_SHADOW_IN, style,
QString(
QLS(
"p%0")).arg(slider->sliderPosition));
2044 QRect upperGroove = grooveRect;
2045 QRect lowerGroove = grooveRect;
2048 if (slider->upsideDown) {
2056 if (!slider->upsideDown) {
2065 gtkPainter.
paintBox( scaleWidget,
"trough-upper", upperGroove, state,
2066 GTK_SHADOW_IN, style,
QString(
QLS(
"p%0")).arg(slider->sliderPosition));
2067 gtkPainter.
paintBox( scaleWidget,
"trough-lower", lowerGroove, state,
2068 GTK_SHADOW_IN, style,
QString(
QLS(
"p%0")).arg(slider->sliderPosition));
2073 painter->
setPen(darkOutline);
2076 int interval = slider->tickInterval;
2078 if (interval <= 0) {
2079 interval = slider->singleStep;
2085 interval = slider->pageStep;
2091 int v = slider->minimum;
2093 while (v <= slider->maximum + 1) {
2094 if (v == slider->maximum + 1 && interval == 1)
2096 const int v_ =
qMin(v, slider->maximum);
2099 ? slider->rect.width()
2100 : slider->rect.height()) - len,
2101 slider->upsideDown) + len / 2;
2102 int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
2105 painter->
drawLine(pos, slider->rect.top() + extra,
2106 pos, slider->rect.top() + tickSize);
2108 painter->
drawLine(pos, slider->rect.bottom() - extra,
2109 pos, slider->rect.bottom() - tickSize);
2113 painter->
drawLine(slider->rect.left() + extra, pos,
2114 slider->rect.left() + tickSize, pos);
2116 painter->
drawLine(slider->rect.right() - extra, pos,
2117 slider->rect.right() - tickSize, pos);
2121 int nextInterval = v + interval;
2122 if (nextInterval < v)
2130 GtkShadowType shadow = GTK_SHADOW_OUT;
2131 GtkStateType state = GTK_STATE_NORMAL;
2134 state = GTK_STATE_INSENSITIVE;
2136 state = GTK_STATE_PRELIGHT;
2142 fropt.QStyleOption::operator=(*slider);
2155 gtkPainter.
paintSlider( scaleWidget, horizontal ?
"hscale" :
"vscale", handle, state, shadow, style,
2157 horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
2164 #endif // QT_NO_SLIDER 2184 if (!
d->isThemeAvailable()) {
2189 GtkStyle* style =
d->gtkStyle();
2195 GtkWidget *gtkProgressBar =
d->gtkWidget(
"GtkProgressBar");
2196 if (!gtkProgressBar)
2200 QRect rect = bar->rect;
2201 GdkColor gdkText = gtkProgressBar->style->fg[GTK_STATE_NORMAL];
2202 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2203 gdkText = gtkProgressBar->style->fg[GTK_STATE_PRELIGHT];
2204 QColor alternateTextColor=
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2207 bool vertical =
false, inverted =
false;
2210 inverted = bar2->invertedAppearance;
2214 const int progressIndicatorPos = (bar->progress -
qreal(bar->minimum)) * rect.
width() /
2216 if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.
width())
2221 bool flip = (!vertical && (((bar->direction ==
Qt::RightToLeft) && !inverted) ||
2227 painter->
setPen(flip ? alternateTextColor : textColor);
2229 if (!leftRect.
isNull()) {
2230 painter->
setPen(flip ? textColor : alternateTextColor);
2238 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
2239 QRect ir = button->rect;
2252 if (!button->icon.isNull()) {
2265 QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
2266 int w = pixmap.
width();
2269 if (!button->text.isEmpty())
2270 w += button->fontMetrics.boundingRect(option->
rect, tf, button->text).width() + 4;
2273 ir.
y() + ir.
height() / 2 - h / 2);
2278 painter->
drawPixmap(
visualPos(button->direction, button->rect, point + buttonShift), pixmap);
2286 if (!button->text.isEmpty())
2298 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
2300 int labelState = GTK_STATE_INSENSITIVE;
2303 GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
2305 GdkColor gdkText = gtkButton->style->fg[labelState];
2306 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2315 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
2319 GtkWidget *gtkRadioButton =
d->gtkWidget(
"GtkRadioButton");
2323 GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkRadioButton->style);
2330 &subopt, painter, widget);
2335 int labelState = GTK_STATE_INSENSITIVE;
2339 GdkColor gdkText = gtkRadioButton->style->fg[labelState];
2340 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2347 fropt.QStyleOption::operator=(*btn);
2355 #ifndef QT_NO_COMBOBOX 2358 if (
const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
2364 if (!cb->currentIcon.isNull()) {
2367 QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
2368 QRect iconRect(editRect);
2369 iconRect.
setWidth(cb->iconSize.width() + 4);
2373 iconRect.
size(), editRect);
2381 editRect.
translate(-4 - cb->iconSize.width(), 0);
2383 editRect.
translate(cb->iconSize.width() + 4, 0);
2386 if (!cb->currentText.isEmpty() && !cb->editable) {
2387 GtkWidget *gtkCombo =
d->gtkWidget(
"GtkComboBox");
2389 int labelState = GTK_STATE_INSENSITIVE;
2392 labelState = (option->
state &
State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
2394 GdkColor gdkText = gtkCombo->style->fg[labelState];
2396 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2409 #endif // QT_NO_COMBOBOX 2418 QRect rect = dwOpt->rect;
2421 if (verticalTitleBar)
2424 if (verticalTitleBar) {
2442 if (!dwOpt->title.isEmpty()) {
2462 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
2464 GtkWidget *gtkTreeView =
d->gtkWidget(
"GtkTreeView");
2466 GtkTreeViewColumn *column =
d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1);
2469 GtkWidget *gtkTreeHeader = column->button;
2470 GtkStateType state = gtkPainter.
gtkState(option);
2471 GtkShadowType shadow = GTK_SHADOW_OUT;
2474 shadow = GTK_SHADOW_IN;
2476 gtkPainter.
paintBox(gtkTreeHeader,
"button", option->
rect.
adjusted(-1, 0, 0, 0), state, shadow, gtkTreeHeader->style);
2482 #ifndef QT_NO_SIZEGRIP 2485 GtkWidget *gtkStatusbar =
d->gtkWidget(
"GtkStatusbar.GtkFrame");
2486 QRect gripRect = option->
rect.
adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
2487 gtkPainter.
paintResizeGrip( gtkStatusbar,
"statusbar", gripRect, GTK_STATE_NORMAL,
2489 GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
2490 gtkStatusbar->style);
2494 #endif // QT_NO_SIZEGRIP 2497 GtkWidget *gtkMenubar =
d->gtkWidget(
"GtkMenuBar");
2498 GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL];
2499 painter->
fillRect(option->
rect,
QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
2506 GtkShadowType shadow_type;
2507 d->gtk_widget_style_get(gtkMenubar,
"shadow-type", &shadow_type, NULL);
2508 gtkMenuBarPainter.
paintBox( gtkMenubar,
"menubar", menuBarRect,
2509 GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
2519 if (
const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
2520 GtkWidget *gtkMenubarItem =
d->gtkWidget(
"GtkMenuBar.GtkMenuItem");
2521 GtkWidget *gtkMenubar =
d->gtkWidget(
"GtkMenuBar");
2523 style = gtkMenubarItem->style;
2535 GtkShadowType shadow_type;
2536 d->gtk_widget_style_get(gtkMenubar,
"shadow-type", &shadow_type, NULL);
2537 GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL];
2538 painter->
fillRect(option->
rect,
QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
2539 menubarPainter.
paintBox(gtkMenubar,
"menubar", menuBarRect,
2540 GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
2548 item.
rect = mbi->rect;
2549 GdkColor gdkText = gtkMenubarItem->style->fg[dis ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL];
2550 GdkColor gdkHText = gtkMenubarItem->style->fg[GTK_STATE_PRELIGHT];
2551 QColor normalTextColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2552 QColor highlightedTextColor =
QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
2559 GtkShadowType shadowType = GTK_SHADOW_NONE;
2560 d->gtk_widget_style_get (gtkMenubarItem,
"selected-shadow-type", &shadowType, NULL);
2562 GTK_STATE_PRELIGHT, shadowType, gtkMenubarItem->style);
2577 GtkWidget *gtkWindow =
d->gtkWidget(
"GtkWindow");
2584 #ifndef QT_NO_TOOLBAR 2589 if (!(widget && qobject_cast<const QMainWindow*> (widget->
parentWidget())))
2597 GtkWidget *gtkToolbar =
d->gtkWidget(
"GtkToolbar");
2598 GtkShadowType shadow_type = GTK_SHADOW_NONE;
2599 d->gtk_widget_style_get(gtkToolbar,
"shadow-type", &shadow_type, NULL);
2600 gtkPainter.
paintBox( gtkToolbar,
"toolbar", rect,
2601 GTK_STATE_NORMAL, shadow_type, gtkToolbar->style);
2605 #endif // QT_NO_TOOLBAR 2611 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
2616 GtkWidget *gtkMenuItem = menuItem->checked ?
d->gtkWidget(
"GtkMenu.GtkCheckMenuItem") :
2617 d->gtkWidget(
"GtkMenu.GtkMenuItem");
2619 style = gtkPainter.
getStyle(gtkMenuItem);
2623 GtkWidget *gtkMenuSeparator =
d->gtkWidget(
"GtkMenu.GtkSeparatorMenuItem");
2625 gboolean wide_separators = 0;
2626 gint separator_height = 0;
2627 guint horizontal_padding = 3;
2629 if (!
d->gtk_check_version(2, 10, 0)) {
2630 d->gtk_widget_style_get(gtkMenuSeparator,
2631 "wide-separators", &wide_separators,
2632 "separator-height", &separator_height,
2633 "horizontal-padding", &horizontal_padding,
2637 separatorRect.
setWidth(option->
rect.
width() - 2 * (horizontal_padding + gtkMenuSeparator->style->xthickness));
2639 if (wide_separators)
2640 gtkPainter.
paintBox( gtkMenuSeparator,
"hseparator",
2641 separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparator->style);
2643 gtkPainter.
paintHline( gtkMenuSeparator,
"hseparator",
2644 separatorRect, GTK_STATE_NORMAL, gtkMenuSeparator->style,
2654 #ifndef QT_NO_COMBOBOX 2655 if (qobject_cast<const QComboBox*>(widget))
2656 rect = option->
rect;
2658 gtkPainter.
paintBox( gtkMenuItem,
"menuitem", rect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style);
2662 bool checked = menuItem->checked;
2664 bool ignoreCheckMark =
false;
2667 d->gtk_widget_style_get(
d->gtkWidget(
"GtkMenu.GtkCheckMenuItem"),
"indicator-size", &checkSize, NULL);
2669 int checkcol =
qMax(menuItem->maxIconWidth,
qMax(20, checkSize));
2671 #ifndef QT_NO_COMBOBOX 2673 if (qobject_cast<const QComboBox*>(widget))
2674 ignoreCheckMark =
true;
2677 if (!ignoreCheckMark) {
2680 checkRect =
visualRect(menuItem->direction, menuItem->rect, checkRect);
2682 if (checkable && menuItem->icon.isNull()) {
2688 GtkShadowType shadow = GTK_SHADOW_OUT;
2689 GtkStateType state = gtkPainter.
gtkState(option);
2692 state = GTK_STATE_PRELIGHT;
2694 shadow = GTK_SHADOW_IN;
2696 gtkPainter.
setClipRect(checkRect.adjusted(-spacing, -spacing, spacing, spacing));
2697 gtkPainter.
paintOption(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
2698 gtkMenuItem->style,
QLS(
"option"));
2703 if (menuItem->icon.isNull()) {
2704 GtkShadowType shadow = GTK_SHADOW_OUT;
2705 GtkStateType state = gtkPainter.
gtkState(option);
2708 state = GTK_STATE_PRELIGHT;
2710 shadow = GTK_SHADOW_IN;
2712 gtkPainter.
setClipRect(checkRect.adjusted(-spacing, -spacing, -spacing, -spacing));
2713 gtkPainter.
paintCheckbox(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
2714 gtkMenuItem->style,
QLS(
"check"));
2722 if (menuItem->icon.isNull())
2725 checkcol = menuItem->maxIconWidth;
2737 if (!menuItem->icon.isNull()) {
2745 QSize iconSize(smallIconSize, smallIconSize);
2747 #ifndef QT_NO_COMBOBOX 2748 if (
const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
2749 iconSize = combo->iconSize();
2751 #endif // QT_NO_COMBOBOX 2753 pixmap = menuItem->icon.pixmap(iconSize, mode,
QIcon::On);
2755 pixmap = menuItem->icon.pixmap(iconSize, mode);
2757 int pixw = pixmap.
width();
2758 int pixh = pixmap.
height();
2759 QRect pmr(0, 0, pixw, pixh);
2761 painter->
setPen(menuItem->palette.text().color());
2762 if (!ignoreCheckMark && checkable && checked) {
2771 opt.
rect = vCheckRect;
2777 GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL];
2778 GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE];
2779 GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT];
2781 QColor textColor =
QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
2782 QColor disabledTextColor =
QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8);
2788 QColor highlightedTextColor =
QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
2794 painter->
setPen(highlightedTextColor);
2796 painter->
setPen(textColor);
2802 int xpos = menuitem->
rect.
x() + xm + 1;
2803 QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
2819 int rightMargin = 12;
2824 p->
setPen(disabledTextColor);
2825 p->
drawText(vShortcutRect, text_flags , s.
mid(t + 1));
2837 p->
setPen(disabledTextColor);
2846 int arrow_size = fm.
ascent() + fm.
descent() - 2 * gtkMenuItem->style->ythickness;
2847 gfloat arrow_scaling = 0.8;
2849 if (!
d->gtk_check_version(2, 16, 0)) {
2852 d->gtk_widget_style_get(gtkMenuItem,
"arrow-scaling", &arrow_scaling, NULL);
2854 extra = 2 * gtkMenuItem->style->ythickness;
2857 int horizontal_padding;
2858 d->gtk_widget_style_get(gtkMenuItem,
"horizontal-padding", &horizontal_padding, NULL);
2860 const int dim =
static_cast<int>(arrow_size * arrow_scaling) + extra;
2861 int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim;
2863 QRect(xpos, menuItem->rect.top() +
2864 menuItem->rect.height() / 2 - dim / 2, dim, dim));
2865 GtkStateType state = enabled ? (act ? GTK_STATE_PRELIGHT: GTK_STATE_NORMAL) : GTK_STATE_INSENSITIVE;
2866 GtkShadowType shadowType = (state == GTK_STATE_PRELIGHT) ? GTK_SHADOW_OUT : GTK_SHADOW_IN;
2868 shadowType,
FALSE, style);
2875 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
2876 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
2880 gint interiorFocus =
true;
2881 d->gtk_widget_style_get(gtkButton,
"interior-focus", &interiorFocus, NULL);
2882 int xt = interiorFocus ? gtkButton->style->xthickness : 0;
2883 int yt = interiorFocus ? gtkButton->style->ythickness : 0;
2891 btn->state &
State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
2898 #ifndef QT_NO_TABBAR 2901 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
2902 GtkWidget *gtkNotebook =
d->gtkWidget(
"GtkNotebook");
2903 style = gtkPainter.
getStyle(gtkNotebook);
2906 GtkShadowType shadow = GTK_SHADOW_OUT;
2907 GtkStateType state = GTK_STATE_ACTIVE;
2909 state = GTK_STATE_NORMAL;
2912 bool first =
false, last =
false;
2916 last = tab->rect.right() == widget->
rect().
right();
2923 int bottomIndent = 1;
2927 switch (tab->shape) {
2930 rect.
adjust(first ? 0 : -tabOverlap, topIndent, last ? 0 : tabOverlap, -bottomIndent);
2932 state, shadow, GTK_POS_BOTTOM, style);
2937 rect.
adjust(first ? 0 : -tabOverlap, 0, last ? 0 : tabOverlap, -topIndent);
2939 state, shadow, GTK_POS_TOP, style);
2944 rect.
adjust(topIndent, 0, -bottomIndent, 0);
2945 gtkPainter.
paintExtention( gtkNotebook,
"tab", rect, state, shadow, GTK_POS_RIGHT, style);
2950 rect.
adjust(bottomIndent, 0, -topIndent, 0);
2951 gtkPainter.
paintExtention( gtkNotebook,
"tab", rect, state, shadow, GTK_POS_LEFT, style);
2964 #endif //QT_NO_TABBAR 2969 GtkWidget *gtkProgressBar =
d->gtkWidget(
"GtkProgressBar");
2970 GtkStateType state = gtkPainter.
gtkState(option);
2971 gtkPainter.
paintBox( gtkProgressBar,
"trough", option->
rect, state, GTK_SHADOW_IN, gtkProgressBar->style);
2978 GtkStateType state = option->
state &
State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
2979 GtkWidget *gtkProgressBar =
d->gtkWidget(
"GtkProgressBar");
2980 style = gtkProgressBar->style;
2981 gtkPainter.
paintBox( gtkProgressBar,
"trough", option->
rect, state, GTK_SHADOW_IN, style);
2982 int xt = style->xthickness;
2983 int yt = style->ythickness;
2985 bool vertical =
false;
2986 bool inverted =
false;
2987 bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
2992 inverted = bar2->invertedAppearance;
3006 int maxWidth = rect.
width();
3010 double vc6_workaround = ((progress -
qint64(bar->minimum)) /
double(
qint64(bar->maximum) -
qint64(bar->minimum))) * maxWidth;
3011 int progressBarWidth = (int(vc6_workaround) > minWidth ) ?
int(vc6_workaround) : minWidth;
3012 int width = indeterminate ? maxWidth : progressBarWidth;
3020 if (bar->minimum == bar->maximum)
3022 if (bar->progress == bar->maximum)
3024 else if (bar->progress > bar->minimum)
3025 fakePos = maximum - 1;
3027 d->gtk_progress_configure((GtkProgress*)gtkProgressBar, fakePos, 0, maximum);
3031 if (!indeterminate) {
3039 int slideWidth = ((rect.
width() - 4) * 2) / 3;
3040 int step = ((
d->animateStep * slideWidth) /
d->animationFps) % slideWidth;
3041 if ((((
d->animateStep * slideWidth) /
d->animationFps) % (2 * slideWidth)) >= slideWidth)
3042 step = slideWidth - step;
3051 gtkPainter.
paintBox( gtkProgressBar,
"bar", progressBar, GTK_STATE_SELECTED, GTK_SHADOW_OUT, style, key);
3070 if (!
d->isThemeAvailable())
3078 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3087 #ifndef QT_NO_GROUPBOX 3090 if (qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
3095 QRect frameRect = rect;
3096 frameRect.
setTop(topMargin);
3102 int leftMarginExtension = 8;
3106 if (
const QGroupBox *groupBoxWidget = qobject_cast<const QGroupBox *>(widget)) {
3121 if (groupBoxWidget->isCheckable())
3122 rect.
adjust(indicatorWidth + 4, 0, 0, 0);
3132 #ifndef QT_NO_SPINBOX 3135 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
3136 GtkWidget *gtkSpinButton =
d->gtkWidget(
"GtkSpinButton");
3137 int center = spinbox->rect.height() / 2;
3138 int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0;
3139 int yt = spinbox->frame ? gtkSpinButton->style->ythickness : 0;
3146 x = spinbox->rect.width() - y - bs.
width() + 2;
3150 switch (subControl) {
3155 rect =
QRect(x, xt, bs.
width(), center - yt);
3161 rect =
QRect(x, center, bs.
width(), spinbox->rect.bottom() - center - yt + 1);
3166 rect =
QRect(lx, yt, spinbox->rect.width() - 2*xt, spinbox->rect.height() - 2*yt);
3168 rect =
QRect(lx, yt, rx -
qMax(xt - 1, 0), spinbox->rect.height() - 2*yt);
3172 rect = spinbox->rect;
3178 rect =
visualRect(spinbox->direction, spinbox->rect, rect);
3183 #endif // Qt_NO_SPINBOX 3184 #ifndef QT_NO_COMBOBOX 3187 if (
const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
3189 GtkWidget *gtkCombo = box->editable ?
d->gtkWidget(
"GtkComboBoxEntry")
3190 :
d->gtkWidget(
"GtkComboBox");
3193 d->gtk_widget_size_allocate(gtkCombo, &geometry);
3196 if (!box->editable) {
3197 if (appears_as_list)
3198 arrowPath =
"GtkComboBox.GtkToggleButton";
3200 arrowPath =
"GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow";
3203 GtkWidget *arrowWidget =
d->gtkWidget(arrowPath);
3207 QRect buttonRect(option->
rect.
left() + arrowWidget->allocation.x,
3208 option->
rect.
top() + arrowWidget->allocation.y,
3209 arrowWidget->allocation.width, arrowWidget->allocation.height);
3211 switch (subControl) {
3219 int xMargin = box->editable ? 1 : 4, yMargin = 2;
3220 rect.
setRect(option->
rect.
left() + gtkCombo->style->xthickness + xMargin,
3221 option->
rect.
top() + gtkCombo->style->ythickness + yMargin,
3222 option->
rect.
width() - buttonRect.width() - 2*(gtkCombo->style->xthickness + xMargin),
3223 option->
rect.
height() - 2*(gtkCombo->style->ythickness + yMargin));
3235 #endif // QT_NO_COMBOBOX 3253 if (!
d->isThemeAvailable())
3259 if (
const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
3260 GtkWidget *gtkButton =
d->gtkWidget(
"GtkToolButton.GtkButton");
3261 newSize = size +
QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
3262 if (widget && qobject_cast<QToolBar *>(widget->
parentWidget())) {
3263 QSize minSize(0, 25);
3265 minSize = toolbutton->iconSize + QSize(12, 12);
3270 newSize += QSize(6, 0);
3274 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
3278 GtkWidget *gtkMenuSeparator =
d->gtkWidget(
"GtkMenu.GtkSeparatorMenuItem");
3279 GtkRequisition sizeReq = {0, 0};
3280 d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq);
3281 newSize =
QSize(size.
width(), sizeReq.height);
3285 GtkWidget *gtkMenuItem =
d->gtkWidget(
"GtkMenu.GtkCheckMenuItem");
3286 GtkStyle* style = gtkMenuItem->style;
3291 GtkRequisition sizeReq = {0, 0};
3292 d->gtk_widget_size_request(gtkMenuItem, &sizeReq);
3294 newSize +=
QSize(textMargin + style->xthickness - 1, 0);
3299 d->gtk_widget_style_get(gtkMenuItem,
"indicator-size", &checkSize, NULL);
3307 newSize = size +
QSize(0, -
d->gtkWidget(
"GtkSpinButton")->style->ythickness * 2);
3311 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
3312 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
3313 gint focusPadding, focusWidth;
3314 d->gtk_widget_style_get(gtkButton,
"focus-padding", &focusPadding, NULL);
3315 d->gtk_widget_style_get(gtkButton,
"focus-line-width", &focusWidth, NULL);
3317 newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness);
3318 newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
3320 GtkWidget *gtkButtonBox =
d->gtkWidget(
"GtkHButtonBox");
3321 gint minWidth = 85, minHeight = 0;
3322 d->gtk_widget_style_get(gtkButtonBox,
"child-min-width", &minWidth,
3323 "child-min-height", &minHeight, NULL);
3324 if (!btn->text.isEmpty() && newSize.
width() < minWidth)
3326 if (newSize.
height() < minHeight)
3333 GtkWidget *gtkSlider =
d->gtkWidget(
"GtkHScale");
3334 newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness);
3339 GtkWidget *gtkEntry =
d->gtkWidget(
"GtkEntry");
3340 newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness);
3345 newSize += QSize(0, 2);
3349 if (
const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
3350 GtkWidget *gtkCombo =
d->gtkWidget(
"GtkComboBox");
3352 newSize = size + QSize(12 + arrowButtonRect.
width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
3354 if (!(widget && qobject_cast<QToolBar *>(widget->
parentWidget())))
3355 newSize += QSize(0, 2);
3364 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
3365 if (!tab->icon.isNull())
3366 newSize += QSize(6, 0);
3368 newSize += QSize(1, 1);
3385 if (!
d->isThemeAvailable())
3454 if (!
d->isThemeAvailable())
3456 switch (standardIcon) {
3495 if (!
d->isThemeAvailable())
3502 return option->
rect;
3504 if (!
d->gtk_check_version(2, 10, 0)) {
3505 GtkWidget *gtkButton =
d->gtkWidget(
"GtkButton");
3506 GtkBorder *border = 0;
3507 d->gtk_widget_style_get(gtkButton,
"inner-border", &border, NULL);
3509 r = option->
rect.
adjusted(border->left, border->top, -border->right, -border->bottom);
3510 d->gtk_border_free(border);
3536 int alignment,
const QPixmap &pixmap)
const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define BEGIN_STYLE_PIXMAPCACHE(a)
void polish(QWidget *widget)
Reimplemented Function
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QPainter class performs low-level painting on widgets and other paint devices.
void setRed(int red)
Sets the red color component of this color to red.
The QColor class provides colors based on RGB, HSV or CMYK values.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
static int pmKey(const QSize &size, QIcon::Mode mode, QIcon::State state)
const QBrush & highlight() const
Returns the highlight brush of the current color group.
The QApplication class manages the GUI application's control flow and main settings.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
void setHeight(int h)
Sets the height of the rectangle to the given height.
const QBrush & base() const
Returns the base brush of the current color group.
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
SubControl
This enum describes the available sub controls.
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
StyleHint
This enum describes the available style hints.
The QStyleHintReturn class provides style hints that return more than basic data types.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
void setClipRect(const QRect &rect)
#define QT_END_NAMESPACE
This macro expands to.
Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook
const QColor & color() const
Returns the brush color.
void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail)
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
Reimplemented Function
int width() const
Returns the width of the pixmap.
ushort hue
Returns the hue color component of this color.
QPointer< QWidget > widget
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
Returns the given logicalPosition converted to screen coordinates based on the specified direction...
const QBrush & dark() const
Returns the dark brush of the current color group.
void paintExpander(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey=QString())
void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const
Reimplemented Function
void paintFocus(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, const QString &pmKey=QString())
static Ptr_gtk_widget_set_direction gtk_widget_set_direction
QStyle::State state
the style flags that are used when drawing the control
int descent() const
Returns the descent of the font.
void paintShadow(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &pmKey=QString())
static QString saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
void paintHandle(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style)
static const int groupBoxTitleMargin
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
void paintFlatBox(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &=QString())
void paintArrow(GtkWidget *gtkWidget, const gchar *part, const QRect &arrowrect, GtkArrowType arrow_type, GtkStateType state, GtkShadowType shadow, gboolean fill, GtkStyle *style, const QString &pmKey=QString())
void rotate(qreal a)
Rotates the coordinate system the given angle clockwise.
const QBrush & background() const
Use window() instead.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QGtkStyle()
Constructs a QGtkStyle object.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
ComplexControl
This enum describes the available complex controls.
static QPixmap getIcon(const char *iconName, GtkIconSize size=GTK_ICON_SIZE_BUTTON)
static C reverse(const C &l)
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook
void paintResizeGrip(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GdkWindowEdge edge, GtkStyle *style, const QString &pmKey=QString())
The QPointF class defines a point in the plane using floating point precision.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
void setGreen(int green)
Sets the green color component of this color to green.
void restore()
Restores the current painter state (pops a saved state off the stack).
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
State
This enum describes the state for which a pixmap is intended to be used.
PixelMetric
This enum describes the various available pixel metrics.
~QGtkStyle()
Destroys the QGtkStyle object.
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
#define END_STYLE_PIXMAPCACHE
int width() const
Returns the width of the rectangle.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
static const char *const dock_widget_close_xpm[]
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
void drawLine(const QLineF &line)
Draws a line defined by line.
ushort red
Returns the red color component of this color.
int height() const
Returns the height of the rectangle.
static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
void setFlipHorizontal(bool value)
GtkStateType gtkState(const QStyleOption *option)
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
static GdkColor fromQColor(const QColor &color)
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
Reimplemented Function
The QChar class provides a 16-bit Unicode character.
void paintSlider(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, GtkOrientation orientation, const QString &pmKey=QString())
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
void paintBox(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &pmKey=QString())
void save()
Saves the current painter state (pushes the state onto a stack).
void paintExtention(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkPositionType gap_pos, GtkStyle *style)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
StandardPixmap
This enum describes the available standard pixmaps.
static QPixmap * find(const QString &key)
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
QStyle::SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w) const
Reimplemented Function
void setWidth(int w)
Sets the width to the given width.
void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Reimplemented Function
int ascent() const
Returns the ascent of the font.
void setUsePixmapCache(bool value)
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
static const int groupBoxTopMargin
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Reimplemented Function
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
int width() const
Returns the width.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
static void setSystemFont(const QFont &font)
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
void drawControl(ControlElement control, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
ushort value
Returns the value color component of this color.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
Shape
This enum type lists the built-in shapes supported by QTabBar.
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Reimplemented Function
QPoint bottomRight() const
Returns the position of the rectangle's bottom-right corner.
QPoint brushOrigin() const
Returns the currently set brush origin.
static const int windowsItemFrame
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
The QStyleOption class stores the parameters used by QStyle functions.
int size() const
Returns the number of characters in this string.
ushort saturation
Returns the saturation color component of this color.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
ContentsType
This enum describes the available contents types.
The QTreeView class provides a default model/view implementation of a tree view.
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
const QFont & font() const
Returns the currently set font used for drawing text.
void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail)
QSize size() const
Returns the size of the rectangle.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
QColor dark(int f=200) const
Use darker(factor) instead.
The QStringList class provides a list of strings.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
static void clear()
Removes all pixmaps from the cache.
The QComboBox widget is a combined button and popup list.
QPalette standardPalette() const
Reimplemented Function
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
static const int groupBoxBottomMargin
int & rx()
Returns a reference to the x coordinate of this point.
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
The QImage class provides a hardware-independent image representation that allows direct access to th...
void transpose()
Swaps the width and height values.
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
static bool getGConfBool(const QString &key, bool fallback=0)
Returns the configuration boolean for key.
static QString getGConfString(const QString &key, const QString &fallback=QString())
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
#define FALSE
Synonym for false.
The QGroupBox widget provides a group box frame with a title.
The QSlider widget provides a vertical or horizontal slider.
The QRegion class specifies a clip region for a painter.
The QStyleOptionTabBarBase class is used to describe the base of a tab bar, i.e.
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
GtkStyle * getStyle(GtkWidget *gtkWidget)
The State element defines configurations of objects and properties.
static QString getGConfString(const QString &key, const QString &fallback=QString())
Returns the configuration string for value.
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
static const char *const dock_widget_restore_xpm[]
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
void setBlue(int blue)
Sets the blue color component of this color to blue.
void polish(QWidget *widget)
Reimplemented Function
void setAlphaSupport(bool value)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void moveCenter(const QPoint &p)
Moves the rectangle, leaving the center point at the given position.
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
#define TRUE
Synonym for true.
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
const QBrush & brush() const
Returns the painter's current brush.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
QPalette palette
the palette that should be used when painting the control
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QPoint center() const
Returns the center point of the rectangle.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook
The QAbstractItemView class provides the basic functionality for item view classes.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
The QCleanlooksStyle class provides a widget style similar to the Clearlooks style available in GNOME...
ushort blue
Returns the blue color component of this color.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
int right() const
Returns the x-coordinate of the rectangle's right edge.
PrimitiveElement
This enum describes the various primitive elements.
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor=50)
void paintHline(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, int x1, int x2, int y, const QString &pmKey=QString())
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
ushort alpha
Returns the alpha color component of this color.
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
Reimplemented Function
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QPalette standardPalette() const
Reimplemented Function
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
T qstyleoption_cast(const QStyleOption *opt)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int x() const
Returns the x-coordinate of the rectangle's left edge.
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
The QPoint class defines a point in the plane using integer precision.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
The QStyleOptionGroupBox class describes the parameters for drawing a group box.
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
void setWidth(int w)
Sets the width of the rectangle to the given width.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int height() const
Returns the height.
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
The QSpinBox class provides a spin box widget.
The QTextOption class provides a description of general rich text properties.
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width a...
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
static void setSystemPalette(const QPalette &pal)
static const int windowsItemHMargin
int y() const
Returns the y coordinate of this point.
const QStyle * proxy() const
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QPixmap class is an off-screen image representation that can be used as a paint device...
int styleHint(StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
ControlElement
This enum represents a control element.
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const
Reimplemented Function
The QSize class defines the size of a two-dimensional object using integer point precision.
void setFont(const QFont &f)
Sets the painter's font to the given font.
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
void unpolish(QWidget *widget)
Reimplemented Function
int x() const
Returns the x coordinate of this point.
The QStyleOptionComplex class is used to hold parameters that are common to all complex controls...
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
QRegion subtracted(const QRegion &r) const
Returns a region which is r subtracted from this region.
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
static const int windowsItemVMargin
The QStyleOptionProgressBar class is used to describe the parameters necessary for drawing a progress...
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
void drawPrimitive(PrimitiveElement elem, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
const QBrush & button() const
Returns the button brush of the current color group.
Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false...
QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
void paintVline(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkStyle *style, int y1, int y2, int x, const QString &pmKey=QString())
static bool getGConfBool(const QString &key, bool fallback=0)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Reimplemented Function
QRgb color(int i) const
Returns the color in the color table at index i.
int styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
Reimplemented Function
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
void unpolish(QWidget *widget)
Reimplemented Function
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
Reimplemented Function
const QBrush & text() const
Returns the text foreground brush of the current color group.
SubElement
This enum represents a sub-area of a widget.
The QGtkStyle class provides a widget style rendered by GTK+.
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
void paintBoxGap(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkPositionType gap_side, gint x, gint width, GtkStyle *style)
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
static const int windowsRightBorder
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.