#include <PluginInterface.h>
Mutators | |
PluginNameFn | PluginName |
DefaultFontNameFn | DefaultFontName |
DefaultFontSizeFn | DefaultFontSize |
GetStyleFactoryFn | GetStyleFactory |
SaveWndFn | SaveWnd |
LoadWndFn | LoadWnd |
bool | Load (const std::string &lib_name) |
template<class T> | |
void | LoadWndT (T *&wnd, const std::string &name, boost::archive::xml_iarchive &ar) |
Structors | |
PluginInterface () | |
PluginInterface (const std::string &lib_name) | |
~PluginInterface () | |
Accessors | |
operator int ConvertibleToBoolDummy::* () const | |
Public Types | |
typedef const char *(*) | PluginNameFn () |
typedef const char *(*) | DefaultFontNameFn () |
typedef int(*) | DefaultFontSizeFn () |
typedef boost::shared_ptr< StyleFactory >(*) | GetStyleFactoryFn () |
typedef GUI::SaveWndFn | SaveWndFn |
typedef GUI::LoadWndFn | LoadWndFn |
This class is used to access derived GG controls and dialogs that are unknown until runtime, but are available for dynamic loading in shared libraries/DLLs. The interface basically allows you to create custom controls and dialogs (anything a StyleFactory can produce) from a dynamic-link library, which in turn allows you to change the styles of the controls in an application without recompiling, or even relinking. While the interface is in an unloaded state, the functions in the interface are all null, and calling any of them will crash your app. Once a plugin has been loaded, all the functions in the interface should be valid (if the plugin author did everything correctly). The plugin interface also provides SaveWnd() and LoadWnd() methods to serialize all types in the GG::Wnd hierarchy. Note that includes all the original GG types, not just the ones added by the plugin; if Wnd is not serializable, none of its descendents are either.
Definition at line 59 of file PluginInterface.h.
typedef const char*(*) GG::PluginInterface::PluginNameFn() |
The type of function that supplies the name of the plugin.
Definition at line 66 of file PluginInterface.h.
typedef const char*(*) GG::PluginInterface::DefaultFontNameFn() |
The type of function that supplies the name of the plugin's default font.
Definition at line 68 of file PluginInterface.h.
typedef int(*) GG::PluginInterface::DefaultFontSizeFn() |
The type of function that supplies the plugin's default font size.
Definition at line 70 of file PluginInterface.h.
typedef boost::shared_ptr<StyleFactory>(*) GG::PluginInterface::GetStyleFactoryFn() |
The type of function that supplies the plugin's StyleFactory.
Definition at line 72 of file PluginInterface.h.
GG::PluginInterface::PluginInterface | ( | ) |
default ctor.
GG::PluginInterface::PluginInterface | ( | const std::string & | lib_name | ) |
ctor that loads the plugin file lib_name.
The base filename should be provided, without the extension (i.e. "foo", not "foo.so" or "foo.dll").
GG::PluginInterface::~PluginInterface | ( | ) |
dtor.
GG::PluginInterface::operator int ConvertibleToBoolDummy::* | ( | ) | const |
returns true iff this PluginInterface has a loaded plugin.
This is a conversion operator, allowing you to test the validity of the interface, as you would a pointer (e.g. if (my_interface) my_interface.PluginName();).
bool GG::PluginInterface::Load | ( | const std::string & | lib_name | ) |
loads the plugin lib_name, unloading the currently-loaded plugin if necessary.
void GG::PluginInterface::LoadWndT | ( | T *& | wnd, | |
const std::string & | name, | |||
boost::archive::xml_iarchive & | ar | |||
) | [inline] |
Since LoadWnd() will only accept a referemce to a Wnd*, this method is provided to more conveniently accept Wnd subclass pointers.
It unfortunately cannot overload the name of LoadWnd, which is a data member.
Definition at line 161 of file PluginInterface.h.
References LoadWnd.
returns the default font name that should be used to create controls using this plugin.
Definition at line 101 of file PluginInterface.h.
returns the default font point size that should be used to create controls using this plugin.
Definition at line 102 of file PluginInterface.h.
returns a shared_ptr to the plugin's style factory, which creates controls and dialogs
Definition at line 103 of file PluginInterface.h.
creates a new Wnd from the next one found in the given XML archive.
Definition at line 105 of file PluginInterface.h.
Referenced by LoadWndT().