[Libreoffice-commits] .: vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 28 04:52:13 PDT 2012
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 17 +++++++++++++----
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 14 ++++++++++++++
2 files changed, 27 insertions(+), 4 deletions(-)
New commits:
commit 58d757fd295d48bcd2eef51c2f41f5014c1cda21
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Tue Aug 28 14:58:34 2012 +0400
gtk: sumulate native insensitivity of scrollbar buttons
Change-Id: I13ac2c43aadd494389586166771b1d0e6bfb9ea6
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index f28cb0a..011e755 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1948,11 +1948,17 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
GTK_WIDGET(scrollbarWidget)->allocation.width = w;
GTK_WIDGET(scrollbarWidget)->allocation.height = h;
+ bool backwardButtonInsensitive =
+ pScrollbarVal->mnCur == pScrollbarVal->mnMin;
+ bool forwardButtonInsensitive = pScrollbarVal->mnMax == 0 ||
+ pScrollbarVal->mnCur + pScrollbarVal->mnVisibleSize >= pScrollbarVal->mnMax;
+
// ----------------- BUTTON 1 //
if ( has_backward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( backwardButtonInsensitive )
+ stateType = GTK_STATE_INSENSITIVE;
gtk_paint_box( style, gdkDrawable, stateType, shadowType,
gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag,
x+hShim+button11BoundRect.Left(), y+vShim+button11BoundRect.Top(),
@@ -1967,7 +1973,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_forward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( forwardButtonInsensitive )
+ stateType = GTK_STATE_INSENSITIVE;
gtk_paint_box( style, gdkDrawable, stateType, shadowType,
gdkRect, GTK_WIDGET(scrollbarWidget), scrollbarTag,
x+hShim+button12BoundRect.Left(), y+vShim+button12BoundRect.Top(),
@@ -1983,7 +1990,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_backward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( backwardButtonInsensitive )
+ stateType = GTK_STATE_INSENSITIVE;
gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect,
GTK_WIDGET(scrollbarWidget), scrollbarTag,
x+hShim+button21BoundRect.Left(), y+vShim+button21BoundRect.Top(),
@@ -1998,7 +2006,8 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
if ( has_forward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateType, &shadowType );
- if ( stateType == GTK_STATE_INSENSITIVE ) stateType = GTK_STATE_NORMAL;
+ if ( forwardButtonInsensitive )
+ stateType = GTK_STATE_INSENSITIVE;
gtk_paint_box( style, gdkDrawable, stateType, shadowType, gdkRect,
GTK_WIDGET(scrollbarWidget), scrollbarTag,
x+hShim+button22BoundRect.Left(), y+vShim+button22BoundRect.Top(),
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 45e8977..0774699 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -431,10 +431,18 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
gtk_style_context_restore(context);
}
+
+ bool backwardButtonInsensitive =
+ pScrollbarVal->mnCur == pScrollbarVal->mnMin;
+ bool forwardButtonInsensitive = pScrollbarVal->mnMax == 0 ||
+ pScrollbarVal->mnCur + pScrollbarVal->mnVisibleSize >= pScrollbarVal->mnMax;
+
// ----------------- BUTTON 1 //
if ( has_backward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateFlags, &shadowType );
+ if ( backwardButtonInsensitive )
+ stateFlags = GTK_STATE_FLAG_INSENSITIVE;
gtk_style_context_save(context);
gtk_style_context_set_state(context, stateFlags);
@@ -459,6 +467,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
if ( has_forward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateFlags, &shadowType );
+ if ( forwardButtonInsensitive )
+ stateFlags = GTK_STATE_FLAG_INSENSITIVE;
gtk_style_context_save(context);
gtk_style_context_set_state(context, stateFlags);
@@ -484,6 +494,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
if ( has_backward2 )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton1State, &stateFlags, &shadowType );
+ if ( backwardButtonInsensitive )
+ stateFlags = GTK_STATE_FLAG_INSENSITIVE;
gtk_style_context_save(context);
gtk_style_context_set_state(context, stateFlags);
@@ -508,6 +520,8 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
if ( has_forward )
{
NWConvertVCLStateToGTKState( pScrollbarVal->mnButton2State, &stateFlags, &shadowType );
+ if ( forwardButtonInsensitive )
+ stateFlags = GTK_STATE_FLAG_INSENSITIVE;
gtk_style_context_save(context);
gtk_style_context_set_state(context, stateFlags);
More information about the Libreoffice-commits
mailing list