summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--docs/reference/ChangeLog5
-rw-r--r--docs/reference/gtk/gtk-sections.txt2
-rw-r--r--gtk/gtk.symbols2
-rw-r--r--gtk/gtklabel.c72
-rw-r--r--gtk/gtklabel.h4
7 files changed, 99 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e8b2bd269..f557a31b06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-19 Alexander Larsson <alexl@redhat.com>
+
+ * gtk/gtk.symbols:
+ * gtk/gtklabel.[ch]:
+ Add gtk_label_set_line_wrap_mode, gtk_label_get_line_wrap_mode, and
+ a wrap-mode property that lets you set the PangoWrapMode.
+
2006-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprinter-private.h:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 1e8b2bd269..f557a31b06 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+2006-06-19 Alexander Larsson <alexl@redhat.com>
+
+ * gtk/gtk.symbols:
+ * gtk/gtklabel.[ch]:
+ Add gtk_label_set_line_wrap_mode, gtk_label_get_line_wrap_mode, and
+ a wrap-mode property that lets you set the PangoWrapMode.
+
2006-06-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprinter-private.h:
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index 4d98aeecc9..0193c12e39 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-19 Alexander Larsson <alexl@redhat.com>
+
+ * gtk/gtk-sections.txt:
+ Add gtk_label_set_line_wrap_mode and gtk_label_get_line_wrap_mode
+
2006-06-12 Matthias Clasen <mclasen@redhat.com>
* === Released 2.9.3 ===
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index c213980d44..879b6eb64c 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -2008,6 +2008,7 @@ gtk_label_set_max_width_chars
gtk_label_get
gtk_label_parse_uline
gtk_label_set_line_wrap
+gtk_label_set_line_wrap_mode
gtk_label_set
gtk_label_get_layout_offsets
gtk_label_get_mnemonic_keyval
@@ -2026,6 +2027,7 @@ gtk_label_get_max_width_chars
gtk_label_get_label
gtk_label_get_layout
gtk_label_get_line_wrap
+gtk_label_get_line_wrap_mode
gtk_label_get_mnemonic_widget
gtk_label_get_selection_bounds
gtk_label_get_use_markup
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 95cc90ed67..6591ac26d9 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -1984,6 +1984,7 @@ gtk_label_get_label
gtk_label_get_layout
gtk_label_get_layout_offsets
gtk_label_get_line_wrap
+gtk_label_get_line_wrap_mode
gtk_label_get_max_width_chars
gtk_label_get_mnemonic_keyval
gtk_label_get_mnemonic_widget
@@ -2004,6 +2005,7 @@ gtk_label_set_ellipsize
gtk_label_set_justify
gtk_label_set_label
gtk_label_set_line_wrap
+gtk_label_set_line_wrap_mode
gtk_label_set_markup
gtk_label_set_markup_with_mnemonic
gtk_label_set_max_width_chars
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index f94642dae4..2a755adc78 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -83,6 +83,7 @@ enum {
PROP_JUSTIFY,
PROP_PATTERN,
PROP_WRAP,
+ PROP_WRAP_MODE,
PROP_SELECTABLE,
PROP_MNEMONIC_KEYVAL,
PROP_MNEMONIC_WIDGET,
@@ -340,6 +341,23 @@ gtk_label_class_init (GtkLabelClass *class)
P_("If set, wrap lines if the text becomes too wide"),
FALSE,
GTK_PARAM_READWRITE));
+ /**
+ * GtkLabel:wrap-mode:
+ *
+ * If line wrapping is on (see the wrap property) this controls how
+ * the line wrapping is done. The default is %PANGO_WRAP_WORD which means
+ * wrap on word boundaries.
+ *
+ * Since: 2.10
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_WRAP_MODE,
+ g_param_spec_enum ("wrap-mode",
+ P_("Line wrap mode"),
+ P_("If wrap is set, controls how linewrapping is done"),
+ PANGO_TYPE_WRAP_MODE,
+ PANGO_WRAP_WORD,
+ GTK_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_SELECTABLE,
g_param_spec_boolean ("selectable",
@@ -641,6 +659,9 @@ gtk_label_set_property (GObject *object,
case PROP_WRAP:
gtk_label_set_line_wrap (label, g_value_get_boolean (value));
break;
+ case PROP_WRAP_MODE:
+ gtk_label_set_line_wrap_mode (label, g_value_get_enum (value));
+ break;
case PROP_SELECTABLE:
gtk_label_set_selectable (label, g_value_get_boolean (value));
break;
@@ -698,6 +719,9 @@ gtk_label_get_property (GObject *object,
case PROP_WRAP:
g_value_set_boolean (value, label->wrap);
break;
+ case PROP_WRAP_MODE:
+ g_value_set_enum (value, label->wrap_mode);
+ break;
case PROP_SELECTABLE:
g_value_set_boolean (value, gtk_label_get_selectable (label));
break;
@@ -763,6 +787,7 @@ gtk_label_init (GtkLabel *label)
label->jtype = GTK_JUSTIFY_LEFT;
label->wrap = FALSE;
+ label->wrap_mode = PANGO_WRAP_WORD;
label->ellipsize = PANGO_ELLIPSIZE_NONE;
label->use_underline = FALSE;
@@ -1693,6 +1718,51 @@ gtk_label_get_line_wrap (GtkLabel *label)
return label->wrap;
}
+/**
+ * gtk_label_set_line_wrap_mode:
+ * @label: a #GtkLabel
+ * @wrap: the line wrapping mode
+ *
+ * If line wrapping is on (see gtk_label_set_line_wrap()) this controls how
+ * the line wrapping is done. The default is %PANGO_WRAP_WORD which means
+ * wrap on word boundaries.
+ *
+ * Since: 2.10
+ **/
+void
+gtk_label_set_line_wrap_mode (GtkLabel *label,
+ PangoWrapMode wrap_mode)
+{
+ g_return_if_fail (GTK_IS_LABEL (label));
+
+ if (label->wrap_mode != wrap_mode)
+ {
+ label->wrap_mode = wrap_mode;
+ g_object_notify (G_OBJECT (label), "wrap-mode");
+
+ gtk_widget_queue_resize (GTK_WIDGET (label));
+ }
+}
+
+/**
+ * gtk_label_get_line_wrap_mode:
+ * @label: a #GtkLabel
+ *
+ * Returns line wrap mode used by the label. See gtk_label_set_line_wrap_mode ().
+ *
+ * Return value: %TRUE if the lines of the label are automatically wrapped.
+ *
+ * Since: 2.10
+ */
+PangoWrapMode
+gtk_label_get_line_wrap_mode (GtkLabel *label)
+{
+ g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
+
+ return label->wrap_mode;
+}
+
+
void
gtk_label_get (GtkLabel *label,
gchar **str)
@@ -1875,6 +1945,8 @@ gtk_label_ensure_layout (GtkLabel *label)
GtkWidgetAuxInfo *aux_info;
gint longest_paragraph;
gint width, height;
+
+ pango_layout_set_wrap (label->layout, label->wrap_mode);
aux_info = _gtk_widget_get_aux_info (widget, FALSE);
if (aux_info && aux_info->width > 0)
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
index 3e14e01b4a..e13a71677d 100644
--- a/gtk/gtklabel.h
+++ b/gtk/gtklabel.h
@@ -61,6 +61,7 @@ struct _GtkLabel
guint single_line_mode : 1;
guint have_transform : 1;
guint in_click : 1;
+ guint wrap_mode : 3;
guint mnemonic_keyval;
@@ -143,6 +144,9 @@ void gtk_label_set_pattern (GtkLabel *label,
void gtk_label_set_line_wrap (GtkLabel *label,
gboolean wrap);
gboolean gtk_label_get_line_wrap (GtkLabel *label);
+void gtk_label_set_line_wrap_mode (GtkLabel *label,
+ PangoWrapMode wrap_mode);
+PangoWrapMode gtk_label_get_line_wrap_mode (GtkLabel *label);
void gtk_label_set_selectable (GtkLabel *label,
gboolean setting);
gboolean gtk_label_get_selectable (GtkLabel *label);