Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
Notebook Class Reference

#include "stage/dialog/test-control.hpp"

Description

Helper widget to simplify construction and wiring of a Notebook widget.

Gtk::Notebook is quite powerful container foundation to build complex dialog widgets with multiple pages on tabs. However, the construction, wiring and setup is notoriously tedious, due to the repetitiveness and the sheer amount of child widgets spread over various pages.

This design draft is an attempt to mitigate the required boilerplate, without overly much obscuring the structure. The basic idea is to package each page into a locally defined child struct, which is actually heap allocated and managed automatically. This way, each child page gets its own namespace, and wiring to other components is made explicit by passing named ctor arguments – while the overall structure of building and wiring of widgets stays close to the habits of programming with GTKmm.

  • define the pages as custom widgets, typically just as locally known struct types
  • invoke buildPage passing the type and tab label for each page
  • define the wiring of the components within a page in the page's ctor
  • possibly pass external dependencies for wiring into that ctor
    Note
    the page widgets are actually heap allocated and managed automatically
    See also
    stage::dialog::TestControl as a usage example

Definition at line 126 of file test-control.hpp.

Public Member Functions

template<class PAG , typename... ARGS>
NotebookbuildPage (cuString pageLabel, ARGS &&...ctorArgs)
 

Additional Inherited Members

- Private Types inherited from ScopedPtrVect< Gtk::Widget >
typedef size_t size_type
 
typedef Gtk::Widget value_type
 
typedef Gtk::Widget & reference
 
typedef Gtk::Widget const & const_reference
 
using iterator = IterType
 
using const_iterator = ConstIterType
 
- Private Member Functions inherited from ScopedPtrVect< Gtk::Widget >
 ~ScopedPtrVect ()
 
 ScopedPtrVect ()
 
 ScopedPtrVect (size_type capacity)
 
 ScopedPtrVect (ScopedPtrVect &&src)
 
ScopedPtrVectoperator= (ScopedPtrVect &&other)
 
Gtk::Widget & manage (Gtk::Widget *obj)
 take ownership of the given object, adding it at the end of the collection
 
Gtk::Widget * detach (void *objAddress)
 withdraw responsibility for a specific object.
 
void clear ()
 
Gtk::Widget & operator[] (size_type i)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_type size () const
 
size_type max_size () const
 
size_type capacity () const
 
bool empty () const
 

Member Function Documentation

◆ buildPage()

template<class PAG , typename... ARGS>
Notebook & buildPage ( cuString  pageLabel,
ARGS &&...  ctorArgs 
)
inline

Definition at line 133 of file test-control.hpp.

References ScopedPtrVect< Gtk::Widget >::manage().

Referenced by TestControl::TestControl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
+ Inheritance diagram for Notebook:
+ Collaboration diagram for Notebook:

The documentation for this class was generated from the following file: