Lumiera  0.pre.03
gen-node-location-query.hpp File Reference

Go to the source code of this file.


Implementation of the gui::interact::LocationQuery interface to work on a GenNode tree.

The interface allows to pose queries against a concrete structure to verify and reshape some UI Coordinate specification; basically it offers methods to navigate within a tree-like structure. While in the actual implementation, such a query interface would be backed by navigating real UI structures, the implementation given here instead uses a generic tree structure given as Record<GenNode>.

Representing UI structure as GenNode tree

While basically the interface LocationQuery abstracts and reduces the structure of an UI into just some hierarchically arranged and nested IDs, we should note some specific twists how a GenNode tree is used here to represent the structure elements as defined through UI coordinates:

  • we use the special type attribute to represent the perspective within each window; deliberately, we'll use this twisted structure here to highlight the fact that the backing structure need not be homogeneous; rather, it may require explicit branching
  • we use the attributes within the GenNode "object" representation, since these are named nested elements, and the whole notion of an UI coordinate path is based on named child components
  • relying upon the object builder notation, it is possible to define a whole structure as nested inline tree; named nested elements can be added with the set(key, val) builder function, and for each nested scope, we start a new nested builder with MakeRec().
  • since GenNodeLocationQuery is conceived for writing test and verification code, there is a special convention to set the currentWindow to be the last one in list – in a real UI this would not of course not be a configurable property of the LocationQuery, and rather just reflect the transient window state and return the currently activated window
WIP 10/2017 started in the effort of shaping the LoactionQuery interface, and used to support writing unit tests, to verify the UiCoordResolver. It remains to be seen if this implementation can be used beyond this limited purpose
See also

Definition in file gen-node-location-query.hpp.

#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "gui/interact/ui-coord-resolver.hpp"
#include "lib/diff/gen-node.hpp"
#include "lib/format-string.hpp"
#include "lib/iter-tree-explorer.hpp"
#include "lib/iter-source.hpp"
#include "lib/itertools.hpp"
#include "lib/util.hpp"
#include <utility>
#include <string>


class  GenNodeLocationQuery
 Test/Diagnostics: implementation of the LocationQuery-API based on a abstract topological structure given as Record<GenNode> ("GenNode tree"). More...
class  GenNodeLocationQuery::GenNodeNavigator< PAR >
 Helper to navigate a tree topology represented as GenNode tree. More...


 Lumiera GTK UI implementation root.
 UI interaction control.