Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CGUIManager::SGUIPage Struct Reference

Classes

struct  Close
 
struct  OpenRequest
 

Public Types

using CloseResult = std::variant< Close, OpenRequest >
 

Public Member Functions

 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). More...
 
void LoadPage (Script::Context &context)
 Create the CGUI with it's own Script::Interface. More...
 
JS::Value GetPromise ()
 A reference to the promise is returned. More...
 
std::optional< CloseResult > MaybeClose (const bool isRootPage)
 If the page should be closed this function closes the page and returns the result of the init function. More...
 
void Refocus (const Close &result)
 This function should be called when a child page got closed. More...
 

Public Attributes

std::wstring m_Name
 
std::unordered_set< VfsPath > inputs
 
Script::StructuredClone initData
 
std::shared_ptr< CGUI > gui
 
std::shared_ptr< JS::PersistentRootedObject > sendingPromise
 When this promise is settled this page wants to be closed. More...
 
std::shared_ptr< JS::PersistentRootedObject > receivingPromise
 The parent page waits on this promise. More...
 

Member Typedef Documentation

◆ CloseResult

Constructor & Destructor Documentation

◆ SGUIPage()

CGUIManager::SGUIPage::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).

Member Function Documentation

◆ GetPromise()

JS::Value CGUIManager::SGUIPage::GetPromise ( )

A reference to the promise is returned.

The promise will settle when the page is closed.

◆ LoadPage()

void CGUIManager::SGUIPage::LoadPage ( Script::Context &  context)

Create the CGUI with it's own Script::Interface.

Deletes the previous CGUI if it existed.

◆ MaybeClose()

std::optional< CGUIManager::SGUIPage::CloseResult > CGUIManager::SGUIPage::MaybeClose ( const bool  isRootPage)

If the page should be closed this function closes the page and returns the result of the init function.

If this page wasn't closed an empty optional is returned.

◆ Refocus()

void CGUIManager::SGUIPage::Refocus ( const Close &  result)

This function should be called when a child page got closed.

The result of the closed page should be the argument of this function. This function resolves the receivingPromise.

Member Data Documentation

◆ gui

std::shared_ptr<CGUI> CGUIManager::SGUIPage::gui

◆ initData

Script::StructuredClone CGUIManager::SGUIPage::initData

◆ inputs

std::unordered_set<VfsPath> CGUIManager::SGUIPage::inputs

◆ m_Name

std::wstring CGUIManager::SGUIPage::m_Name

◆ receivingPromise

std::shared_ptr<JS::PersistentRootedObject> CGUIManager::SGUIPage::receivingPromise

The parent page waits on this promise.

It also gets the completion value through this promise.

◆ sendingPromise

std::shared_ptr<JS::PersistentRootedObject> CGUIManager::SGUIPage::sendingPromise

When this promise is settled this page wants to be closed.

It settles with the page completion value.


The documentation for this struct was generated from the following files: