summaryrefslogtreecommitdiff
path: root/gtk/gtktextiter.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-11-03 20:40:57 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-03 20:40:57 +0000
commitca83d0a3dcb6660cff67f61fca108b1b02c31859 (patch)
treee3fc8cfe149cdfaac5adb2750c24c200c38e276a /gtk/gtktextiter.c
parentb506b461cb03d4b3aac16f82298a5427f1baf759 (diff)
downloadgdk-pixbuf-ca83d0a3dcb6660cff67f61fca108b1b02c31859.tar.gz
Get widgets working on the btree/buffer side. Display of them still
2000-11-03 Havoc Pennington <hp@redhat.com> Get widgets working on the btree/buffer side. Display of them still doesn't work. * gtk/gtktextview.c: start implementing child widget stuff * gtk/gtktextiter.c (gtk_text_iter_get_child_anchor): new function * gtk/gtktextlayout.c: handle embedded widgets * gtk/gtktextdisplay.c: handle embedded widgets * gtk/gtktextchild.c: Implement all the child anchor goo * gtk/gtktextbuffer.c (gtk_text_buffer_create_child_anchor): New function * gtk/gtktextbtree.c: Add child anchor table to the btree struct (insert_pixbuf_or_widget_segment): abstract out common portions of creating a child anchor or a pixbuf segment. (gtk_text_btree_create_child_anchor): new function (gtk_text_btree_unregister_child_anchor): new function * gtk/gtkmarshal.list: added VOID:OBJECT,INT,INT for the allocate_child signal on GtkTextLayout * gtk/gtktextiter.c (gtk_text_iter_get_pixbuf): fix bogus return values (gtk_text_iter_get_child_anchor): new function * gtk/gtktextbuffer.c (gtk_text_buffer_real_changed): Add a default handler for the changed signal, which calls gtk_text_buffer_set_modified(), instead of just always emitting changed then calling set_modified() manually. I guess this is maybe more flexible. It seems logical.
Diffstat (limited to 'gtk/gtktextiter.c')
-rw-r--r--gtk/gtktextiter.c55
1 files changed, 52 insertions, 3 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index 4e5ba2bce..e57855551 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -849,22 +849,52 @@ gtk_text_iter_get_pixbuf (const GtkTextIter *iter)
{
GtkTextRealIter *real;
- g_return_val_if_fail (iter != NULL, FALSE);
+ g_return_val_if_fail (iter != NULL, NULL);
real = gtk_text_iter_make_real (iter);
if (real == NULL)
- return FALSE;
+ return NULL;
check_invariants (iter);
if (real->segment->type != &gtk_text_pixbuf_type)
- return FALSE;
+ return NULL;
else
return real->segment->body.pixbuf.pixbuf;
}
/**
+ * gtk_text_iter_get_child_anchor:
+ * @iter: an iterator
+ *
+ * If the location pointed to by @iter contains a child anchor, the
+ * anchor is returned (with no new reference count added). Otherwise,
+ * NULL is returned.
+ *
+ * Return value: the anchor at @iter
+ **/
+GtkTextChildAnchor*
+gtk_text_iter_get_child_anchor (const GtkTextIter *iter)
+{
+ GtkTextRealIter *real;
+
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ real = gtk_text_iter_make_real (iter);
+
+ if (real == NULL)
+ return NULL;
+
+ check_invariants (iter);
+
+ if (real->segment->type != &gtk_text_child_type)
+ return NULL;
+ else
+ return real->segment->body.child.obj;
+}
+
+/**
* gtk_text_iter_get_marks:
* @iter: an iterator
*
@@ -3734,6 +3764,25 @@ gtk_text_btree_get_iter_at_mark (GtkTextBTree *tree,
}
void
+gtk_text_btree_get_iter_at_child_anchor (GtkTextBTree *tree,
+ GtkTextIter *iter,
+ GtkTextChildAnchor *anchor)
+{
+ GtkTextLineSegment *seg;
+
+ g_return_if_fail (iter != NULL);
+ g_return_if_fail (tree != NULL);
+ g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
+
+ seg = anchor->segment;
+
+ iter_init_from_segment (iter, tree,
+ seg->body.child.line, seg);
+ g_assert (seg->body.child.line == gtk_text_iter_get_text_line (iter));
+ check_invariants (iter);
+}
+
+void
gtk_text_btree_get_last_iter (GtkTextBTree *tree,
GtkTextIter *iter)
{