Kaydet (Commit) 76c9d45c authored tarafından Ivan Timofeev's avatar Ivan Timofeev

gtk3: add indicator-spacing to size of checkbox/radiobutton

Change-Id: Ifea43607c8cd5a8047796b7d2efdf14289b029e2
üst a201ae63
...@@ -103,6 +103,10 @@ private: ...@@ -103,6 +103,10 @@ private:
ControlType nType, ControlType nType,
ControlPart nPart, ControlPart nPart,
const ImplControlValue& aValue ); const ImplControlValue& aValue );
void PaintCheckOrRadio(GtkStyleContext *context,
cairo_t *cr,
const Rectangle& rControlRectangle,
ControlType nType);
static bool style_loaded; static bool style_loaded;
}; };
......
...@@ -751,6 +751,24 @@ void GtkSalGraphics::PaintCombobox( GtkStyleContext *context, ...@@ -751,6 +751,24 @@ void GtkSalGraphics::PaintCombobox( GtkStyleContext *context,
arrowRect.GetWidth() ); 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, sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue, ControlState nState, const ImplControlValue& aValue,
const OUString& ) const OUString& )
...@@ -891,14 +909,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart ...@@ -891,14 +909,8 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart
rControlRegion.GetWidth(), rControlRegion.GetHeight()); rControlRegion.GetWidth(), rControlRegion.GetHeight());
break; break;
case RENDER_CHECK: case RENDER_CHECK:
gtk_render_check(context, cr,
0, 0,
rControlRegion.GetWidth(), rControlRegion.GetHeight());
break;
case RENDER_RADIO: case RENDER_RADIO:
gtk_render_option(context, cr, PaintCheckOrRadio(context, cr, rControlRegion, nType);
0, 0,
rControlRegion.GetWidth(), rControlRegion.GetHeight());
break; break;
case RENDER_LINE: case RENDER_LINE:
gtk_render_line(context, cr, gtk_render_line(context, cr,
...@@ -982,18 +994,21 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart ...@@ -982,18 +994,21 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart
{ {
/* TODO: all this funcions needs improvements */ /* TODO: all this funcions needs improvements */
Rectangle aEditRect = rControlRegion; Rectangle aEditRect = rControlRegion;
gint indicator_size, point; gint indicator_size, indicator_spacing, point;
if(((nType == CTRL_CHECKBOX) || (nType == CTRL_RADIOBUTTON)) && if(((nType == CTRL_CHECKBOX) || (nType == CTRL_RADIOBUTTON)) &&
nPart == PART_ENTIRE_CONTROL) nPart == PART_ENTIRE_CONTROL)
{ {
gtk_style_context_get_style( mpCheckButtonStyle, gtk_style_context_get_style( mpCheckButtonStyle,
"indicator-size", &indicator_size, "indicator-size", &indicator_size,
"indicator-spacing", &indicator_spacing,
(char *)NULL ); (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), aEditRect = Rectangle( Point( 0, point / 2),
Size( indicator_size, indicator_size ) ); Size( size, size ) );
} }
else if( nType == CTRL_MENU_POPUP) else if( nType == CTRL_MENU_POPUP)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment