wavelength 1.0.0
Loading...
Searching...
No Matches
UIPanel Class Reference

Group of components drawn from one .rnd file, which a screen shows. More...

#include <uipanel.h>

Inheritance diagram for UIPanel:
Collaboration diagram for UIPanel:

Public Types

enum  State { kStateShown = 0 , kStateHidden = 1 , kStateEntering = 2 , kStateExiting = 3 }
 Where the panel is in its entry and exit, the values of mState. More...

Public Member Functions

 UIPanel (DataArray *pData, const char *pszDir)
 Construct a hidden panel from its script description.
 ~UIPanel () override
 Destroy the panel, its components, and the objects its file loaded.
bool Dispatch (Message *pMsg) override
 Offer a message to the current screen, the panel, the navigator, and the component with the focus.
bool DispatchPriv (Message *pMsg) override
 Handle a message sent to the panel.
virtual void Load ()
 Take a reference to the panel's file, queueing the file on the first reference.
virtual void Unload ()
 Drop a reference to the panel's file, destroying the components and the loader on the last reference.
virtual void Enter (bool bForce, float fTime)
 Start the entry animation.
virtual void Exit (bool bForce, float fTime)
 Start the exit animation.
virtual void Focus ()
 React to the screen giving the panel the focus by letting the navigator move the focus.
virtual void Unfocus ()
 React to the screen taking the focus away.
virtual void DrawGizmo ()
 Draw what goes under the panel.
virtual void Poll (float fTime)
 Advance the panel's animations and its components to a time.
virtual void Draw ()
 Draw the panel's view once it has loaded, unless the panel is hidden.
virtual void SetShowing (bool bShowing)
 Show or hide the panel's view.
virtual void SetFocus (UIComponent *pComponent, int nButton)
 Move the focus to a component.
virtual void FinishLoad ()
 Find the loaded objects and create the components once the panel's file has loaded.
bool IsLoaded ()
 Report whether the panel's file has loaded, finishing the load when it has.
void AddComponent (UIComponent *pComponent)
 Register a component under its name.
void SetTextsShowing (bool bShowing)
 Show or hide every text object of the panel's file.
float ComputeFrame (float fTime)
 Report the frame of the entry and exit animation at a time.
UIComponent * FindComponent (const char *pszName, bool bFail)
 Find a component by name.
void LocalizeTexts (const char *pszFile, std::list< RndObject * > &objects)
 Collect and localise the text objects of the panel's file.
const char * GetName () const
UIComponent * GetFocus () const
int GetState () const
float GetTransitionStart () const
const std::map< const char *, std::unique_ptr< UIComponent >, StrLess > & GetComponents () const
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.

Static Public Member Functions

static void Init (DataArray *pConfig)
 Read the default frames of the entry and exit animation.
static UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.

Protected Attributes

float mFrame
float mIdleFrame
const char * mName
String mFile
int mState
RndView * mView
const char * mFocusName
float mLoopStart
RndAnimatable * mLoopAnim
RndAnimatable * mEnterExitAnim
float mTransitionStart
float mShownFrame
float mHiddenFrame
float mEnterMs
float mExitMs
int mEnterReversed
int mExitReversed
float mEnterStartFrame
float mExitStartFrame
int mLoadRefs
int mLoaded
DataArray * mData
std::list< RndText * > mTexts
std::map< const char *, std::unique_ptr< UIComponent >, StrLess > mComponents
std::unique_ptr< UINavigator > mNavigator
UIComponent * mFocus
RndLoader * mLoader
std::unique_ptr< RndLoader > mOwnedLoader
 The loader the panel created, or null when it has none or uses a shared one.

Detailed Description

Group of components drawn from one .rnd file, which a screen shows.

The RTTI records the class as deriving from MsgSink. The object is 0x90 bytes. UIManager creates one for each panel entry of the front-end description, through the factory registered for the entry's type. Index 1 of the entry is the name, and the file is <directory>/<name>.rnd beside the description. From index 2 the entry lists the components (each entry type that includes comp), the component that first receives the focus (focus), the navigator (navigator), and the frames of the entry and exit animation (panel_enter_exit).

Load() and Unload() count references. The first Load() queues the file, and IsLoaded() creates the components once the file has loaded. The file provides the view <name>.view, the looping animation <name>_always.anim, and the entry and exit animation <name>_enterexit.anim. Enter() and Exit() play the entry and exit animation over the time given by its frames, and mState follows them.

Member Enumeration Documentation

◆ State

Where the panel is in its entry and exit, the values of mState.

Enumerator
kStateShown 

The panel shows and does not animate.

kStateHidden 

The panel has exited, or has not entered yet.

kStateEntering 

The entry animation plays.

kStateExiting 

