|
wavelength 1.0.0
|
Owner of every front-end screen, panel, and style, and of the screen that shows. More...
#include <uimanager.h>


Classes | |
| class | Callback |
| Callback that keeps a shared .rnd file from replacing loaded objects. More... | |
Public Types | |
| typedef UIPanel *(* | PanelFactory) (DataArray *pData, const char *pszDir) |
| Routine that creates a panel from its script description. | |
| typedef UIScreen *(* | ScreenFactory) (DataArray *pData) |
| Routine that creates a screen from its script description. | |
| typedef UIStyle *(* | StyleFactory) (DataArray *pData) |
| Routine that creates a style from its script description. | |
| typedef UIComponent *(* | ComponentFactory) (DataArray *pData, const char *pszDir) |
| Routine that creates a component from its script description. | |
Public Member Functions | |
| UIManager () | |
| Construct an empty manager. | |
| ~UIManager () override | |
| Destroy the manager. | |
| void | Init () |
| Read the ui section of the configuration, load the shared .rnd files, and register the built-in panel, screen, style, and component types. | |
| void | Terminate () |
| Destroy every style, screen, panel, and shared object. | |
| void | AddScreen (UIScreen *pScreen) |
| Register a screen under its name. | |
| void | AddPanel (UIPanel *pPanel) |
| Register a panel under its name. | |
| void | AddStyle (UIStyle *pStyle) |
| Register a style under its name. | |
| bool | IsNavigationMsg (Message *pMsg) |
| Report whether a message is a controller button or a keyboard key. | |
| bool | DispatchPriv (Message *pMsg) override |
| Track the directional buttons for the repeat. | |
| __attribute__ ((noinline)) bool HandleJoypad(JoypadInputMsg *pMsg) | |
| Start or stop the repeat of a directional button. | |
| bool | Dispatch (Message *pMsg) override |
| Offer a message to the sinks, then to the manager, then to the current screen. | |
| void | Poll (float fTime) |
| Advance the current screen to a time, and send the repeat of a held directional button. | |
| void | Draw () |
| Draw the current screen. | |
| UIScreen * | FindScreen (const char *pszName, bool bFail) |
| Find a screen by name. | |
| UIPanel * | FindPanel (const char *pszName, bool bFail) |
| Find a panel by name. | |
| UIComponent * | FindComponent (const char *pszPanel, const char *pszComponent, bool bFail) |
| Find a component of a panel by name. | |
| UIStyle * | FindStyle (const char *pszName, bool bFail) |
| Find a style by name. | |
| void | GotoScreen (const char *pszName) |
| Change to the screen of a name. | |
| void | GotoScreen (UIScreen *pScreen) |
| Change to a screen. | |
| void | SetCurrentScreen (UIScreen *pScreen) |
| Record the current screen. | |
| UIPanel * | FocusPanel () |
| Report the panel with the focus on the current screen. | |
| void | LoadGroup (const char *pszGroup) |
| Load the panels of every screen of a loading group. | |
| void | UnloadGroup (const char *pszGroup) |
| Unload the panels of every screen of a loading group. | |
| bool | IsGroupLoaded (const char *pszGroup) |
| Report whether every screen of a loading group has loaded. | |
| void | RegisterPanelType (PanelFactory pfnFactory, const char *pszType) |
| Register a panel type. | |
| void | RegisterScreenType (ScreenFactory pfnFactory, const char *pszType) |
| Register a screen type. | |
| void | RegisterStyleType (StyleFactory pfnFactory, const char *pszType) |
| Register a style type. | |
| void | RegisterComponentType (ComponentFactory pfnFactory, const char *pszType) |
| Register a component type. | |
| UIPanel * | CreatePanel (DataArray *pData, const char *pszDir) |
| Create a panel through the factory registered for its entry type. | |
| UIScreen * | CreateScreen (DataArray *pData) |
| Create a screen through the factory registered for its entry type. | |
| UIStyle * | CreateStyle (DataArray *pData) |
| Create a style through the factory registered for its entry type. | |
| UIComponent * | CreateComponent (DataArray *pData, const char *pszDir) |
| Create a component through the factory registered for its entry type. | |
| void | LoadFile (const char *pszFile, bool bLoadAll) |
| Read a front-end description and create what it describes. | |
| void | VerifyGroup (const char **ppszGroup) |
| Check a loading group against the allowable_groups of the configuration. | |
| void | ReportLocalizeErrors () |
| Report the localisation errors the panels recorded while their texts loaded. | |
| UIScreen * | GetCurrentScreen () const |
| float | GetTime () const |
| int | GetEditMode () const |
| Public Member Functions inherited from MsgSource | |
| MsgSource () | |
| Construct a source with no sinks. | |
| virtual | ~MsgSource () |
| Release the list of sinks. | |
| virtual void | AddSink (MsgSink *pSink) |
| Register a sink, ignoring a sink that is already registered. | |
| virtual void | RemoveSink (MsgSink *pSink) |
| Unregister the first occurrence of a sink. | |
| void | Send (Message *pMsg) |
| Deliver a message to every registered sink, in registration order. | |
| bool | SendUntilHandled (Message *pMsg) |
| Deliver a message to the registered sinks in registration order until one handles it. | |
| MsgSource () | |
| Create a source with no sinks. | |
| virtual | ~MsgSource () |
| Free the list of sinks. | |
| virtual void | AddSink (MsgSink *sink) |
| Add a sink at the end of the list, unless it is already there. | |
| virtual void | RemoveSink (MsgSink *sink) |
| Remove a sink, which must be in the list. | |
| Public Member Functions inherited from MsgSink | |
| void * | operator new (size_t nSize) |
| Allocate a sink from the pool heaps under the tag "MsgSink". | |
| void | operator delete (void *pBlock) |
| Return a sink to the pool heaps. | |
| virtual | ~MsgSink () |
| void * | operator new (size_t size) |
| Allocate from the main heap under the name MsgSink. | |
| void | operator delete (void *mem) |
| Return memory to its heap. | |
| virtual | ~MsgSink () |
| Destroy the sink. | |
Additional Inherited Members | |
| Public Attributes inherited from MsgSource | |
| int | mGraphBuilt |
Owner of every front-end screen, panel, and style, and of the screen that shows.
The RTTI records the class as deriving from MsgSource and MsgSink, and includes the class name. The one instance is TheUI. Its MsgSource subobject sits at +0x00 and its MsgSink subobject at +0x10.
LoadFile() reads a front-end description and creates its styles, screens, and panels through the factories registered for their entry types. An entry whose type includes style, screen, or panel is one of those, in that order of precedence, and a focus entry goes to the screen it names. The metagame registers its screen and panel classes before it loads its description.
The manager routes front-end input. A message reaches its sinks until one handles it, then the current screen when the message is a controller button or a keyboard key. Directional buttons held down repeat, first after the longer delay and then after the shorter one.
Routine that creates a panel from its script description.
| pData | The script description. |
| pszDir | The directory of the description file. |
Routine that creates a screen from its script description.
| pData | The script description. |
Routine that creates a style from its script description.
| pData | The script description. |
| typedef UIComponent *(* UIManager::ComponentFactory) (DataArray *pData, const char *pszDir) |
Routine that creates a component from its script description.
| pData | The script description. |
| pszDir | The name of the panel the component belongs to. |
| UIManager::UIManager | ( | ) |
Construct an empty manager.
|
override |
Destroy the manager.
| void UIManager::Init | ( | ) |
Read the ui section of the configuration, load the shared .rnd files, and register the built-in panel, screen, style, and component types.
| void UIManager::Terminate | ( | ) |
Destroy every style, screen, panel, and shared object.
| void UIManager::AddScreen | ( | UIScreen * | pScreen | ) |
Register a screen under its name.
| pScreen | The screen. |
| void UIManager::AddPanel | ( | UIPanel * | pPanel | ) |
Register a panel under its name.
| pPanel | The panel. |
| void UIManager::AddStyle | ( | UIStyle * | pStyle | ) |
Register a style under its name.
| pStyle | The style. |
| bool UIManager::IsNavigationMsg | ( | Message * | pMsg | ) |
Report whether a message is a controller button or a keyboard key.
| pMsg | The message. |
|
overridevirtual |
| UIManager::__attribute__ | ( | (noinline) | ) |
Start or stop the repeat of a directional button.
Pressing a directional button starts its repeat unless another controller's repeat runs. Releasing the button that repeats stops the repeat.
| pMsg | The message of the button. |
|
overridevirtual |
Offer a message to the sinks, then to the manager, then to the current screen.
Only a controller button or a keyboard key reaches the current screen, and only those skip the sinks.
| pMsg | The message. |
Reimplemented from MsgSink.
| void UIManager::Poll | ( | float | fTime | ) |
Advance the current screen to a time, and send the repeat of a held directional button.
| fTime | The front-end time in milliseconds. |
| void UIManager::Draw | ( | ) |
Draw the current screen.
| UIScreen * UIManager::FindScreen | ( | const char * | pszName, |
| bool | bFail ) |
Find a screen by name.
| pszName | The name. |
| bFail | Treat a missing screen as an error. The shipped build ignores it. |
| UIPanel * UIManager::FindPanel | ( | const char * | pszName, |
| bool | bFail ) |
Find a panel by name.
| pszName | The name. |
| bFail | Treat a missing panel as an error. The shipped build ignores it. |
| UIComponent * UIManager::FindComponent | ( | const char * | pszPanel, |
| const char * | pszComponent, | ||
| bool | bFail ) |
Find a component of a panel by name.
| pszPanel | The name of the panel. |
| pszComponent | The name of the component. |
| bFail | Treat a missing panel or component as an error. The shipped build ignores it. |
| UIStyle * UIManager::FindStyle | ( | const char * | pszName, |
| bool | bFail ) |
Find a style by name.
| pszName | The name. |
| bFail | Treat a missing style as an error. The shipped build ignores it. |
| void UIManager::GotoScreen | ( | const char * | pszName | ) |
Change to the screen of a name.
The routine looks the screen up in TheUI rather than in this manager.
| pszName | The name. |
| void UIManager::GotoScreen | ( | UIScreen * | pScreen | ) |
Change to a screen.
Nothing happens when the screen is current or is the one the current screen exits to. The manager otherwise dispatches a UIScreenChangeMsg to itself, and a handler that reports it as handled cancels the change. The new screen loads its panels, and the current screen exits to it, or the new screen enters at once when no screen is current.
| pScreen | The screen. |
| void UIManager::SetCurrentScreen | ( | UIScreen * | pScreen | ) |
Record the current screen.
UIScreen::Enter() calls the routine.
| pScreen | The screen. |
| UIPanel * UIManager::FocusPanel | ( | ) |
Report the panel with the focus on the current screen.
A screen must be current.
| void UIManager::LoadGroup | ( | const char * | pszGroup | ) |
Load the panels of every screen of a loading group.
| pszGroup | The group. |
| void UIManager::UnloadGroup | ( | const char * | pszGroup | ) |
Unload the panels of every screen of a loading group.
| pszGroup | The group. |
| bool UIManager::IsGroupLoaded | ( | const char * | pszGroup | ) |
Report whether every screen of a loading group has loaded.
| pszGroup | The group. |
| void UIManager::RegisterPanelType | ( | PanelFactory | pfnFactory, |
| const char * | pszType ) |
Register a panel type.
| pfnFactory | The routine that creates a panel of the type. |
| pszType | The entry type of the front-end description. |
| void UIManager::RegisterScreenType | ( | ScreenFactory | pfnFactory, |
| const char * | pszType ) |
Register a screen type.
| pfnFactory | The routine that creates a screen of the type. |
| pszType | The entry type of the front-end description. |
| void UIManager::RegisterStyleType | ( | StyleFactory | pfnFactory, |
| const char * | pszType ) |
Register a style type.
| pfnFactory | The routine that creates a style of the type. |
| pszType | The entry type of the front-end description. |
| void UIManager::RegisterComponentType | ( | ComponentFactory | pfnFactory, |
| const char * | pszType ) |
Register a component type.
| pfnFactory | The routine that creates a component of the type. |
| pszType | The entry type of a panel description. |
Create a panel through the factory registered for its entry type.
The type must be registered.
| pData | The script description. Index 0 is the type. |
| pszDir | The directory of the description file. |
Create a screen through the factory registered for its entry type.
The type must be registered.
| pData | The script description. Index 0 is the type. |
Create a style through the factory registered for its entry type.
The type must be registered.
| pData | The script description. Index 0 is the type. |
| UIComponent * UIManager::CreateComponent | ( | DataArray * | pData, |
| const char * | pszDir ) |
Create a component through the factory registered for its entry type.
The type must be registered.
| pData | The script description. Index 0 is the type. |
| pszDir | The name of the panel the component belongs to. |
| void UIManager::LoadFile | ( | const char * | pszFile, |
| bool | bLoadAll ) |
Read a front-end description and create what it describes.
| pszFile | The description file, or null to do nothing. |
| bLoadAll | Also load every screen at once, waiting for each to finish. |
| void UIManager::VerifyGroup | ( | const char ** | ppszGroup | ) |
Check a loading group against the allowable_groups of the configuration.
A null group becomes the first allowable group. A group the list does not include is reported.
| ppszGroup | The group, which may be replaced. |
| void UIManager::ReportLocalizeErrors | ( | ) |
Report the localisation errors the panels recorded while their texts loaded.
The body is with LocalizeErrors, the record it reports.
|
inline |
|
inline |
|
inline |