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

The front-end keyboard, for typing a name or another text for the screen that opened it. More...

#include <keyboardpanel.h>

Inheritance diagram for KeyboardPanel:
Collaboration diagram for KeyboardPanel:

Public Types

enum  ShiftMode { kShiftNone = 0 , kShiftOnce = 1 , kShiftCaps = 2 }
 The shift states of the keys, the values of mShiftMode. More...
Public Types inherited from UIPanel
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

 KeyboardPanel (DataArray *pData, const char *pszDir)
 Construct the panel from its script description.
 ~KeyboardPanel () override
 Destroy the panel.
bool DispatchPriv (Message *pMsg) override
 Route keys about to be chosen, controller buttons, keys of an attached keyboard, and refused characters, and pass on every other message.
void Enter (bool bForce, float fTime) override
 Start the entry and prepare the text entry from the request.
void Exit (bool bForce, float fTime) override
 Start the exit and forget the keys and the animation.
void Poll (float fTime) override
 Advance the panel and the animation of the selected key.
void SetFocus (UIComponent *pComponent, int nButton) override
 Play the KEYBOARD_LEFT_UP cue and move the focus to a key.
void SetRequest (const KeyboardRequest &request)
 Take the request of the screen that opens the keyboard.
bool HandleSelectStart (UIComponentSelectStartMsg *pMsg)
 Act on the key about to be chosen.
void FlashKey (const char *pszKey)
 Flash the key a controller button stands for.
bool HandleJoypad (JoypadInputMsg *pMsg)
 Act on a button of the controller that types.
bool HandleKey (KeyboardKeyMsg *pMsg)
 Act on a key of a keyboard attached to the console.
void SetShiftMode (int nMode)
 Change the shift state, restyling the shift keys and relabelling every key.
void Backspace ()
 Erase the character before the caret.
void MoveLeft ()
 Move the caret left.
void MoveRight ()
 Move the caret right.
void TypeTab ()
 Type a tab.
void TypeSpace ()
 Type a space.
void Delete ()
 Erase the character after the caret.
void Commit ()
 Hand the text to the user and return to the screen that opened the keyboard, unless the user moved to another screen.
void TypeFunctionKey (const char *pszKey)
 Replace the text with the text fkey_<key> of the locale, or go to kb_fkey_error_screen when the request disallows the function keys.
void TypeChar (char ch)
 Type a character, replacing the starting text with the first one typed, and end a shift of one key.
bool HandleInvalid (UITextEntryInvalidMsg *pMsg)
 Play the WRONG cue when the text is full, or go to kb_badkey_error_screen for a character the entry does not accept.
Public Member Functions inherited from FreqPanel
 FreqPanel (DataArray *pData, const char *pszDir)
 Construct a panel from its script description.
 ~FreqPanel () override
 Destroy the panel.
void Unload () override
 Drop a reference to the panel's file, forgetting the meshes and the animation on the last reference.
void DrawGizmo () override
 Stretch the gizmo pyramid from the background mesh to the gizmo and draw it.
void Draw () override
 Move the panel material animations to the front-end time and draw the panel.
void SetShowing (bool bShowing) override
 Show or hide the panel's view and the gizmo pyramid.
void FinishLoad () override
 Find the meshes and animations of the panel once its file has loaded.
void ShowGizmoMesh (bool bShowing)
 Show or hide the gizmo pyramid.
void UpdateBgBox ()
 Measure the background mesh into mBgBox.
Public Member Functions inherited from UIPanel
 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 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.
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 UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.
Static Public Member Functions inherited from FreqPanel
static UIPanel * New (DataArray *pData, const char *pszDir)
 Create a panel from its script description.
static void Init (DataArray *pConfig)
 Read the freq_panel section of the metagame configuration.
Static Public Member Functions inherited from UIPanel
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.

Additional Inherited Members

Public Attributes inherited from FreqPanel
Box mBgBox
Static Public Attributes inherited from FreqPanel
static constexpr int kNumGizmoOffsets = 3
 The number of gizmo offsets the configuration provides.
static Vector3 sGizmoOrigPos
 The position of the gizmo, the panel_gizmo_orig_pos setting.
static Vector3 sGizmoOffsets [kNumGizmoOffsets]
 The points of the gizmo the pyramids reach, the panel_gizmo_offset_1 to _3 settings.
Protected Attributes inherited from UIPanel
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

The front-end keyboard, for typing a name or another text for the screen that opened it.

The RTTI records the class as deriving from FreqPanel. The object is 0x140 bytes and its vtable is at 0x003d0370. The metagame registers the class for the panel type kb_panel, and the front-end description's keyboard panel of the kb_screen screen is one. The entry is the text entry 01. Each key is a KeyboardKey whose text it types, and the keys but_caps, but_lshift, but_rshift, but_back, but_larrow, but_rarrow, but_tab, but_space, but_del, but_enter, and the function keys but_f1 to but_f12 act instead. The controller types as well. Circle is enter, square a space, L1 and R1 move the caret, L2 is backspace, R2 shifts the next key, and triangle returns without the text. A keyboard attached to the console types directly.

Member Enumeration Documentation

◆ ShiftMode

The shift states of the keys, the values of mShiftMode.

Enumerator
kShiftNone 

The keys type their plain characters.

kShiftOnce 

The next key types its shifted character.

kShiftCaps 

The keys type their capital characters until caps is chosen again.

Constructor & Destructor Documentation

◆ KeyboardPanel()

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

Construct the panel from its script description.

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

◆ ~KeyboardPanel()

KeyboardPanel::~KeyboardPanel ( )
override

Destroy the panel.

Ghidra address:
NTSC-U/C: 0x003625f8
Ghidra address:
PAL: 0x003d0b10

Member Function Documentation

◆ New()

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

