GG
|
#include <PluginInterface.h>
Public Types | |
typedef const char *(* | PluginNameFn )() |
typedef const char *(* | DefaultFontNameFn )() |
typedef unsigned int(* | DefaultFontSizeFn )() |
typedef boost::shared_ptr < StyleFactory >(* | GetStyleFactoryFn )() |
Structors | |
PluginInterface () | |
PluginInterface (const std::string &lib_name) | |
~PluginInterface () |
Accessors | |
operator int ConvertibleToBoolDummy::* () const |
Mutators | |
PluginNameFn | PluginName |
DefaultFontNameFn | DefaultFontName |
DefaultFontSizeFn | DefaultFontSize |
GetStyleFactoryFn | GetStyleFactory |
bool | Load (const std::string &lib_name) |
The interface to custom-control plugins.
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).
Definition at line 58 of file PluginInterface.h.
typedef const char*(* GG::PluginInterface::PluginNameFn)() |
The type of function that supplies the name of the plugin.
Definition at line 65 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 unsigned 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 | ( | 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::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.