[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/unx
Ivan Timofeev
timofeev.i.s at gmail.com
Mon Jul 1 10:43:49 PDT 2013
vcl/inc/unx/gtk/gtkgdi.hxx | 4 ++
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 39 ++++++++++++++++++--------
2 files changed, 32 insertions(+), 11 deletions(-)
New commits:
commit cc06e7b6b8b73ae68a2eea72d94c6f45c9fbf497
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Mon Jul 1 21:29:29 2013 +0400
gtk3: for checkbox map BUTTONVALUE_MIXED to GTK_STATE_FLAG_INCONSISTENT
Change-Id: I5f5810a1e2dc56afb0fba7fde20a383980e3ba51
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 1821cbe..350d1e9 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -853,7 +853,9 @@ sal_Bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart
break;
case CTRL_CHECKBOX:
flags = (GtkStateFlags)(flags |
- ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL));
+ ( (aValue.getTristateVal() == BUTTONVALUE_ON) ? GTK_STATE_FLAG_ACTIVE :
+ (aValue.getTristateVal() == BUTTONVALUE_MIXED) ? GTK_STATE_FLAG_INCONSISTENT :
+ GTK_STATE_FLAG_NORMAL));
context = mpCheckButtonStyle;
styleClass = GTK_STYLE_CLASS_CHECK;
renderType = RENDER_CHECK;
commit 76c9d45ccf8480f8b73815607ff8701a3d41a649
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Mon Jul 1 21:24:25 2013 +0400
gtk3: add indicator-spacing to size of checkbox/radiobutton
Change-Id: Ifea43607c8cd5a8047796b7d2efdf14289b029e2
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 4d5ff7c..912e27e 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -103,6 +103,10 @@ private:
ControlType nType,
ControlPart nPart,
const ImplControlValue& aValue );
+ void PaintCheckOrRadio(GtkStyleContext *context,
+ cairo_t *cr,
+ const Rectangle& rControlRectangle,
+ ControlType nType);
static bool style_loaded;
};
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 3448615..1821cbe 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)
{
More information about the Libreoffice-commits
mailing list