definitions for creating my first Interface instance :-)
This commit is contained in:
parent
8c501a3d7c
commit
b841ab3139
4 changed files with 115 additions and 25 deletions
|
|
@ -26,6 +26,10 @@
|
|||
#include "include/nobugcfg.h"
|
||||
#include "common/util.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "lumiera/interfacedescriptor.h"
|
||||
}
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
|
|
@ -34,23 +38,109 @@ namespace gui {
|
|||
using std::string;
|
||||
using util::cStr;
|
||||
|
||||
class GuiNotificationFacade
|
||||
: public GuiNotification
|
||||
{
|
||||
void
|
||||
displayInfo (string const& text)
|
||||
{
|
||||
INFO (operate, "GUI: display '%s' as notification message.", cStr(text));
|
||||
}
|
||||
|
||||
void
|
||||
triggerGuiShutdown (string const& cause)
|
||||
{
|
||||
NOTICE (operate, "GUI: shutdown triggered with explanation '%s'....", cStr(cause));
|
||||
}
|
||||
};
|
||||
|
||||
namespace { // facade implementation details
|
||||
|
||||
//////////////////////////////////////////////TODO: define an instance lumieraorg_guinotification_facade by forwarding to GuiNotificationFacade
|
||||
|
||||
|
||||
class GuiNotificationFacade
|
||||
: public GuiNotification
|
||||
{
|
||||
void
|
||||
displayInfo (string const& text)
|
||||
{
|
||||
INFO (operate, "@GUI: display '%s' as notification message.", cStr(text));
|
||||
}
|
||||
|
||||
void
|
||||
triggerGuiShutdown (string const& cause)
|
||||
{
|
||||
NOTICE (operate, "@GUI: shutdown triggered with explanation '%s'....", cStr(cause));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*=================== define an lumieraorg_guinotification instance ====================== */
|
||||
|
||||
LUMIERA_INTERFACE_INSTANCE (lumieraorg_interfacedescriptor, 0
|
||||
,lumieraorg_GuiNotificationFacade_descriptor
|
||||
, NULL, NULL, NULL
|
||||
, LUMIERA_INTERFACE_INLINE (name, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "GuiNotification"; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (brief, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "GUI Interface: push state update and notification of events into the GUI"; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (homepage, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "http://www.lumiera.org/develompent.html" ;}
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (version, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "0.1~pre"; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (author, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "Hermann Vosseler"; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (email, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{ return "Ichthyostega@web.de"; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (copyright, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{
|
||||
return
|
||||
"Copyright (C) Lumiera.org\n"
|
||||
" 2008 Hermann Vosseler <Ichthyostega@web.de>";
|
||||
}
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (license, LUIDGEN,
|
||||
const char*, (LumieraInterface iface),
|
||||
{
|
||||
return
|
||||
"This program is free software; you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
"the Free Software Foundation; either version 2 of the License, or\n"
|
||||
"(at your option) any later version.\n"
|
||||
"\n"
|
||||
"This program is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
"GNU General Public License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU General Public License\n"
|
||||
"along with this program; if not, write to the Free Software\n"
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA";
|
||||
}
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (state, LUIDGEN,
|
||||
int, (LumieraInterface iface),
|
||||
{return LUMIERA_INTERFACE_EXPERIMENTAL; }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (versioncmp, LUIDGEN,
|
||||
int, (const char* a, const char* b),
|
||||
{return 0;} ////////////////////////////////////////////TODO
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
LUMIERA_INTERFACE_INSTANCE (lumieraorg_GuiNotification, 1
|
||||
,lumieraorg_GuiNotificationFacade
|
||||
, LUMIERA_INTERFACE_REF(lumieraorg_interfacedescriptor, 0, lumieraorg_GuiNotificationFacade_descriptor)
|
||||
, open_facade
|
||||
, close_facade
|
||||
, LUMIERA_INTERFACE_INLINE (displayInfo, LUIDGEN,
|
||||
void, (const char* text),
|
||||
{ return _facade->displayInfo(text); }
|
||||
)
|
||||
, LUMIERA_INTERFACE_INLINE (triggerGuiShutdown, LUIDGEN,
|
||||
void, (const char* cause),
|
||||
{ return _facade->triggerGuiShutdown(cause); }
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
} // (END) facade implementation details
|
||||
|
||||
} // namespace gui
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace gui {
|
|||
|
||||
|
||||
/*********************************************************************
|
||||
* Global access point pushing state update and notification of events
|
||||
* Global access point to push state update and notification of events
|
||||
* from the lower layers into the Lumiera GUI. Typically, this happens
|
||||
* asynchronously and triggered by events within the lower layers.
|
||||
*
|
||||
|
|
@ -74,7 +74,7 @@ namespace gui {
|
|||
extern "C" {
|
||||
#include "lumiera/interface.h"
|
||||
|
||||
LUMIERA_INTERFACE_DECLARE (lumieraorg_guinotification, 0,
|
||||
LUMIERA_INTERFACE_DECLARE (lumieraorg_GuiNotification, 1,
|
||||
LUMIERA_INTERFACE_SLOT (void, displayInfo, (const char*)),
|
||||
LUMIERA_INTERFACE_SLOT (void, triggerGuiShutdown, (const char*)),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@
|
|||
* The interface subsystem must be able to categorize implementations to present possible
|
||||
* upgrade paths to the user. This is done by the tagging it to a certain state in concert
|
||||
* with the version and the user supplied version compare function. The respective numbers
|
||||
* are choosen in a way that a higher value indicates precedence when selecting an implementation.
|
||||
* are chosen in a way that a higher value indicates precedence when selecting an implementation.
|
||||
* Note that 'BETA' is higher than 'DEPRECATED', we make the assumption that BETA is at least
|
||||
* maintained code and something gets deprecated for some reason. For common practice it is
|
||||
* suggested to make a stable release before declaring its predcessor version as deprecated.
|
||||
* suggested to make a stable release before declaring its predecessor version as deprecated.
|
||||
*/
|
||||
enum lumiera_interface_state {
|
||||
/** some known bugs exist which won't be fixed, don't use this */
|
||||
|
|
@ -73,7 +73,7 @@ LUMIERA_INTERFACE_DECLARE (lumieraorg_interfacedescriptor, 0,
|
|||
|
||||
#if 0
|
||||
/**
|
||||
* For convinience, a copy'n'paste descriptor
|
||||
* For convenience, a copy'n'paste descriptor
|
||||
*/
|
||||
LUMIERA_INTERFACE_INSTANCE (lumieraorg_interfacedescriptor, 0,
|
||||
/*IDENTIFIER*/,
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ namespace gui {
|
|||
class GuiNotificationInterfaceProxy
|
||||
: public GuiNotification
|
||||
{
|
||||
LUMIERA_INTERFACE_HANDLE(lumieraorg_guinotification, 0) interface_;
|
||||
LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 1) * interface_;
|
||||
|
||||
GuiNotificationInterfaceProxy ()
|
||||
{
|
||||
interface_ = LUMIERA_INTERFACE_OPEN (lumieraorg_guinotification, 0, 0, lumieraorg_guinotification_facade);
|
||||
interface_ = LUMIERA_INTERFACE_OPEN (lumieraorg_GuiNotification, 1, 2, lumieraorg_GuiNotificationFacade);
|
||||
if (!interface_)
|
||||
throw lumiera::error::State ("unable to access GuiNotificationFacade");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue