wavelength 1.0.0
Loading...
Searching...
No Matches
keyboardpanel.h
Go to the documentation of this file.
1#pragma once
2
3#include "met/freqpanel.h"
7#include "rnd/rndmatanim.h"
8#include "script/dataarray.h"
9#include "ui/uibutton.h"
10#include "ui/uicomponent.h"
12#include "ui/uitextentry.h"
14
28class KeyboardPanel : public FreqPanel {
29public:
31#ifdef VIDEO_STANDARD_PAL
32 enum ShiftMode {
33 kShiftUnset = 0,
34 kShiftNone = 1,
35 kShiftOnce = 2,
36 kShiftCaps = 3,
37 };
38#else
44#endif
45
54 KeyboardPanel(DataArray *pData, const char *pszDir);
55
62 ~KeyboardPanel() override;
63
75 static UIPanel *New(DataArray *pData, const char *pszDir) {
76 return new KeyboardPanel(pData, pszDir);
77 }
78
88 bool DispatchPriv(Message *pMsg) override;
89
98 void Enter(bool bForce, float fTime) override;
99
108 void Exit(bool bForce, float fTime) override;
109
117 void Poll(float fTime) override;
118
127 void SetFocus(UIComponent *pComponent, int nButton) override;
128
136 void SetRequest(const KeyboardRequest &request);
137
147
155 void FlashKey(const char *pszKey);
156
166
176
187 void SetShiftMode(int nMode);
188
195 void Backspace();
196
203 void MoveLeft();
204
211 void MoveRight();
212
219 void TypeTab();
220
227 void TypeSpace();
228
235 void Delete();
236
244 void Commit();
245
254 void TypeFunctionKey(const char *pszKey);
255
264 void TypeChar(char ch);
265
276
277private:
278 KeyboardRequest mRequest;
279 int mShiftMode;
280 int mReplaceText;
281 UITextEntry *mEntry;
282 UIButton *mCapsButton;
283 UIButton *mLeftShiftButton;
284 UIButton *mRightShiftButton;
285 RndMatAnim *mSelectAnim;
286};
Reference-counted array of script data nodes.
Definition dataarray.h:20
FreqPanel(DataArray *pData, const char *pszDir)
Construct a panel from its script description.
Message the controller poll sends when a button is pressed or released.
Definition joypadinputmsg.h:23
Message the keyboard poll sends when a key of a USB keyboard is pressed.
Definition keyboardkeymsg.h:23
void Exit(bool bForce, float fTime) override
Start the exit and forget the keys and the animation.
void SetRequest(const KeyboardRequest &request)
Take the request of the screen that opens the keyboard.
~KeyboardPanel() override
Destroy the panel.
void Commit()
Hand the text to the user and return to the screen that opened the keyboard, unless the user moved to...
void TypeChar(char ch)
Type a character, replacing the starting text with the first one typed, and end a shift of one key.
void TypeSpace()
Type a space.
bool HandleJoypad(JoypadInputMsg *pMsg)
Act on a button of the controller that types.
void MoveLeft()
Move the caret left.
void SetFocus(UIComponent *pComponent, int nButton) override
Play the KEYBOARD_LEFT_UP cue and move the focus to a key.
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 reque...
void SetShiftMode(int nMode)
Change the shift state, restyling the shift keys and relabelling every 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 d...
static UIPanel * New(DataArray *pData, const char *pszDir)
Create a panel from its script description.
Definition keyboardpanel.h:75
bool HandleKey(KeyboardKeyMsg *pMsg)
Act on a key of a keyboard attached to the console.
ShiftMode
The shift states of the keys, the values of mShiftMode.
Definition keyboardpanel.h:39
@ kShiftNone
Definition keyboardpanel.h:40
@ kShiftOnce
Definition keyboardpanel.h:41
@ kShiftCaps
Definition keyboardpanel.h:42
void Backspace()
Erase the character before the caret.
bool HandleSelectStart(UIComponentSelectStartMsg *pMsg)
Act on the key about to be chosen.
KeyboardPanel(DataArray *pData, const char *pszDir)
Construct the panel from its script description.
void MoveRight()
Move the caret right.
void FlashKey(const char *pszKey)
Flash the key a controller button stands for.
void Enter(bool bForce, float fTime) override
Start the entry and prepare the text entry from the request.
void Poll(float fTime) override
Advance the panel and the animation of the selected key.
void TypeTab()
Type a tab.
bool DispatchPriv(Message *pMsg) override
Route keys about to be chosen, controller buttons, keys of an attached keyboard, and refused characte...
void Delete()
Erase the character after the caret.
What a screen requests of the front-end keyboard: who receives the text, the text to start from,...
Definition keyboardrequest.h:15
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Animation of a material's colours, alpha, and texture stages by keys.
Definition rndmatanim.h:19
Component the player chooses with the cross button.
Definition uibutton.h:24
Message a component sends when the player presses the button that chooses it.
Definition uicomponentselectstartmsg.h:27
One control of a front-end panel, such as a label, a button, or a list.
Definition uicomponent.h:21
UIPanel(DataArray *pData, const char *pszDir)
Construct a hidden panel from its script description.
Message a text entry sends when it refuses a typed character.
Definition uitextentryinvalidmsg.h:25
Field the player types text into from a USB keyboard or the on-screen keyboard.
Definition uitextentry.h:27