Pyrogenesis  trunk
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CGUIManager Class Reference

External interface to the GUI system. More...

#include <GUIManager.h>

Collaboration diagram for CGUIManager:
Collaboration graph
[legend]

Classes

struct  SGUIPage
 

Public Member Functions

 CGUIManager ()
 
 ~CGUIManager ()
 
shared_ptr< ScriptInterfaceGetScriptInterface ()
 
shared_ptr< ScriptRuntimeGetRuntime ()
 
shared_ptr< CGUIGetActiveGUI ()
 
bool HasPages ()
 Returns whether there are any current pages. More...
 
void SwitchPage (const CStrW &name, ScriptInterface *srcScriptInterface, JS::HandleValue initData)
 Load a new GUI page and make it active. More...
 
void PushPage (const CStrW &pageName, shared_ptr< ScriptInterface::StructuredClone > initData)
 Load a new GUI page and make it active. More...
 
void PopPage ()
 Unload the currently active GUI page, and make the previous page active. More...
 
void PopPageCB (shared_ptr< ScriptInterface::StructuredClone > args)
 
void DisplayMessageBox (int width, int height, const CStrW &title, const CStrW &message)
 Display a modal message box with an "OK" button. More...
 
Status ReloadChangedFile (const VfsPath &path)
 Called when a file has been modified, to hotload changes. More...
 
void ResetCursor ()
 Sets the default mouse pointer. More...
 
Status ReloadAllPages ()
 Called when we should reload all pages (e.g. More...
 
InReaction HandleEvent (const SDL_Event_ *ev)
 Pass input events to the currently active GUI page. More...
 
bool GetPreDefinedColor (const CStr &name, CColor &output) const
 See CGUI::GetPreDefinedColor; applies to the currently active page. More...
 
IGUIObjectFindObjectByName (const CStr &name) const
 See CGUI::FindObjectByName; applies to the currently active page. More...
 
void SendEventToAll (const CStr &eventName) const
 See CGUI::SendEventToAll; applies to the currently active page. More...
 
void TickObjects ()
 See CGUI::TickObjects; applies to all loaded pages. More...
 
void Draw ()
 See CGUI::Draw; applies to all loaded pages. More...
 
void UpdateResolution ()
 See CGUI::UpdateResolution; applies to all loaded pages. More...
 
std::string GetSavedGameData ()
 Calls the current page's script function getSavedGameData() and returns the result. More...
 
void RestoreSavedGameData (const std::string &jsonData)
 
bool TemplateExists (const std::string &templateName) const
 Check if a template with this name exists. More...
 
const CParamNodeGetTemplate (const std::string &templateName)
 Retrieve the requested template, used for displaying faction specificities. More...
 

Private Types

typedef std::vector< SGUIPagePageStackType
 

Private Member Functions

 NONCOPYABLE (CGUIManager)
 
void LoadPage (SGUIPage &page)
 
shared_ptr< CGUItop () const
 

Private Attributes

shared_ptr< CGUIm_CurrentGUI
 
shared_ptr< ScriptRuntimem_ScriptRuntime
 
shared_ptr< ScriptInterfacem_ScriptInterface
 
PageStackType m_PageStack
 
CTemplateLoader m_TemplateLoader
 

Detailed Description

External interface to the GUI system.

The GUI consists of a set of pages. Each page is constructed from a series of XML files, and is independent from any other page. Only one page is active at a time. All events and render requests etc will go to the active page. This lets the GUI switch between pre-game menu and in-game UI.

Member Typedef Documentation

typedef std::vector<SGUIPage> CGUIManager::PageStackType
private

Constructor & Destructor Documentation

CGUIManager::CGUIManager ( )
CGUIManager::~CGUIManager ( )

Member Function Documentation

void CGUIManager::DisplayMessageBox ( int  width,
int  height,
const CStrW &  title,
const CStrW &  message 
)

Display a modal message box with an "OK" button.

void CGUIManager::Draw ( )

See CGUI::Draw; applies to all loaded pages.

IGUIObject * CGUIManager::FindObjectByName ( const CStr &  name) const

See CGUI::FindObjectByName; applies to the currently active page.

shared_ptr<CGUI> CGUIManager::GetActiveGUI ( )
inline
bool CGUIManager::GetPreDefinedColor ( const CStr &  name,
CColor output 
) const

See CGUI::GetPreDefinedColor; applies to the currently active page.

shared_ptr<ScriptRuntime> CGUIManager::GetRuntime ( )
inline
std::string CGUIManager::GetSavedGameData ( )

Calls the current page's script function getSavedGameData() and returns the result.

shared_ptr<ScriptInterface> CGUIManager::GetScriptInterface ( )
inline
const CParamNode & CGUIManager::GetTemplate ( const std::string &  templateName)

Retrieve the requested template, used for displaying faction specificities.

InReaction CGUIManager::HandleEvent ( const SDL_Event_ ev)

Pass input events to the currently active GUI page.

bool CGUIManager::HasPages ( )

Returns whether there are any current pages.

void CGUIManager::LoadPage ( SGUIPage page)
private
CGUIManager::NONCOPYABLE ( CGUIManager  )
private
void CGUIManager::PopPage ( )

Unload the currently active GUI page, and make the previous page active.

(There must be at least two pages when you call this.)

void CGUIManager::PopPageCB ( shared_ptr< ScriptInterface::StructuredClone args)
void CGUIManager::PushPage ( const CStrW &  pageName,
shared_ptr< ScriptInterface::StructuredClone initData 
)

Load a new GUI page and make it active.

All current pages will be retained, and will still be drawn and receive tick events, but will not receive user inputs.

Status CGUIManager::ReloadAllPages ( )

Called when we should reload all pages (e.g.

translation hotloading update).

Status CGUIManager::ReloadChangedFile ( const VfsPath path)

Called when a file has been modified, to hotload changes.

void CGUIManager::ResetCursor ( )

Sets the default mouse pointer.

void CGUIManager::RestoreSavedGameData ( const std::string &  jsonData)
void CGUIManager::SendEventToAll ( const CStr &  eventName) const

See CGUI::SendEventToAll; applies to the currently active page.

void CGUIManager::SwitchPage ( const CStrW &  name,
ScriptInterface srcScriptInterface,
JS::HandleValue  initData 
)

Load a new GUI page and make it active.

All current pages will be destroyed.

bool CGUIManager::TemplateExists ( const std::string &  templateName) const

Check if a template with this name exists.

void CGUIManager::TickObjects ( )

See CGUI::TickObjects; applies to all loaded pages.

shared_ptr< CGUI > CGUIManager::top ( ) const
private
void CGUIManager::UpdateResolution ( )

See CGUI::UpdateResolution; applies to all loaded pages.

Member Data Documentation

shared_ptr<CGUI> CGUIManager::m_CurrentGUI
private
PageStackType CGUIManager::m_PageStack
private
shared_ptr<ScriptInterface> CGUIManager::m_ScriptInterface
private
shared_ptr<ScriptRuntime> CGUIManager::m_ScriptRuntime
private
CTemplateLoader CGUIManager::m_TemplateLoader
private

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