diff options
author | Tim Janik <timj@gimp.org> | 1998-02-02 04:54:25 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-02-02 04:54:25 +0000 |
commit | eef38289b2379669784be1b030b1c803ebc7ee69 (patch) | |
tree | bbd108413216f18474aac3af49605a79a1264a10 /gtk/gtkobject.h | |
parent | 81fe36047e9bfbf27b224cd35cc869ca6082bf38 (diff) | |
download | gtk+-eef38289b2379669784be1b030b1c803ebc7ee69.tar.gz |
GTK_RESIZE_NEEDED is a private flag now.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
(gtk_container_register_toplevel): new function.
(gtk_container_unregister_toplevel): new function.
* gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.
* gtk/gtkmenu.c: call gtk_container_register_toplevel in
gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
hack. new default handler gtk_menu_destroy for calling
gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.
* gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.
* gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
(object).
* gtk/gtkprivate.h: new file that will not be automatically included.
it holds the private flags for GtkWidget along with it's SET/UNSET
and examination macros.
* gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
removed the gtk_widget_set_parent(, NULL) hack for toplevels.
upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.
* gtk/gtkwidget.h: split up the widget flags into a public and a private
portion. added an extra field private_flags to GtkWidget without making
it bigger by using an alignment gap of 16 bit. macro cleanups.
* gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
for calling gtk_container_unregister_toplevel. removed the
gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.
* gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
removal that cut off the handler list -> living_objects == 0
with testgtk. made some warnings more descriptive.
new function gtk_signal_connect_object_while_alive, which
will automatically destroy the connection once one of the objects
is destroyed. didn't include this before removal of the above
mentioned bug.
* reflected refcounting revolution in ChangeLog
Diffstat (limited to 'gtk/gtkobject.h')
-rw-r--r-- | gtk/gtkobject.h | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h index b52083d4c8..958f7893f1 100644 --- a/gtk/gtkobject.h +++ b/gtk/gtkobject.h @@ -28,18 +28,6 @@ extern "C" { #endif /* __cplusplus */ -/* GtkObject only uses the first 3 bits of the "flags" field. - * They refer to the following flags. - * GtkWidget uses the remaining bits. Though this is a kinda nasty - * break up, it does make the size of GtkWidget smaller. - */ -enum -{ - GTK_FLOATING = 1 << 0, - GTK_RESERVED_1 = 1 << 1, - GTK_RESERVED_2 = 1 << 2 -}; - /* The debugging versions of the casting macros make sure the cast is "ok" * before proceeding, but they are definately slower than their less @@ -47,48 +35,62 @@ enum */ #ifdef NDEBUG -#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) obj) -#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) klass) +#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) (obj)) +#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) (klass)) #else /* NDEBUG */ #define GTK_CHECK_CAST(obj,cast_type,cast) \ - ((cast*) gtk_object_check_cast ((GtkObject*) obj, cast_type)) + ((cast*) gtk_object_check_cast ((GtkObject*) (obj), cast_type)) #define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) \ - ((cast*) gtk_object_check_class_cast ((GtkObjectClass*) klass, cast_type)) + ((cast*) gtk_object_check_class_cast ((GtkObjectClass*) (klass), cast_type)) #endif /* NDEBUG */ /* Determines whether 'obj' is a type of 'otype'. */ -#define GTK_CHECK_TYPE(obj,otype) (gtk_type_is_a (((GtkObject*) obj)->klass->type, otype)) +#define GTK_CHECK_TYPE(obj,otype) (gtk_type_is_a (((GtkObject*) (obj))->klass->type, otype)) /* Macro for casting a pointer to a GtkObject pointer. */ -#define GTK_OBJECT(obj) GTK_CHECK_CAST (obj, gtk_object_get_type (), GtkObject) +#define GTK_OBJECT(obj) GTK_CHECK_CAST ((obj), gtk_object_get_type (), GtkObject) -/* Macros for extracting various fields from GtkObject and - * GtkObjectClass. +/* Macros for extracting various fields from GtkObject and GtkObjectClass. */ -#define GTK_OBJECT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_object_get_type (), GtkObjectClass) -#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags) -#define GTK_OBJECT_FLOATING(obj) (GTK_OBJECT_FLAGS (obj) & GTK_FLOATING) -#define GTK_OBJECT_DESTROY(obj) (GTK_OBJECT (obj)->klass->destroy) +#define GTK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_object_get_type (), GtkObjectClass)) #define GTK_OBJECT_TYPE(obj) (GTK_OBJECT (obj)->klass->type) #define GTK_OBJECT_SIGNALS(obj) (GTK_OBJECT (obj)->klass->signals) #define GTK_OBJECT_NSIGNALS(obj) (GTK_OBJECT (obj)->klass->nsignals) -/* Macro for testing whether "obj" is of type GtkObject. +/* GtkObject only uses the first 4 bits of the flags field. + * GtkWidget uses the remaining bits. Though this is a kinda nasty + * break up, it does make the size of GtkWidget smaller. + */ +enum + { + GTK_DESTROYED = 1 << 0, + GTK_FLOATING = 1 << 1, + GTK_RESERVED_1 = 1 << 2, + GTK_RESERVED_2 = 1 << 3 + }; + +/* Macros for extracting the object_flags from GtkObject. */ -#define GTK_IS_OBJECT(obj) GTK_CHECK_TYPE (obj, gtk_object_get_type ()) +#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags) +#define GTK_OBJECT_DESTROYED(obj) (GTK_OBJECT_FLAGS (obj) & GTK_DESTROYED) +#define GTK_OBJECT_FLOATING(obj) (GTK_OBJECT_FLAGS (obj) & GTK_FLOATING) -/* Macros for setting and clearing bits in the "flags" field of GtkObject. +/* Macros for setting and clearing bits in the object_flags field of GtkObject. */ -#define GTK_OBJECT_SET_FLAGS(obj,flag) (GTK_OBJECT_FLAGS (obj) |= (flag)) -#define GTK_OBJECT_UNSET_FLAGS(obj,flag) (GTK_OBJECT_FLAGS (obj) &= ~(flag)) +#define GTK_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END +#define GTK_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END + +/* Macro for testing whether "obj" is of type GtkObject. + */ +#define GTK_IS_OBJECT(obj) (GTK_CHECK_TYPE ((obj), gtk_object_get_type ())) typedef struct _GtkObjectClass GtkObjectClass; @@ -99,10 +101,16 @@ typedef struct _GtkObjectClass GtkObjectClass; */ struct _GtkObject { - /* 32 bits of flags. GtkObject only uses 3 of these bits and + /* A pointer to the objects class. This will actually point to + * the derived objects class struct (which will be derived from + * GtkObjectClass). + */ + GtkObjectClass *klass; + + /* 32 bits of flags. GtkObject only uses 4 of these bits and * GtkWidget uses the rest. This is done because structs are - * aligned on 4 or 8 byte boundaries. If bitfields were used - * both here and in GtkWidget much space would be wasted. + * aligned on 4 or 8 byte boundaries. If a new bitfield were + * used in GtkWidget much space would be wasted. */ guint32 flags; @@ -111,12 +119,6 @@ struct _GtkObject */ guint ref_count; - /* A pointer to the objects class. This will actually point to - * the derived objects class struct (which will be derived from - * GtkObjectClass). - */ - GtkObjectClass *klass; - /* The list of signal handlers and other data * fields for this object. */ |