summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-08-28 14:58:34 +0400
committerIvan Timofeev <timofeev.i.s@gmail.com>2012-08-28 15:51:39 +0400
commit58d757fd295d48bcd2eef51c2f41f5014c1cda21 (patch)
treeeeda0bdbd3a8d1755a3572425bc72ba09a006984 /vcl/unx
parentc2b40d6fa57e0176d52ec4ac0565de352064c661 (diff)
gtk: sumulate native insensitivity of scrollbar buttons
Change-Id: I13ac2c43aadd494389586166771b1d0e6bfb9ea6
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx17
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx14
2 files changed, 27 insertions, 4 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index f28cb0a312d4..011e755a51a9 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 45e897795441..0774699fb0e6 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);