NotificationDisplay: integrate with the new Revealer-Functor (closes #1162)

after an extended digression to fix our matcher for tests on the EventLog,
the new helper abstractions gui::model::Expander and gui::model::Revealer
are now covered and ready for use.

In this special case here, the controller uses both the Expander and Revealer
inherited from model::Tangible; yet both are wired to access the actual
display widget via the getter, and delegate to the Expander rsp. Revealer
located within the widget. Which in turn are wired when creating the widget
within the InfoboxPanel.

Bottom line -- we have a generic scheme now, and the actual implementation
is filled in as lambda, at the point where the component or widget is created
This commit is contained in:
Fischlurch 2018-09-21 05:17:54 +02:00
parent 258a807e97
commit 8fa3eb2517
5 changed files with 39 additions and 18 deletions

View file

@ -152,7 +152,7 @@ namespace ctrl {
doFlash() override
{
if (not widget_) return;
widget_->revealYourself();
widget_->reveal();
widget_->triggerFlash();
}
@ -173,7 +173,7 @@ namespace ctrl {
getWidget().expand (yes);
}
);
installRevealer([&](){ getWidget().revealYourself(); }); // implementation implies also expand
installRevealer([&](){ getWidget().reveal(); }); // implementation implies also expand
}
~NotificationHub() { };

View file

@ -36,10 +36,10 @@
**
** The base class of all [tangible UI elements](\ref Tangible) provides a default implementation
** for these generic interaction mechanism: It offers slots to connect UI signals against, and
** it understands the _`mark`_ messages "`expand`" and "`revealYourself`". These are implemented
** it understands the \em `mark` messages `"expand"` and `"revealYourself"`. These are implemented
** by delegating to the \ref Expander and \ref Revealer functors respectively. Moreover, this
** default implementation automatically detects a resulting state change and emits an appropriate
** _`note`_ message on the UI-Bus, so to make those state changes persistent. However, in order
** \em `note` message on the UI-Bus, so to make those state changes persistent. However, in order
** to supply an concrete implementation, depending on the circumstances, either the widget itself
** or a parent container holding the element needs to install lambdas into those functor holders,
** to detail what actually needs to be done. E.g. it is quite common to implement the "expand"
@ -53,6 +53,7 @@
** install an appropriate Expander functor within their constructor.
**
** @see [UI-Element protocol](\ref tangible.hpp)
** @see [simple test case](\ref AbstractTangible_test::revealer())
** @see [usage example](\ref error-log-display.hpp)
**
*/

View file

