[gtk+/extended-layout-jhs: 1/64] Implement GtkExtendLayout interface. Implement GtkExtendLayout interface.
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/extended-layout-jhs: 1/64] Implement GtkExtendLayout interface. Implement GtkExtendLayout interface.
- Date: Wed, 25 Nov 2009 11:18:58 +0000 (UTC)
commit 38e773ec70a7f7b129ac887d7ed27f06b1e48884
Author: Mathias Hasselmann <mathias hasselmann gmx de>
Date: Tue Jun 19 18:26:07 2007 +0000
Implement GtkExtendLayout interface. Implement GtkExtendLayout interface.
2007-06-19 Mathias Hasselmann <mathias hasselmann gmx de>
* gtk/Makefile.am, gtk/gtk.h, gtk/gtkextendedlayout.c,
gtk/gtkextendedlayout.h: Implement GtkExtendLayout interface.
* docs/reference/gtk/tmpl/gtkextendedlayout.sgml,
docs/reference/gtk/gtk-docs.sgml, docs/reference/gtk/gtk-sections.txt,
docs/reference/gtk/gtk.types: Implement GtkExtendLayout interface.
svn path=/branches/extended-layout/; revision=18195
ChangeLog.gtk-extended-layout | 13 ++
docs/reference/ChangeLog.gtk-extended-layout | 6 +
docs/reference/gtk/gtk-docs.sgml | 2 +
docs/reference/gtk/gtk-sections.txt | 20 +++
docs/reference/gtk/gtk.types | 1 +
docs/reference/gtk/tmpl/gtkextendedlayout.sgml | 85 ++++++++++++
gtk/Makefile.am | 2 +
gtk/gtk.h | 1 +
gtk/gtkextendedlayout.c | 166 ++++++++++++++++++++++++
gtk/gtkextendedlayout.h | 77 +++++++++++
10 files changed, 373 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog.gtk-extended-layout b/ChangeLog.gtk-extended-layout
index e19ca2e..fc7c961 100644
--- a/ChangeLog.gtk-extended-layout
+++ b/ChangeLog.gtk-extended-layout
@@ -1,3 +1,16 @@
+<<<<<<< HEAD:ChangeLog.gtk-extended-layout
+=======
+2007-06-19 Mathias Hasselmann <mathias hasselmann gmx de>
+
+ * gtk/Makefile.am, gtk/gtk.h, gtk/gtkextendedlayout.c,
+ gtk/gtkextendedlayout.h: Implement GtkExtendLayout interface.
+
+2007-06-18 Mathias Hasselmann <mathias hasselmann gmx de>
+
+ * gdk/*, gtk/*: Resynching with trunk to avoid future
+ merge conflicts with the giant GtkBuilder patch.
+
+>>>>>>> bd36257... Implement GtkExtendLayout interface. Implement GtkExtendLayout interface.:ChangeLog.gtk-extended-layout
2007-05-29 Mathias Hasselmann <mathias hasselmann gmx de>
* testextendedlayout.c: Implement formal testing.
diff --git a/docs/reference/ChangeLog.gtk-extended-layout b/docs/reference/ChangeLog.gtk-extended-layout
new file mode 100644
index 0000000..96c0329
--- /dev/null
+++ b/docs/reference/ChangeLog.gtk-extended-layout
@@ -0,0 +1,6 @@
+2007-06-19 Mathias Hasselmann <mathias hasselmann gmx de>
+
+ * docs/reference/gtk/tmpl/gtkextendedlayout.sgml,
+ docs/reference/gtk/gtk-docs.sgml, docs/reference/gtk/gtk-sections.txt,
+ docs/reference/gtk/gtk.types: Implement GtkExtendLayout interface.
+
diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml
index 0a008ed..964e480 100644
--- a/docs/reference/gtk/gtk-docs.sgml
+++ b/docs/reference/gtk/gtk-docs.sgml
@@ -35,6 +35,7 @@
<!ENTITY GtkEntryCompletion SYSTEM "xml/gtkentrycompletion.xml">
<!ENTITY GtkEventBox SYSTEM "xml/gtkeventbox.xml">
<!ENTITY GtkExpander SYSTEM "xml/gtkexpander.xml">
+<!ENTITY GtkExtendedLayout SYSTEM "xml/gtkextendedlayout.xml">
<!ENTITY GtkFileChooser SYSTEM "xml/gtkfilechooser.xml">
<!ENTITY GtkFileChooserButton SYSTEM "xml/gtkfilechooserbutton.xml">
<!ENTITY GtkFileChooserDialog SYSTEM "xml/gtkfilechooserdialog.xml">
@@ -563,6 +564,7 @@ that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
&GtkBox;
&GtkButtonBox;
&GtkContainer;
+ &GtkExtendedLayout;
&GtkItem;
&GtkMisc;
&GtkObject;
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 4cdb79f..8e7abe4 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -1247,6 +1247,26 @@ GtkExpanderPrivate
</SECTION>
<SECTION>
+<FILE>gtkextendedlayout</FILE>
+<TITLE>GtkExtendedLayout</TITLE>
+GtkExtendedLayout
+GtkExtendedLayoutIface
+gtk_extended_layout_get_baselines
+gtk_extended_layout_get_features
+gtk_extended_layout_get_height_for_width
+gtk_extended_layout_get_natural_size
+gtk_extended_layout_get_width_for_height
+<SUBSECTION Standard>
+GTK_EXTENDED_LAYOUT
+GTK_EXTENDED_LAYOUT_CLASS
+GTK_EXTENDED_LAYOUT_GET_IFACE
+GTK_IS_EXTENDED_LAYOUT
+GTK_TYPE_EXTENDED_LAYOUT
+<SUBSECTION Private>
+gtk_extended_layout_get_type
+</SECTION>
+
+<SECTION>
<FILE>gtkfilechooser</FILE>
<TITLE>GtkFileChooser</TITLE>
GtkFileChooser
diff --git a/docs/reference/gtk/gtk.types b/docs/reference/gtk/gtk.types
index 5ad47ff..2493217 100644
--- a/docs/reference/gtk/gtk.types
+++ b/docs/reference/gtk/gtk.types
@@ -52,6 +52,7 @@ gtk_entry_completion_get_type
gtk_entry_get_type
gtk_event_box_get_type
gtk_expander_get_type
+gtk_extended_layout_get_type
gtk_file_chooser_button_get_type
gtk_file_chooser_dialog_get_type
gtk_file_chooser_get_type
diff --git a/docs/reference/gtk/tmpl/gtkextendedlayout.sgml b/docs/reference/gtk/tmpl/gtkextendedlayout.sgml
new file mode 100644
index 0000000..4571504
--- /dev/null
+++ b/docs/reference/gtk/tmpl/gtkextendedlayout.sgml
@@ -0,0 +1,85 @@
+<!-- ##### SECTION Title ##### -->
+GtkExtendedLayout
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT GtkExtendedLayout ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT GtkExtendedLayoutIface ##### -->
+<para>
+
+</para>
+
+ g_iface:
+ get_features:
+ get_height_for_width:
+ get_width_for_height:
+ get_natural_size:
+ get_baselines:
+
+<!-- ##### FUNCTION gtk_extended_layout_get_baselines ##### -->
+<para>
+
+</para>
+
+ layout:
+ baselines:
+ Returns:
+
+
+<!-- ##### FUNCTION gtk_extended_layout_get_features ##### -->
+<para>
+
+</para>
+
+ layout:
+ Returns:
+
+
+<!-- ##### FUNCTION gtk_extended_layout_get_height_for_width ##### -->
+<para>
+
+</para>
+
+ layout:
+ width:
+ Returns:
+
+
+<!-- ##### FUNCTION gtk_extended_layout_get_natural_size ##### -->
+<para>
+
+</para>
+
+ layout:
+ requisition:
+
+
+<!-- ##### FUNCTION gtk_extended_layout_get_width_for_height ##### -->
+<para>
+
+</para>
+
+ layout:
+ height:
+ Returns:
+
+
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index e491701..d48ec8b 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -179,6 +179,7 @@ gtk_public_h_sources = \
gtkenums.h \
gtkeventbox.h \
gtkexpander.h \
+ gtkextendedlayout.h \
gtkfilechooser.h \
gtkfilechooserbutton.h \
gtkfilechooserdialog.h \
@@ -437,6 +438,7 @@ gtk_base_c_sources = \
gtkentrycompletion.c \
gtkeventbox.c \
gtkexpander.c \
+ gtkextendedlayout.c \
gtkfilechooser.c \
gtkfilechooserbutton.c \
gtkfilechooserdefault.c \
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 1e9436f..07ca775 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -79,6 +79,7 @@
#include <gtk/gtkenums.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkexpander.h>
+#include <gtk/gtkextendedlayout.h>
#include <gtk/gtkfilesel.h>
#include <gtk/gtkfixed.h>
#include <gtk/gtkfilechooserbutton.h>
diff --git a/gtk/gtkextendedlayout.c b/gtk/gtkextendedlayout.c
new file mode 100644
index 0000000..78e0593
--- /dev/null
+++ b/gtk/gtkextendedlayout.c
@@ -0,0 +1,166 @@
+/* gtkextendedlayout.c
+ * Copyright (C) 2007 Mathias Hasselmann <mathias hasselmann gmx de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include "gtkextendedlayout.h"
+#include "gtkintl.h"
+#include "gtkalias.h"
+
+GType
+gtk_extended_layout_get_type (void)
+{
+ static GType extended_layout_type = 0;
+
+ if (G_UNLIKELY(!extended_layout_type))
+ extended_layout_type =
+ g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkExtendedLayout"),
+ sizeof (GtkExtendedLayoutIface),
+ NULL, 0, NULL, 0);
+
+ return extended_layout_type;
+}
+
+/**
+ * gtk_extended_layout_get_features:
+ * @layout: a #GtkExtendedLayout
+ *
+ * Query which extended layout features are supported.
+ *
+ * Returns: the #GtkExtendedLayoutFeatures supported
+ *
+ * Since: 2.14
+ **/
+GtkExtendedLayoutFeatures
+gtk_extended_layout_get_features (GtkExtendedLayout *layout)
+{
+ GtkExtendedLayoutIface *iface;
+
+ g_return_val_if_fail (GTK_IS_EXTENDED_LAYOUT (layout), 0);
+
+ iface = GTK_EXTENDED_LAYOUT_GET_IFACE (layout);
+
+ g_return_val_if_fail (iface->get_features, 0);
+ return iface->get_features(layout);
+}
+
+/**
+ * gtk_extended_layout_get_height_for_width:
+ * @layout: a #GtkExtendedLayout
+ * @width: the horizontal space available
+ *
+ * Query which vertical space this extended layout item would require,
+ * given the specified amount of horizontal space is made available.
+ *
+ * Returns: the height required when #width is assigned or -1 on error
+ *
+ * Since: 2.14
+ **/
+gint
+gtk_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
+ gint width)
+{
+ GtkExtendedLayoutIface *iface;
+
+ g_return_val_if_fail (GTK_IS_EXTENDED_LAYOUT (layout), -1);
+
+ iface = GTK_EXTENDED_LAYOUT_GET_IFACE (layout);
+
+ g_return_val_if_fail (iface->get_height_for_width, -1);
+ return iface->get_height_for_width(layout, width);
+}
+
+/**
+ * gtk_extended_layout_get_width_for_height:
+ * @layout: a #GtkExtendedLayout
+ * @height: the vertical space available
+ *
+ * Query which horizontal space this extended layout item would require,
+ * given the specified amount of vertical space is made available.
+ *
+ * Returns: the width required when #height is assigned or -1 on error
+ *
+ * Since: 2.14
+ **/
+gint
+gtk_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
+ gint height)
+{
+ GtkExtendedLayoutIface *iface;
+
+ g_return_val_if_fail (GTK_IS_EXTENDED_LAYOUT (layout), -1);
+
+ iface = GTK_EXTENDED_LAYOUT_GET_IFACE (layout);
+
+ g_return_val_if_fail (iface->get_width_for_height, -1);
+ return iface->get_width_for_height(layout, height);
+}
+
+/**
+ * gtk_extended_layout_get_natural_size:
+ * @layout: a #GtkExtendedLayout
+ * @requisition: a #GtkRequisition to be filled in
+ *
+ * Query the natural (preferred) size of the layout item.
+ * This natural size can be larger than the requested size,
+ * e.g. if the item contains optional or ellipized text.
+ *
+ * Since: 2.14
+ **/
+void
+gtk_extended_layout_get_natural_size (GtkExtendedLayout *layout,
+ GtkRequisition *requisition)
+{
+ GtkExtendedLayoutIface *iface;
+
+ g_return_if_fail (GTK_IS_EXTENDED_LAYOUT (layout));
+ g_return_if_fail (NULL != requisition);
+
+ iface = GTK_EXTENDED_LAYOUT_GET_IFACE (layout);
+
+ g_return_if_fail (iface->get_natural_size);
+ return iface->get_natural_size(layout, requisition);
+}
+
+/**
+ * gtk_extended_layout_get_baselines:
+ * @layout: a #GtkExtendedLayout
+ * @baselines: an array of baselines to be filled in
+ *
+ * Query the baselines of the layout item. Baselines are imaginary
+ * horizontal lines used to vertically align text and images.
+ *
+ * Returns: the number of entries in @baselines or -1 on error
+ *
+ * Since: 2.14
+ **/
+gint
+gtk_extended_layout_get_baselines (GtkExtendedLayout *layout,
+ gint **baselines)
+{
+ GtkExtendedLayoutIface *iface;
+
+ g_return_val_if_fail (GTK_IS_EXTENDED_LAYOUT (layout), -1);
+ g_return_val_if_fail (NULL != baselines, -1);
+
+ iface = GTK_EXTENDED_LAYOUT_GET_IFACE (layout);
+
+ g_return_val_if_fail (iface->get_baselines, -1);
+ return iface->get_baselines(layout, baselines);
+}
diff --git a/gtk/gtkextendedlayout.h b/gtk/gtkextendedlayout.h
new file mode 100644
index 0000000..481d8f9
--- /dev/null
+++ b/gtk/gtkextendedlayout.h
@@ -0,0 +1,77 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2007 Mathias Hasselmann <mathias hasselmann gmx de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_EXTENDED_LAYOUT_H__
+#define __GTK_EXTENDED_LAYOUT_H__
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_EXTENDED_LAYOUT (gtk_extended_layout_get_type ())
+#define GTK_EXTENDED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EXTENDED_LAYOUT, GtkExtendedLayout))
+#define GTK_EXTENDED_LAYOUT_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GTK_TYPE_EXTENDED_LAYOUT, GtkExtendedLayoutIface))
+#define GTK_IS_EXTENDED_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EXTENDED_LAYOUT))
+#define GTK_EXTENDED_LAYOUT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_EXTENDED_LAYOUT, GtkExtendedLayoutIface))
+
+typedef struct _GtkExtendedLayout GtkExtendedLayout;
+typedef struct _GtkExtendedLayoutIface GtkExtendedLayoutIface;
+typedef enum _GtkExtendedLayoutFeatures GtkExtendedLayoutFeatures;
+
+/*< flags >*/
+enum _GtkExtendedLayoutFeatures
+{
+ GTK_EXTENDED_LAYOUT_WIDTH_FOR_HEIGHT = (1 << 0),
+ GTK_EXTENDED_LAYOUT_HEIGHT_FOR_WIDTH = (1 << 1),
+ GTK_EXTENDED_LAYOUT_NATURAL_SIZE = (1 << 2),
+ GTK_EXTENDED_LAYOUT_BASELINES = (1 << 3)
+};
+
+struct _GtkExtendedLayoutIface
+{
+ GTypeInterface g_iface;
+
+ /* virtual table */
+
+ GtkExtendedLayoutFeatures (*get_features) (GtkExtendedLayout *layout);
+ gint (*get_height_for_width) (GtkExtendedLayout *layout,
+ gint width);
+ gint (*get_width_for_height) (GtkExtendedLayout *layout,
+ gint height);
+ void (*get_natural_size) (GtkExtendedLayout *layout,
+ GtkRequisition *requisition);
+ gint (*get_baselines) (GtkExtendedLayout *layout,
+ gint **baselines);
+};
+
+
+GType gtk_extended_layout_get_type (void) G_GNUC_CONST;
+GtkExtendedLayoutFeatures gtk_extended_layout_get_features (GtkExtendedLayout *layout);
+gint gtk_extended_layout_get_height_for_width (GtkExtendedLayout *layout,
+ gint width);
+gint gtk_extended_layout_get_width_for_height (GtkExtendedLayout *layout,
+ gint height);
+void gtk_extended_layout_get_natural_size (GtkExtendedLayout *layout,
+ GtkRequisition *requisition);
+gint gtk_extended_layout_get_baselines (GtkExtendedLayout *layout,
+ gint **baselines);
+
+G_END_DECLS
+
+#endif /* __GTK_EXTENDED_LAYOUT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]