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);

Then, to add a widget at that position, use Gtk::TextView::add_child_at_anchor():

m_TextView.add_child_at_anchor(m_Button, refAnchor);

Reference