Using composite widget



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

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]