From c9e78a10947a24226f12e74e0985e485f51a664c Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 12 May 1998 21:30:52 +0000 Subject: [PATCH] (James A : gtk-jamesa-980511-4.patch) Tue May 12 16:54:15 1998 Owen Taylor (James A : gtk-jamesa-980511-4.patch) * glib.h gstring.c gmessages.c: Added some missing const to arguments. * gutils.c (g_strsignal.c): Added missing return statements. Tue May 12 16:56:35 1998 Owen Taylor (James A : gtk-jamesa-980511-4.patch) * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: Changed #include "gtkfoo.h" to #include * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass Tue May 12 15:16:10 1998 Owen Taylor (From: Christopher James Lahey ) * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] gtk/testgtk.c: Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL (old style), or GTK_RELIEF_NONE - no relief in the NORMAL state. Added gtk_toolbar_{set,get}_button_relief, which set/get the default relief for the toolbars buttons. Added an toggle for the toolbar test in testgtk.c. --- ChangeLog | 20 +++++++++++++++ ChangeLog.pre-2-0 | 20 +++++++++++++++ ChangeLog.pre-2-10 | 20 +++++++++++++++ ChangeLog.pre-2-2 | 20 +++++++++++++++ ChangeLog.pre-2-4 | 20 +++++++++++++++ ChangeLog.pre-2-6 | 20 +++++++++++++++ ChangeLog.pre-2-8 | 20 +++++++++++++++ gdk/gdkregion.c | 2 +- gdk/x11/gdkregion-x11.c | 2 +- glib/ChangeLog | 9 +++++++ glib/glib.h | 12 ++++----- glib/gmessages.c | 8 +++--- glib/gstring.c | 4 +-- glib/gutils.c | 54 ++++++++++++++++++++--------------------- gtk/gtkbbox.h | 2 +- gtk/gtkbutton.c | 45 +++++++++++++++++++++++++++++----- gtk/gtkbutton.h | 23 +++++++++++------- gtk/gtkcolorsel.h | 32 ++++++++++++------------ gtk/gtkenums.h | 7 ++++++ gtk/gtktoolbar.c | 40 +++++++++++++++++++++++++++++- gtk/gtktoolbar.h | 4 +++ gtk/gtkvbbox.h | 2 +- gtk/gtkwindow.c | 4 +-- gtk/gtkwindow.h | 4 +-- gtk/testgtk.c | 39 +++++++++++++++++++++++++++++ tests/testgtk.c | 39 +++++++++++++++++++++++++++++ 26 files changed, 393 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0673d6972..39afd1db66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c0673d6972..39afd1db66 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,23 @@ +Tue May 12 16:56:35 1998 Owen Taylor + (James A : gtk-jamesa-980511-4.patch) + + * gtk/gtkbbox.h gtk/gtkcolorsel.h gtk/gtkvbbox.h: + Changed #include "gtkfoo.h" to #include + + * gtk/gtkwindow.[ch]: Added const to gtk_window_set_wmclass + +Tue May 12 15:16:10 1998 Owen Taylor + (From: Christopher James Lahey ) + + * gtk/gtkbutton.[ch] gtk/gtkenums.h gtk/gtktoolbar.[ch] + gtk/testgtk.c: + + Added 'relief' for buttons - they can be either GTK_RELIEF_NORMAL + (old style), or GTK_RELIEF_NONE - no relief in the NORMAL + state. Added gtk_toolbar_{set,get}_button_relief, which set/get + the default relief for the toolbars buttons. Added an + toggle for the toolbar test in testgtk.c. + Tue May 12 00:24:59 1998 Owen Taylor * docs/gtk-config.1: Rewritten and hopefully improved. diff --git a/gdk/gdkregion.c b/gdk/gdkregion.c index 77a0dd26c9..4b5c1c866c 100644 --- a/gdk/gdkregion.c +++ b/gdk/gdkregion.c @@ -127,7 +127,7 @@ gdk_region_polygon (GdkPoint *points, GdkRegionPrivate *private; GdkRegion *region; Region xregion; - gint xfill_rule = 0; + gint xfill_rule = EvenOddRule; g_return_val_if_fail (points != NULL, NULL); g_return_val_if_fail (npoints != 0, NULL); /* maybe we should check for at least three points */ diff --git a/gdk/x11/gdkregion-x11.c b/gdk/x11/gdkregion-x11.c index 77a0dd26c9..4b5c1c866c 100644 --- a/gdk/x11/gdkregion-x11.c +++ b/gdk/x11/gdkregion-x11.c @@ -127,7 +127,7 @@ gdk_region_polygon (GdkPoint *points, GdkRegionPrivate *private; GdkRegion *region; Region xregion; - gint xfill_rule = 0; + gint xfill_rule = EvenOddRule; g_return_val_if_fail (points != NULL, NULL); g_return_val_if_fail (npoints != 0, NULL); /* maybe we should check for at least three points */ diff --git a/glib/ChangeLog b/glib/ChangeLog index c90468ca16..0a214dcc79 100644 --- a/glib/ChangeLog +++ b/glib/ChangeLog @@ -1,3 +1,12 @@ +Tue May 12 16:54:15 1998 Owen Taylor + + ( James A : gtk-jamesa-980511-4.patch) + + * glib.h gstring.c gmessages.c: Added some missing + const to arguments. + + * gutils.c (g_strsignal.c): Added missing return statements. + Mon May 11 21:11:54 1998 Owen Taylor * gutils.c gmessages.c: Moved g_error, g_warning, g_message and diff --git a/glib/glib.h b/glib/glib.h index 671f1c5148..a86aa34a5a 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -684,10 +684,10 @@ gdouble g_timer_elapsed (GTimer *timer, /* Output */ -void g_error (gchar *format, ...) G_GNUC_PRINTF (1, 2); -void g_warning (gchar *format, ...) G_GNUC_PRINTF (1, 2); -void g_message (gchar *format, ...) G_GNUC_PRINTF (1, 2); -void g_print (gchar *format, ...) G_GNUC_PRINTF (1, 2); +void g_error (const gchar *format, ...) G_GNUC_PRINTF (1, 2); +void g_warning (const gchar *format, ...) G_GNUC_PRINTF (1, 2); +void g_message (const gchar *format, ...) G_GNUC_PRINTF (1, 2); +void g_print (const gchar *format, ...) G_GNUC_PRINTF (1, 2); /* Utility functions */ @@ -742,9 +742,9 @@ void g_stack_trace (const gchar *progname, GStringChunk* g_string_chunk_new (gint size); void g_string_chunk_free (GStringChunk *chunk); gchar* g_string_chunk_insert (GStringChunk *chunk, - gchar* string); + const gchar *string); gchar* g_string_chunk_insert_const (GStringChunk *chunk, - gchar* string); + const gchar *string); /* Strings */ diff --git a/glib/gmessages.c b/glib/gmessages.c index 93ce386b4c..2e58fc3a65 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -31,7 +31,7 @@ static GPrintFunc glib_print_func = NULL; extern char* g_vsprintf (const gchar *fmt, va_list *args, va_list *args2); void -g_error (gchar *format, ...) +g_error (const gchar *format, ...) { va_list args, args2; char *buf; @@ -65,7 +65,7 @@ g_error (gchar *format, ...) } void -g_warning (gchar *format, ...) +g_warning (const gchar *format, ...) { va_list args, args2; char *buf; @@ -89,7 +89,7 @@ g_warning (gchar *format, ...) } void -g_message (gchar *format, ...) +g_message (const gchar *format, ...) { va_list args, args2; char *buf; @@ -113,7 +113,7 @@ g_message (gchar *format, ...) } void -g_print (gchar *format, ...) +g_print (const gchar *format, ...) { va_list args, args2; char *buf; diff --git a/glib/gstring.c b/glib/gstring.c index 9a7a44ceb5..35346f104b 100644 --- a/glib/gstring.c +++ b/glib/gstring.c @@ -124,7 +124,7 @@ g_string_chunk_free (GStringChunk *fchunk) gchar* g_string_chunk_insert (GStringChunk *fchunk, - gchar* string) + const gchar *string) { GRealStringChunk *chunk = (GRealStringChunk*) fchunk; gint len = strlen (string); @@ -160,7 +160,7 @@ g_string_chunk_insert (GStringChunk *fchunk, gchar* g_string_chunk_insert_const (GStringChunk *fchunk, - gchar* string) + const gchar *string) { GRealStringChunk *chunk = (GRealStringChunk*) fchunk; char* lookup; diff --git a/glib/gutils.c b/glib/gutils.c index 437328e3d1..c20f075660 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -570,85 +570,85 @@ g_strsignal (gint signum) case SIGQUIT: return "Quit"; #endif #ifdef SIGILL - case SIGILL: "Illegal instruction"; + case SIGILL: return "Illegal instruction"; #endif #ifdef SIGTRAP - case SIGTRAP: "Trace/breakpoint trap"; + case SIGTRAP: return "Trace/breakpoint trap"; #endif #ifdef SIGABRT - case SIGABRT: "IOT trap/Abort"; + case SIGABRT: return "IOT trap/Abort"; #endif #ifdef SIGBUS - case SIGBUS: "Bus error"; + case SIGBUS: return "Bus error"; #endif #ifdef SIGFPE - case SIGFPE: "Floating point exception"; + case SIGFPE: return "Floating point exception"; #endif #ifdef SIGKILL - case SIGKILL: "Killed"; + case SIGKILL: return "Killed"; #endif #ifdef SIGUSR1 - case SIGUSR1: "User defined signal 1"; + case SIGUSR1: return "User defined signal 1"; #endif #ifdef SIGSEGV - case SIGSEGV: "Segmentation fault"; + case SIGSEGV: return "Segmentation fault"; #endif #ifdef SIGUSR2 - case SIGUSR2: "User defined signal 2"; + case SIGUSR2: return "User defined signal 2"; #endif #ifdef SIGPIPE - case SIGPIPE: "Broken pipe"; + case SIGPIPE: return "Broken pipe"; #endif #ifdef SIGALRM - case SIGALRM: "Alarm clock"; + case SIGALRM: return "Alarm clock"; #endif #ifdef SIGTERM - case SIGTERM: "Terminated"; + case SIGTERM: return "Terminated"; #endif #ifdef SIGSTKFLT - case SIGSTKFLT: "Stack fault"; + case SIGSTKFLT: return "Stack fault"; #endif #ifdef SIGCHLD - case SIGCHLD: "Child exited"; + case SIGCHLD: return "Child exited"; #endif #ifdef SIGCONT - case SIGCONT: "Continued"; + case SIGCONT: return "Continued"; #endif #ifdef SIGSTOP - case SIGSTOP: "Stopped (signal)"; + case SIGSTOP: return "Stopped (signal)"; #endif #ifdef SIGTSTP - case SIGTSTP: "Stopped"; + case SIGTSTP: return "Stopped"; #endif #ifdef SIGTTIN - case SIGTTIN: "Stopped (tty input)"; + case SIGTTIN: return "Stopped (tty input)"; #endif #ifdef SIGTTOU - case SIGTTOU: "Stopped (tty output)"; + case SIGTTOU: return "Stopped (tty output)"; #endif #ifdef SIGURG - case SIGURG: "Urgent condition"; + case SIGURG: return "Urgent condition"; #endif #ifdef SIGXCPU - case SIGXCPU: "CPU time limit exceeded"; + case SIGXCPU: return "CPU time limit exceeded"; #endif #ifdef SIGXFSZ - case SIGXFSZ: "File size limit exceeded"; + case SIGXFSZ: return "File size limit exceeded"; #endif #ifdef SIGVTALRM - case SIGVTALRM: "Virtual time alarm"; + case SIGVTALRM: return "Virtual time alarm"; #endif #ifdef SIGPROF - case SIGPROF: "Profile signal"; + case SIGPROF: return "Profile signal"; #endif #ifdef SIGWINCH - case SIGWINCH: "Window size changed"; + case SIGWINCH: return "Window size changed"; #endif #ifdef SIGIO - case SIGIO: "Possible I/O"; + case SIGIO: return "Possible I/O"; #endif #ifdef SIGPWR - case SIGPWR: "Power failure"; + case SIGPWR: return "Power failure"; #endif #ifdef SIGUNUSED case SIGUNUSED: return "Unused signal"; diff --git a/gtk/gtkbbox.h b/gtk/gtkbbox.h index 22bbd497d1..6ec7585926 100644 --- a/gtk/gtkbbox.h +++ b/gtk/gtkbbox.h @@ -19,7 +19,7 @@ #ifndef __GTK_BUTTON_BOX_H__ #define __GTK_BUTTON_BOX_H__ -#include "gtkbox.h" +#include #ifdef __cplusplus diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 68933ed224..d54c98b645 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -206,6 +206,7 @@ gtk_button_init (GtkButton *button) button->child = NULL; button->in_button = FALSE; button->button_down = FALSE; + button->relief = GTK_RELIEF_NORMAL; } static void @@ -290,6 +291,25 @@ gtk_button_leave (GtkButton *button) gtk_signal_emit (GTK_OBJECT (button), button_signals[LEAVE]); } +void +gtk_button_set_relief (GtkButton *button, + GtkReliefStyle newrelief) +{ + g_return_if_fail (button != NULL); + g_return_if_fail (GTK_IS_BUTTON (button)); + + button->relief = newrelief; +} + +GtkReliefStyle +gtk_button_get_relief(GtkButton *button) +{ + g_return_val_if_fail (button != NULL, GTK_RELIEF_NORMAL); + g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL); + + return button->relief; +} + static void gtk_button_map (GtkWidget *widget) { @@ -507,7 +527,11 @@ gtk_button_paint (GtkWidget *widget, if (gdk_rectangle_intersect (area, &restrict_area, &new_area)) { - gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget)); + if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && + (GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE)) + gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); + else + gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget)); gdk_window_clear_area (widget->window, new_area.x, new_area.y, new_area.width, new_area.height); @@ -631,10 +655,14 @@ gtk_button_draw_focus (GtkWidget *widget) gdk_draw_rectangle (widget->window, widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE, x + 1, y + 1, width - 4, height - 4); - else + else if (button->relief == GTK_RELIEF_NORMAL) gdk_draw_rectangle (widget->window, widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE, x + 2, y + 2, width - 5, height - 5); + else + gdk_draw_rectangle (widget->window, + widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE, + x, y, width - 1, height - 1); } if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE) @@ -642,9 +670,14 @@ gtk_button_draw_focus (GtkWidget *widget) else shadow_type = GTK_SHADOW_OUT; - gtk_draw_shadow (widget->style, widget->window, - GTK_WIDGET_STATE (widget), shadow_type, - x, y, width, height); + if ((button->relief == GTK_RELIEF_NORMAL) || + ((GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL) && + (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE))) + { + gtk_draw_shadow (widget->style, widget->window, + GTK_WIDGET_STATE (widget), shadow_type, + x, y, width, height); + } if (GTK_WIDGET_HAS_FOCUS (widget)) { @@ -676,7 +709,7 @@ gtk_button_draw_default (GtkWidget *widget) width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2; height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2; - if (GTK_WIDGET_HAS_DEFAULT (widget)) + if (GTK_WIDGET_HAS_DEFAULT (widget) && gtk_button_get_relief (GTK_BUTTON (widget)) == GTK_RELIEF_NORMAL) { gtk_draw_shadow (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, diff --git a/gtk/gtkbutton.h b/gtk/gtkbutton.h index 66b5f5eb06..0a74aba7fd 100644 --- a/gtk/gtkbutton.h +++ b/gtk/gtkbutton.h @@ -22,6 +22,7 @@ #include #include +#include #ifdef __cplusplus @@ -47,12 +48,13 @@ struct _GtkButton guint in_button : 1; guint button_down : 1; + guint relief : 2; }; struct _GtkButtonClass { GtkContainerClass parent_class; - + void (* pressed) (GtkButton *button); void (* released) (GtkButton *button); void (* clicked) (GtkButton *button); @@ -61,14 +63,17 @@ struct _GtkButtonClass }; -GtkType gtk_button_get_type (void); -GtkWidget* gtk_button_new (void); -GtkWidget* gtk_button_new_with_label (const gchar *label); -void gtk_button_pressed (GtkButton *button); -void gtk_button_released (GtkButton *button); -void gtk_button_clicked (GtkButton *button); -void gtk_button_enter (GtkButton *button); -void gtk_button_leave (GtkButton *button); +GtkType gtk_button_get_type (void); +GtkWidget* gtk_button_new (void); +GtkWidget* gtk_button_new_with_label (const gchar *label); +void gtk_button_pressed (GtkButton *button); +void gtk_button_released (GtkButton *button); +void gtk_button_clicked (GtkButton *button); +void gtk_button_enter (GtkButton *button); +void gtk_button_leave (GtkButton *button); +void gtk_button_set_relief (GtkButton *button, + GtkReliefStyle newstyle); +GtkReliefStyle gtk_button_get_relief (GtkButton *button); #ifdef __cplusplus diff --git a/gtk/gtkcolorsel.h b/gtk/gtkcolorsel.h index acb44e38e0..9646605fe9 100644 --- a/gtk/gtkcolorsel.h +++ b/gtk/gtkcolorsel.h @@ -24,22 +24,22 @@ #include #include -#include "gtkwindow.h" -#include "gtkvbox.h" -#include "gtkframe.h" -#include "gtkpreview.h" -#include "gtkbutton.h" -#include "gtkentry.h" -#include "gtkhbox.h" -#include "gtklabel.h" -#include "gtkmain.h" -#include "gtksignal.h" -#include "gtkmisc.h" -#include "gtkrange.h" -#include "gtkscale.h" -#include "gtkhscale.h" -#include "gtktable.h" -#include "gtkeventbox.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 9624090ad0..130ed1091c 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -209,6 +209,13 @@ typedef enum GTK_TOOLBAR_BOTH } GtkToolbarStyle; +/* Style for buttons */ +typedef enum +{ + GTK_RELIEF_NORMAL, + GTK_RELIEF_NONE +} GtkReliefStyle; + /* Generic visibility flags */ typedef enum { diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index ac1dda62ae..ad19b4b209 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -160,6 +160,7 @@ gtk_toolbar_init (GtkToolbar *toolbar) toolbar->children = NULL; toolbar->orientation = GTK_ORIENTATION_HORIZONTAL; toolbar->style = GTK_TOOLBAR_ICONS; + toolbar->relief = GTK_RELIEF_NORMAL; toolbar->space_size = DEFAULT_SPACE_SIZE; toolbar->tooltips = gtk_tooltips_new (); toolbar->button_maxw = 0; @@ -765,7 +766,10 @@ gtk_toolbar_insert_element (GtkToolbar *toolbar, case GTK_TOOLBAR_CHILD_TOGGLEBUTTON: case GTK_TOOLBAR_CHILD_RADIOBUTTON: if (type == GTK_TOOLBAR_CHILD_BUTTON) - child->widget = gtk_button_new (); + { + child->widget = gtk_button_new (); + gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief); + } else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) { child->widget = gtk_toggle_button_new (); @@ -881,6 +885,40 @@ gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gtk_tooltips_disable (toolbar->tooltips); } +void +gtk_toolbar_set_button_relief (GtkToolbar *toolbar, + GtkReliefStyle relief) +{ + GList *children; + GtkToolbarChild *child; + + g_return_if_fail (toolbar != NULL); + g_return_if_fail (GTK_IS_TOOLBAR (toolbar)); + + if (toolbar->relief != relief) + { + toolbar->relief = relief; + + for (children = toolbar->children; children; children = children->next) + { + child = children->data; + if (child->type == GTK_TOOLBAR_CHILD_BUTTON) + gtk_button_set_relief (GTK_BUTTON (child->widget), relief); + } + + gtk_widget_queue_resize (GTK_WIDGET (toolbar)); + } +} + +GtkReliefStyle +gtk_toolbar_get_button_relief (GtkToolbar *toolbar) +{ + g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL); + g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL); + + return toolbar->relief; +} + static void gtk_toolbar_marshal_signal_1 (GtkObject *object, GtkSignalFunc func, diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index 8e81abf9ab..ea689460be 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -75,6 +75,7 @@ struct _GtkToolbar gint button_maxw; gint button_maxh; + GtkReliefStyle relief; }; struct _GtkToolbarClass @@ -178,6 +179,9 @@ void gtk_toolbar_set_space_size (GtkToolbar *toolbar, gint space_size); void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gint enable); +void gtk_toolbar_set_button_relief (GtkToolbar *toolbar, + GtkReliefStyle relief); +GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar *toolbar); #ifdef __cplusplus diff --git a/gtk/gtkvbbox.h b/gtk/gtkvbbox.h index 493c9c3459..596b304d40 100644 --- a/gtk/gtkvbbox.h +++ b/gtk/gtkvbbox.h @@ -20,7 +20,7 @@ #define __GTK_VBUTTON_BOX_H__ -#include "gtkbbox.h" +#include #ifdef __cplusplus diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index d077514dff..c618097d03 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -329,8 +329,8 @@ gtk_window_set_title (GtkWindow *window, void gtk_window_set_wmclass (GtkWindow *window, - gchar *wmclass_name, - gchar *wmclass_class) + const gchar *wmclass_name, + const gchar *wmclass_class) { g_return_if_fail (window != NULL); g_return_if_fail (GTK_IS_WINDOW (window)); diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h index 8940f8525f..5c90caf6a1 100644 --- a/gtk/gtkwindow.h +++ b/gtk/gtkwindow.h @@ -84,8 +84,8 @@ GtkWidget* gtk_window_new (GtkWindowType type); void gtk_window_set_title (GtkWindow *window, const gchar *title); void gtk_window_set_wmclass (GtkWindow *window, - gchar *wmclass_name, - gchar *wmclass_class); + const gchar *wmclass_name, + const gchar *wmclass_class); void gtk_window_set_focus (GtkWindow *window, GtkWidget *focus); void gtk_window_set_default (GtkWindow *window, diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 4ed3a25eb3..a851873262 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -648,6 +648,20 @@ set_toolbar_disable (GtkWidget *widget, gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE); } +static void +set_toolbar_borders (GtkWidget *widget, + gpointer data) +{ + gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NORMAL); +} + +static void +set_toolbar_borderless (GtkWidget *widget, + gpointer data) +{ + gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NONE); +} + static void create_toolbar (void) { @@ -669,6 +683,7 @@ create_toolbar (void) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", @@ -722,6 +737,17 @@ create_toolbar (void) new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), (GtkSignalFunc) set_toolbar_disable, toolbar); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borders", "Show Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borders, toolbar); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borderless", "Hide Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borderless, toolbar); + gtk_container_add (GTK_CONTAINER (window), toolbar); gtk_widget_show (toolbar); } @@ -741,6 +767,7 @@ make_toolbar (GtkWidget *window) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Horizontal", "Horizontal toolbar layout", NULL, @@ -788,6 +815,17 @@ make_toolbar (GtkWidget *window) new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), (GtkSignalFunc) set_toolbar_disable, toolbar); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borders", "Show Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borders, toolbar); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borderless", "Hide Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borderless, toolbar); + return toolbar; } @@ -1553,6 +1591,7 @@ create_handle_box (void) gtk_widget_show (handle_box); toolbar = make_toolbar (window); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NORMAL); gtk_container_add (GTK_CONTAINER (handle_box), toolbar); gtk_widget_show (toolbar); diff --git a/tests/testgtk.c b/tests/testgtk.c index 4ed3a25eb3..a851873262 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -648,6 +648,20 @@ set_toolbar_disable (GtkWidget *widget, gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE); } +static void +set_toolbar_borders (GtkWidget *widget, + gpointer data) +{ + gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NORMAL); +} + +static void +set_toolbar_borderless (GtkWidget *widget, + gpointer data) +{ + gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NONE); +} + static void create_toolbar (void) { @@ -669,6 +683,7 @@ create_toolbar (void) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal", @@ -722,6 +737,17 @@ create_toolbar (void) new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), (GtkSignalFunc) set_toolbar_disable, toolbar); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borders", "Show Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borders, toolbar); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borderless", "Hide Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borderless, toolbar); + gtk_container_add (GTK_CONTAINER (window), toolbar); gtk_widget_show (toolbar); } @@ -741,6 +767,7 @@ make_toolbar (GtkWidget *window) gtk_widget_realize (window); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE); gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), "Horizontal", "Horizontal toolbar layout", NULL, @@ -788,6 +815,17 @@ make_toolbar (GtkWidget *window) new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), (GtkSignalFunc) set_toolbar_disable, toolbar); + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borders", "Show Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borders, toolbar); + gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), + "Borderless", "Hide Borders", NULL, + new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]), + (GtkSignalFunc) set_toolbar_borderless, toolbar); + return toolbar; } @@ -1553,6 +1591,7 @@ create_handle_box (void) gtk_widget_show (handle_box); toolbar = make_toolbar (window); + gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NORMAL); gtk_container_add (GTK_CONTAINER (handle_box), toolbar); gtk_widget_show (toolbar);