[gtk+] GtkLabel: Make it possible to get the ellipsis range
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkLabel: Make it possible to get the ellipsis range
- Date: Thu, 4 Sep 2014 02:23:38 +0000 (UTC)
commit fc5f7cc1383f869c3e82c9e327801d6b03bc854b
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 3 21:39:34 2014 -0400
GtkLabel: Make it possible to get the ellipsis range
This will be used in the next commit to expand the selection.
gtk/gtklabel.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index d5377ae..9c9d098 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -4562,9 +4562,11 @@ get_layout_index (GtkLabel *label,
}
static gboolean
-range_is_in_ellipsis (GtkLabel *label,
- gint start,
- gint end)
+range_is_in_ellipsis_full (GtkLabel *label,
+ gint range_start,
+ gint range_end,
+ gint *ellipsis_start,
+ gint *ellipsis_end)
{
GtkLabelPrivate *priv = label->priv;
PangoLayoutIter *iter;
@@ -4592,13 +4594,19 @@ range_is_in_ellipsis (GtkLabel *label,
item = ((PangoGlyphItem*)run)->item;
- if (item->offset <= start && end <= item->offset + item->length)
+ if (item->offset <= range_start && range_end <= item->offset + item->length)
{
if (item->analysis.flags & PANGO_ANALYSIS_FLAG_IS_ELLIPSIS)
- in_ellipsis = TRUE;
+ {
+ if (ellipsis_start)
+ *ellipsis_start = item->offset;
+ if (ellipsis_end)
+ *ellipsis_end = item->offset + item->length;
+ in_ellipsis = TRUE;
+ }
break;
}
- else if (item->offset + item->length >= end)
+ else if (item->offset + item->length >= range_end)
break;
}
} while (pango_layout_iter_next_run (iter));
@@ -4608,6 +4616,14 @@ range_is_in_ellipsis (GtkLabel *label,
return in_ellipsis;
}
+static gboolean
+range_is_in_ellipsis (GtkLabel *label,
+ gint range_start,
+ gint range_end)
+{
+ return range_is_in_ellipsis_full (label, range_start, range_end, NULL, NULL);
+}
+
static void
gtk_label_select_word (GtkLabel *label)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]