Create a panel from its script description.

The metagame registers the routine for the entry type kb_panel.

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

◆ DispatchPriv()

bool KeyboardPanel::DispatchPriv ( Message * pMsg)
overridevirtual

Route keys about to be chosen, controller buttons, keys of an attached keyboard, and refused characters, and pass on every other message.

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

Implements MsgSink.

◆ Enter()

void KeyboardPanel::Enter ( bool bForce,
float fTime )
overridevirtual

Start the entry and prepare the text entry from the request.

Parameters
bForceWhether the panel skips its animation.
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x001a8b58
Ghidra address:
PAL: 0x001b0850

Reimplemented from FreqPanel.

◆ Exit()

void KeyboardPanel::Exit ( bool bForce,
float fTime )
overridevirtual

Start the exit and forget the keys and the animation.

Parameters
bForceWhether the panel skips its animation.
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x001a8e80
Ghidra address:
PAL: 0x001b0b78

Reimplemented from FreqPanel.

◆ Poll()

void KeyboardPanel::Poll ( float fTime)
overridevirtual

Advance the panel and the animation of the selected key.

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

Reimplemented from FreqPanel.

◆ SetFocus()

void KeyboardPanel::SetFocus ( UIComponent * pComponent,
int nButton )
overridevirtual

Play the KEYBOARD_LEFT_UP cue and move the focus to a key.

Parameters
pComponentThe key.
nButtonThe controller button that moved the focus, or kPadNone.
Ghidra address:
NTSC-U/C: 0x001a8eb8
Ghidra address:
PAL: 0x001b0bb0

Reimplemented from FreqPanel.

◆ SetRequest()

void KeyboardPanel::SetRequest ( const KeyboardRequest & request)

Take the request of the screen that opens the keyboard.

Parameters
requestThe request.
Ghidra address:
NTSC-U/C: 0x001a8f50
Ghidra address:
PAL: 0x001b0c48

◆ HandleSelectStart()

bool KeyboardPanel::HandleSelectStart ( UIComponentSelectStartMsg * pMsg)

Act on the key about to be chosen.

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

◆ FlashKey()

void KeyboardPanel::FlashKey ( const char * pszKey)

Flash the key a controller button stands for.

Parameters
pszKeyThe key.
Ghidra address:
NTSC-U/C: 0x001a91d8
Ghidra address:
PAL: 0x001b0ed8

◆ HandleJoypad()

bool KeyboardPanel::HandleJoypad ( JoypadInputMsg * pMsg)

Act on a button of the controller that types.

Parameters
pMsgThe message.
Returns
True for another controller or a button that typed, otherwise false.
Ghidra address:
NTSC-U/C: 0x001a9238
Ghidra address:
PAL: 0x001b0f38

◆ HandleKey()

bool KeyboardPanel::HandleKey ( KeyboardKeyMsg * pMsg)

Act on a key of a keyboard attached to the console.

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

◆ SetShiftMode()

void KeyboardPanel::SetShiftMode ( int nMode)

Change the shift state, restyling the shift keys and relabelling every key.

A key <name> shows the text <name>, <name>_shift, or <name>_caps of the locale. Choosing the current shift state again returns to kShiftNone.

Parameters
nModeOne of ShiftMode.
Ghidra address:
NTSC-U/C: 0x001a9628
Ghidra address:
PAL: 0x001b1328

◆ Backspace()

void KeyboardPanel::Backspace ( )

Erase the character before the caret.

Ghidra address:
NTSC-U/C: 0x001a9928
Ghidra address:
PAL: 0x001b1628

◆ MoveLeft()

void KeyboardPanel::MoveLeft ( )

Move the caret left.

Ghidra address:
NTSC-U/C: 0x001a9950
Ghidra address:
PAL: 0x001b1650

◆ MoveRight()

void KeyboardPanel::MoveRight ( )

Move the caret right.

Ghidra address:
NTSC-U/C: 0x001a9978
Ghidra address:
PAL: 0x001b1678

◆ TypeTab()

void KeyboardPanel::TypeTab ( )

Type a tab.

Ghidra address:
NTSC-U/C: 0x001a99a0
Ghidra address:
PAL: 0x001b16a0

◆ TypeSpace()

void KeyboardPanel::TypeSpace ( )

Type a space.

Ghidra address:
NTSC-U/C: 0x001a99c0
Ghidra address:
PAL: 0x001b16c0

◆ Delete()

void KeyboardPanel::Delete ( )

Erase the character after the caret.

Ghidra address:
NTSC-U/C: 0x001a99e0
Ghidra address:
PAL: 0x001b16e0

◆ Commit()

void KeyboardPanel::Commit ( )

Hand the text to the user and return to the screen that opened the keyboard, unless the user moved to another screen.

Ghidra address:
NTSC-U/C: 0x001a9a08
Ghidra address:
PAL: 0x001b1708

◆ TypeFunctionKey()

void KeyboardPanel::TypeFunctionKey ( const char * pszKey)

Replace the text with the text fkey_<key> of the locale, or go to kb_fkey_error_screen when the request disallows the function keys.

Parameters
pszKeyThe function key, such as f1.
Ghidra address:
NTSC-U/C: 0x001a9ab0
Ghidra address:
PAL: 0x001b17b0

◆ TypeChar()

void KeyboardPanel::TypeChar ( char ch)

Type a character, replacing the starting text with the first one typed, and end a shift of one key.

Parameters
chThe character.
Ghidra address:
NTSC-U/C: 0x001a9b50
Ghidra address:
PAL: 0x001b1850

◆ HandleInvalid()

bool KeyboardPanel::HandleInvalid ( UITextEntryInvalidMsg * pMsg)

Play the WRONG cue when the text is full, or go to kb_badkey_error_screen for a character the entry does not accept.

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

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