Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
A solver to match incomplete coordinate specifications against the actual UI topology.
Within the Lumiera UI, a component view is typically created or retrieved to live at some position within the tree-like topology of the interface. Such happens as a consequence of interaction or other events, and the logic as to where and how to place a new UI element shall not be intermingled with the actual event handling code. Rather, the ViewLocator, as a service related to the InteractionDirector, can be invoked to draw on some default configuration plus the actual UI topology present at this time.
This Location solver is based on the pattern matching algorithm embedded within the UICoordResolver component. This mechanism allows to treat (typically) incomplete coordinate specifications as rules for locating an element. Several such coordinate clauses can be combined into a disjunctive LocationRule, which is evaluated by matching the clauses one by one, in given order, against the currently existing UI tree (topology). Each clause is evaluated individually from scratch (there is no common variable binding); the first clause to produce a successful match is used as solution – with any placeholders replaced by the actually matching UI elements.
Whenever a new UI element of a given kind is to be created, we query a standard location configuration to determine it's actual location within the interface. This standard configuration is known as id-scheme.hppViewSpec DSL"" and hard-wired into the UI code. Based on the aforementioned pattern matching rules, it allows to express placement rules dependent on the already existing UI. There are two kinds of location clauses
.create()
. It may still be incomplete (i.e. contain wildcards), which means, that the first explicitly given element after (below) the wildcards must exist in the tree, to allow for an unambiguous pattern match. Otherwise, for creating a new path completely from scratch, all elements have to be given explicitly. As a minimum requirement, each LocationRule should be concluded with such a "catch-all" explicit create clause, which describes the standard location of the element in question.Definition in file ui-location-solver.hpp.
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/format-util.hpp"
#include "stage/interact/ui-coord.hpp"
#include "stage/interact/ui-coord-resolver.hpp"
#include "lib/nocopy.hpp"
#include <utility>
#include <vector>
#include <string>
Classes | |
struct | LocationClause |
A single location specification to be matched and fulfilled. More... | |
class | LocationRule |
A rule to determine some location by matching against the UI-tree. More... | |
class | UILocationSolver |
Service to determine the location of an UI component view. More... | |
Typedefs | |
using | LocationQueryAccess = std::function< LocationQuery &()> |
Functions | |
LocationRule | operator or (UICoord::Builder &&firstRule, UICoord secondRule) |
DSL operator to assemble a sequence of clauses. More... | |
LocationRule && | operator or (LocationRule &&ruleSet, UICoord furtherRule) |
Namespaces | |
stage | |
Lumiera GTK UI implementation root. | |
stage::interact | |
UI interaction control. | |