[gtk+/native-layout] Implement extended layout for GtkBin
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Implement extended layout for GtkBin
- Date: Sat, 19 Dec 2009 18:23:42 +0000 (UTC)
commit 5e8045b14dde691fef5447b7ca483d95f9132b8a
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Dec 19 00:34:04 2009 -0500
Implement extended layout for GtkBin
gtk/gtkbin.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index e813813..812f2df 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -21,11 +21,12 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkbin.h"
+#include "gtkextendedlayout.h"
#include "gtkintl.h"
#include "gtkalias.h"
@@ -39,8 +40,12 @@ static void gtk_bin_forall (GtkContainer *container,
gpointer callback_data);
static GType gtk_bin_child_type (GtkContainer *container);
+static void gtk_bin_extended_layout_interface_init (GtkExtendedLayoutIface *iface);
+
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
+ gtk_bin_extended_layout_interface_init))
-G_DEFINE_ABSTRACT_TYPE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
static void
gtk_bin_class_init (GtkBinClass *class)
@@ -146,5 +151,54 @@ gtk_bin_get_child (GtkBin *bin)
return bin->child;
}
+static void
+gtk_bin_extended_layout_get_desired_size (GtkExtendedLayout *layout,
+ GtkRequisition *minimum_size,
+ GtkRequisition *natural_size)
+{
+ GtkBin *bin = GTK_BIN (layout);
+
+ g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
+
+ gtk_extended_layout_get_desired_size (GTK_EXTENDED_LAYOUT (bin->child),
+ minimum_size, natural_size);
+}
+
+static void
+gtk_bin_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ GtkBin *bin = GTK_BIN (layout);
+
+ g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
+
+ gtk_extended_layout_get_width_for_height (GTK_EXTENDED_LAYOUT (bin->child),
+ height, minimum_width, natural_width);
+}
+
+static void
+gtk_bin_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
+ gint width,
+ gint *minimum_height,
+ gint natural_height)
+{
+ GtkBin *bin = GTK_BIN (layout);
+
+ g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (bin->child));
+
+ gtk_extended_layout_get_height_for_width (GTK_EXTENDED_LAYOUT (bin->child),
+ width, minimum_height, natural_height);
+}
+
+static void
+gtk_bin_extended_layout_interface_init (GtkExtendedLayoutIface *iface)
+{
+ iface->get_desired_size = gtk_bin_extended_layout_get_desired_size;
+ iface->get_height_for_width = gtk_bin_extended_layout_get_height_for_width;
+ iface->get_width_for_height = gtk_bin_extended_layout_get_width_for_height;
+}
+
#define __GTK_BIN_C__
#include "gtkaliasdef.c"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]