Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/GUIManager.h
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
CGUIManager(); | CGUIManager(); | ||||
~CGUIManager(); | ~CGUIManager(); | ||||
shared_ptr<ScriptInterface> GetScriptInterface() | shared_ptr<ScriptInterface> GetScriptInterface() | ||||
{ | { | ||||
return m_ScriptInterface; | return m_ScriptInterface; | ||||
} | } | ||||
shared_ptr<ScriptRuntime> GetRuntime() { return m_ScriptRuntime; } | shared_ptr<ScriptContext> GetContext() { return m_ScriptContext; } | ||||
shared_ptr<CGUI> GetActiveGUI() { return top(); } | shared_ptr<CGUI> GetActiveGUI() { return top(); } | ||||
/** | /** | ||||
* Returns the number of currently open GUI pages. | * Returns the number of currently open GUI pages. | ||||
*/ | */ | ||||
size_t GetPageCount() const; | size_t GetPageCount() const; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | struct SGUIPage | ||||
/** | /** | ||||
* Initializes the data that will be used to create the CGUI page one or multiple times (hotloading). | * Initializes the data that will be used to create the CGUI page one or multiple times (hotloading). | ||||
*/ | */ | ||||
SGUIPage(const CStrW& pageName, const shared_ptr<ScriptInterface::StructuredClone> initData); | SGUIPage(const CStrW& pageName, const shared_ptr<ScriptInterface::StructuredClone> initData); | ||||
/** | /** | ||||
* Create the CGUI with it's own ScriptInterface. Deletes the previous CGUI if it existed. | * Create the CGUI with it's own ScriptInterface. Deletes the previous CGUI if it existed. | ||||
*/ | */ | ||||
void LoadPage(shared_ptr<ScriptRuntime> scriptRuntime); | void LoadPage(shared_ptr<ScriptContext> scriptContext); | ||||
/** | /** | ||||
* Sets the callback handler when a new page is opened that will be performed when the page is closed. | * Sets the callback handler when a new page is opened that will be performed when the page is closed. | ||||
*/ | */ | ||||
void SetCallbackFunction(ScriptInterface& scriptInterface, JS::HandleValue callbackFunc); | void SetCallbackFunction(ScriptInterface& scriptInterface, JS::HandleValue callbackFunc); | ||||
/** | /** | ||||
* Execute the stored callback function with the given arguments. | * Execute the stored callback function with the given arguments. | ||||
Show All 11 Lines | struct SGUIPage | ||||
*/ | */ | ||||
shared_ptr<JS::PersistentRootedValue> callbackFunction; | shared_ptr<JS::PersistentRootedValue> callbackFunction; | ||||
}; | }; | ||||
const static CStr EventNameWindowResized; | const static CStr EventNameWindowResized; | ||||
shared_ptr<CGUI> top() const; | shared_ptr<CGUI> top() const; | ||||
shared_ptr<ScriptRuntime> m_ScriptRuntime; | shared_ptr<ScriptContext> m_ScriptContext; | ||||
shared_ptr<ScriptInterface> m_ScriptInterface; | shared_ptr<ScriptInterface> m_ScriptInterface; | ||||
using PageStackType = std::vector<SGUIPage>; | using PageStackType = std::vector<SGUIPage>; | ||||
PageStackType m_PageStack; | PageStackType m_PageStack; | ||||
CTemplateLoader m_TemplateLoader; | CTemplateLoader m_TemplateLoader; | ||||
}; | }; | ||||
extern CGUIManager* g_GUI; | extern CGUIManager* g_GUI; | ||||
extern InReaction gui_handler(const SDL_Event_* ev); | extern InReaction gui_handler(const SDL_Event_* ev); | ||||
#endif // INCLUDED_GUIMANAGER | #endif // INCLUDED_GUIMANAGER |
Wildfire Games · Phabricator