#include <scriptmodule.h>

Public Types | |
| typedef bool(* | STATIC_FUNCTION )(const CEGUI::EventArgs &e) |
| typedef dtUtil::Functor< bool, TYPELIST_1(const CEGUI::EventArgs &)> | HandlerFunctor |
| typedef std::map< std::string, HandlerFunctor > | CallbackRegistry |
Public Member Functions | |
| ScriptModule () | |
| virtual | ~ScriptModule () |
| bool | AddCallback (const std::string &name, STATIC_FUNCTION func) |
| Add a static callback handler. | |
| bool | AddCallback (const std::string &name, const HandlerFunctor &callback) |
| Add a non-static callback handler. | |
| const CallbackRegistry & | GetRegistry () const |
| Returns the StaticRegistry. | |
| virtual void | executeScriptFile (const CEGUI::String &filename, const CEGUI::String &resourceGroup="") |
| virtual int | executeScriptGlobal (const CEGUI::String &function_name) |
| virtual void | executeString (const CEGUI::String &str) |
| virtual bool | executeScriptedEventHandler (const CEGUI::String &handler_name, const CEGUI::EventArgs &ea) |
| Uses the map of strings to functions to execute a function to handle the EventArgs. | |
Create an instance of this class, and provide it as a parameter during construction of a CEUIDrawable instance. Add new handlers with the AddCallback function.
| typedef bool(* dtGUI::ScriptModule::STATIC_FUNCTION)(const CEGUI::EventArgs &e) |
| typedef dtUtil::Functor<bool,TYPELIST_1(const CEGUI::EventArgs&)> dtGUI::ScriptModule::HandlerFunctor |
| typedef std::map<std::string,HandlerFunctor> dtGUI::ScriptModule::CallbackRegistry |
| ScriptModule::ScriptModule | ( | ) |
| ScriptModule::~ScriptModule | ( | ) | [virtual] |
| bool ScriptModule::AddCallback | ( | const std::string & | name, | |
| STATIC_FUNCTION | func | |||
| ) |
Add a static callback handler.
Example:
class MyClass { ... static bool OnClick( const CEGUI::EventArgs &e ); ... } ... mScriptModule->AddCallback("OnDoSomething", &OnClick); ...
| name | is the string representation of the handler function to be executed for the CEGUI::Event. | |
| func | is the pointer to the function to be called when the CEGUI::Event is activated. |
| bool ScriptModule::AddCallback | ( | const std::string & | name, | |
| const HandlerFunctor & | callback | |||
| ) |
Add a non-static callback handler.
Example:
class App { ... public: bool OnClick( const CEGUI::EventArgs &e ); ... } ... App *mApp = new App(); dtGUI::ScriptModule::HandlerFunctor handler( dtUtil::MakeFunctor( &App::OnClick, mApp ) ); mScriptModule->AddCallback("OnDoSomething", handler ); ...
| name | is the string representation of the handler function to be executed for the CEGUI::Event. | |
| func | is an instance of a function object to be called when the CEGUI::Event is activated. |
| const CallbackRegistry& dtGUI::ScriptModule::GetRegistry | ( | ) | const [inline] |
Returns the StaticRegistry.
| void ScriptModule::executeScriptFile | ( | const CEGUI::String & | filename, | |
| const CEGUI::String & | resourceGroup = "" | |||
| ) | [virtual] |
Implements dtGUI::BaseScriptModule.
| int ScriptModule::executeScriptGlobal | ( | const CEGUI::String & | function_name | ) | [virtual] |
Implements dtGUI::BaseScriptModule.
| void ScriptModule::executeString | ( | const CEGUI::String & | str | ) | [virtual] |
Implements dtGUI::BaseScriptModule.
| bool ScriptModule::executeScriptedEventHandler | ( | const CEGUI::String & | handler_name, | |
| const CEGUI::EventArgs & | ea | |||
| ) | [virtual] |
Uses the map of strings to functions to execute a function to handle the EventArgs.
This function is called by CEGUI::System when a CEGUI::Window throws an CEGUI::Event
Implements dtGUI::BaseScriptModule.