Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>

Classes

struct  SGUIPage
 

Public Member Functions

 CGUIManager (ScriptInterface &scriptInterface)
 
 ~CGUIManager ()
 
ScriptInterfaceGetScriptInterface ()
 
bool HasPages ()
 Returns whether there are any current pages. More...
 
void SwitchPage (const CStrW &name, CScriptVal initData)
 Load a new GUI page and make it active. More...
 
void PushPage (const CStrW &name, CScriptVal 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 DisplayMessageBox (int width, int height, const CStrW &title, const CStrW &message)
 Display a modal message box with an "OK" button. More...
 
Status ReloadChangedFiles (const VfsPath &path)
 Call when a file has bee modified, to hotload pages if their .xml files changed. More...
 
InReaction HandleEvent (const SDL_Event_ *ev)
 Pass input events to the currently active GUI page. More...
 
bool GetPreDefinedColor (const CStr &name, CColor &output)
 See CGUI::GetPreDefinedColor; applies to the currently active page. More...
 
bool IconExists (const CStr &str) const
 See CGUI::IconExists; applies to the currently active page. More...
 
SGUIIcon GetIcon (const CStr &str) const
 See CGUI::GetIcon; 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)
 See CGUI::SendEventToAll; applies to the currently active page. More...
 
JSObject * GetScriptObject ()
 See CGUI::GetScriptObject; 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...
 
CScriptVal GetSavedGameData ()
 Calls the current page's script function getSavedGameData() and returns the result. More...
 

Private Types

typedef std::vector< SGUIPagePageStackType
 

Private Member Functions

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

Private Attributes

PageStackType m_PageStack
 
shared_ptr< CGUIm_CurrentGUI
 
ScriptInterfacem_ScriptInterface
 

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.

Definition at line 45 of file GUIManager.h.

Member Typedef Documentation

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

Definition at line 158 of file GUIManager.h.

Constructor & Destructor Documentation

CGUIManager::CGUIManager ( ScriptInterface scriptInterface)

Definition at line 51 of file GUIManager.cpp.

CGUIManager::~CGUIManager ( )

Definition at line 60 of file GUIManager.cpp.

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.

Definition at line 94 of file GUIManager.cpp.

void CGUIManager::Draw ( )

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

Definition at line 276 of file GUIManager.cpp.

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

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

Definition at line 246 of file GUIManager.cpp.

SGUIIcon CGUIManager::GetIcon ( const CStr &  str) const

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

Definition at line 241 of file GUIManager.cpp.

bool CGUIManager::GetPreDefinedColor ( const CStr &  name,
CColor output 
)

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

Definition at line 231 of file GUIManager.cpp.

CScriptVal CGUIManager::GetSavedGameData ( )

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

Definition at line 187 of file GUIManager.cpp.

ScriptInterface& CGUIManager::GetScriptInterface ( )
inline

Definition at line 52 of file GUIManager.h.

JSObject * CGUIManager::GetScriptObject ( )

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

Definition at line 290 of file GUIManager.cpp.

InReaction CGUIManager::HandleEvent ( const SDL_Event_ ev)

Pass input events to the currently active GUI page.

Definition at line 195 of file GUIManager.cpp.

bool CGUIManager::HasPages ( )

Returns whether there are any current pages.

Definition at line 64 of file GUIManager.cpp.

bool CGUIManager::IconExists ( const CStr &  str) const

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

Definition at line 236 of file GUIManager.cpp.

void CGUIManager::LoadPage ( SGUIPage page)
private

Definition at line 109 of file GUIManager.cpp.

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.)

Definition at line 83 of file GUIManager.cpp.

void CGUIManager::PushPage ( const CStrW &  name,
CScriptVal  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.

Definition at line 75 of file GUIManager.cpp.

Status CGUIManager::ReloadChangedFiles ( const VfsPath path)

Call when a file has bee modified, to hotload pages if their .xml files changed.

Definition at line 172 of file GUIManager.cpp.

void CGUIManager::SendEventToAll ( const CStr &  eventName)

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

Definition at line 256 of file GUIManager.cpp.

void CGUIManager::SwitchPage ( const CStrW &  name,
CScriptVal  initData 
)

Load a new GUI page and make it active.

All current pages will be destroyed.

Definition at line 69 of file GUIManager.cpp.

void CGUIManager::TickObjects ( )

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

Definition at line 261 of file GUIManager.cpp.

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

Definition at line 298 of file GUIManager.cpp.

void CGUIManager::UpdateResolution ( )

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

Definition at line 284 of file GUIManager.cpp.

Member Data Documentation

shared_ptr<CGUI> CGUIManager::m_CurrentGUI
private

Definition at line 161 of file GUIManager.h.

PageStackType CGUIManager::m_PageStack
private

Definition at line 159 of file GUIManager.h.

ScriptInterface& CGUIManager::m_ScriptInterface
private

Definition at line 163 of file GUIManager.h.


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