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

Field the player types text into from a USB keyboard or the on-screen keyboard. More...

#include <uitextentry.h>

Inheritance diagram for UITextEntry:
Collaboration diagram for UITextEntry:

Public Member Functions

 UITextEntry (DataArray *pData, const char *pszPanel)
 Construct a text entry from its script description.
 ~UITextEntry () override
 Destroy the text entry.
bool DispatchPriv (Message *pMsg) override
 Handle a keyboard key, or pass any other message to UIComponent.
const char * Text () const override
 Report the text the player has entered.
void SetText (const char *pszText) override
 Replace the text and put the caret after it.
void SetState (int nState, bool bForce) override
 Change the state, showing the material and the font of the highlight style.
void Poll (float fTime) override
 Blink the caret while the entry edits, and hide it otherwise.
void Print (PrnStream &stream) override
 Write the entry's name.
String MaskText (const char *pszText) const
 Report a copy of a text with every character replaced by an asterisk.
float CharWidth (int nIndex)
 Report the width one character of the text takes, including the font's tracking.
void SetEditing (bool bEditing)
 Start or stop editing.
bool HandleKey (int nKey)
 Act on a key as if it were typed.
void ToggleCaret ()
 Show the caret when it is hidden, and hide it when it shows.
void Layout ()
 Show the part of the text that fits, and place the caret.
void UpdateCaret ()
 Move the caret object to mCaretPos.
bool ProcessKey (int nKey)
 Edit the text for a key.
bool HandleKeyMsg (KeyboardKeyMsg *pMsg)
 Edit the text for a keyboard message.
float GetMaxEntryWidth () const
void SetMaxEntryWidth (float fMaxEntryWidth)
void SetMaxNumChars (int nMaxNumChars)
void SetScroll (int nScroll)
void SetNumLines (int nNumLines)
void SetPassword (int nPassword)
void SetInvalidChars (DataArray *pInvalidChars)
int GetWordWrapLines () const
Public Member Functions inherited from UIComponent
 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.
virtual bool IsShowing () const
 Report whether the component is showing.
virtual void SetShowing (bool bShowing)
 Show or hide the component.
virtual int GetState () const
 Report 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.
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 UIComponent * New (DataArray *pData, const char *pszPanel)
 Create a text entry from its script description.
Static Public Member Functions inherited from UIComponent
static void Init (DataArray *pConfig)
 Read the parameters of the flash a button shows when it is chosen.

Additional Inherited Members

Public Types inherited from UIComponent
enum  State { kStateNormal = 0 , kStateSelected = 1 , kStateDisabled = 2 }
 The state a component shows, the values of mState and the index UIStyle selects with. More...
Protected Attributes inherited from UIComponent
const char * mName
int mShowing
int mState
Static Protected Attributes inherited from UIComponent
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

Field the player types text into from a USB keyboard or the on-screen keyboard.

The RTTI records the class as deriving from UIComponent. The object is 0xb0 bytes, and the vtable is at 0x003d21f0. The panel's file provides the text object <panel>_<name>.txt, the caret <panel>_<name>_cursor.txt, the marker of the field's right edge <panel>_<name>_lastcursor.txt, and optionally the highlight mesh <panel>_<name>.mesh. The description may set scroll, num_lines, word_wrap_lines, max_entry_width, max_num_chars, password, invalid_chars, and, with a mesh, hilight_style.

A character that is refused sends a UITextEntryInvalidMsg, and the return key sends a UITextEntryCompleteMsg, both through the entry's own Dispatch(). While the entry edits, the caret blinks.

Constructor & Destructor Documentation

◆ UITextEntry()

UITextEntry::UITextEntry ( DataArray * pData,
const char * pszPanel )

Construct a text entry from its script description.

Parameters
pDataThe script description.
pszPanelThe name of the panel the entry belongs to.
Ghidra address:
NTSC-U/C: 0x002073d0
Ghidra address:
PAL: 0x00210188

◆ ~UITextEntry()

UITextEntry::~UITextEntry ( )
override

Destroy the text entry.

Ghidra address:
NTSC-U/C: 0x00207838
Ghidra address:
PAL: 0x00210610

Member Function Documentation

◆ New()

UIComponent * UITextEntry::New ( DataArray * pData,
const char * pszPanel )
inlinestatic

Create a text entry from its script description.

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

Parameters
pDataThe script description.
pszPanelThe name of the panel the entry belongs to.
Returns
The new text entry.
Ghidra address:
NTSC-U/C: 0x00377708
Ghidra address:
PAL: 0x003e5e38

◆ DispatchPriv()

bool UITextEntry::DispatchPriv ( Message * pMsg)
overridevirtual

Handle a keyboard key, or pass any other message to UIComponent.

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

Reimplemented from UIComponent.

◆ Text()

const char * UITextEntry::Text ( ) const
overridevirtual

Report the text the player has entered.

Returns
The text.
Ghidra address:
NTSC-U/C: 0x00207ae8
Ghidra address:
PAL: 0x002108c0

Reimplemented from UIComponent.

◆ SetText()

void UITextEntry::SetText ( const char * pszText)
overridevirtual

