diff options
author | Benjamin Otte <otte@redhat.com> | 2010-09-21 16:35:17 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-09-26 15:11:45 +0200 |
commit | d9c92598612714683eab96fecf6e90a9531607e5 (patch) | |
tree | 4091fc22f94eeed203385670e1eb05d43b6f264c /gtk/gtksizerequest.h | |
parent | f52a1fcfbde5c1b1108d4a03a9bf5c409b59a73e (diff) | |
download | gtk+-d9c92598612714683eab96fecf6e90a9531607e5.tar.gz |
Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.
Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.
So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.
The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
Diffstat (limited to 'gtk/gtksizerequest.h')
-rw-r--r-- | gtk/gtksizerequest.h | 59 |
1 files changed, 3 insertions, 56 deletions
diff --git a/gtk/gtksizerequest.h b/gtk/gtksizerequest.h index 272458930a..22922c26b0 100644 --- a/gtk/gtksizerequest.h +++ b/gtk/gtksizerequest.h @@ -28,14 +28,6 @@ G_BEGIN_DECLS -#define GTK_TYPE_SIZE_REQUEST (gtk_size_request_get_type ()) -#define GTK_SIZE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SIZE_REQUEST, GtkSizeRequest)) -#define GTK_SIZE_REQUEST_CLASS(klass) ((GtkSizeRequestIface*)g_type_interface_peek ((klass), GTK_TYPE_SIZE_REQUEST)) -#define GTK_IS_SIZE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SIZE_REQUEST)) -#define GTK_SIZE_REQUEST_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_SIZE_REQUEST, GtkSizeRequestIface)) - -typedef struct _GtkSizeRequest GtkSizeRequest; -typedef struct _GtkSizeRequestIface GtkSizeRequestIface; typedef struct _GtkRequestedSize GtkRequestedSize; /** @@ -56,55 +48,10 @@ struct _GtkRequestedSize }; -struct _GtkSizeRequestIface -{ - GTypeInterface g_iface; - - /* virtual table */ - GtkSizeRequestMode (* get_request_mode) (GtkSizeRequest *widget); - - void (* get_height) (GtkSizeRequest *widget, - gint *minimum_height, - gint *natural_height); - void (* get_width_for_height) (GtkSizeRequest *widget, - gint height, - gint *minimum_width, - gint *natural_width); - void (* get_width) (GtkSizeRequest *widget, - gint *minimum_width, - gint *natural_width); - void (* get_height_for_width) (GtkSizeRequest *widget, - gint width, - gint *minimum_height, - gint *natural_height); -}; - -GType gtk_size_request_get_type (void) G_GNUC_CONST; - -GtkSizeRequestMode gtk_size_request_get_request_mode (GtkSizeRequest *widget); -void gtk_size_request_get_width (GtkSizeRequest *widget, - gint *minimum_width, - gint *natural_width); -void gtk_size_request_get_height_for_width (GtkSizeRequest *widget, - gint width, - gint *minimum_height, - gint *natural_height); -void gtk_size_request_get_height (GtkSizeRequest *widget, - gint *minimum_height, - gint *natural_height); -void gtk_size_request_get_width_for_height (GtkSizeRequest *widget, - gint height, - gint *minimum_width, - gint *natural_width); -void gtk_size_request_get_size (GtkSizeRequest *widget, - GtkRequisition *minimum_size, - GtkRequisition *natural_size); - - /* General convenience function to aid in allocating natural sizes */ -gint gtk_distribute_natural_allocation (gint extra_space, - guint n_requested_sizes, - GtkRequestedSize *sizes); +gint gtk_distribute_natural_allocation (gint extra_space, + guint n_requested_sizes, + GtkRequestedSize *sizes); G_END_DECLS |