diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2013-07-01 21:24:25 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2013-07-01 21:39:44 +0400 |
commit | 76c9d45ccf8480f8b73815607ff8701a3d41a649 (patch) | |
tree | 1ccd28da9e7a6539b4c54541ab062e5d09e0f951 /vcl/unx | |
parent | a201ae63ce798438057a1328dc644dc8b64fe4e8 (diff) |
gtk3: add indicator-spacing to size of checkbox/radiobutton
Change-Id: Ifea43607c8cd5a8047796b7d2efdf14289b029e2
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 3448615165e9..1821cbec1e69 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -751,6 +751,24 @@ void GtkSalGraphics::PaintCombobox( GtkStyleContext *context, arrowRect.GetWidth() ); } +void GtkSalGraphics::PaintCheckOrRadio(GtkStyleContext *context, + cairo_t *cr, + const Rectangle& rControlRectangle, + ControlType nType) +{ + gint x, y, indicator_size; + gtk_style_context_get_style(mpCheckButtonStyle, + "indicator-size", &indicator_size, + NULL ); + + x = (rControlRectangle.GetWidth() - indicator_size) / 2; + y = (rControlRectangle.GetHeight() - indicator_size) / 2; + if (nType == CTRL_CHECKBOX) + gtk_render_check(context, cr, x, y, indicator_size, indicator_size); + else if (nType == CTRL_RADIOBUTTON) + gtk_render_option(context, cr, x, y, indicator_size, indicator_size); +} + sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& ) @@ -891,14 +909,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart rControlRegion.GetWidth(), rControlRegion.GetHeight()); break; case RENDER_CHECK: - gtk_render_check(context, cr, - 0, 0, - rControlRegion.GetWidth(), rControlRegion.GetHeight()); - break; case RENDER_RADIO: - gtk_render_option(context, cr, - 0, 0, - rControlRegion.GetWidth(), rControlRegion.GetHeight()); + PaintCheckOrRadio(context, cr, rControlRegion, nType); break; case RENDER_LINE: gtk_render_line(context, cr, @@ -982,18 +994,21 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart { /* TODO: all this funcions needs improvements */ Rectangle aEditRect = rControlRegion; - gint indicator_size, point; + gint indicator_size, indicator_spacing, point; if(((nType == CTRL_CHECKBOX) || (nType == CTRL_RADIOBUTTON)) && nPart == PART_ENTIRE_CONTROL) { gtk_style_context_get_style( mpCheckButtonStyle, "indicator-size", &indicator_size, + "indicator-spacing", &indicator_spacing, (char *)NULL ); - point = MAX(0, rControlRegion.GetHeight() - indicator_size); + gint size = indicator_size + indicator_spacing*2; + + point = MAX(0, rControlRegion.GetHeight() - size); aEditRect = Rectangle( Point( 0, point / 2), - Size( indicator_size, indicator_size ) ); + Size( size, size ) ); } else if( nType == CTRL_MENU_POPUP) { |