[gnome-love] Desensitizing arrow buttons in scrollbars
- From: Federico Mena Quintero <federico ximian com>
- To: gnome-love gnome org
- Subject: [gnome-love] Desensitizing arrow buttons in scrollbars
- Date: Thu, 15 Apr 2004 12:08:33 -0500
Want a fun little bug?
Please see http://bugzilla.gnome.org/show_bug.cgi?id=140068
When a scrollbar's position is at its limits, it would be nice if the
corresponding arrow button appeared disabled. OpenOffice does this, for
example, when you are at the very top or bottom of a document.
If you look at gtk+/gtk/gtkrange.c and grep for "draw_stepper", you'll
see that this is the function that draws the arrow buttons --- see line
862. It takes two boolean arguments, "clicked" and "prelighted", which
are computed by the caller. It could take another "sensitive" argument,
which would determine whether the button is to be drawn in sensitive or
another state. (In GTK+'s terminology, "sensitive" means "enabled" ---
grayed-out or disabled menu items are "insensitive", just like a bad
lover).
So, the caller of draw_stepper() should see whether the current value of
the range's corresponding GtkAdjustment is at the limits.
A GtkAdjustment has these fields:
struct _GtkAdjustment
{
GtkObject parent_instance;
gdouble lower;
gdouble upper;
gdouble value;
gdouble step_increment;
gdouble page_increment;
gdouble page_size;
};
"lower" and "upper" determine the extents of the range.
"value" is the current value.
"page_size" is the size of the visible area. So, a scrollbar's thumb
shows [value, value + page_size] within [lower, upper].
"step_increment" and "page_increment" are the amounts by which the value
changes when you click on the arrows or in the scrollbar's trough,
respectively.
Adding a "sensitive" argument to draw_stepper(), and computing it in the
caller, is left as an exercise to the reader.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]