UiElement: likewise integrate the Revealer functor (#1162)

This commit is contained in:
Fischlurch 2018-08-31 23:42:55 +02:00
parent 41e0496576
commit 026049a13c
8 changed files with 69 additions and 71 deletions

View file

@ -117,12 +117,6 @@ namespace ctrl {
return true;
}
virtual void
doRevealYourself() override
{
getWidget().revealYourself(); // implies also expand
}
virtual bool
doMsg (string text) override
{
@ -179,6 +173,7 @@ namespace ctrl {
getWidget().expand (yes);
}
);
installRevealer([&](){ getWidget().revealYourself(); }); // implementation implies also expand
}
~NotificationHub() { };

View file

@ -70,18 +70,6 @@ namespace model {
UNIMPLEMENTED ("Controller reset");
}
virtual void
doReveal (ID child) override
{
UNIMPLEMENTED ("Controller doReveal");
}
virtual void
doRevealYourself() override
{
UNIMPLEMENTED ("Controller doRevealYourself");
}
virtual bool
doMsg (string text) override
{

View file

@ -189,22 +189,41 @@ namespace model {
/**
* @todo 12/2015 not clear yet what needs to be done
* @remarks the intention is to request the given child
* to be brought into sight. We need to set up some kind
* of children registration, but better not do this in
* a completely generic fashion, for danger of overengineering.
* Moreover, it is not clear yet, who will issue this request
* and at which element the initial request can/will be targeted.
* Cause the element to be brought into sight.
* This is a generic Slot to connect UI signals against;
* the same action can also be triggered by sending a **mark**
* message over the UI-Bus with the symbol "`revealYourself`".
* @note this is an optional feature and requires the actual widget or controller
* either to override the ::doRevealYourself() extension point, or to
* [install a suitable closure](\ref installRevealer()). Typically this
* is not in itself a persistent state change; however, it might incur
* expanding some widgets, which is recorded as persistent UI state.
* @remarks the intention is to make a specific element visible, e.g. to reveal
* the effect of some operation, or to mark a serious error condition.
* Implementing this is by no means trivial, since it involves the
* possibly recursive collaboration with enclosing container widgets,
* and maybe even to scroll to a given canvas position.
*/
void
Tangible::slotReveal(ID child)
Tangible::slotReveal()
{
this->doReveal(child);
this->doRevealYourself();
}
/**
* generic default implementation of the "reveal" functionality.
* Based on the #reveal_ functor, which needs to be [configured](\ref installRevealer())
* explicitly to enable this functionality.
*/
void
Tangible::doRevealYourself()
{
if (reveal_.canReveal())
reveal_();
}
/**
* Perform a command or action, once the execution context has been established.

View file

@ -202,8 +202,7 @@ namespace model {
void slotExpand();
void slotCollapse();
void slotReveal(ID child);
void slotReveal();
void markFlash();
void markMsg (string message);
@ -211,14 +210,14 @@ namespace model {
void mark(GenNode const&);
void installExpander (Expander::ProbeFun, Expander::ChangeFun);
void installRevealer (Revealer::RevealeItFun);
protected:
virtual bool doReset() =0;
virtual bool doClearMsg() =0;
virtual bool doClearErr() =0;
virtual bool doExpand (bool yes);
virtual void doReveal (ID child) =0;
virtual void doRevealYourself () =0;
virtual void doRevealYourself();
virtual bool doMsg (string) =0;
virtual bool doErr (string) =0;
@ -269,6 +268,20 @@ namespace model {
{
expand_ = Expander{move (detectCurrExpansionState), move (howto_expand_collapse)};
}
/**
* Configure the (optional) functionality to bring the UI-Element into sight.
* @param how_to_uncover_the_element a lambda or function<void()> to actually cause the necessary actions.
* @note unless this setup function is invoked, the "`revealYourself`" functionality remains disabled.
* Typically this setup will be done by an owning parent container, binding to some internals
* and also recursively invoking the "`revealYourself`" action on the container.
*/
inline void
Tangible::installRevealer (Revealer::RevealeItFun how_to_uncover_the_element)
{
reveal_ = Revealer{move (how_to_uncover_the_element)};
}

View file

@ -67,18 +67,6 @@ namespace model {
UNIMPLEMENTED ("Widget reset");
}
virtual void
doReveal (ID child) override
{
UNIMPLEMENTED ("Widget doReveal");
}
virtual void
doRevealYourself() override
{
UNIMPLEMENTED ("Widget doRevealYourself");
}
virtual bool
doMsg (string text) override
{

View file

@ -145,16 +145,11 @@ namespace test{
return Tangible::doExpand (yes);
}
virtual void
doReveal (ID child) override
{
UNIMPLEMENTED ("mock doReveal");
}
virtual void
doRevealYourself() override
{
UNIMPLEMENTED ("mock doRevealYourself");
log_.call(this->identify(), "revealYourself");
Tangible::doRevealYourself(); // NOTE: without specific configuration this is NOP
}
virtual bool

View file

@ -3241,7 +3241,7 @@ More specifically, the integration is based on ''messaging''. To start with, the
----
In a preliminary attempt to establish an integration between the GUI and the lower layers, in 1/2009 we created an PlayerDummy, which &quot;pulls&quot; dummy frames from the (not yet existing) engine and displays them within an XV viewer widget. This highlighted the problems we're about to encounter and made us think about the more radically decoupled approach we followed thereafter...</pre>
</div>
<div title="GuiModel" creator="Ichthyostega" modifier="Ichthyostega" created="201410170142" modified="201808311937" tags="GuiIntegration design draft" changecount="23">
<div title="GuiModel" creator="Ichthyostega" modifier="Ichthyostega" created="201410170142" modified="201808312301" tags="GuiIntegration design draft" changecount="24">
<pre>Building a layered architecture is a challenge, since the lower layer //really// needs to be self-contained, while prepared for usage by the higher layer.
A major fraction of all desktop applications is written in a way where operational logic is built around the invocation from UI events -- what should be a shell turns into a backbone. One possible way to escape from this common anti pattern is to introduce a mediating entity, to translate between two partially incompatible demands and concerns: Sure, the &quot;tangible stuff&quot; is what matters, but you can not build any significant piece of technology if all you want is to &quot;serve&quot; the user.
@ -3275,7 +3275,7 @@ Several UI elements offer the ability to be collapsed into a minimal representat
!!!revealing an element
The UI-Element protocol also includes the ability to //reveal an element// -- which means actively to bring this element into sight, in case it is hidden, collapsed or obscured by scrolling away.
{{red{As of 8/2018 this is just an idea}}}, and many details still need to be considered. Yet at least one point is clear: implementing such a feature requires the help of the container widget actually holding the element to be revealed. It might even happen that also the collaboration of the container holding aforementioned immediate parent container is necessary -- indicating a recursive implementation scheme.
{{red{As of 8/2018 this is just an idea}}}, and many details still need to be considered. Yet at least one point is clear: implementing such a feature requires the help of the container widget actually holding the element to be revealed. It might even happen that also the collaboration of the container holding aforementioned immediate parent container is necessary -- indicating a recursive implementation scheme. The default implementation is based on a similar scheme as the expand/collapse functionality: here we embed a {{{Revealer}}} functor, which then needs to be outfitted with a lambda binding into the internals of the parent container to effect the necessary presentation changes.
</pre>
</div>
<div title="GuiModelElements" creator="Ichthyostega" modifier="Ichthyostega" created="201501061138" modified="201703170201" tags="GuiIntegration design draft img" changecount="47">

View file

@ -2009,22 +2009,19 @@
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534722011622" ID="ID_232472679" MODIFIED="1534722142986" TEXT="revealYourself">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534722011622" ID="ID_232472679" MODIFIED="1535756110798" TEXT="revealYourself">
<linktarget COLOR="#af6a8f" DESTINATION="ID_232472679" ENDARROW="Default" ENDINCLINATION="94;307;" ID="Arrow_ID_634173548" SOURCE="ID_898428560" STARTARROW="None" STARTINCLINATION="859;27;"/>
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535726017256" ID="ID_899234988" MODIFIED="1535726030336" TEXT="default-Impl doReveal()">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535726035309" ID="ID_1034773573" MODIFIED="1535726044126" TEXT="pr&#xfc;fen canReveal">
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1535726017256" ID="ID_899234988" MODIFIED="1535756045754" TEXT="default-Impl doReveal()">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1535726035309" ID="ID_1034773573" MODIFIED="1535756048350" TEXT="pr&#xfc;fen canReveal">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534722040354" ID="ID_633013" MODIFIED="1534722061920" TEXT="eigennen show/hide-Status erkennen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1535726053483" ID="ID_628118697" MODIFIED="1535756052676" TEXT="Revealer aufrufen">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535726053483" ID="ID_628118697" MODIFIED="1535726058196" TEXT="Revealer aufrufen">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535743810027" ID="ID_1786165843" MODIFIED="1535743829532" TEXT="bestehende default-Impl aus Widget/Controller entfernen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1535743810027" ID="ID_1786165843" MODIFIED="1535756056057" TEXT="bestehende default-Impl aus Widget/Controller entfernen">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node CREATED="1534722062911" ID="ID_1134044414" MODIFIED="1535725975155" TEXT="braucht Parent-Link">
@ -2033,18 +2030,21 @@
<node CREATED="1534722073526" ID="ID_1428186731" MODIFIED="1535725979353" TEXT="parent.reveal(this)">
<icon BUILTIN="button_cancel"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535725982021" ID="ID_858097581" MODIFIED="1535725997876" TEXT="Revealer geeignet verdrahten">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535743705113" ID="ID_267884906" MODIFIED="1535743721369" TEXT="auch MockElm anpassen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1535725982021" ID="ID_858097581" MODIFIED="1535756066541" TEXT="Revealer geeignet verdrahten">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1535743705113" ID="ID_267884906" MODIFIED="1535756061190" TEXT="auch MockElm anpassen">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535743754227" ID="ID_1964115972" MODIFIED="1535743768498" TEXT="doReveal(ID) API entfernen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1535743754227" ID="ID_1964115972" MODIFIED="1535756064674" TEXT="doReveal(ID) API entfernen">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1535737911365" ID="ID_79619425" MODIFIED="1535737923428" TEXT="Unit-Test: AbtractTangible_test erweitern">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1535756076321" ID="ID_1044092797" MODIFIED="1535756101199" TEXT="konkret was machen, damit man die Funktion sehen kann">
<icon BUILTIN="flag-pink"/>
</node>
</node>
</node>
</node>