NotificateDisplay: delegate view allocation through a functor
This commit is contained in:
parent
42cbc9219f
commit
e7e09a642b
4 changed files with 38 additions and 7 deletions
|
|
@ -69,6 +69,7 @@
|
|||
#include "gui/model/controller.hpp"
|
||||
#include "gui/model/w-link.hpp"
|
||||
|
||||
#include <functional>
|
||||
//#include <memory>
|
||||
//#include <list>
|
||||
|
||||
|
|
@ -159,14 +160,22 @@ namespace ctrl {
|
|||
|
||||
|
||||
public:
|
||||
NotificationHub (ID identity, ctrl::BusTerm& nexus)
|
||||
using WidgetAllocator = std::function<widget::ErrorLogDisplay&(void)>;
|
||||
|
||||
|
||||
NotificationHub (ID identity, ctrl::BusTerm& nexus, WidgetAllocator wa)
|
||||
: model::Controller{identity, nexus}
|
||||
, allocateWidget_{wa}
|
||||
, widget_{}
|
||||
{ }
|
||||
|
||||
~NotificationHub() { };
|
||||
|
||||
private:
|
||||
|
||||
/** external operation to find or allocate an log display widget */
|
||||
WidgetAllocator allocateWidget_;
|
||||
|
||||
/** collaboration with a log display allocated elsewhere */
|
||||
WLink<widget::ErrorLogDisplay> widget_;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,12 @@ namespace interact {
|
|||
|
||||
Wizard::Wizard (GlobalCtx& globals)
|
||||
: globalCtx_{globals}
|
||||
, notificationHub_{new NotificationHub{getErrorLogID(), globals.uiBus_.getAccessPoint()}}
|
||||
, notificationHub_{new NotificationHub{getErrorLogID()
|
||||
,globals.uiBus_.getAccessPoint()
|
||||
,[&]() -> widget::ErrorLogDisplay&
|
||||
{
|
||||
return allocateErrorLogView();
|
||||
}} }
|
||||
{ }
|
||||
|
||||
|
||||
|
|
@ -107,4 +112,17 @@ namespace interact {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/** @internal reach out to attach or allocate a display widget for the error log.
|
||||
* @todo as of 8/2018 we use "inside knowledge" to create this view in a hard wired location.
|
||||
* But in the end, this allocation task should be delegated to the ViewLocator
|
||||
*/
|
||||
widget::ErrorLogDisplay&
|
||||
Wizard::allocateErrorLogView()
|
||||
{
|
||||
UNIMPLEMENTED("reach out to attach or allocate a display widget for the error log");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}}// namespace gui::interact
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ namespace ctrl {
|
|||
class GlobalCtx;
|
||||
class NotificationHub;
|
||||
}
|
||||
namespace widget {
|
||||
class ErrorLogDisplay;
|
||||
}
|
||||
namespace interact {
|
||||
|
||||
using std::unique_ptr;
|
||||
|
|
@ -92,8 +95,9 @@ namespace interact {
|
|||
void show_HelpAbout();
|
||||
|
||||
static ID getErrorLogID() { return proc::asset::meta::theErrorLog_ID; }
|
||||
private:
|
||||
|
||||
private:
|
||||
widget::ErrorLogDisplay& allocateErrorLogView();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1767,11 +1767,11 @@
|
|||
<icon BUILTIN="full-3"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534119968325" ID="ID_1630503080" MODIFIED="1534119972876" TEXT="Einrichtung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534336479160" ID="ID_203145360" MODIFIED="1534336575048" TEXT="Link zum Widget herstellen">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534336479160" ID="ID_203145360" MODIFIED="1534508403856" TEXT="Link zum Widget herstellen">
|
||||
<arrowlink COLOR="#a66b86" DESTINATION="ID_1326202399" ENDARROW="Default" ENDINCLINATION="279;-1333;" ID="Arrow_ID_664593340" STARTARROW="None" STARTINCLINATION="-1296;0;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534334830126" ID="ID_932140820" MODIFIED="1534339973276" TEXT="als Funktor konfiguriert">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1534334830126" ID="ID_932140820" MODIFIED="1534508409365" TEXT="als Funktor konfiguriert">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534334822288" ID="ID_1305015272" MODIFIED="1534451691196" TEXT="Allozieren">
|
||||
<arrowlink COLOR="#726b86" DESTINATION="ID_1806645586" ENDARROW="Default" ENDINCLINATION="232;27;" ID="Arrow_ID_246715972" STARTARROW="None" STARTINCLINATION="180;-21;"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue