Lumiera  0.pre.03
»edit your freedom«
expander-revealer.hpp File Reference

Go to the source code of this file.

Description

Helper components to implement some standard UI-element actions by installing a functor.

The protocol for operating UI elements connected to the UI-Bus includes some generic operations, which need to be concretised for each actual usage situation. Moreover, there are many situations where implementing those actions does not make much sense, and thus they need to be treated as optional.

  • some widgets or elements can be expanded or collapsed, to show more information or to save screen real estate. Such widgets also expose an expansion state.
  • sometimes it is necessary to bring a given widget into sight, be it to show the effect of some processing, or be it to indicate an error situation.

Usage in the default implementation

The base class of all tangible UI elements provides a default implementation for these generic interaction mechanisms: It offers slots to connect UI signals against, and it understands the mark messages "expand" and "reveal". These are implemented by delegating to the Expander and Revealer functors respectively. Moreover, this default implementation automatically detects a resulting state change and emits an appropriate note message on the UI-Bus, so to make those state changes persistent. However, in order to supply an concrete implementation, depending on the circumstances, either the widget itself or a parent container holding the element needs to install lambdas into those functor holders, to detail what actually needs to be done. E.g. it is quite common to implement the "expand" functionality by wrapping the widget into a Gtk::Expander. Which effectively means that the widget itself is not able to expand itself, since this Gtk::Expander container widget lives within the parent widget to hold the element. So this parent needs to install a lambda when establishing the child element, and bind it to the Gtk::Expander::set_expanded property, and the corresponding Gtk::Expander::get_expanded to retrieve the current expansion state. However, to the contrary, some widgets do implement their expansion state all by themselves, e.g. by switching the presentation layout. Those widgets will have to install an appropriate Expander functor within their constructor.

See also
UI-Element protocol
simple test case
usage example

Definition in file expander-revealer.hpp.

#include "lib/error.hpp"
#include <functional>
#include <utility>

Classes

class  Expander
 Functor component to support the default implementation of expanding/collapsing. More...
 
class  Revealer
 Functor component to support the default implementation of revealing an UI-Element. 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.