Using composite widget

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using composite widget

Kip Warner
Hey list,

I have a Gtk::Notebook that will be dynamically populated with new
pages at run time. Each page will contain patterns of the same widget
layouts (for now, but later I will add some other kinds of pages too).
I think the logical way to handle this, and correct me if mistaken, is
by defining a composite widget for the pages to reuse?

I have defined a GtkBox containing the pattern of widgets I'd like to
see via Glade / GtkBuilder markup and flagged it as a composite in
Glade. At this time it just contains a GtkBox with a GtkSourceView but
later may contain toolbars, etc..

I cannot seem to find much documentation on how to use this composite
widget at runtime in Gtkmm. The closest I found was this thread below
which defined its widgets programmatically at run time.

https://mail.gnome.org/archives/gtkmm-list/2017-January/msg00027.html

I am assuming I must create a C++ class as he did and some how
"register" it so Gtk::Builder knows how to parse that composite widget
when it finds it in markup?. Without that I get...

    Error: Gtk::Builder cannot add resource: .:49:78 Not expecting to
    handle a template (class 'MyCompositeWidgetClass', parent 'GtkBox')

Can anyone point me to a minimal of what this should look like?

--
Kip Warner | Senior Software Engineer
OpenPGP signed/encrypted mail preferred
https://www.cartesiantheatre.com
_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

signature.asc (169 bytes) Download Attachment