18 #ifndef INCLUDED_GUIMANAGER 19 #define INCLUDED_GUIMANAGER 29 #include <unordered_set> 100 void SendEventToAll(
const CStr& eventName, JS::HandleValueArray paramData)
const;
146 void LoadPage(std::shared_ptr<ScriptContext> scriptContext);
161 std::shared_ptr<CGUI>
gui;
170 std::shared_ptr<CGUI>
top()
const;
190 #endif // INCLUDED_GUIMANAGER An entity initialisation parameter node.
Definition: ParamNode.h:150
Template loader: Handles the loading of entity template files for:
Definition: TemplateLoader.h:47
size_t GetPageCount() const
Returns the number of currently open GUI pages.
Definition: GUIManager.cpp:89
void PushPage(const CStrW &pageName, Script::StructuredClone initData, JS::HandleValue callbackFunc)
Load a new GUI page and make it active.
Definition: GUIManager.cpp:116
void LoadPage(std::shared_ptr< ScriptContext > scriptContext)
Create the CGUI with it's own ScriptInterface.
Definition: GUIManager.cpp:156
PageStackType m_PageStack
Definition: GUIManager.h:181
void Draw(CCanvas2D &canvas) const
See CGUI::Draw; applies to all loaded pages.
Definition: GUIManager.cpp:391
std::shared_ptr< JSStructuredCloneData > StructuredClone
Structured clones are a way to serialize 'simple' JS::Values into a buffer that can safely be passed ...
Definition: StructuredClone.h:36
bool TemplateExists(const std::string &templateName) const
Check if a template with this name exists.
Definition: GUIManager.cpp:411
Definition: GUIManager.h:133
Status ReloadAllPages()
Called when we should reload all pages (e.g.
Definition: GUIManager.cpp:306
void SetCallbackFunction(ScriptInterface &scriptInterface, JS::HandleValue callbackFunc)
Sets the callback handler when a new page is opened that will be performed when the page is closed...
Definition: GUIManager.cpp:246
std::deque< SGUIPage > PageStackType
The page stack must not move pointers on push/pop, or pushing a page in a page's init method may cras...
Definition: GUIManager.h:180
std::shared_ptr< CGUI > gui
Definition: GUIManager.h:161
void UpdateResolution()
See CGUI::UpdateResolution; applies to all loaded pages.
Definition: GUIManager.cpp:399
void DisplayLoadProgress(int percent, const wchar_t *pending_task)
Display progress / description in loading screen.
Definition: GUIManager.cpp:425
The main object that represents a whole GUI page.
Definition: CGUI.h:60
~CGUIManager()
Definition: GUIManager.cpp:84
void PopPage(Script::StructuredClone args)
Unload the currently active GUI page, and make the previous page active.
Definition: GUIManager.cpp:133
std::shared_ptr< CGUI > GetActiveGUI()
Definition: GUIManager.h:55
void PerformCallbackFunction(Script::StructuredClone args)
Execute the stored callback function with the given arguments.
Definition: GUIManager.cpp:265
std::shared_ptr< ScriptInterface > m_ScriptInterface
Definition: GUIManager.h:173
Definition: Canvas2D.h:35
std::shared_ptr< ScriptContext > m_ScriptContext
Definition: GUIManager.h:172
std::shared_ptr< ScriptInterface > GetScriptInterface()
Definition: GUIManager.h:50
void TickObjects()
See CGUI::TickObjects; applies to all loaded pages.
Definition: GUIManager.cpp:376
i64 Status
Error handling system.
Definition: status.h:169
const CParamNode & GetTemplate(const std::string &templateName)
Retrieve the requested template, used for displaying faction specificities.
Definition: GUIManager.cpp:416
SGUIPage(const CStrW &pageName, const Script::StructuredClone initData)
Initializes the data that will be used to create the CGUI page one or multiple times (hotloading)...
Definition: GUIManager.cpp:151
void SendEventToAll(const CStr &eventName) const
See CGUI::SendEventToAll; applies to the currently active page.
Definition: GUIManager.cpp:357
CStrW m_Name
Definition: GUIManager.h:158
CGUIManager * g_GUI
Definition: GUIManager.cpp:43
std::shared_ptr< ScriptContext > GetContext()
Definition: GUIManager.h:54
std::unordered_set< VfsPath > inputs
Definition: GUIManager.h:159
Script::StructuredClone initData
Definition: GUIManager.h:160
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:71
External interface to the GUI system.
Definition: GUIManager.h:43
CTemplateLoader m_TemplateLoader
Definition: GUIManager.h:183
std::shared_ptr< CGUI > top() const
Definition: GUIManager.cpp:444
CGUIManager()
Definition: GUIManager.cpp:69
Status ReloadChangedFile(const VfsPath &path)
Called when a file has been modified, to hotload changes.
Definition: GUIManager.cpp:293
InReaction HandleEvent(const SDL_Event_ *ev)
Pass input events to the currently active GUI page.
Definition: GUIManager.cpp:315
std::shared_ptr< JS::PersistentRootedValue > callbackFunction
Function executed by this parent GUI page when the child GUI page it pushed is popped.
Definition: GUIManager.h:167
void SwitchPage(const CStrW &name, const ScriptInterface *srcScriptInterface, JS::HandleValue initData)
Load a new GUI page and make it active.
Definition: GUIManager.cpp:94
InReaction gui_handler(const SDL_Event_ *ev)
Definition: GUIManager.cpp:55