18#ifndef INCLUDED_GUIMANAGER
19#define INCLUDED_GUIMANAGER
29#include <unordered_set>
100 void SendEventToAll(
const CStr& eventName, JS::HandleValueArray paramData)
const;
162 std::shared_ptr<CGUI>
gui;
171 std::shared_ptr<CGUI>
top()
const;
192 while (!std::deque<SGUIPage>::empty())
193 std::deque<SGUIPage>::pop_back();
InReaction gui_handler(const SDL_Event_ *ev)
Definition: GUIManager.cpp:58
CGUIManager * g_GUI
Definition: GUIManager.cpp:46
Definition: Canvas2D.h:36
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:183
void clear()
Definition: GUIManager.h:190
~PageStackType()
Definition: GUIManager.h:185
External interface to the GUI system.
Definition: GUIManager.h:44
ScriptInterface & m_ScriptInterface
Definition: GUIManager.h:174
void TickObjects()
See CGUI::TickObjects; applies to all loaded pages.
Definition: GUIManager.cpp:367
Status ReloadAllPages()
Called when we should reload all pages (e.g.
Definition: GUIManager.cpp:297
PageStackType m_PageStack
Definition: GUIManager.h:196
CGUIManager(ScriptContext &scriptContext, ScriptInterface &scriptInterface)
Definition: GUIManager.cpp:72
void DisplayLoadProgress(int percent, const wchar_t *pending_task)
Display progress / description in loading screen.
Definition: GUIManager.cpp:418
void SendEventToAll(const CStr &eventName) const
See CGUI::SendEventToAll; applies to the currently active page.
Definition: GUIManager.cpp:348
ScriptContext & GetContext()
Definition: GUIManager.h:54
void SwitchPage(const CStrW &name, const ScriptInterface *srcScriptInterface, JS::HandleValue initData)
Load a new GUI page and make it active.
Definition: GUIManager.cpp:97
std::shared_ptr< CGUI > top() const
Definition: GUIManager.cpp:437
bool TemplateExists(const std::string &templateName) const
Check if a template with this name exists.
Definition: GUIManager.cpp:404
ScriptInterface & GetScriptInterface()
Definition: GUIManager.h:50
void Draw(CCanvas2D &canvas) const
See CGUI::Draw; applies to all loaded pages.
Definition: GUIManager.cpp:384
std::shared_ptr< CGUI > GetActiveGUI()
Definition: GUIManager.h:55
InReaction HandleEvent(const SDL_Event_ *ev)
Pass input events to the currently active GUI page.
Definition: GUIManager.cpp:306
Status ReloadChangedFile(const VfsPath &path)
Called when a file has been modified, to hotload changes.
Definition: GUIManager.cpp:284
JS::Value PushPage(const CStrW &pageName, Script::StructuredClone initData)
Load a new GUI page and make it active.
Definition: GUIManager.cpp:119
ScriptContext & m_ScriptContext
Definition: GUIManager.h:173
void UpdateResolution()
See CGUI::UpdateResolution; applies to all loaded pages.
Definition: GUIManager.cpp:392
void PopPage(Script::StructuredClone args)
Unload the currently active GUI page, and make the previous page active.
Definition: GUIManager.cpp:140
const CParamNode & GetTemplate(const std::string &templateName)
Retrieve the requested template, used for displaying faction specificities.
Definition: GUIManager.cpp:409
size_t GetPageCount() const
Returns the number of currently open GUI pages.
Definition: GUIManager.cpp:92
~CGUIManager()
Definition: GUIManager.cpp:87
CTemplateLoader m_TemplateLoader
Definition: GUIManager.h:198
The main object that represents a whole GUI page.
Definition: CGUI.h:61
An entity initialisation parameter node.
Definition: ParamNode.h:151
Template loader: Handles the loading of entity template files for:
Definition: TemplateLoader.h:48
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptContext.h:46
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72
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
i64 Status
Error handling system.
Definition: status.h:173
Definition: GUIManager.h:134
void ResolvePromise(Script::StructuredClone args)
Execute the stored callback function with the given arguments.
Definition: GUIManager.cpp:261
std::shared_ptr< JS::PersistentRootedObject > callbackFunction
Function executed by this parent GUI page when the child GUI page it pushed is popped.
Definition: GUIManager.h:168
std::unordered_set< VfsPath > inputs
Definition: GUIManager.h:160
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:158
std::shared_ptr< CGUI > gui
Definition: GUIManager.h:162
std::wstring m_Name
Definition: GUIManager.h:159
void LoadPage(ScriptContext &scriptContext)
Create the CGUI with it's own ScriptInterface.
Definition: GUIManager.cpp:163
JS::Value ReplacePromise(ScriptInterface &scriptInterface)
A new promise gets set.
Definition: GUIManager.cpp:253
Script::StructuredClone initData
Definition: GUIManager.h:161