vcl/inc/unx/gtk/gtkgdi.hxx | 4 ++ vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 44 +++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 13 deletions(-)
New commits: commit 7f1af0a1c7401552704eaba2091b078890567cd8 Author: Caolán McNamara <[email protected]> Date: Thu Nov 17 15:31:38 2016 +0000 put the render frame at the end of these blocks too Change-Id: I72270faa4138377ea04467ad0c6f01a3de0156b6 diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 4a957bb..f3edc2b 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -685,9 +685,6 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context, gtk_render_background(context, cr, buttonRect.Left(), buttonRect.Top(), buttonRect.GetWidth(), buttonRect.GetHeight() ); - gtk_render_frame(context, cr, - buttonRect.Left(), buttonRect.Top(), - buttonRect.GetWidth(), buttonRect.GetHeight() ); gint iconWidth = (buttonRect.GetWidth() - padding.left - padding.right - border.left - border.right); gint iconHeight = (buttonRect.GetHeight() - padding.top - padding.bottom - border.top - border.bottom); @@ -710,6 +707,10 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context, gtk_render_icon(context, cr, pixbuf, arrowRect.Left(), arrowRect.Top()); g_object_unref(pixbuf); + + gtk_render_frame(context, cr, + buttonRect.Left(), buttonRect.Top(), + buttonRect.GetWidth(), buttonRect.GetHeight() ); } void GtkSalGraphics::PaintSpinButton(GtkStateFlags flags, @@ -1758,12 +1759,13 @@ void GtkSalGraphics::PaintCheckOrRadio(cairo_t *cr, GtkStyleContext *context, if (!bInMenu) gtk_render_background(context, cr, x, y, indicator_size, indicator_size); - gtk_render_frame(context, cr, x, y, indicator_size, indicator_size); if (bIsCheck) gtk_render_check(context, cr, x, y, indicator_size, indicator_size); else gtk_render_option(context, cr, x, y, indicator_size, indicator_size); + + gtk_render_frame(context, cr, x, y, indicator_size, indicator_size); } void GtkSalGraphics::PaintCheck(cairo_t *cr, GtkStyleContext *context, @@ -2142,7 +2144,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co case RenderType::Progress: { gtk_render_background(mpProgressBarTroughStyle, cr, nX, nY, nWidth, nHeight); - gtk_render_frame(mpProgressBarTroughStyle, cr, nX, nY, nWidth, nHeight); + long nProgressWidth = rValue.getNumericVal(); if (nProgressWidth) { @@ -2157,6 +2159,8 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co gtk_render_frame(context, cr, nX, nY, nProgressWidth, nHeight); } + gtk_render_frame(mpProgressBarTroughStyle, cr, nX, nY, nWidth, nHeight); + break; } case RenderType::TabItem: commit 4579c43861635dda15158478404aa90151228e91 Author: Caolán McNamara <[email protected]> Date: Thu Nov 17 12:34:44 2016 +0000 gtk3: spinbuttons under Ambiance don't look beautiful enough lets draw the frame after the sub-contents are done, and use a dedicated entry child Change-Id: I7db1ac56e5cfb1a46ddd2fb56c5e95deaa83a95d diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 514c71d..e7169e9 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -53,6 +53,7 @@ enum class GtkControlPart ListboxBoxButtonBox, ListboxBoxButtonBoxArrow, SpinButton, + SpinButtonEntry, SpinButtonUpButton, SpinButtonDownButton, ScrollbarVertical, @@ -151,6 +152,7 @@ private: static GtkStyleContext *mpRadioButtonStyle; static GtkStyleContext *mpRadioButtonRadioStyle; static GtkStyleContext *mpSpinStyle; + static GtkStyleContext *mpSpinEntryStyle; static GtkStyleContext *mpSpinUpStyle; static GtkStyleContext *mpSpinDownStyle; static GtkStyleContext *mpComboboxStyle; @@ -210,7 +212,7 @@ private: ControlPart nPart, Rectangle aAreaRect, ControlState nState ); - void PaintSpinButton(GtkStyleContext *context, + void PaintSpinButton(GtkStateFlags flags, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 86e039c..4a957bb 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -46,6 +46,7 @@ GtkStyleContext* GtkSalGraphics::mpCheckButtonCheckStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpRadioButtonStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpRadioButtonRadioStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpSpinStyle = nullptr; +GtkStyleContext* GtkSalGraphics::mpSpinEntryStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpSpinUpStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpSpinDownStyle = nullptr; GtkStyleContext* GtkSalGraphics::mpComboboxStyle = nullptr; @@ -711,7 +712,7 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context, g_object_unref(pixbuf); } -void GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, +void GtkSalGraphics::PaintSpinButton(GtkStateFlags flags, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, @@ -735,18 +736,24 @@ void GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, if (nPart == ControlPart::Entire) { - gtk_render_background(context, cr, + gtk_style_context_set_state(mpSpinStyle, flags); + + gtk_render_background(mpSpinStyle, cr, 0, 0, rControlRectangle.GetWidth(), rControlRectangle.GetHeight() ); - gtk_render_frame(context, cr, - 0, 0, - rControlRectangle.GetWidth(), rControlRectangle.GetHeight() ); } cairo_translate(cr, -rControlRectangle.Left(), -rControlRectangle.Top()); PaintOneSpinButton(mpSpinUpStyle, cr, nType, upBtnPart, rControlRectangle, upBtnState ); PaintOneSpinButton(mpSpinDownStyle, cr, nType, downBtnPart, rControlRectangle, downBtnState ); cairo_translate(cr, rControlRectangle.Left(), rControlRectangle.Top()); + + if (nPart == ControlPart::Entire) + { + gtk_render_frame(mpSpinStyle, cr, + 0, 0, + rControlRectangle.GetWidth(), rControlRectangle.GetHeight() ); + } } #define FALLBACK_ARROW_SIZE 11 * 0.85 @@ -1122,6 +1129,13 @@ GtkStyleContext* GtkSalGraphics::createNewContext(GtkControlPart ePart, gtk_widg gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HORIZONTAL); return makeContext(path, nullptr); } + case GtkControlPart::SpinButtonEntry: + { + GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSpinStyle)); + gtk_widget_path_append_type(path, G_TYPE_NONE); + set_object_name(path, -1, "entry"); + return makeContext(path, mpSpinStyle); + } case GtkControlPart::SpinButtonUpButton: case GtkControlPart::SpinButtonDownButton: { @@ -1419,6 +1433,7 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart) } case GtkControlPart::Entry: case GtkControlPart::ComboboxBoxEntry: + case GtkControlPart::SpinButtonEntry: { GtkWidgetPath *path = gtk_widget_path_new(); gtk_widget_path_append_type(path, GTK_TYPE_ENTRY); @@ -1787,7 +1802,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co { case ControlType::Spinbox: case ControlType::SpinButtons: - context = mpEntryStyle; + context = mpSpinStyle; renderType = RenderType::Spinbutton; break; case ControlType::Editbox: @@ -2097,7 +2112,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co PaintScrollbar(context, cr, rControlRegion, nType, nPart, rValue); break; case RenderType::Spinbutton: - PaintSpinButton(context, cr, rControlRegion, nType, nPart, rValue); + PaintSpinButton(flags, cr, rControlRegion, nType, nPart, rValue); break; case RenderType::Combobox: PaintCombobox(flags, cr, rControlRegion, nType, nPart, rValue); @@ -2983,6 +2998,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) gSpinBox = gtk_spin_button_new(nullptr, 0, 0); gtk_container_add(GTK_CONTAINER(gDumbContainer), gSpinBox); mpSpinStyle = createStyleContext(set_object_name, GtkControlPart::SpinButton); + mpSpinEntryStyle = createStyleContext(set_object_name, GtkControlPart::SpinButtonEntry); mpSpinUpStyle = createStyleContext(set_object_name, GtkControlPart::SpinButtonUpButton); mpSpinDownStyle = createStyleContext(set_object_name, GtkControlPart::SpinButtonDownButton);
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
