diff --git a/src/gui/interact/ui-coord.hpp b/src/gui/interact/ui-coord.hpp index 3e44a001f..f66d064fb 100644 --- a/src/gui/interact/ui-coord.hpp +++ b/src/gui/interact/ui-coord.hpp @@ -101,8 +101,8 @@ namespace interact { /** * Describe a location within the UI through structural/topological coordinates. - * A UICoord specification is a tuple, elaborating a path through the hierarchy - * of UI elements down to the specific element referred. + * A UICoord specification is a sequence of Literal tokens, elaborating a path descending + * through the hierarchy of UI elements down to the specific UI element to refer. * * @todo initial draft as of 9/2017 */ @@ -112,7 +112,26 @@ namespace interact { using PathAry = lib::PathArray; public: - using PathAry::PathArray; + /** + * UI-Coordinates can be created explicitly by specifying a sequence of Literal tokens, + * which will be used to initialise and then normalise the underlying PathArray. + * @warning Literal means _"literal"_ with guaranteed storage during the whole execution. + * @remarks - in case you need to construct some part, then use Symbol to _intern_ the + * resulting string into the global static SymbolTable. + * - usually the Builder API leads to more readable definitions, + * explicitly indicating the meaning of the coordinate's parts. + */ + template + explicit + UICoord (ARGS&& ...args) : PathArray(std::forward (args)...) { } + + UICoord (UICoord&&) = default; + UICoord (UICoord const&) = default; + UICoord (UICoord& o) : UICoord((UICoord const&)o) { } + + UICoord& operator= (UICoord const&) = default; + UICoord& operator= (UICoord &&) = default; + /* === Builder API === */ diff --git a/tests/gui/interact/ui-coord-test.cpp b/tests/gui/interact/ui-coord-test.cpp index 2ee8b7b7b..2df206d74 100644 --- a/tests/gui/interact/ui-coord-test.cpp +++ b/tests/gui/interact/ui-coord-test.cpp @@ -354,7 +354,12 @@ namespace test { void verify_comparisons() { - UNIMPLEMENTED ("verify comparison of UI coordinates"); + UICoord u1 {"Γ","Δ","Θ","Ξ","Σ","Ψ","Φ" }; + UICoord u11{"Γ","Δ","Θ","Ξ","Σ","Ψ","Φ","Ω"}; + UICoord u2 {"Γ","Δ","Θ","Σ","Ξ","Ψ","Φ","Ω"}; + + UICoord u1c{u1}; + }