reserv a signal slot for GtkWidget::style_set.

added GTK_STYLE_SET flag.
-timj
This commit is contained in:
Tim Janik 1998-02-26 01:48:28 +00:00
parent 6c2818881d
commit 95efae09a7
2 changed files with 90 additions and 58 deletions

View File

@ -46,6 +46,7 @@ enum {
SIZE_ALLOCATE,
STATE_CHANGED,
PARENT_SET,
STYLE_SET,
INSTALL_ACCELERATOR,
REMOVE_ACCELERATOR,
EVENT,
@ -388,6 +389,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_widget_marshal_signal_6,
GTK_TYPE_NONE, 1,
GTK_TYPE_OBJECT);
widget_signals[STYLE_SET] =
gtk_signal_new ("style_set",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, style_set),
gtk_widget_marshal_signal_4,
GTK_TYPE_NONE, 1,
GTK_TYPE_BOXED);
widget_signals[INSTALL_ACCELERATOR] =
gtk_signal_new ("install_accelerator",
GTK_RUN_FIRST,
@ -676,6 +685,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->size_allocate = gtk_widget_real_size_allocate;
klass->state_changed = NULL;
klass->parent_set = NULL;
klass->style_set = NULL;
klass->install_accelerator = NULL;
klass->remove_accelerator = NULL;
klass->event = NULL;
@ -2781,6 +2791,8 @@ gtk_widget_is_child (GtkWidget *widget,
void
gtk_widget_push_colormap (GdkColormap *cmap)
{
g_return_if_fail (cmap != NULL);
colormap_stack = g_slist_prepend (colormap_stack, cmap);
}
@ -2795,6 +2807,8 @@ gtk_widget_push_colormap (GdkColormap *cmap)
void
gtk_widget_push_visual (GdkVisual *visual)
{
g_return_if_fail (visual != NULL);
visual_stack = g_slist_prepend (visual_stack, visual);
}
@ -2809,6 +2823,8 @@ gtk_widget_push_visual (GdkVisual *visual)
void
gtk_widget_push_style (GtkStyle *style)
{
g_return_if_fail (style != NULL);
gtk_style_ref (style);
style_stack = g_slist_prepend (style_stack, style);
}
@ -3032,7 +3048,9 @@ gtk_widget_marshal_signal_1 (GtkObject *object,
rfunc = (GtkWidgetSignal1) func;
(* rfunc) (object, GTK_VALUE_POINTER (args[0]), func_data);
(* rfunc) (object,
GTK_VALUE_POINTER (args[0]),
func_data);
}
/*****************************************
@ -3055,8 +3073,10 @@ gtk_widget_marshal_signal_2 (GtkObject *object,
rfunc = (GtkWidgetSignal2) func;
return_val = GTK_RETLOC_BOOL (args[3]);
*return_val = (* rfunc) (object, GTK_VALUE_STRING (args[0]),
GTK_VALUE_CHAR (args[1]), GTK_VALUE_INT (args[2]),
*return_val = (* rfunc) (object,
GTK_VALUE_STRING (args[0]),
GTK_VALUE_CHAR (args[1]),
GTK_VALUE_INT (args[2]),
func_data);
}
@ -3078,7 +3098,9 @@ gtk_widget_marshal_signal_3 (GtkObject *object,
rfunc = (GtkWidgetSignal3) func;
(* rfunc) (object, GTK_VALUE_STRING (args[0]), func_data);
(* rfunc) (object,
GTK_VALUE_STRING (args[0]),
func_data);
}
/*****************************************
@ -3101,7 +3123,9 @@ gtk_widget_marshal_signal_4 (GtkObject *object,
rfunc = (GtkWidgetSignal4) func;
return_val = GTK_RETLOC_BOOL (args[1]);
*return_val = (* rfunc) (object, GTK_VALUE_BOXED (args[0]), func_data);
*return_val = (* rfunc) (object,
GTK_VALUE_BOXED (args[0]),
func_data);
}
/*****************************************
@ -3122,7 +3146,9 @@ gtk_widget_marshal_signal_5 (GtkObject *object,
rfunc = (GtkWidgetSignal5) func;
(* rfunc) (object, GTK_VALUE_UINT (args[0]), func_data);
(* rfunc) (object,
GTK_VALUE_UINT (args[0]),
func_data);
}
/*****************************************
@ -3143,7 +3169,9 @@ gtk_widget_marshal_signal_6 (GtkObject *object,
rfunc = (GtkWidgetSignal6) func;
(* rfunc) (object, GTK_VALUE_OBJECT (args[0]), func_data);
(* rfunc) (object,
GTK_VALUE_OBJECT (args[0]),
func_data);
}
static void
@ -3174,8 +3202,10 @@ gtk_widget_real_destroy (GtkObject *object)
if (widget->parent)
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
gtk_style_unref (widget->style);
widget->style = NULL;
parent_class->destroy (object);
gtk_widget_unref (widget);
}
@ -3220,9 +3250,6 @@ gtk_widget_real_finalize (GtkObject *object)
gtk_object_remove_data (GTK_OBJECT (widget), extension_event_key);
}
gtk_style_unref (widget->style);
widget->style = NULL;
parent_class->finalize (object);
}

View File

@ -35,19 +35,21 @@ extern "C" {
*/
enum
{
GTK_TOPLEVEL = 1 << 4,
GTK_NO_WINDOW = 1 << 5,
GTK_REALIZED = 1 << 6,
GTK_MAPPED = 1 << 7,
GTK_VISIBLE = 1 << 8,
GTK_SENSITIVE = 1 << 9,
GTK_PARENT_SENSITIVE = 1 << 10,
GTK_CAN_FOCUS = 1 << 11,
GTK_HAS_FOCUS = 1 << 12,
GTK_CAN_DEFAULT = 1 << 13,
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_BASIC = 1 << 16
GTK_TOPLEVEL = 1 << 4,
GTK_NO_WINDOW = 1 << 5,
GTK_REALIZED = 1 << 6,
GTK_MAPPED = 1 << 7,
GTK_VISIBLE = 1 << 8,
GTK_SENSITIVE = 1 << 9,
GTK_PARENT_SENSITIVE = 1 << 10,
GTK_CAN_FOCUS = 1 << 11,
GTK_HAS_FOCUS = 1 << 12,
GTK_CAN_DEFAULT = 1 << 13,
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_BASIC = 1 << 16,
GTK_RESERVED_3 = 1 << 17,
GTK_STYLE_SET = 1 << 18
};
@ -67,8 +69,8 @@ enum
/* Macros for extracting the widget flags from GtkWidget.
*/
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
#define GTK_WIDGET_TOPLEVEL(wid) (GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL)
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
#define GTK_WIDGET_TOPLEVEL(wid) (GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL)
#define GTK_WIDGET_NO_WINDOW(wid) (GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW)
#define GTK_WIDGET_REALIZED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_REALIZED)
#define GTK_WIDGET_MAPPED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED)
@ -84,6 +86,7 @@ enum
#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT)
#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB)
#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC)
#define GTK_WIDGET_STYLE_SET(wid) (GTK_WIDGET_FLAGS (wid) & GTK_STYLE_SET)
/* Macros for setting and clearing widget flags.
*/
@ -254,6 +257,8 @@ struct _GtkWidgetClass
guint previous_state);
void (* parent_set) (GtkWidget *widget,
GtkWidget *previous_parent);
void (* style_set) (GtkWidget *widget,
GtkStyle *previous_style);
/* accelerators */
gint (* install_accelerator) (GtkWidget *widget,
@ -317,7 +322,7 @@ struct _GtkWidgetClass
gint (* drop_leave_event) (GtkWidget *widget,
GdkEventDropLeave *event);
gint (* drop_data_available_event) (GtkWidget *widget,
GdkEventDropDataAvailable *event);
GdkEventDropDataAvailable *event);
gint (* other_event) (GtkWidget *widget,
GdkEventOther *event);
@ -327,8 +332,8 @@ struct _GtkWidgetClass
gint (* client_event) (GtkWidget *widget,
GdkEventClient *event);
gint (* no_expose_event) (GtkWidget *widget,
GdkEventAny *event);
gint (* no_expose_event) (GtkWidget *widget,
GdkEventAny *event);
};
struct _GtkWidgetAuxInfo
@ -353,11 +358,11 @@ GtkWidget* gtk_widget_new (guint type,
GtkWidget* gtk_widget_newv (guint type,
guint nargs,
GtkArg *args);
void gtk_widget_ref (GtkWidget *widget);
void gtk_widget_unref (GtkWidget *widget);
void gtk_widget_destroy (GtkWidget *widget);
void gtk_widget_destroyed (GtkWidget *widget,
GtkWidget **widget_pointer);
void gtk_widget_ref (GtkWidget *widget);
void gtk_widget_unref (GtkWidget *widget);
void gtk_widget_destroy (GtkWidget *widget);
void gtk_widget_destroyed (GtkWidget *widget,
GtkWidget **widget_pointer);
void gtk_widget_get (GtkWidget *widget,
GtkArg *arg);
void gtk_widget_getv (GtkWidget *widget,
@ -510,7 +515,7 @@ void gtk_widget_dnd_data_set (GtkWidget *widget,
gpointer data,
gulong data_numbytes);
#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
# define gtk_widget_ref gtk_object_ref
# define gtk_widget_unref gtk_object_unref
#endif /* GTK_TRACE_OBJECTS && __GNUC__ */