The exit animation plays.

Constructor & Destructor Documentation

◆ UIPanel()

UIPanel::UIPanel ( DataArray * pData,
const char * pszDir )

Construct a hidden panel from its script description.

The panel takes a reference to the description.

Parameters
pDataThe script description.
pszDirThe directory of the description file.
Ghidra address:
NTSC-U/C: 0x00208758
Ghidra address:
PAL: 0x00211558

◆ ~UIPanel()

UIPanel::~UIPanel ( )
override

Destroy the panel, its components, and the objects its file loaded.

Ghidra address:
NTSC-U/C: 0x00208fc0
Ghidra address:
PAL: 0x00211dc0

Member Function Documentation

◆ Init()

void UIPanel::Init ( DataArray * pConfig)
static

Read the default frames of the entry and exit animation.

The panel_enter_exit section of the configuration provides enter_start_frame, enter_stop_frame, exit_start_frame, and exit_stop_frame. Without the section the defaults remain. A panel's own panel_enter_exit entry overrides them.

Parameters
pConfigThe ui section of the configuration.
Ghidra address:
NTSC-U/C: 0x002086b0
Ghidra address:
PAL: 0x002114b0

◆ New()

UIPanel * UIPanel::New ( DataArray * pData,
const char * pszDir )
inlinestatic

Create a panel from its script description.

UIManager::Init() registers the routine for the entry type panel.

Parameters
pDataThe script description.
pszDirThe directory of the description file.
Returns
The new panel.
Ghidra address:
NTSC-U/C: 0x00378608
Ghidra address:
PAL: 0x003e6d38

◆ Dispatch()

bool UIPanel::Dispatch ( Message * pMsg)
overridevirtual

Offer a message to the current screen, the panel, the navigator, and the component with the focus.

A message that is neither a controller button nor a keyboard key goes first to the current screen and goes no further than the navigator. A controller button or keyboard key skips the screen and reaches the component with the focus when nothing before handles it.

Parameters
pMsgThe message.
Returns
Whether the message was handled.
Ghidra address:
NTSC-U/C: 0x00209460
Ghidra address:
PAL: 0x00212260

Reimplemented from MsgSink.

◆ DispatchPriv()

bool UIPanel::DispatchPriv ( Message * pMsg)
overridevirtual

Handle a message sent to the panel.

The routine asks the message for its type and handles nothing.

Parameters
pMsgThe message.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00209558
Ghidra address:
PAL: 0x00212358

Implements MsgSink.

◆ Load()

virtual void UIPanel::Load ( )
virtual

Take a reference to the panel's file, queueing the file on the first reference.

The first reference also hides the panel.

Ghidra address:
NTSC-U/C: 0x00208948
Ghidra address:
PAL: 0x00211748

Reimplemented in BonusPicPanel, and HelpPanel.

◆ Unload()

virtual void UIPanel::Unload ( )
virtual

Drop a reference to the panel's file, destroying the components and the loader on the last reference.

The name of the component with the focus is kept, and that component receives the focus again after the next load.

Ghidra address:
NTSC-U/C: 0x002089b8
Ghidra address:
PAL: 0x002117b8

Reimplemented in BonusPicPanel, ChatPanel, FreqPanel, FreqSelPanel, HelpPanel, SoloLoseTipsPanel, and SoloWinStatsPanel.

◆ Enter()

virtual void UIPanel::Enter ( bool bForce,
float fTime )
virtual

Start the entry animation.

A panel that is exiting reverses into its entry at the matching point of the animation.

Parameters
bForceShow the panel at once instead of animating.
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x00209228
Ghidra address:
PAL: 0x00212028

Reimplemented in AvatarPanel, ChatPanel, ControllerPanel, DialogPanel, FreqPanel, FreqSelPanel, KeyboardPanel, LaunchMTVPanel, MCDialogPanel, NetFoundPlayerPanel, NetLPadGamePanel, NetLPadPlayerPanel, NetMainPanel, NetMainPlayersPanel, NetRankedPlayersPanel, NetSortedLaunchpadsPanel, and SoloLoseTipsPanel.

◆ Exit()

virtual void UIPanel::Exit ( bool bForce,
float fTime )
virtual

Start the exit animation.

A panel that is entering reverses into its exit at the matching point of the animation.

Parameters
bForceHide the panel at once instead of animating.
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x00209398
Ghidra address:
PAL: 0x00212198

Reimplemented in AvatarPanel, ChatPanel, FreqPanel, KeyboardPanel, NetMainPanel, NetMainPlayersPanel, SoloWinStatsPanel, and SongPicPanel.

◆ Focus()

virtual void UIPanel::Focus ( )
virtual

React to the screen giving the panel the focus by letting the navigator move the focus.

Ghidra address:
NTSC-U/C: 0x002097d8
Ghidra address:
PAL: 0x002125d8

Reimplemented in FocusChangePanel, NetHostLPadButtonPanel, NetLPadPlayerPanel, NetMainLaunchpadsPanel, NetMainLobbiesPanel, NetMainPlayersPanel, NetSongPanel, and PlaylistPanel.

◆ Unfocus()

virtual void UIPanel::Unfocus ( )
inlinevirtual

React to the screen taking the focus away.

The base routine does nothing.

Ghidra address:
NTSC-U/C: 0x00378658
Ghidra address:
PAL: 0x003e6d88

Reimplemented in FocusChangePanel, NetHostLPadButtonPanel, NetLPadPlayerPanel, NetMainLaunchpadsPanel, NetMainLobbiesPanel, NetMainPlayersPanel, NetSongPanel, and PlaylistPanel.

◆ DrawGizmo()

virtual void UIPanel::DrawGizmo ( )
inlinevirtual

Draw what goes under the panel.

FreqScreen::Draw() calls the routine for each panel before the panels draw. The base routine draws nothing.

Ghidra address:
NTSC-U/C: 0x00378660
Ghidra address:
PAL: 0x003e6d90

Reimplemented in FreqPanel.

◆ Poll()

virtual void UIPanel::Poll ( float fTime)
virtual

Advance the panel's animations and its components to a time.

Parameters
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x00209658
Ghidra address:
PAL: 0x00212458

Reimplemented in ControllerPanel, FreqPanel, FullRankedPanel, KeyboardPanel, NetMainPanel, SoloLoseTipsPanel, SoloWinStatsPanel, and SongPicPanel.

◆ Draw()

virtual void UIPanel::Draw ( )
virtual

Draw the panel's view once it has loaded, unless the panel is hidden.

Ghidra address:
NTSC-U/C: 0x00209768
Ghidra address:
PAL: 0x00212568

Reimplemented in AvatarPanel, FreqPanel, and NetMainPlayersPanel.

◆ SetShowing()

virtual void UIPanel::SetShowing ( bool bShowing)
virtual

Show or hide the panel's view.

Parameters
bShowingWhether the view shows.
Ghidra address:
NTSC-U/C: 0x002097a0
Ghidra address:
PAL: 0x002125a0

Reimplemented in FreqPanel.

◆ SetFocus()

virtual void UIPanel::SetFocus ( UIComponent * pComponent,
int nButton )
virtual

Move the focus to a component.

The panel first dispatches a UIComponentFocusChangeMsg to itself, and a handler that reports it as handled keeps the focus where it is.

Parameters
pComponentThe component, or null.
nButtonThe controller button that moved the focus, or kPadNone. The base routine ignores it.
Ghidra address:
NTSC-U/C: 0x002097f0
Ghidra address:
PAL: 0x002125f0

Reimplemented in FreqPanel, and KeyboardPanel.

◆ FinishLoad()

virtual void UIPanel::FinishLoad ( )
virtual

Find the loaded objects and create the components once the panel's file has loaded.

Ghidra address:
NTSC-U/C: 0x00208b48
Ghidra address:
PAL: 0x00211948

Reimplemented in AvatarPanel, ChatPanel, DialogPanel, FreqPanel, FullRankedPanel, HelpPanel, NetButtonPanel, NetMainPanel, NetMainPlayersPanel, and SongPicPanel.

◆ IsLoaded()

bool UIPanel::IsLoaded ( )

Report whether the panel's file has loaded, finishing the load when it has.

Returns
Whether the panel is ready to show.
Ghidra address:
NTSC-U/C: 0x00208ae8
Ghidra address:
PAL: 0x002118e8

◆ AddComponent()

void UIPanel::AddComponent ( UIComponent * pComponent)

Register a component under its name.

Parameters
pComponentThe component.
Ghidra address:
NTSC-U/C: 0x002090a0
Ghidra address:
PAL: 0x00211ea0

◆ SetTextsShowing()

void UIPanel::SetTextsShowing ( bool bShowing)

Show or hide every text object of the panel's file.

Parameters
bShowingWhether the texts show.
Ghidra address:
NTSC-U/C: 0x002091a0
Ghidra address:
PAL: 0x00211fa0

◆ ComputeFrame()

float UIPanel::ComputeFrame ( float fTime)

Report the frame of the entry and exit animation at a time.

An entry or exit that has run its length ends here, which hides the texts of an exit.

Parameters
fTimeThe front-end time in milliseconds.
Returns
The frame, or mIdleFrame while neither animation plays.
Ghidra address:
NTSC-U/C: 0x00209588
Ghidra address:
PAL: 0x00212388

