Insensitive Widgets Patch for GTK+ 1.2.x
- From: "James M. Cape" <jcape jcinteractive com>
- To: GTK+ Development List <gtk-devel-list redhat com>
- Subject: Insensitive Widgets Patch for GTK+ 1.2.x
- Date: Sun, 09 Apr 2000 00:52:57 -0500
I'm including a patch for GTK+ 1.2.x in CVS which implements
GTK_SHADOW_ETCHED_IN as the shadow_type for widgets when they are
insensitive. I'm also including a clipped screenshot demonstrating what
it looks like using The GIMP out of CVS. I'm sure this patch is not the
best, and there are plenty of things that can be done more
intellegently.
I realize that the chances of this patch being included in GTK+ are
precisely zero, but I would like to generate some discussion about how
insensitive widgets are handled in GTK+ 1.3.x, and I'm hoping people
will use this patch in their stable sources before rejecting the idea of
using GTK_SHADOW_ETCHED_IN (or some similar shadow type) for 1.3.x.
Thanks.
Jim Cape
http://www.jcinteractive.com
"Men occasionally stumble over the truth, but most of them
pick themselves up and hurry off as if nothing had happened."
-- Winston Churchill
Index: gtk/gtkbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkbutton.c,v
retrieving revision 1.41.2.1
diff -r1.41.2.1 gtkbutton.c
579c579,581
< if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
---
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
Index: gtk/gtkcheckbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcheckbutton.c,v
retrieving revision 1.19
diff -r1.19 gtkcheckbutton.c
395c395,398
< if (GTK_TOGGLE_BUTTON (widget)->active)
---
>
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE && !GTK_TOGGLE_BUTTON (widget)->active)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else if (GTK_TOGGLE_BUTTON (widget)->active)
Index: gtk/gtkcheckmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcheckmenuitem.c,v
retrieving revision 1.18.2.1
diff -r1.18.2.1 gtkcheckmenuitem.c
274a275,277
> if (state_type == GTK_STATE_INSENSITIVE && !(check_menu_item->always_show_toggle || check_menu_item->active))
> shadow_type = GTK_SHADOW_ETCHED_IN;
>
Index: gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.75.2.5
diff -r1.75.2.5 gtkentry.c
722c722,723
<
---
> GtkShadowType shadow_type;
>
739a741,745
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_IN;
>
741c747
< GTK_STATE_NORMAL, GTK_SHADOW_IN,
---
> GTK_STATE_NORMAL, shadow_type,
Index: gtk/gtkhscale.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhscale.c,v
retrieving revision 1.15.2.3
diff -r1.15.2.3 gtkhscale.c
486a487,488
> GtkWidget *widget;
> GtkShadowType shadow_type;
490a493,494
> widget = GTK_WIDGET (range);
>
498a503,507
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_OUT;
>
500c509
< GTK_SHADOW_OUT,
---
> shadow_type,
Index: gtk/gtkhscrollbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhscrollbar.c,v
retrieving revision 1.15
diff -r1.15 gtkhscrollbar.c
304a305
> GtkWidget *widget;
320a322,323
> widget = GTK_WIDGET (range);
>
322a326,327
> else if (GTK_WIDGET_STATE (range) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
338a344
> GtkWidget *widget;
354a361,362
> widget = GTK_WIDGET (range);
>
356a365,366
> else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
Index: gtk/gtkoptionmenu.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkoptionmenu.c,v
retrieving revision 1.26.2.2
diff -r1.26.2.2 gtkoptionmenu.c
333a334
> GtkShadowType shadow_type;
352a354,358
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_OUT;
>
354c360
< GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
---
> GTK_WIDGET_STATE (widget), shadow_type,
360c366
< GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
---
> GTK_WIDGET_STATE (widget), shadow_type,
Index: gtk/gtkradiobutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkradiobutton.c,v
retrieving revision 1.20
diff -r1.20 gtkradiobutton.c
417c417,419
< if (GTK_TOGGLE_BUTTON (widget)->active)
---
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE && !GTK_TOGGLE_BUTTON (widget)->active)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else if (GTK_TOGGLE_BUTTON (widget)->active)
Index: gtk/gtkradiomenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkradiomenuitem.c,v
retrieving revision 1.14.2.1
diff -r1.14.2.1 gtkradiomenuitem.c
300a301,303
> if (state_type == GTK_STATE_INSENSITIVE && !(check_menu_item->active || check_menu_item->always_show_toggle))
> shadow_type = GTK_SHADOW_ETCHED_IN;
>
Index: gtk/gtkrange.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrange.c,v
retrieving revision 1.26
diff -r1.26 gtkrange.c
1202a1203,1205
> GtkWidget *widget;
> GtkShadowType shadow_type;
>
1205a1209,1215
> widget = GTK_WIDGET (range);
>
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_IN;
>
1209c1219
< GTK_STATE_ACTIVE, GTK_SHADOW_IN,
---
> GTK_STATE_ACTIVE, shadow_type,
1224c1234,1236
<
---
> GtkShadowType shadow_type;
> GtkWidget *widget;
>
1234a1247,1254
>
> widget = GTK_WIDGET (range);
>
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_OUT;
>
1236c1256
< state_type, GTK_SHADOW_OUT,
---
> state_type, shadow_type,
Index: gtk/gtkspinbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkspinbutton.c,v
retrieving revision 1.35.2.1
diff -r1.35.2.1 gtkspinbutton.c
594a595,596
> else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.27.2.11
diff -r1.27.2.11 gtkstyle.c
2103a2104,2142
> case GTK_SHADOW_ETCHED_IN:
> gdk_draw_line (window, style->bg_gc[state_type],
> x + 2, y + half_height,
> x + half_width, y + height - 2);
> gdk_draw_line (window, style->bg_gc[state_type],
> x + half_width, y + height - 2,
> x + width - 2, y + half_height);
> gdk_draw_line (window, style->dark_gc[state_type],
> x + 1, y + half_height,
> x + half_width, y + height - 1);
> gdk_draw_line (window, style->dark_gc[state_type],
> x + half_width, y + height - 1,
> x + width - 1, y + half_height);
> gdk_draw_line (window, style->light_gc[state_type],
> x, y + half_height,
> x + half_width, y + height);
> gdk_draw_line (window, style->light_gc[state_type],
> x + half_width, y + height,
> x + width, y + half_height);
>
> gdk_draw_line (window, style->light_gc,
> x + 2, y + half_height,
> x + half_width, y + 2);
> gdk_draw_line (window, style->light_gc,
> x + half_width, y + 2,
> x + width - 2, y + half_height);
> gdk_draw_line (window, style->light_gc[state_type],
> x + 1, y + half_height,
> x + half_width, y + 1);
> gdk_draw_line (window, style->light_gc[state_type],
> x + half_width, y + 1,
> x + width - 1, y + half_height);
> gdk_draw_line (window, style->dark_gc[state_type],
> x, y + half_height,
> x + half_width, y);
> gdk_draw_line (window, style->dark_gc[state_type],
> x + half_width, y,
> x + width, y + half_height);
> break;
Index: gtk/gtktogglebutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktogglebutton.c,v
retrieving revision 1.24
diff -r1.24 gtktogglebutton.c
363c363,365
< if ((GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) ||
---
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE && toggle_button->active)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) ||
Index: gtk/gtkvscale.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkvscale.c,v
retrieving revision 1.16.2.3
diff -r1.16.2.3 gtkvscale.c
488a489,490
> GtkWidget *widget;
> GtkShadowType shadow_type;
491a494,495
>
> widget = GTK_WIDGET (range);
499a504,508
>
> if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
> else
> shadow_type = GTK_SHADOW_OUT;
502c511
< GTK_SHADOW_OUT,
---
> shadow_type,
Index: gtk/gtkvscrollbar.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkvscrollbar.c,v
retrieving revision 1.15
diff -r1.15 gtkvscrollbar.c
304a305
> GtkWidget *widget;
320a322,323
> widget = GTK_WIDGET (range);
>
322a326,327
> else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
338a344
> GtkWidget *widget;
353a360,361
>
> widget = GTK_WIDGET (range);
356a365,366
> else if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
> shadow_type = GTK_SHADOW_ETCHED_IN;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]