@ -98,6 +98,9 @@ namespace panel{
theLog_->expand = model::Expander{[&]() { return logExpander_.get_expanded(); }
,[&](bool yes) { logExpander_.set_expanded (yes); }
};
theLog_->reveal = model::Revealer{[&]() { Panel::show(true);
theLog_->expand(true);
} };
frame_.set_border_width (5);
frame_.add (logExpander_);
frame_.show_all();

View file

@ -98,6 +98,7 @@ namespace widget {
}
model::Expander expand;
model::Revealer reveal;
void
@ -153,12 +154,6 @@ namespace widget {
UNIMPLEMENTED ("paint and set callback-timeout to return to normal state");
}
void
revealYourself()
{
UNIMPLEMENTED ("store a link to parent. Ask parent to reveal us. Switch to expanded display");
}
private:/* ===== Internals ===== */

View file

@ -2045,8 +2045,23 @@
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1535756076321" ID="ID_1044092797" MODIFIED="1535756101199" TEXT="konkret was machen, damit man die Funktion sehen kann">
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1535756076321" ID="ID_1044092797" MODIFIED="1537459860078" TEXT="konkret was machen, damit man die Funktion sehen kann">
<linktarget COLOR="#fa8074" DESTINATION="ID_1044092797" ENDARROW="Default" ENDINCLINATION="131;259;" ID="Arrow_ID_1805058492" SOURCE="ID_1726008784" STARTARROW="None" STARTINCLINATION="890;-197;"/>
<icon BUILTIN="flag-pink"/>
<node CREATED="1537461362558" ID="ID_1738911844" MODIFIED="1537461379041" TEXT="Idee: ggfs minimiertes DockItem wiederherstellen">
<icon BUILTIN="idea"/>
</node>
<node CREATED="1537499243954" ID="ID_971802810" MODIFIED="1537499360773" TEXT="versuche mal Panel::show(true)">
<icon BUILTIN="help"/>
<node COLOR="#338800" CREATED="1537499275630" ID="ID_1288942046" MODIFIED="1537499354292" TEXT="verdrahtet in den Revealer">
<icon BUILTIN="button_ok"/>
<node CREATED="1537499313305" ID="ID_1086105877" MODIFIED="1537499333065" TEXT="von ErrorLogDisplay"/>
<node CREATED="1537499333798" ID="ID_57237574" MODIFIED="1537499352071" TEXT="verdrahtet in InfoboxPanel::getLog()"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537499267335" ID="ID_608745909" MODIFIED="1537499372012" TEXT="keine Ahnung ob das was bewirkt">
<icon BUILTIN="bell"/>
</node>
</node>
</node>
</node>
</node>
@ -2152,7 +2167,7 @@
<linktarget COLOR="#726b86" DESTINATION="ID_1806645586" ENDARROW="Default" ENDINCLINATION="232;27;" ID="Arrow_ID_246715972" SOURCE="ID_1305015272" STARTARROW="None" STARTINCLINATION="180;-21;"/>
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689125583" FOLDED="true" ID="ID_1077285383" MODIFIED="1535814842908" TEXT="mit close-signal verdrahten">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689125583" FOLDED="true" ID="ID_1077285383" MODIFIED="1537461348507" TEXT="mit close-signal verdrahten">
<icon BUILTIN="stop-sign"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1534629989468" ID="ID_1497889519" MODIFIED="1534630008024" TEXT="close-Signal gibtsned">
<icon BUILTIN="broken-line"/>
@ -2387,8 +2402,8 @@
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689146501" ID="ID_1371087868" MODIFIED="1533689151053" TEXT="bei Bedarf anzeigen">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534636343111" ID="ID_1922277957" MODIFIED="1534636350863" TEXT="ebenfalls explizit zu bauen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1534636343111" ID="ID_1922277957" MODIFIED="1537499519266" TEXT="ebenfalls explizit zu bauen">
<icon BUILTIN="button_ok"/>
<node CREATED="1534636352398" ID="ID_435790811" MODIFIED="1534636448600" TEXT="&#xe4;hnliche Lage wie bei Destroy">
<richcontent TYPE="NOTE"><html>
<head>
@ -2414,14 +2429,17 @@
<arrowlink COLOR="#af6a8f" DESTINATION="ID_232472679" ENDARROW="Default" ENDINCLINATION="94;307;" ID="Arrow_ID_634173548" STARTARROW="None" STARTINCLINATION="859;27;"/>
<icon BUILTIN="idea"/>
</node>
<node CREATED="1534636377938" ID="ID_64685935" MODIFIED="1534636392354" TEXT="k&#xf6;nnte Lumiera-Framework werden">
<node CREATED="1534636377938" ID="ID_64685935" MODIFIED="1537499412751" TEXT="Lumiera-Framework: Revealer">
<icon BUILTIN="yes"/>
<node COLOR="#338800" CREATED="1537499427673" ID="ID_671371282" MODIFIED="1537499435729" TEXT="#1162 helper abstractions for generic widgets">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
<node CREATED="1534721937152" ID="ID_1396835945" MODIFIED="1534721944841" TEXT="macht aber nicht der Controller">
<icon BUILTIN="yes"/>
<node CREATED="1534721946351" ID="ID_1570295012" MODIFIED="1534721954170" TEXT="typisches OO-Design"/>
<node CREATED="1534721955070" ID="ID_1390682663" MODIFIED="1534722916337" TEXT="der Controller sagt nur &quot;revealYourself&quot;">
<node CREATED="1534721955070" ID="ID_1390682663" MODIFIED="1537499200269" TEXT="der Controller ruft nur getWidget().reveal() auf">
<linktarget COLOR="#7691b1" DESTINATION="ID_1390682663" ENDARROW="Default" ENDINCLINATION="-71;33;" ID="Arrow_ID_1469414604" SOURCE="ID_558411855" STARTARROW="None" STARTINCLINATION="109;16;"/>
<icon BUILTIN="idea"/>
</node>
@ -2457,7 +2475,7 @@
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534120150459" ID="ID_1466610963" MODIFIED="1535752377006" TEXT="doRevealYourself()">
<icon BUILTIN="pencil"/>
<node CREATED="1534120150460" ID="ID_1726008784" MODIFIED="1534120253931">
<node CREATED="1534120150460" ID="ID_1726008784" MODIFIED="1537459860078">
<richcontent TYPE="NODE"><html>
<head>
@ -2471,6 +2489,7 @@
</p>
</body>
</html></richcontent>
<arrowlink COLOR="#fa8074" DESTINATION="ID_1044092797" ENDARROW="Default" ENDINCLINATION="131;259;" ID="Arrow_ID_1805058492" STARTARROW="None" STARTINCLINATION="890;-197;"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534120150457" ID="ID_1499287865" MODIFIED="1534725759893" TEXT="doReset()">
@ -18835,6 +18854,9 @@
<icon BUILTIN="yes"/>
</node>
</node>
<node COLOR="#338800" CREATED="1537499427673" ID="ID_1035982675" MODIFIED="1537499435729" TEXT="#1162 helper abstractions for generic widgets">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node CREATED="1455421282030" HGAP="54" ID="ID_1448430954" MODIFIED="1518487921086" TEXT="state mark" VSHIFT="12">
<icon BUILTIN="button_ok"/>
@ -37962,7 +37984,7 @@
</node>
<node CREATED="1534511566130" HGAP="93" ID="ID_833641481" MODIFIED="1534512921306" TEXT="libGDL" VSHIFT="-58">
<linktarget COLOR="#39478f" DESTINATION="ID_833641481" ENDARROW="Default" ENDINCLINATION="-1307;0;" ID="Arrow_ID_214595057" SOURCE="ID_358403014" STARTARROW="None" STARTINCLINATION="-2073;0;"/>
<node CREATED="1534511647623" ID="ID_586745535" MODIFIED="1534511657393" TEXT="&quot;Gnome Diocking Library&quot;">
<node CREATED="1534511647623" ID="ID_586745535" MODIFIED="1537461227333" TEXT="&quot;Gnome Docking Library&quot;">
<node CREATED="1534511675819" ID="ID_458805224" MODIFIED="1534511684396" TEXT="wird auch von Anjuta genutzt"/>
<node CREATED="1534511663333" ID="ID_1116756676" MODIFIED="1534511675015" TEXT="historisch: Gnome Design Library"/>
</node>