Replace the text and put the caret after it.

Parameters
pszTextThe text.
Ghidra address:
NTSC-U/C: 0x002079e0
Ghidra address:
PAL: 0x002107b8

Reimplemented from UIComponent.

◆ SetState()

void UITextEntry::SetState ( int nState,
bool bForce )
overridevirtual

Change the state, showing the material and the font of the highlight style.

Parameters
nStateOne of UIComponent::State.
bForceApply the state even when it does not change.
Ghidra address:
NTSC-U/C: 0x00207af0
Ghidra address:
PAL: 0x002108c8

Reimplemented from UIComponent.

◆ Poll()

void UITextEntry::Poll ( float fTime)
overridevirtual

Blink the caret while the entry edits, and hide it otherwise.

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

Reimplemented from UIComponent.

◆ Print()

void UITextEntry::Print ( PrnStream & stream)
overridevirtual

Write the entry's name.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00208660
Ghidra address:
PAL: 0x00211460

Implements UIComponent.

◆ MaskText()

String UITextEntry::MaskText ( const char * pszText) const

Report a copy of a text with every character replaced by an asterisk.

Parameters
pszTextThe text.
Returns
The masked copy.
Ghidra address:
NTSC-U/C: 0x002078a8
Ghidra address:
PAL: 0x00210680

◆ CharWidth()

float UITextEntry::CharWidth ( int nIndex)

Report the width one character of the text takes, including the font's tracking.

A password entry measures an asterisk instead.

Parameters
nIndexThe character's position in mText.
Returns
The width.
Ghidra address:
NTSC-U/C: 0x00207960
Ghidra address:
PAL: 0x00210738

◆ SetEditing()

void UITextEntry::SetEditing ( bool bEditing)

Start or stop editing.

Editing blinks the caret from the current front-end time. Stopping hides it.

Parameters
bEditingWhether the entry edits.
Ghidra address:
NTSC-U/C: 0x00207bb0
Ghidra address:
PAL: 0x00210988

◆ HandleKey()

bool UITextEntry::HandleKey ( int nKey)

Act on a key as if it were typed.

Parameters
nKeyThe key.
Returns
True.
Ghidra address:
NTSC-U/C: 0x00207c08
Ghidra address:
PAL: 0x002109e0

◆ ToggleCaret()

void UITextEntry::ToggleCaret ( )

Show the caret when it is hidden, and hide it when it shows.

Ghidra address:
NTSC-U/C: 0x00207c28
Ghidra address:
PAL: 0x00210a00

◆ Layout()

void UITextEntry::Layout ( )

Show the part of the text that fits, and place the caret.

A scrolling entry moves its first visible character to keep the caret inside the field.

Ghidra address:
NTSC-U/C: 0x00207d00
Ghidra address:
PAL: 0x00210ad8

◆ UpdateCaret()

void UITextEntry::UpdateCaret ( )

Move the caret object to mCaretPos.

Ghidra address:
NTSC-U/C: 0x00208038
Ghidra address:
PAL: 0x00210e10

◆ ProcessKey()

bool UITextEntry::ProcessKey ( int nKey)

Edit the text for a key.

Return completes the entry, backspace and delete remove a character, the left and right arrows move the caret, and a printable character is inserted at the caret when it is allowed and fits.

Parameters
nKeyThe key.
Returns
True, for every key.
Ghidra address:
NTSC-U/C: 0x00208058
Ghidra address:
PAL: 0x00210e30

◆ HandleKeyMsg()

bool UITextEntry::HandleKeyMsg ( KeyboardKeyMsg * pMsg)

Edit the text for a keyboard message.

Parameters
pMsgThe message.
Returns
True.
Ghidra address:
NTSC-U/C: 0x00208640
Ghidra address:
PAL: 0x00211440

◆ GetMaxEntryWidth()

float UITextEntry::GetMaxEntryWidth ( ) const
inline
Returns
The max_entry_width setting, or -1 for no limit.

◆ SetMaxEntryWidth()

void UITextEntry::SetMaxEntryWidth ( float fMaxEntryWidth)
inline
Parameters
fMaxEntryWidthThe max_entry_width setting, or -1 for no limit.

◆ SetMaxNumChars()

void UITextEntry::SetMaxNumChars ( int nMaxNumChars)
inline
Parameters
nMaxNumCharsThe max_num_chars setting, or -1 for no limit.

◆ SetScroll()

void UITextEntry::SetScroll ( int nScroll)
inline
Parameters
nScrollThe scroll setting.

◆ SetNumLines()

void UITextEntry::SetNumLines ( int nNumLines)
inline
Parameters
nNumLinesThe num_lines setting.

◆ SetPassword()

void UITextEntry::SetPassword ( int nPassword)
inline
Parameters
nPasswordThe password setting. It masks the text.

◆ SetInvalidChars()

void UITextEntry::SetInvalidChars ( DataArray * pInvalidChars)
inline
Parameters
pInvalidCharsThe invalid_chars array, or null.

◆ GetWordWrapLines()

int UITextEntry::GetWordWrapLines ( ) const
inline
Returns
The word_wrap_lines setting, or 0 for no wrapping.

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