Widgets and ChildAnchors

You can embed widgets, such as Gtk::Buttons, in the text. Each such child widget needs a ChildAnchor. ChildAnchors are associated with iterators. For instance, to create a child anchor at a particular position, use Gtk::TextBuffer::create_child_anchor():

auto refAnchor = refBuffer->create_child_anchor(iter);

Använd sedan Gtk::TextView::add_child_at_anchor() för att lägga till en komponent på den positionen:

m_TextView.add_child_at_anchor(m_Button, refAnchor);

Referens