Do not access GtkWidget::style directly, it doesn't exist in GTK3.
Change-Id: I947776848f5dd64011a40446fcdb9079f295f182
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
gdkBg = style->bg[GTK_STATE_NORMAL];
GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
gdkBg = style->bg[GTK_STATE_NORMAL];
- gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
+ gdkForeground = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_NORMAL];
// Our base and selected color is primarily used for text
// so we assume a gtkEntry will have the most correct value
// Our base and selected color is primarily used for text
// so we assume a gtkEntry will have the most correct value
- gdkBase = gtkEntry->style->base[GTK_STATE_NORMAL];
- gdkText = gtkEntry->style->text[GTK_STATE_NORMAL];
- gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
- gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED];
+ GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry);
+ gdkBase = gtkEntryStyle->base[GTK_STATE_NORMAL];
+ gdkText = gtkEntryStyle->text[GTK_STATE_NORMAL];
+ gdkSbg = gtkEntryStyle->base[GTK_STATE_SELECTED];
+ gdkSfg = gtkEntryStyle->text[GTK_STATE_SELECTED];
// The ACTIVE base color is really used for inactive windows
// The ACTIVE base color is really used for inactive windows
- gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE];
- gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE];
+ gdkaSbg = gtkEntryStyle->base[GTK_STATE_ACTIVE];
+ gdkaSfg = gtkEntryStyle->text[GTK_STATE_ACTIVE];
bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
// horizontal-padding is used by Maemo to get thicker borders
if (!d->gtk_check_version(2, 10, 0))
d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL);
// horizontal-padding is used by Maemo to get thicker borders
if (!d->gtk_check_version(2, 10, 0))
d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL);
- int padding = qMax<int>(gtkMenu->style->xthickness, horizontal_padding);
+ int padding = qMax<int>(d->gtk_widget_get_style(gtkMenu)->xthickness, horizontal_padding);
gint val;
d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
if (metric == PM_SliderControlThickness)
gint val;
d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
if (metric == PM_SliderControlThickness)
- return val + 2*gtkScale->style->ythickness;
+ return val + 2*d->gtk_widget_get_style(gtkScale)->ythickness;
case PM_MenuBarVMargin: {
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
case PM_MenuBarVMargin: {
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
- return qMax(0, gtkMenubar->style->ythickness);
+ return qMax(0, d->gtk_widget_get_style(gtkMenubar)->ythickness);
}
case PM_ScrollView_ScrollBarSpacing:
{
}
case PM_ScrollView_ScrollBarSpacing:
{
GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame");
d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL);
gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame");
d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL);
gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
- shadow_type, gtkStatusbarFrame->style);
+ shadow_type, d->gtk_widget_get_style(gtkStatusbarFrame));
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton");
GtkStateType state = gtkPainter.gtkState(option);
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton");
GtkStateType state = gtkPainter.gtkState(option);
- style = gtkTreeHeader->style;
+ style = d->gtk_widget_get_style(gtkTreeHeader);
GtkArrowType type = GTK_ARROW_UP;
// This sorting indicator inversion is intentional, and follows the GNOME HIG.
// See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable
GtkArrowType type = GTK_ARROW_UP;
// This sorting indicator inversion is intentional, and follows the GNOME HIG.
// See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable
state = GTK_STATE_PRELIGHT;
gtkPainter.paintExpander(gtkTreeView, "treeview", rect, state,
state = GTK_STATE_PRELIGHT;
gtkPainter.paintExpander(gtkTreeView, "treeview", rect, state,
- option->state & State_Open ? openState : closedState , gtkTreeView->style);
+ option->state & State_Open ? openState : closedState , d->gtk_widget_get_style(gtkTreeView));
gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect,
option->state & State_Selected ? GTK_STATE_SELECTED :
isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect,
option->state & State_Selected ? GTK_STATE_SELECTED :
isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_OUT, gtkTreeView->style, key);
+ GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkTreeView), key);
if (isActive )
GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
}
if (isActive )
GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
}
QRect rect = option->rect.adjusted(offset, margin, 0, -margin);
painter->setPen(QPen(option->palette.background().color().darker(110)));
gtkPainter.paintVline( gtkSeparator, "vseparator",
QRect rect = option->rect.adjusted(offset, margin, 0, -margin);
painter->setPen(QPen(option->palette.background().color().darker(110)));
gtkPainter.paintVline( gtkSeparator, "vseparator",
- rect, GTK_STATE_NORMAL, gtkSeparator->style,
+ rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator),
0, rect.height(), 0);
} else { //Draw vertical separator
const int offset = option->rect.height()/2;
QRect rect = option->rect.adjusted(margin, offset, -margin, 0);
painter->setPen(QPen(option->palette.background().color().darker(110)));
gtkPainter.paintHline( gtkSeparator, "hseparator",
0, rect.height(), 0);
} else { //Draw vertical separator
const int offset = option->rect.height()/2;
QRect rect = option->rect.adjusted(margin, offset, -margin, 0);
painter->setPen(QPen(option->palette.background().color().darker(110)));
gtkPainter.paintHline( gtkSeparator, "hseparator",
- rect, GTK_STATE_NORMAL, gtkSeparator->style,
+ rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator),
painter->setClipRect(option->rect);
gtkPainter.paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1),
GTK_STATE_NORMAL, shadow_type, !(option->state & State_Horizontal) ?
painter->setClipRect(option->rect);
gtkPainter.paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1),
GTK_STATE_NORMAL, shadow_type, !(option->state & State_Horizontal) ?
- GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, gtkToolbar->style);
+ GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, d->gtk_widget_get_style(gtkToolbar));
GdkColor color = fromQColor(arrowColor);
d->gtk_widget_modify_fg (gtkArrow, state, &color);
gtkPainter.paintArrow(gtkArrow, "button", arrowRect,
GdkColor color = fromQColor(arrowColor);
d->gtk_widget_modify_fg (gtkArrow, state, &color);
gtkPainter.paintArrow(gtkArrow, "button", arrowRect,
- type, state, shadow, false, gtkArrow->style,
+ type, state, shadow, false, d->gtk_widget_get_style(gtkArrow),
QString::number(arrowColor.rgba(), 16));
// Passing NULL will revert the color change
d->gtk_widget_modify_fg (gtkArrow, state, NULL);
QString::number(arrowColor.rgba(), 16));
// Passing NULL will revert the color change
d->gtk_widget_modify_fg (gtkArrow, state, NULL);
case PE_PanelMenu: {
GtkWidget *gtkMenu = d->gtkWidget("GtkMenu");
gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons
case PE_PanelMenu: {
GtkWidget *gtkMenu = d->gtkWidget("GtkMenu");
gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons
- gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString());
+ gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkMenu), QString());
GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_IN, gtkEntry->style,
+ GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry),
option->state & State_HasFocus ? QLS("focus") : QString());
if (!interior_focus && option->state & State_HasFocus)
gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
option->state & State_HasFocus ? QLS("focus") : QString());
if (!interior_focus && option->state & State_HasFocus)
gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_IN, gtkEntry->style, QLS("GtkEntryShadowIn"));
+ GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLS("GtkEntryShadowIn"));
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
if (panel->lineWidth > 0)
proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
uint resolve_mask = option->palette.resolve();
if (panel->lineWidth > 0)
proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
uint resolve_mask = option->palette.resolve();
- QRect textRect = option->rect.adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness,
- -gtkEntry->style->xthickness, -gtkEntry->style->ythickness);
+ GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry);
+ QRect textRect = option->rect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness,
+ -gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness);
if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
painter->fillRect(textRect, option->palette.base());
else
gtkPainter.paintFlatBox( gtkEntry, "entry_bg", textRect,
if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
painter->fillRect(textRect, option->palette.base());
else
gtkPainter.paintFlatBox( gtkEntry, "entry_bg", textRect,
- option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntry->style);
+ option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntryStyle);
"focus-padding", &focusPad,
"interior-focus", &interiorFocus, NULL);
"focus-padding", &focusPad,
"interior-focus", &interiorFocus, NULL);
- style = gtkButton->style;
+ style = d->gtk_widget_get_style(gtkButton);
QRect buttonRect = option->rect;
QRect buttonRect = option->rect;
key += QLatin1Char('f');
GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
}
key += QLatin1Char('f');
GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
}
- gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, key);
+ gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, d->gtk_widget_get_style(gtkRadioButton), key);
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
}
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
}
QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
- gtkPainter.paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtkCheckButton->style,
+ gtkPainter.paintCheckbox(gtkCheckButton, checkRect, state, shadow, d->gtk_widget_get_style(gtkCheckButton),
key);
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
key);
if (option->state & State_HasFocus)
GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
if (option->state & State_MouseOver) {
QRect bgRect = textRect | checkBoxRect;
gtkPainter.paintFlatBox(gtkCheckButton, "checkbutton", bgRect.adjusted(0, 0, 0, -2),
if (option->state & State_MouseOver) {
QRect bgRect = textRect | checkBoxRect;
gtkPainter.paintFlatBox(gtkCheckButton, "checkbutton", bgRect.adjusted(0, 0, 0, -2),
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkCheckButton->style);
+ GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkCheckButton));
}
if (!groupBox->text.isEmpty()) {
}
if (!groupBox->text.isEmpty()) {
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
- GdkColor gdkText = gtkCheckButton->style->fg[labelState];
+ GdkColor gdkText = d->gtk_widget_get_style(gtkCheckButton)->fg[labelState];
textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
painter->setPen(textColor);
QFont font = painter->font();
textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
painter->setPen(textColor);
QFont font = painter->font();
// Fill the line edit background
// We could have used flat_box with "entry_bg" but that is probably not worth the overhead
uint resolve_mask = option->palette.resolve();
// Fill the line edit background
// We could have used flat_box with "entry_bg" but that is probably not worth the overhead
uint resolve_mask = option->palette.resolve();
- int xt = gtkEntry->style->xthickness;
- int yt = gtkEntry->style->ythickness;
- QRect contentRect = frameRect.adjusted(xt, yt, -xt, -yt);
+ GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry);
+ QRect contentRect = frameRect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness,
+ -gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness);
// Required for inner blue highlight with clearlooks
if (focus)
GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
// Required for inner blue highlight with clearlooks
if (focus)
GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
else {
gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
else {
gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_NONE, gtkEntry->style, entryPath.toString() + QString::number(focus));
+ GTK_SHADOW_NONE, gtkEntryStyle, entryPath.toString() + QString::number(focus));
}
gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState,
}
gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState,
- GTK_SHADOW_IN, gtkEntry->style, entryPath.toString() +
+ GTK_SHADOW_IN, gtkEntryStyle, entryPath.toString() +
QString::number(focus) + QString::number(comboBox->editable) +
QString::number(option->direction));
if (focus)
QString::number(focus) + QString::number(comboBox->editable) +
QString::number(option->direction));
if (focus)
Q_ASSERT(gtkToggleButton);
gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
Q_ASSERT(gtkToggleButton);
gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
- shadow, gtkToggleButton->style, buttonPath.toString() +
+ shadow, d->gtk_widget_get_style(gtkToggleButton), buttonPath.toString() +
QString::number(focus) + QString::number(option->direction));
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
} else {
// Draw combo box as a button
QRect buttonRect = option->rect;
QString::number(focus) + QString::number(option->direction));
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
} else {
// Draw combo box as a button
QRect buttonRect = option->rect;
+ GtkStyle *gtkToggleButtonStyle = d->gtk_widget_get_style(gtkToggleButton);
if (focus) // Clearlooks actually check the widget for the default state
GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
gtkCachedPainter.paintBox(gtkToggleButton, "button",
buttonRect, state,
if (focus) // Clearlooks actually check the widget for the default state
GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
gtkCachedPainter.paintBox(gtkToggleButton, "button",
buttonRect, state,
- shadow, gtkToggleButton->style,
+ shadow, gtkToggleButtonStyle,
buttonPath.toString() + QString::number(focus));
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
buttonPath.toString() + QString::number(focus));
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
QRect vLineRect(allocation.x, allocation.y, allocation.width, allocation.height);
gtkCachedPainter.paintVline( gtkVSeparator, "vseparator",
QRect vLineRect(allocation.x, allocation.y, allocation.width, allocation.height);
gtkCachedPainter.paintVline( gtkVSeparator, "vseparator",
- vLineRect, state, gtkVSeparator->style,
+ vLineRect, state, d->gtk_widget_get_style(gtkVSeparator),
0, vLineRect.height(), 0, vSeparatorPath.toString());
gint interiorFocus = true;
d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
0, vLineRect.height(), 0, vSeparatorPath.toString());
gint interiorFocus = true;
d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
- int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
- int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
+ GtkStyle *gtkToggleButtonStyle = gtkToggleButtonStyle;
+ int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0;
+ int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0;
if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
gtkCachedPainter.paintFocus(gtkToggleButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
gtkCachedPainter.paintFocus(gtkToggleButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
- gtkToggleButton->style);
GtkAllocation allocation;
d->gtk_widget_get_allocation(gtkArrow, &allocation);
arrowWidgetRect = QRect(allocation.x, allocation.y, allocation.width, allocation.height);
GtkAllocation allocation;
d->gtk_widget_get_allocation(gtkArrow, &allocation);
arrowWidgetRect = QRect(allocation.x, allocation.y, allocation.width, allocation.height);
- style = gtkArrow->style;
+ style = d->gtk_widget_get_style(gtkArrow);
}
// Note that for some reason the arrow-size is not properly respected with Hildon
// Hence we enforce the minimum "arrow-size" ourselves
}
// Note that for some reason the arrow-size is not properly respected with Hildon
// Hence we enforce the minimum "arrow-size" ourselves
- int arrowSize = qMax(qMin(rect.height() - gtkCombo->style->ythickness * 2, minSize),
+ int arrowSize = qMax(qMin(rect.height() - d->gtk_widget_get_style(gtkCombo)->ythickness * 2, minSize),
qMin(arrowWidgetRect.width(), arrowWidgetRect.height()));
QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale));
qMin(arrowWidgetRect.width(), arrowWidgetRect.height()));
QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale));
QPalette pal = toolbutton->palette;
if (option->state & State_Enabled &&
option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) {
QPalette pal = toolbutton->palette;
if (option->state & State_Enabled &&
option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) {
- GdkColor gdkText = gtkButton->style->fg[GTK_STATE_PRELIGHT];
+ GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_PRELIGHT];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::All, QPalette::ButtonText, textColor);
label.palette = pal;
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::All, QPalette::ButtonText, textColor);
label.palette = pal;
QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
bool horizontal = scrollBar->orientation == Qt::Horizontal;
GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
bool horizontal = scrollBar->orientation == Qt::Horizontal;
GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
- style = scrollbarWidget->style;
+ style = d->gtk_widget_get_style(scrollbarWidget);
gboolean trough_under_steppers = true;
gboolean trough_side_details = false;
gboolean activate_slider = false;
gboolean trough_under_steppers = true;
gboolean trough_side_details = false;
gboolean activate_slider = false;
option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key);
option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key);
- gtkPainter.paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, gtkSpinButton->style, key);
+ gtkPainter.paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkSpinButton), key);
if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
gtkPainter.paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key);
if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
gtkPainter.paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key);
QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
- style = scaleWidget->style;
+ style = d->gtk_widget_get_style(scaleWidget);
if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
QRect leftRect;
QRect rect = bar->rect;
QRect leftRect;
QRect rect = bar->rect;
- GdkColor gdkText = gtkProgressBar->style->fg[GTK_STATE_NORMAL];
+ GtkStyle *gtkProgressBarStyle = d->gtk_widget_get_style(gtkProgressBar);
+ GdkColor gdkText = gtkProgressBarStyle->fg[GTK_STATE_NORMAL];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- gdkText = gtkProgressBar->style->fg[GTK_STATE_PRELIGHT];
+ gdkText = gtkProgressBarStyle->fg[GTK_STATE_PRELIGHT];
QColor alternateTextColor= QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
painter->save();
QColor alternateTextColor= QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
painter->save();
labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ?
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ?
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
- GdkColor gdkText = gtkButton->style->fg[labelState];
+ GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[labelState];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::ButtonText, textColor);
proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::ButtonText, textColor);
proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
if (option->state & State_MouseOver) {
gtkPainter.paintFlatBox(gtkRadioButton, "checkbutton", option->rect,
if (option->state & State_MouseOver) {
gtkPainter.paintFlatBox(gtkRadioButton, "checkbutton", option->rect,
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkRadioButton->style);
+ GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkRadioButton));
}
QStyleOptionButton subopt = *btn;
}
QStyleOptionButton subopt = *btn;
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
- GdkColor gdkText = gtkRadioButton->style->fg[labelState];
+ GdkColor gdkText = d->gtk_widget_get_style(gtkRadioButton)->fg[labelState];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::WindowText, textColor);
subopt.palette = pal;
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::WindowText, textColor);
subopt.palette = pal;
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
if (option->state & State_Enabled)
labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
- GdkColor gdkText = gtkCombo->style->fg[labelState];
+ GdkColor gdkText = d->gtk_widget_get_style(gtkCombo)->fg[labelState];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
if (option->state & State_Sunken)
shadow = GTK_SHADOW_IN;
if (option->state & State_Sunken)
shadow = GTK_SHADOW_IN;
- gtkPainter.paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, gtkTreeHeader->style);
+ gtkPainter.paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, d->gtk_widget_get_style(gtkTreeHeader));
case CE_SizeGrip: {
GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame");
case CE_SizeGrip: {
GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame");
- QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
+ GtkStyle *gtkStatusbarStyle = d->gtk_widget_get_style(gtkStatusbar);
+ QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbarStyle->xthickness, -gtkStatusbarStyle->ythickness);
gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
GTK_SHADOW_OUT, QApplication::isRightToLeft() ?
GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
GTK_SHADOW_OUT, QApplication::isRightToLeft() ?
GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
case CE_MenuBarEmptyArea: {
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
case CE_MenuBarEmptyArea: {
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
- GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
+ GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
if (widget) { // See CE_MenuBarItem
QRect menuBarRect = widget->rect();
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
if (widget) { // See CE_MenuBarItem
QRect menuBarRect = widget->rect();
GtkShadowType shadow_type;
d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
gtkMenuBarPainter.paintBox( gtkMenubar, "menubar", menuBarRect,
GtkShadowType shadow_type;
d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
gtkMenuBarPainter.paintBox( gtkMenubar, "menubar", menuBarRect,
- GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
+ GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar));
pmPainter.end();
painter->drawPixmap(option->rect, pixmap, option->rect);
}
pmPainter.end();
painter->drawPixmap(option->rect, pixmap, option->rect);
}
GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem");
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem");
GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar");
- style = gtkMenubarItem->style;
+ style = d->gtk_widget_get_style(gtkMenubarItem);
if (widget) {
// Since Qt does not currently allow filling the entire background
if (widget) {
// Since Qt does not currently allow filling the entire background
QGtkPainter menubarPainter(&pmPainter);
GtkShadowType shadow_type;
d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
QGtkPainter menubarPainter(&pmPainter);
GtkShadowType shadow_type;
d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
- GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
+ GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
menubarPainter.paintBox(gtkMenubar, "menubar", menuBarRect,
painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
menubarPainter.paintBox(gtkMenubar, "menubar", menuBarRect,
- GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
+ GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar));
pmPainter.end();
painter->drawPixmap(option->rect, pixmap, option->rect);
}
pmPainter.end();
painter->drawPixmap(option->rect, pixmap, option->rect);
}
bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
bool dis = !(mbi->state & State_Enabled);
item.rect = mbi->rect;
bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
bool dis = !(mbi->state & State_Enabled);
item.rect = mbi->rect;
- GdkColor gdkText = gtkMenubarItem->style->fg[dis ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL];
- GdkColor gdkHText = gtkMenubarItem->style->fg[GTK_STATE_PRELIGHT];
+ GdkColor gdkText = style->fg[dis ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL];
+ GdkColor gdkHText = style->fg[GTK_STATE_PRELIGHT];
QColor normalTextColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
item.palette.setBrush(QPalette::HighlightedText, highlightedTextColor);
QColor normalTextColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
item.palette.setBrush(QPalette::HighlightedText, highlightedTextColor);
GtkShadowType shadowType = GTK_SHADOW_NONE;
d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL);
gtkPainter.paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3),
GtkShadowType shadowType = GTK_SHADOW_NONE;
d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL);
gtkPainter.paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3),
- GTK_STATE_PRELIGHT, shadowType, gtkMenubarItem->style);
+ GTK_STATE_PRELIGHT, shadowType, style);
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
GtkShadowType shadow_type = GTK_SHADOW_NONE;
d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
gtkPainter.paintBox( gtkToolbar, "toolbar", rect,
GtkShadowType shadow_type = GTK_SHADOW_NONE;
d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
gtkPainter.paintBox( gtkToolbar, "toolbar", rect,
- GTK_STATE_NORMAL, shadow_type, gtkToolbar->style);
+ GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkToolbar));
"horizontal-padding", &horizontal_padding,
NULL);
}
"horizontal-padding", &horizontal_padding,
NULL);
}
- separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparator->style->ythickness);
- separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparator->style->xthickness));
+ GtkStyle *gtkMenuSeparatorStyle = d->gtk_widget_get_style(gtkMenuSeparator);
+ separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparatorStyle->ythickness);
+ separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparatorStyle->xthickness));
separatorRect.moveCenter(option->rect.center());
if (wide_separators)
gtkPainter.paintBox( gtkMenuSeparator, "hseparator",
separatorRect.moveCenter(option->rect.center());
if (wide_separators)
gtkPainter.paintBox( gtkMenuSeparator, "hseparator",
- separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparator->style);
+ separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparatorStyle);
else
gtkPainter.paintHline( gtkMenuSeparator, "hseparator",
else
gtkPainter.paintHline( gtkMenuSeparator, "hseparator",
- separatorRect, GTK_STATE_NORMAL, gtkMenuSeparator->style,
+ separatorRect, GTK_STATE_NORMAL, gtkMenuSeparatorStyle,
0, option->rect.right() - 1, 1);
painter->restore();
break;
0, option->rect.right() - 1, 1);
painter->restore();
break;
gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, spacing, spacing));
gtkPainter.paintOption(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, spacing, spacing));
gtkPainter.paintOption(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
- gtkMenuItem->style, QLS("option"));
gtkPainter.setClipRect(QRect());
} else {
gtkPainter.setClipRect(QRect());
} else {
gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, -spacing, -spacing));
gtkPainter.paintCheckbox(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, -spacing, -spacing));
gtkPainter.paintCheckbox(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
- gtkMenuItem->style, QLS("check"));
gtkPainter.setClipRect(QRect());
}
}
gtkPainter.setClipRect(QRect());
}
}
painter->drawPixmap(pmr.topLeft(), pixmap);
}
painter->drawPixmap(pmr.topLeft(), pixmap);
}
- GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL];
- GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE];
- GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT];
+ GdkColor gdkText = style->fg[GTK_STATE_NORMAL];
+ GdkColor gdkDText = style->fg[GTK_STATE_INSENSITIVE];
+ GdkColor gdkHText = style->fg[GTK_STATE_PRELIGHT];
uint resolve_mask = option->palette.resolve();
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8);
uint resolve_mask = option->palette.resolve();
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8);
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
QFontMetrics fm(menuitem->font);
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
QFontMetrics fm(menuitem->font);
- int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
+ int arrow_size = fm.ascent() + fm.descent() - 2 * style->ythickness;
gfloat arrow_scaling = 0.8;
int extra = 0;
if (!d->gtk_check_version(2, 16, 0)) {
gfloat arrow_scaling = 0.8;
int extra = 0;
if (!d->gtk_check_version(2, 16, 0)) {
// though the current documentation states otherwise
d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL);
// in versions < 2.16 ythickness was previously subtracted from the arrow_size
// though the current documentation states otherwise
d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL);
// in versions < 2.16 ythickness was previously subtracted from the arrow_size
- extra = 2 * gtkMenuItem->style->ythickness;
+ extra = 2 * style->ythickness;
}
int horizontal_padding;
}
int horizontal_padding;
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
gint interiorFocus = true;
d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL);
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
gint interiorFocus = true;
d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL);
- int xt = interiorFocus ? gtkButton->style->xthickness : 0;
- int yt = interiorFocus ? gtkButton->style->ythickness : 0;
+ GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton);
+ int xt = interiorFocus ? gtkButtonStyle->xthickness : 0;
+ int yt = interiorFocus ? gtkButtonStyle->ythickness : 0;
if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
// The normal button focus rect does not work well for flat buttons in Clearlooks
if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
// The normal button focus rect does not work well for flat buttons in Clearlooks
gtkPainter.paintFocus(gtkButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
gtkPainter.paintFocus(gtkButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
}
proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
}
Q_UNUSED(bar);
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
GtkStateType state = gtkPainter.gtkState(option);
Q_UNUSED(bar);
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
GtkStateType state = gtkPainter.gtkState(option);
- gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style);
+ gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkProgressBar));
if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar");
- style = gtkProgressBar->style;
+ style = d->gtk_widget_get_style(gtkProgressBar);
gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style);
int xt = style->xthickness;
int yt = style->ythickness;
gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style);
int xt = style->xthickness;
int yt = style->ythickness;
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton");
int center = spinbox->rect.height() / 2;
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton");
int center = spinbox->rect.height() / 2;
- int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0;
- int yt = spinbox->frame ? gtkSpinButton->style->ythickness : 0;
+ GtkStyle *gtkSpinButtonStyle = d->gtk_widget_get_style(gtkSpinButton);
+ int xt = spinbox->frame ? gtkSpinButtonStyle->xthickness : 0;
+ int yt = spinbox->frame ? gtkSpinButtonStyle->ythickness : 0;
case SC_ComboBoxEditField: {
rect = visualRect(option->direction, option->rect, rect);
int xMargin = box->editable ? 1 : 4, yMargin = 2;
case SC_ComboBoxEditField: {
rect = visualRect(option->direction, option->rect, rect);
int xMargin = box->editable ? 1 : 4, yMargin = 2;
- rect.setRect(option->rect.left() + gtkCombo->style->xthickness + xMargin,
- option->rect.top() + gtkCombo->style->ythickness + yMargin,
- option->rect.width() - buttonRect.width() - 2*(gtkCombo->style->xthickness + xMargin),
- option->rect.height() - 2*(gtkCombo->style->ythickness + yMargin));
+ GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo);
+ rect.setRect(option->rect.left() + gtkComboStyle->xthickness + xMargin,
+ option->rect.top() + gtkComboStyle->ythickness + yMargin,
+ option->rect.width() - buttonRect.width() - 2*(gtkComboStyle->xthickness + xMargin),
+ option->rect.height() - 2*(gtkComboStyle->ythickness + yMargin));
rect = visualRect(option->direction, option->rect, rect);
break;
}
rect = visualRect(option->direction, option->rect, rect);
break;
}
case CT_ToolButton:
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton");
case CT_ToolButton:
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton");
- newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
+ GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton);
+ newSize = size + QSize(2 * gtkButtonStyle->xthickness, 2 + 2 * gtkButtonStyle->ythickness);
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
QSize minSize(0, 25);
if (toolbutton->toolButtonStyle != Qt::ToolButtonTextOnly)
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
QSize minSize(0, 25);
if (toolbutton->toolButtonStyle != Qt::ToolButtonTextOnly)
}
GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem");
}
GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem");
- GtkStyle* style = gtkMenuItem->style;
+ GtkStyle* style = d->gtk_widget_get_style(gtkMenuItem);
// Note we get the perfect height for the default font since we
// set a fake text label on the gtkMenuItem
// Note we get the perfect height for the default font since we
// set a fake text label on the gtkMenuItem
break;
case CT_SpinBox:
// QSpinBox does some nasty things that depends on CT_LineEdit
break;
case CT_SpinBox:
// QSpinBox does some nasty things that depends on CT_LineEdit
- newSize = size + QSize(0, -d->gtkWidget("GtkSpinButton")->style->ythickness * 2);
+ newSize = size + QSize(0, -d->gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2);
break;
case CT_RadioButton:
case CT_CheckBox:
break;
case CT_RadioButton:
case CT_CheckBox:
d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL);
newSize = size;
d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL);
newSize = size;
- newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness);
+ GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton);
+ newSize += QSize(2*gtkButtonStyle->xthickness + 4, 2*gtkButtonStyle->ythickness);
newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox");
newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox");
break;
case CT_Slider: {
GtkWidget *gtkSlider = d->gtkWidget("GtkHScale");
break;
case CT_Slider: {
GtkWidget *gtkSlider = d->gtkWidget("GtkHScale");
- newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness); }
+ GtkStyle *gtkSliderStyle = d->gtk_widget_get_style(gtkSlider);
+ newSize = size + QSize(2*gtkSliderStyle->xthickness, 2*gtkSliderStyle->ythickness); }
break;
case CT_LineEdit: {
GtkWidget *gtkEntry = d->gtkWidget("GtkEntry");
break;
case CT_LineEdit: {
GtkWidget *gtkEntry = d->gtkWidget("GtkEntry");
- newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness); }
+ GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry);
+ newSize = size + QSize(2*gtkEntryStyle->xthickness, 2 + 2*gtkEntryStyle->ythickness); }
break;
case CT_ItemViewItem:
newSize += QSize(0, 2);
break;
case CT_ItemViewItem:
newSize += QSize(0, 2);
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox");
QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox");
QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
- newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
+ GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo);
+ newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkComboStyle->xthickness, 4 + 2*gtkComboStyle->ythickness);
if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
newSize += QSize(0, 2);
if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
newSize += QSize(0, 2);
Ptr_gtk_range_set_inverted QGtkStylePrivate::gtk_range_set_inverted = 0;
Ptr_gtk_icon_factory_lookup_default QGtkStylePrivate::gtk_icon_factory_lookup_default = 0;
Ptr_gtk_icon_theme_get_default QGtkStylePrivate::gtk_icon_theme_get_default = 0;
Ptr_gtk_range_set_inverted QGtkStylePrivate::gtk_range_set_inverted = 0;
Ptr_gtk_icon_factory_lookup_default QGtkStylePrivate::gtk_icon_factory_lookup_default = 0;
Ptr_gtk_icon_theme_get_default QGtkStylePrivate::gtk_icon_theme_get_default = 0;
+Ptr_gtk_widget_get_style QGtkStylePrivate::gtk_widget_get_style = 0;
Ptr_gtk_widget_style_get QGtkStylePrivate::gtk_widget_style_get = 0;
Ptr_gtk_icon_set_render_icon QGtkStylePrivate::gtk_icon_set_render_icon = 0;
Ptr_gtk_fixed_new QGtkStylePrivate::gtk_fixed_new = 0;
Ptr_gtk_widget_style_get QGtkStylePrivate::gtk_widget_style_get = 0;
Ptr_gtk_icon_set_render_icon QGtkStylePrivate::gtk_icon_set_render_icon = 0;
Ptr_gtk_fixed_new QGtkStylePrivate::gtk_fixed_new = 0;
GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path)
{
if (GtkWidget *w = gtkWidgetMap()->value(path))
GtkStyle* QGtkStylePrivate::gtkStyle(const QHashableLatin1Literal &path)
{
if (GtkWidget *w = gtkWidgetMap()->value(path))
+ return QGtkStylePrivate::gtk_widget_get_style(w);
gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add");
gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default");
gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default");
gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add");
gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default");
gtk_icon_theme_get_default = (Ptr_gtk_icon_theme_get_default)libgtk.resolve("gtk_icon_theme_get_default");
+ gtk_widget_get_style = (Ptr_gtk_widget_get_style)libgtk.resolve("gtk_widget_get_style");
gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get");
gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon");
gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new");
gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get");
gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon");
gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new");
{
const int MIN_ARROW_WIDTH = 6;
GtkWidget *spinButton = gtkWidget("GtkSpinButton");
{
const int MIN_ARROW_WIDTH = 6;
GtkWidget *spinButton = gtkWidget("GtkSpinButton");
- GtkStyle *style = spinButton->style;
+ GtkStyle *style = QGtkStylePrivate::gtk_widget_get_style(spinButton);
gint size = pango_font_description_get_size (style->font_desc);
gint arrow_size;
arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness;
gint size = pango_font_description_get_size (style->font_desc);
gint arrow_size;
arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness;
void QGtkStylePrivate::applyCustomPaletteHash()
{
QPalette menuPal = gtkWidgetPalette("GtkMenu");
void QGtkStylePrivate::applyCustomPaletteHash()
{
QPalette menuPal = gtkWidgetPalette("GtkMenu");
- GdkColor gdkBg = gtkWidget("GtkMenu")->style->bg[GTK_STATE_NORMAL];
+ GdkColor gdkBg = QGtkStylePrivate::gtk_widget_get_style(gtkWidget("GtkMenu"))->bg[GTK_STATE_NORMAL];
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
menuPal.setBrush(QPalette::Base, bgColor);
menuPal.setBrush(QPalette::Window, bgColor);
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
menuPal.setBrush(QPalette::Base, bgColor);
menuPal.setBrush(QPalette::Window, bgColor);
GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName);
Q_ASSERT(gtkWidget);
QPalette pal = QApplication::palette();
GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName);
Q_ASSERT(gtkWidget);
QPalette pal = QApplication::palette();
- GdkColor gdkBg = gtkWidget->style->bg[GTK_STATE_NORMAL];
- GdkColor gdkText = gtkWidget->style->fg[GTK_STATE_NORMAL];
- GdkColor gdkDisabledText = gtkWidget->style->fg[GTK_STATE_INSENSITIVE];
+ GdkColor gdkBg = gtk_widget_get_style(gtkWidget)->bg[GTK_STATE_NORMAL];
+ GdkColor gdkText = gtk_widget_get_style(gtkWidget)->fg[GTK_STATE_NORMAL];
+ GdkColor gdkDisabledText = gtk_widget_get_style(gtkWidget)->fg[GTK_STATE_INSENSITIVE];
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
QColor textColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor disabledTextColor(gdkDisabledText.red>>8, gdkDisabledText.green>>8, gdkDisabledText.blue>>8);
QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
QColor textColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
QColor disabledTextColor(gdkDisabledText.red>>8, gdkDisabledText.green>>8, gdkDisabledText.blue>>8);
typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget);
typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*);
typedef GtkIconTheme* (*Ptr_gtk_icon_theme_get_default) (void);
typedef void (*Ptr_gtk_container_add)(GtkContainer *container, GtkWidget *widget);
typedef GtkIconSet* (*Ptr_gtk_icon_factory_lookup_default) (const gchar*);
typedef GtkIconTheme* (*Ptr_gtk_icon_theme_get_default) (void);
+typedef GtkStyle* (*Ptr_gtk_widget_get_style)(GtkWidget *);
typedef void (*Ptr_gtk_widget_style_get)(GtkWidget *, const gchar *first_property_name, ...);
typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_column_new)(void);
typedef GtkWidget* (*Ptr_gtk_fixed_new)(void);
typedef void (*Ptr_gtk_widget_style_get)(GtkWidget *, const gchar *first_property_name, ...);
typedef GtkTreeViewColumn* (*Ptr_gtk_tree_view_column_new)(void);
typedef GtkWidget* (*Ptr_gtk_fixed_new)(void);
static Ptr_gtk_range_set_inverted gtk_range_set_inverted;
static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default;
static Ptr_gtk_icon_theme_get_default gtk_icon_theme_get_default;
static Ptr_gtk_range_set_inverted gtk_range_set_inverted;
static Ptr_gtk_icon_factory_lookup_default gtk_icon_factory_lookup_default;
static Ptr_gtk_icon_theme_get_default gtk_icon_theme_get_default;
+ static Ptr_gtk_widget_get_style gtk_widget_get_style;
static Ptr_gtk_widget_style_get gtk_widget_style_get;
static Ptr_gtk_icon_set_render_icon gtk_icon_set_render_icon;
static Ptr_gtk_fixed_new gtk_fixed_new;
static Ptr_gtk_widget_style_get gtk_widget_style_get;
static Ptr_gtk_icon_set_render_icon gtk_icon_set_render_icon;
static Ptr_gtk_fixed_new gtk_fixed_new;