Navigator: continue draft of UI coordinate resolver
This commit is contained in:
parent
7b2c98474f
commit
2d5717bfd7
4 changed files with 84 additions and 4 deletions
|
|
@ -105,6 +105,20 @@ namespace interact {
|
||||||
|
|
||||||
/* === query functions === */
|
/* === query functions === */
|
||||||
|
|
||||||
|
/** */
|
||||||
|
bool
|
||||||
|
isAnchored() const
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED ("path anchorage check");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
bool
|
||||||
|
canAnchor() const
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED ("determine if a mutation is possible to anchor the path explicitly");
|
||||||
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
bool
|
bool
|
||||||
isCovered() const
|
isCovered() const
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ namespace interact {
|
||||||
|
|
||||||
|
|
||||||
extern Symbol UIC_CURRENT_WINDOW; ///< window spec to refer to the _current window_ @see view-locator.cpp
|
extern Symbol UIC_CURRENT_WINDOW; ///< window spec to refer to the _current window_ @see view-locator.cpp
|
||||||
|
extern Symbol UIC_FIRST_WINDOW; ///< window spec to refer to the _first window_ of the application
|
||||||
extern Symbol UIC_ELIDED; ///< indicate that a component is elided or irrelevant here
|
extern Symbol UIC_ELIDED; ///< indicate that a component is elided or irrelevant here
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,6 +137,9 @@ namespace interact {
|
||||||
/** shortcut to allow init from builder expression */
|
/** shortcut to allow init from builder expression */
|
||||||
UICoord (Builder&& builder);
|
UICoord (Builder&& builder);
|
||||||
|
|
||||||
|
/** Builder: start definition of UI-Coordinates rooted in the `firstWindow` */
|
||||||
|
static Builder firstWindow();
|
||||||
|
|
||||||
/** Builder: start definition of UI-Coordinates rooted in the `currentWindow` */
|
/** Builder: start definition of UI-Coordinates rooted in the `currentWindow` */
|
||||||
static Builder currentWindow();
|
static Builder currentWindow();
|
||||||
|
|
||||||
|
|
@ -144,6 +148,7 @@ namespace interact {
|
||||||
|
|
||||||
//----- convenience shortcuts to start a copy-builder....
|
//----- convenience shortcuts to start a copy-builder....
|
||||||
Builder persp (Literal perspectiveID) const;
|
Builder persp (Literal perspectiveID) const;
|
||||||
|
Builder panel (Literal panelID)const;
|
||||||
Builder view (Literal viewID) const;
|
Builder view (Literal viewID) const;
|
||||||
Builder tab (Literal tabID) const;
|
Builder tab (Literal tabID) const;
|
||||||
Builder tab (uint tabIdx) const;
|
Builder tab (uint tabIdx) const;
|
||||||
|
|
@ -501,6 +506,14 @@ namespace interact {
|
||||||
return std::move (*this);
|
return std::move (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** augment UI coordinates to indicate a specific view to be used */
|
||||||
|
Builder
|
||||||
|
panel (Literal panelID)
|
||||||
|
{
|
||||||
|
uic_.setComponent (UIC_PANEL, panelID);
|
||||||
|
return std::move (*this);
|
||||||
|
}
|
||||||
|
|
||||||
/** augment UI coordinates to indicate a specific view to be used */
|
/** augment UI coordinates to indicate a specific view to be used */
|
||||||
Builder
|
Builder
|
||||||
view (Literal viewID)
|
view (Literal viewID)
|
||||||
|
|
@ -586,9 +599,8 @@ namespace interact {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return an empty Builder allowing to define further parts;
|
/** @return a minimally defined Builder, allowing to define further parts;
|
||||||
* to finish the definition, cast / store it into
|
* to finish the definition, cast / store it into UICoord, which itself is immutable.
|
||||||
* UICoord, which itself is immutable.
|
|
||||||
*/
|
*/
|
||||||
inline UICoord::Builder
|
inline UICoord::Builder
|
||||||
UICoord::currentWindow()
|
UICoord::currentWindow()
|
||||||
|
|
@ -596,6 +608,12 @@ namespace interact {
|
||||||
return window (UIC_CURRENT_WINDOW);
|
return window (UIC_CURRENT_WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline UICoord::Builder
|
||||||
|
UICoord::firstWindow()
|
||||||
|
{
|
||||||
|
return window (UIC_CURRENT_WINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
/** @return aBuilder with just the windowID defined */
|
/** @return aBuilder with just the windowID defined */
|
||||||
inline UICoord::Builder
|
inline UICoord::Builder
|
||||||
UICoord::window (Literal windowID)
|
UICoord::window (Literal windowID)
|
||||||
|
|
@ -616,6 +634,12 @@ namespace interact {
|
||||||
return Builder(*this).persp (perspectiveID);
|
return Builder(*this).persp (perspectiveID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline UICoord::Builder
|
||||||
|
UICoord::panel (Literal panelID) const
|
||||||
|
{
|
||||||
|
return Builder(*this).panel (panelID);
|
||||||
|
}
|
||||||
|
|
||||||
inline UICoord::Builder
|
inline UICoord::Builder
|
||||||
UICoord::view (Literal viewID) const
|
UICoord::view (Literal viewID) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ namespace interact {
|
||||||
/* ==== definitions and concrete bindings for the View-Spec-DSL ==== */
|
/* ==== definitions and concrete bindings for the View-Spec-DSL ==== */
|
||||||
|
|
||||||
Symbol UIC_CURRENT_WINDOW{"currentWindow"};
|
Symbol UIC_CURRENT_WINDOW{"currentWindow"};
|
||||||
|
Symbol UIC_FIRST_WINDOW {"firstWindow"};
|
||||||
Symbol UIC_ELIDED {"."};
|
Symbol UIC_ELIDED {"."};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,51 @@ namespace test {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** @test query anchorage of given UI coordinates.
|
||||||
|
* - an anchored UI coordinate spec explicitly rooted within a top level window.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
verify_queryAnchor()
|
verify_queryAnchor()
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED ("query anchorage of given UI coordinates");
|
GenNodeLocationQuery loQu{MakeRec().scope(
|
||||||
|
MakeRec().type("perspective-A")
|
||||||
|
.genNode("window-1"),
|
||||||
|
MakeRec().type("perspective-B")
|
||||||
|
.scope(
|
||||||
|
MakeRec()
|
||||||
|
.scope(
|
||||||
|
MakeRec()
|
||||||
|
.genNode("someView")
|
||||||
|
).genNode("panelX")
|
||||||
|
).genNode("window-2")
|
||||||
|
)};
|
||||||
|
UICoord uic1 = UICoord::window("window-1").persp("perspective-A");
|
||||||
|
UICoord uic2 = UICoord::window("windows");
|
||||||
|
UICoord uic3 = UICoord::firstWindow();
|
||||||
|
UICoord uic4 = UICoord::currentWindow().persp("perspective-B");
|
||||||
|
UICoord uic5 = UICoord::currentWindow().panel("panelY");
|
||||||
|
UICoord uic6 = UICoord().view("someView").path("α/β/γ");
|
||||||
|
|
||||||
|
UICoordResolver r1{uic1, loQu};
|
||||||
|
UICoordResolver r2{uic2, loQu};
|
||||||
|
UICoordResolver r3{uic3, loQu};
|
||||||
|
UICoordResolver r4{uic4, loQu};
|
||||||
|
UICoordResolver r5{uic5, loQu};
|
||||||
|
UICoordResolver r6{uic6, loQu};
|
||||||
|
|
||||||
|
CHECK ( r1.isAnchored());
|
||||||
|
CHECK (not r2.isAnchored());
|
||||||
|
CHECK ( r3.isAnchored());
|
||||||
|
CHECK ( r4.isAnchored());
|
||||||
|
CHECK (not r5.isAnchored());
|
||||||
|
CHECK (not r6.isAnchored());
|
||||||
|
|
||||||
|
CHECK ( r1.canAnchor());
|
||||||
|
CHECK (not r2.canAnchor());
|
||||||
|
CHECK ( r3.canAnchor());
|
||||||
|
CHECK ( r4.canAnchor());
|
||||||
|
CHECK (not r5.canAnchor());
|
||||||
|
CHECK ( r6.canAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue