wavelength 1.0.0
Loading...
Searching...
No Matches
UIComponent Class Referenceabstract

One control of a front-end panel, such as a label, a button, or a list. More...

#include <uicomponent.h>

Inheritance diagram for UIComponent:
Collaboration diagram for UIComponent:

Public Types

enum  State { kStateNormal = 0 , kStateSelected = 1 , kStateDisabled = 2 }
 The state a component shows, the values of mState and the index UIStyle selects with. More...

Public Member Functions

 UIComponent (DataArray *pData)
 Construct a showing component in the normal state.
bool Dispatch (Message *pMsg) override
 Offer a message to the focused panel of the current screen, then handle it here.
bool DispatchPriv (Message *pMsg) override
 Handle a message sent to the component.
virtual bool IsShowing () const
 Report whether the component is showing.
virtual void SetShowing (bool bShowing)
 Show or hide the component.
virtual const char * Text () const
 Report the text the component shows.
virtual void SetText (const char *pszText)
 Replace the text the component shows.
virtual int GetState () const
 Report the state the component shows.
virtual void SetState (int nState, bool bForce)
 Change the state the component shows.
virtual void Focus ()
 React to the panel giving the component the focus.
virtual void Unfocus ()
 React to the panel taking the focus away.
virtual void Poll (float fTime)
 Advance the component to a time.
virtual void Print (PrnStream &stream)=0
 Write a description of the component.
const char * GetName () const
int GetShowing () 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 parameters of the flash a button shows when it is chosen.

Protected Attributes

const char * mName
int mShowing
int mState

Static Protected Attributes

static int sNumFlashes
 Number of times a chosen button flashes before it reports the choice.
static float sSelectedMs
 Milliseconds of each flash a chosen button spends in the selected state.
static float sNormalMs
 Milliseconds of each flash a chosen button spends in the normal state.

Detailed Description

One control of a front-end panel, such as a label, a button, or a list.

The RTTI records the class as deriving from MsgSink. The class itself is abstract, and no vtable of its own is emitted. A panel creates each component from one entry of its script description through the factory UIManager registered for the entry's type (label_comp, button_comp, lrbutton_comp, list_comp, and text_entry_comp). Index 1 of the entry is the component's name.

A component reports a state that selects the material and the font of its UIStyle. The panel moves the focus between its components with Focus() and Unfocus(). Messages reach a component through Dispatch(), which offers navigation messages to the focused panel of the current screen first.

Member Enumeration Documentation

◆ State

The state a component shows, the values of mState and the index UIStyle selects with.

Enumerator
kStateNormal 

The component does not have the focus.

kStateSelected 

The component has the focus.

kStateDisabled 

The component cannot be chosen.

Constructor & Destructor Documentation

◆ UIComponent()

UIComponent::UIComponent ( DataArray * pData)
inlineexplicit

Construct a showing component in the normal state.

Inline. Each derived constructor expands it.

Parameters
pDataThe script description. Index 1 is the name.

Member Function Documentation

◆ Init()

void UIComponent::Init ( DataArray * pConfig)
static

Read the parameters of the flash a button shows when it is chosen.

The button_select section of the configuration provides num_flashes, frames_selected, and frames_normal. Without the section the defaults remain.

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

◆ Dispatch()

bool UIComponent::Dispatch ( Message * pMsg)
overridevirtual

Offer a message to the focused panel of the current screen, then handle it here.

A message that is neither a controller button nor a keyboard key goes first to the panel UIManager::FocusPanel() reports. The component handles the message when the panel does not.

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

Reimplemented from MsgSink.

◆ DispatchPriv()

bool UIComponent::DispatchPriv ( Message * pMsg)
overridevirtual

Handle a message sent to the component.

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

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

Implements MsgSink.

Reimplemented in UIList, and UITextEntry.

◆ IsShowing()

virtual bool UIComponent::IsShowing ( ) const
inlinevirtual

Report whether the component is showing.

Returns
mShowing.
Ghidra address:
NTSC-U/C: 0x003772b0
Ghidra address:
PAL: 0x003e59e0

◆ SetShowing()

virtual void UIComponent::SetShowing ( bool bShowing)
inlinevirtual

Show or hide the component.

Parameters
bShowingWhether the component shows.
Ghidra address:
NTSC-U/C: 0x003772b8
Ghidra address:
PAL: 0x003e59e8

Reimplemented in LRButton, UIButton, and UILabel.

◆ Text()

virtual const char * UIComponent::Text ( ) const
virtual

Report the text the component shows.

Returns
An empty string. A component with text overrides the routine.
Ghidra address:
NTSC-U/C: 0x00203d40
Ghidra address:
PAL: 0x0020caf8

Reimplemented in UIButton, UILabel, and UITextEntry.

◆ SetText()

virtual void UIComponent::SetText ( const char * pszText)
virtual

Replace the text the component shows.

The base routine does nothing.

Parameters
pszTextThe text.
Ghidra address:
NTSC-U/C: 0x00203d50
Ghidra address:
PAL: 0x0020cb08

Reimplemented in UIButton, UILabel, and UITextEntry.

◆ GetState()

virtual int UIComponent::GetState ( ) const
inlinevirtual

Report the state the component shows.

Returns
One of State.
Ghidra address:
NTSC-U/C: 0x003772c0
Ghidra address:
PAL: 0x003e59f0

◆ SetState()

virtual void UIComponent::SetState ( int nState,
bool bForce )
inlinevirtual

Change the state the component shows.

Parameters
nStateOne of State.
bForceApply the state even when it does not change. The base routine ignores it.
Ghidra address:
NTSC-U/C: 0x003772c8
Ghidra address:
PAL: 0x003e59f8

Reimplemented in LRButton, UIButton, UILabel, and UITextEntry.

◆ Focus()

virtual void UIComponent::Focus ( )
inlinevirtual

React to the panel giving the component the focus.

The base routine does nothing.

Ghidra address:
NTSC-U/C: 0x003772d0
Ghidra address:
PAL: 0x003e5a00

◆ Unfocus()

virtual void UIComponent::Unfocus ( )
inlinevirtual

React to the panel taking the focus away.

The base routine does nothing.

Ghidra address:
NTSC-U/C: 0x003772d8
Ghidra address:
PAL: 0x003e5a08

Reimplemented in LRButton, and UIButton.

◆ Poll()

virtual void UIComponent::Poll ( float fTime)
inlinevirtual

Advance the component to a time.

The base routine does nothing.

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

Reimplemented in LRButton, UIButton, and UITextEntry.

◆ Print()

virtual void UIComponent::Print ( PrnStream & stream)
pure virtual

Write a description of the component.

Parameters
streamThe stream to write to.

Implemented in UIButton, UILabel, UIList, and UITextEntry.

◆ GetName()

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

◆ GetShowing()

int UIComponent::GetShowing ( ) const
inline
Returns
Whether the component shows.

Member Data Documentation

◆ mName

const char* UIComponent::mName
protected

The name, a symbol.

◆ mShowing

int UIComponent::mShowing
protected

Whether the component shows.

◆ mState

int UIComponent::mState
protected

One of State.

◆ sNumFlashes

int UIComponent::sNumFlashes
staticprotected

Number of times a chosen button flashes before it reports the choice.

Ghidra address:
NTSC-U/C: 0x003afcb8
Ghidra address:
PAL: 0x0042eb50

◆ sSelectedMs

float UIComponent::sSelectedMs
staticprotected

Milliseconds of each flash a chosen button spends in the selected state.

Ghidra address:
NTSC-U/C: 0x003afcc0
Ghidra address:
PAL: 0x0042eb58

◆ sNormalMs

float UIComponent::sNormalMs
staticprotected

Milliseconds of each flash a chosen button spends in the normal state.

Ghidra address:
NTSC-U/C: 0x003afcc4
Ghidra address:
PAL: 0x0042eb5c

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