◆ FindComponent()

UIComponent * UIPanel::FindComponent ( const char * pszName,
bool bFail )

Find a component by name.

Parameters
pszNameThe name.
bFailTreat a missing component as an error. The shipped build ignores it.
Returns
The component, or null.
Ghidra address:
NTSC-U/C: 0x002098b8
Ghidra address:
PAL: 0x002126b8

◆ LocalizeTexts()

void UIPanel::LocalizeTexts ( const char * pszFile,
std::list< RndObject * > & objects )

Collect and localise the text objects of the panel's file.

Each text object is hidden, and its name with any .txt removed is the token the locale translates. In the edit mode of the ui configuration the routine counts each token's uses and records the tokens the locale lacks for UIManager::ReportLocalizeErrors().

Parameters
pszFileThe panel's file.
objectsThe objects the file loaded.
Ghidra address:
NTSC-U/C: 0x0020a278
Ghidra address:
PAL: 0x00213078

◆ GetName()

const char * UIPanel::GetName ( ) const
inline
Returns
The name, a symbol.

◆ GetFocus()

UIComponent * UIPanel::GetFocus ( ) const
inline
Returns
The component with the focus, or null.

◆ GetState()

int UIPanel::GetState ( ) const
inline
Returns
One of State.

◆ GetTransitionStart()

float UIPanel::GetTransitionStart ( ) const
inline
Returns
The time the entry or exit started, or 0 for neither.

◆ GetComponents()

const std::map< const char *, std::unique_ptr< UIComponent >, StrLess > & UIPanel::GetComponents ( ) const
inline
Returns
The components by name.

Member Data Documentation

◆ mFrame

float UIPanel::mFrame
protected

The frame of the entry and exit animation.

◆ mIdleFrame

float UIPanel::mIdleFrame
protected

The frame ComputeFrame() reports while neither animation plays.

◆ mName

const char* UIPanel::mName
protected

The name, a symbol.

◆ mFile

String UIPanel::mFile
protected

The .rnd file.

◆ mState

int UIPanel::mState
protected

One of State.

◆ mView

RndView* UIPanel::mView
protected

The view of the file, or null. Borrowed.

◆ mFocusName

const char* UIPanel::mFocusName
protected

The component that receives the focus after a load.

◆ mLoopStart

float UIPanel::mLoopStart
protected

The time the looping animation's frame counts from.

◆ mLoopAnim

RndAnimatable* UIPanel::mLoopAnim
protected

The looping animation, or null. Borrowed.

◆ mEnterExitAnim

RndAnimatable* UIPanel::mEnterExitAnim
protected

The entry and exit animation, or null. Borrowed.

◆ mTransitionStart

float UIPanel::mTransitionStart
protected

The time the entry or exit started, or 0 for neither.

◆ mShownFrame

float UIPanel::mShownFrame
protected

The frame the entry stops at.

◆ mHiddenFrame

float UIPanel::mHiddenFrame
protected

The frame the exit stops at.

◆ mEnterMs

float UIPanel::mEnterMs
protected

The length of the entry.

◆ mExitMs

float UIPanel::mExitMs
protected

The length of the exit.

◆ mEnterReversed

int UIPanel::mEnterReversed
protected

Whether the entry plays its frames backwards.

◆ mExitReversed

int UIPanel::mExitReversed
protected

Whether the exit plays its frames backwards.

◆ mEnterStartFrame

float UIPanel::mEnterStartFrame
protected

The frame the entry starts at.

◆ mExitStartFrame

float UIPanel::mExitStartFrame
protected

The frame the exit starts at.

◆ mLoadRefs

int UIPanel::mLoadRefs
protected

The number of Load() calls not yet balanced by Unload().

◆ mLoaded

int UIPanel::mLoaded
protected

Whether FinishLoad() has run since the last load.

◆ mData

DataArray* UIPanel::mData
protected

The script description. Borrowed (reference counted).

◆ mTexts

std::list<RndText *> UIPanel::mTexts
protected

The text objects of the file. Borrowed.

◆ mComponents

std::map<const char *, std::unique_ptr<UIComponent>, StrLess> UIPanel::mComponents
protected

Components.

◆ mNavigator

std::unique_ptr<UINavigator> UIPanel::mNavigator
protected

The navigator that moves the focus.

◆ mFocus

UIComponent* UIPanel::mFocus
protected

The component with the focus, or null. Borrowed.

◆ mLoader

RndLoader* UIPanel::mLoader
protected

The loader of the file in use, or null. See mOwnedLoader.

◆ mOwnedLoader

std::unique_ptr<RndLoader> UIPanel::mOwnedLoader
protected

The loader the panel created, or null when it has none or uses a shared one.


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