Lumiera  0.pre.03
»edit your freedom«
view-hook.hpp File Reference

Go to the source code of this file.

Description

Allow widgets to connect to a common shared presentation context.

This is an abstraction to overcome the problem of cross-cutting a complex hierarchical widget structure in order to maintain a connection to some central presentation entity or canvas. We do not want a central "God class" to manage and remote-control the widgets, nor do we want the widgets to be aware of the hierarchical control structure they are part of. Yet still, widgets typically require to have some access to those shared central structures, especially if they need to "draw themselves". A widget must be able to attach itself to a presentation canvas, and it must be able to control its position thereon. As usual, we solve this problem by abstracting away the actual implementation of the central facility. The attachment of a widget is thus modelled by a smart-handle stage::timeline::ViewHooked, which – on destruction – automatically detaches the widget from the presentation.

As it turns out in practice, we get two flavours or view attachment:

  • Widgets just somehow placed into a grid or widget layout
  • Widgets attached to a canvas with positioning by coordinates Moreover, such a "hooked" widget will never exist apart from its attachment. Consequently, we locate the widget within the smart-handle itself, thus tightly linking together the lifecycle of the widget and the presentation attachment. However, this combined memory layout incurs some liabilities:
  • the combined ViewHooked<W> must be non-copyable, since it can be expected for the canvas to store some pointer to the attached widget.
  • moreover, the canvas/presentation need to be available and activated when constructing the widget(s) due to the interwoven lifecycle.
  • and, most notably, the presentation/canvas (the ViewHook) must be arranged to outlive the attached widgets, since they call back on destruction. In the typical usage situation these points can be ensured naturally by housing the widgets in some detail data structure owned by the top level presentation frame.
See also
ViewHook_test

Definition in file view-hook.hpp.

#include "lib/nocopy.hpp"
#include "lib/util.hpp"
#include <utility>

Classes

class  ViewHook< WID >
 Interface to represent _"some presentation layout entity",_ with the ability to attach widgets (managed elsewhere), and to re-establish a different sequence of the widgets (whatever this means). More...
 
class  ViewHooked< WID, BASE >
 A widget attached onto a display canvas or similar central presentation context. More...
 

Namespaces

 stage
 Lumiera GTK UI implementation root.
 
 stage::model
 The Lumiera GTK-GUI uses a thin proxy layer data model on top of the actual "high-level-model", which lives in the Steam-Layer below.