2008-12-01 08:04:43 +01:00
|
|
|
/*
|
|
|
|
|
GuiFacade - access point for communicating with the Lumiera GTK GUI
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "gui/guifacade.hpp"
|
|
|
|
|
#include "common/singleton.hpp"
|
2008-12-06 22:01:44 +01:00
|
|
|
#include "lumiera/instancehandle.hpp"
|
2008-12-01 08:04:43 +01:00
|
|
|
|
2008-12-06 22:01:44 +01:00
|
|
|
extern "C" {
|
|
|
|
|
#include "lumiera/interface.h"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2008-12-04 04:21:02 +01:00
|
|
|
#include <string>
|
2008-12-01 08:04:43 +01:00
|
|
|
|
|
|
|
|
|
2008-12-04 04:21:02 +01:00
|
|
|
namespace gui {
|
|
|
|
|
|
|
|
|
|
using std::string;
|
2008-12-06 22:01:44 +01:00
|
|
|
using boost::scoped_ptr;
|
|
|
|
|
using lumiera::Subsys;
|
2008-12-07 05:36:02 +01:00
|
|
|
using lumiera::InstanceHandle;
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
/** interface of the GuiStarterPlugin */
|
|
|
|
|
LUMIERA_INTERFACE_DECLARE (lumieraorg_Gui, 1
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////TODO: Placeholder
|
|
|
|
|
LumieraInterface*
|
|
|
|
|
getGuiStarterPlugin_InstanceDescriptor()
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("implement the GuiStarterPlugin");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
///////////////////////////////////////////////////TODO: Placeholder
|
2008-12-01 08:04:43 +01:00
|
|
|
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
struct GuiRunner
|
|
|
|
|
: public GuiFacade
|
2008-12-01 08:04:43 +01:00
|
|
|
{
|
2008-12-07 05:36:02 +01:00
|
|
|
typedef InstanceHandle<LUMIERA_INTERFACE_INAME(lumieraorg_Gui, 1)> GuiHandle;
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
Subsys& guiSubsysHandle_;
|
|
|
|
|
Subsys::SigTerm terminate_;
|
|
|
|
|
|
|
|
|
|
GuiHandle theGUI_;
|
2008-12-01 08:04:43 +01:00
|
|
|
|
|
|
|
|
|
2008-12-06 22:01:44 +01:00
|
|
|
GuiRunner (Subsys& handle, Subsys::SigTerm terminationSignal)
|
|
|
|
|
: guiSubsysHandle_(handle),
|
|
|
|
|
terminate_(terminationSignal),
|
|
|
|
|
theGUI_(getGuiStarterPlugin_InstanceDescriptor())
|
2008-12-01 08:04:43 +01:00
|
|
|
{
|
2008-12-07 05:36:02 +01:00
|
|
|
ASSERT (theGUI_);
|
2008-12-06 22:01:44 +01:00
|
|
|
TODO ("start gui thread, passing the terminationSignal");
|
2008-12-01 08:04:43 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-06 22:01:44 +01:00
|
|
|
~GuiRunner ()
|
2008-12-01 08:04:43 +01:00
|
|
|
{
|
2008-12-06 22:01:44 +01:00
|
|
|
////TODO any cleanup here?
|
2008-12-01 08:04:43 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace { // implementation details
|
|
|
|
|
|
|
|
|
|
scoped_ptr<GuiFacade> facade (0);
|
|
|
|
|
|
|
|
|
|
class GuiSubsysDescriptor
|
|
|
|
|
: public lumiera::Subsys
|
|
|
|
|
{
|
|
|
|
|
operator string () const { return "Lumiera GTK GUI"; }
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
shouldStart (lumiera::Option&)
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("determine, if a GUI is needed");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
start (lumiera::Option&, Subsys::SigTerm termination)
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("load and start the GUI and register shutdown hook");
|
|
|
|
|
facade.reset (new GuiRunner (*this, termination)); /////////////////////TODO: actually decorate the termSignal, in order to delete the facade
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
triggerShutdown () throw()
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("initiate closing the GUI");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-05 11:07:01 +01:00
|
|
|
lumiera::Singleton<GuiSubsysDescriptor> theDescriptor;
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
} // (End) impl details
|
2008-12-01 08:04:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @internal intended for use by main(). */
|
2008-12-05 11:07:01 +01:00
|
|
|
lumiera::Subsys&
|
2008-12-01 08:04:43 +01:00
|
|
|
GuiFacade::getDescriptor()
|
|
|
|
|
{
|
|
|
|
|
return theDescriptor();
|
|
|
|
|
}
|
2008-12-06 22:01:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
GuiFacade::isUp ()
|
|
|
|
|
{
|
|
|
|
|
return (facade);
|
|
|
|
|
}
|
2008-12-01 08:04:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace gui
|