[gtk+/extended-layout-jhs: 13/64] Introduce GtkBaselinePolicy. Add missing symbols. Introduce
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/extended-layout-jhs: 13/64] Introduce GtkBaselinePolicy. Add missing symbols. Introduce
- Date: Wed, 25 Nov 2009 11:20:00 +0000 (UTC)
commit 2f9952fd91be59326214e03f09702fa396058b16
Author: Mathias Hasselmann <mathias hasselmann gmx de>
Date: Wed Jun 27 23:43:55 2007 +0000
Introduce GtkBaselinePolicy. Add missing symbols. Introduce
2007-06-28 Mathias Hasselmann <mathias hasselmann gmx de>
* gtk/gtkenums.h: Introduce GtkBaselinePolicy.
* gtk/gtk.symbols: Add missing symbols.
* gtk/gtkextendedlayout.c, gtk/gtkextendedlayout.h:
Introduce gtk_extended_layout_get_single_baseline.
svn path=/branches/extended-layout/; revision=18267
ChangeLog.gtk-extended-layout | 7 +++++
gtk/gtk.symbols | 12 +++++++++
gtk/gtkenums.h | 9 +++++++
gtk/gtkextendedlayout.c | 53 +++++++++++++++++++++++++++++++++++++++++
gtk/gtkextendedlayout.h | 2 +
5 files changed, 83 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog.gtk-extended-layout b/ChangeLog.gtk-extended-layout
index a098d7f..a220889 100644
--- a/ChangeLog.gtk-extended-layout
+++ b/ChangeLog.gtk-extended-layout
@@ -1,5 +1,12 @@
2007-06-28 Mathias Hasselmann <mathias hasselmann gmx de>
+ * gtk/gtkenums.h: Introduce GtkBaselinePolicy.
+ * gtk/gtk.symbols: Add missing symbols.
+ * gtk/gtkextendedlayout.c, gtk/gtkextendedlayout.h:
+ Introduce gtk_extended_layout_get_single_baseline.
+
+2007-06-28 Mathias Hasselmann <mathias hasselmann gmx de>
+
* gtk/gtkbin.c: Prevent undefined behaviour when
gtk_widget_translate_coordinates fails.
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 5b28f13..8b78136 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -1284,6 +1284,18 @@ gtk_expander_set_use_underline
#endif
#endif
+#if IN_HEADER(__GTK_EXTENDED_LAYOUT_H__)
+#if IN_FILE(__GTK_EXTENDED_LAYOUT_C__)
+gtk_extended_layout_get_type G_GNUC_CONST
+gtk_extended_layout_get_features
+gtk_extended_layout_get_height_for_width
+gtk_extended_layout_get_width_for_height
+gtk_extended_layout_get_natural_size
+gtk_extended_layout_get_baselines
+gtk_extended_layout_get_single_baseline
+#endif
+#endif
+
#if IN_HEADER(__GTK_FILE_CHOOSER_H__)
#if IN_FILE(__GTK_FILE_CHOOSER_C__)
gtk_file_chooser_add_filter
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 6fabacf..eeb3ac7 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -82,6 +82,15 @@ typedef enum
GTK_BUTTONBOX_CENTER
} GtkButtonBoxStyle;
+/* Baseline alignment policy */
+typedef enum
+{
+ GTK_BASELINE_NONE,
+ GTK_BASELINE_FIRST,
+ GTK_BASELINE_AVERAGE,
+ GTK_BASELINE_LAST
+} GtkBaselinePolicy;
+
/* Curve types */
typedef enum
{
diff --git a/gtk/gtkextendedlayout.c b/gtk/gtkextendedlayout.c
index 78e0593..d7bfa3b 100644
--- a/gtk/gtkextendedlayout.c
+++ b/gtk/gtkextendedlayout.c
@@ -164,3 +164,56 @@ gtk_extended_layout_get_baselines (GtkExtendedLayout *layout,
g_return_val_if_fail (iface->get_baselines, -1);
return iface->get_baselines(layout, baselines);
}
+
+/**
+ * gtk_extended_layout_get_single_baseline:
+ * @layout: a #GtkExtendedLayout
+ * @policy: specifies the policy for choosing a baseline
+ *
+ * Queries a single baseline of the layout item.
+ *
+ * Since: 2.14
+ **/
+gint
+gtk_extended_layout_get_single_baseline (GtkExtendedLayout *layout,
+ GtkBaselinePolicy policy)
+{
+ gint *baselines = NULL;
+ gint offset = -1;
+ gint count, i;
+
+ g_return_val_if_fail (GTK_BASELINE_NONE != policy, -1);
+
+ count = gtk_extended_layout_get_baselines (layout, &baselines);
+
+ if (count > 0)
+ {
+ switch (policy)
+ {
+ case GTK_BASELINE_NONE:
+ break;
+
+ case GTK_BASELINE_FIRST:
+ offset = baselines [0];
+ break;
+
+ case GTK_BASELINE_LAST:
+ offset = baselines [count - 1];
+ break;
+
+ case GTK_BASELINE_AVERAGE:
+ for (i = 0, offset = 0; i < count; ++i)
+ offset += baselines[i];
+
+ offset = (offset + count - 1) / count;
+ break;
+ }
+
+ g_free (baselines);
+ }
+
+ return offset;
+}
+
+#define __GTK_EXTENDED_LAYOUT_C__
+#include "gtkaliasdef.c"
diff --git a/gtk/gtkextendedlayout.h b/gtk/gtkextendedlayout.h
index 69ca7ab..cb6ef75 100644
--- a/gtk/gtkextendedlayout.h
+++ b/gtk/gtkextendedlayout.h
@@ -84,6 +84,8 @@ void gtk_extended_layout_get_natural_size (GtkExtendedL
GtkRequisition *requisition);
gint gtk_extended_layout_get_baselines (GtkExtendedLayout *layout,
gint **baselines);
+gint gtk_extended_layout_get_single_baseline (GtkExtendedLayout *layout,
+ GtkBaselinePolicy policy);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]