libnx  v4.2.0
swkbd.h
Go to the documentation of this file.
1 /**
2  * @file swkbd.h
3  * @brief Wrapper for using the swkbd (software keyboard) LibraryApplet.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../services/applet.h"
10 
11 /// Output result returned by \ref SwkbdTextCheckCb.
12 typedef enum {
13  SwkbdTextCheckResult_OK = 0, ///< Success, valid string.
14  SwkbdTextCheckResult_Bad = 1, ///< Failure, invalid string. Error message is displayed in a message-box, pressing OK will return to swkbd again.
15  SwkbdTextCheckResult_Prompt = 2, ///< Failure, invalid string. Error message is displayed in a message-box, pressing Cancel will return to swkbd again, while pressing OK will continue as if the text was valid.
16  SwkbdTextCheckResult_Silent = 3, ///< Failure, invalid string. With value 3 and above, swkbd will silently not accept the string, without displaying any error.
18 
19 /// Type of keyboard.
20 typedef enum {
21  SwkbdType_Normal = 0, ///< Normal keyboard.
22  SwkbdType_NumPad = 1, ///< Number pad. The buttons at the bottom left/right are only available when they're set by \ref swkbdConfigSetLeftOptionalSymbolKey / \ref swkbdConfigSetRightOptionalSymbolKey.
23  SwkbdType_QWERTY = 2, ///< QWERTY (and variants) keyboard only.
24  SwkbdType_Unknown3 = 3, ///< The same as SwkbdType_Normal keyboard.
25  SwkbdType_Latin = 4, ///< All Latin like languages keyboard only (without CJK keyboard).
26  SwkbdType_ZhHans = 5, ///< Chinese Simplified keyboard only.
27  SwkbdType_ZhHant = 6, ///< Chinese Traditional keyboard only.
28  SwkbdType_Korean = 7, ///< Korean keyboard only.
29  SwkbdType_All = 8, ///< All language keyboards.
30  SwkbdType_Unknown9 = 9, ///< Unknown
31 } SwkbdType;
32 
33 /// Bitmask for SwkbdArgCommon::keySetDisableBitmask. This disables keys on the keyboard when the corresponding bit(s) are set.
34 enum {
35  SwkbdKeyDisableBitmask_Space = BIT(1), ///< Disable space-bar.
36  SwkbdKeyDisableBitmask_At = BIT(2), ///< Disable '@'.
37  SwkbdKeyDisableBitmask_Percent = BIT(3), ///< Disable '%'.
38  SwkbdKeyDisableBitmask_ForwardSlash = BIT(4), ///< Disable '/'.
39  SwkbdKeyDisableBitmask_Backslash = BIT(5), ///< Disable '\'.
40  SwkbdKeyDisableBitmask_Numbers = BIT(6), ///< Disable numbers.
41  SwkbdKeyDisableBitmask_DownloadCode = BIT(7), ///< Used for \ref swkbdConfigMakePresetDownloadCode.
42  SwkbdKeyDisableBitmask_UserName = BIT(8), ///< Used for \ref swkbdConfigMakePresetUserName. Disables '@', '%', and '\'.
43 };
44 
45 /// Value for SwkbdArgCommon::textDrawType. Only applies when stringLenMax is 1..32, otherwise swkbd will only use SwkbdTextDrawType_Box.
46 typedef enum {
47  SwkbdTextDrawType_Line = 0, ///< The text will be displayed on a line. Also enables displaying the Header and Sub text.
48  SwkbdTextDrawType_Box = 1, ///< The text will be displayed in a box.
49  SwkbdTextDrawType_DownloadCode = 2, ///< Used by \ref swkbdConfigMakePresetDownloadCode on [5.0.0+]. Enables using \ref SwkbdArgV7 unk_x3e0.
51 
52 /// SwkbdInline Interactive input storage request ID.
53 typedef enum {
54  SwkbdRequestCommand_Finalize = 0x4,
55  SwkbdRequestCommand_SetUserWordInfo = 0x6,
56  SwkbdRequestCommand_SetCustomizeDic = 0x7,
57  SwkbdRequestCommand_Calc = 0xA,
58  SwkbdRequestCommand_SetCustomizedDictionaries = 0xB,
59  SwkbdRequestCommand_UnsetCustomizedDictionaries = 0xC,
60  SwkbdRequestCommand_SetChangedStringV2Flag = 0xD,
61  SwkbdRequestCommand_SetMovedCursorV2Flag = 0xE,
63 
64 /// SwkbdInline Interactive output storage reply ID.
65 typedef enum {
66  SwkbdReplyType_FinishedInitialize = 0x0,
67  SwkbdReplyType_ChangedString = 0x2,
68  SwkbdReplyType_MovedCursor = 0x3,
69  SwkbdReplyType_MovedTab = 0x4,
70  SwkbdReplyType_DecidedEnter = 0x5,
71  SwkbdReplyType_DecidedCancel = 0x6,
72  SwkbdReplyType_ChangedStringUtf8 = 0x7,
73  SwkbdReplyType_MovedCursorUtf8 = 0x8,
74  SwkbdReplyType_DecidedEnterUtf8 = 0x9,
75  SwkbdReplyType_UnsetCustomizeDic = 0xA,
76  SwkbdReplyType_ReleasedUserWordInfo = 0xB,
77  SwkbdReplyType_UnsetCustomizedDictionaries = 0xC,
78  SwkbdReplyType_ChangedStringV2 = 0xD,
79  SwkbdReplyType_MovedCursorV2 = 0xE,
80  SwkbdReplyType_ChangedStringUtf8V2 = 0xF,
81  SwkbdReplyType_MovedCursorUtf8V2 = 0x10,
83 
84 /// SwkbdInline State
85 typedef enum {
86  SwkbdState_Inactive = 0x0, ///< Default state from \ref swkbdInlineCreate, before a state is set by \ref swkbdInlineUpdate when a reply is received. Also indicates that the applet is no longer running.
87  SwkbdState_Initialized = 0x1, ///< Applet is initialized but hidden.
88  SwkbdState_Appearing = 0x2, ///< Applet is appearing.
89  SwkbdState_Shown = 0x3, ///< Applet is fully shown and ready to accept text input.
90  SwkbdState_Disappearing = 0x4, ///< The user pressed the ok or cancel button, causing the applet to disappear.
91  SwkbdState_Unknown5 = 0x5,
92  SwkbdState_Unknown6 = 0x6,
93 } SwkbdState;
94 
95 /// Value for \ref SwkbdInitializeArg mode. Controls the LibAppletMode when launching the applet.
96 typedef enum {
97  SwkbdInlineMode_UserDisplay = 0, ///< LibAppletMode_BackgroundIndirect. This is the default. The user-process must handle displaying the swkbd gfx on the screen, by loading the image with \ref swkbdInlineGetImage.
98  SwkbdInlineMode_AppletDisplay = 1, ///< LibAppletMode_Background. The applet will handle displaying gfx on the screen.
100 
101 /// TextCheck callback set by \ref swkbdConfigSetTextCheckCallback, for validating the input string when the swkbd ok-button is pressed. This buffer contains an UTF-8 string. This callback should validate the input string, then return a \ref SwkbdTextCheckResult indicating success/failure. On failure, this function must write an error message to the tmp_string buffer, which will then be displayed by swkbd.
102 typedef SwkbdTextCheckResult (*SwkbdTextCheckCb)(char* tmp_string, size_t tmp_string_size);
103 
104 /// User dictionary word.
105 typedef struct {
106  u8 unk_x0[0x64];
107 } SwkbdDictWord;
108 
109 /// Input data for SwkbdInline request SetCustomizeDic.
110 typedef struct {
111  u8 unk_x0[0x70];
113 
114 typedef struct {
115  void* buffer; ///< 0x1000-byte aligned buffer.
116  u32 buffer_size; ///< 0x1000-byte aligned buffer size.
117  u64 entries[0x18];
118  u16 total_entries;
120 
121 /// Base swkbd arg struct.
122 typedef struct {
123  SwkbdType type; ///< See \ref SwkbdType.
124  u16 okButtonText[18/2];
125  u16 leftButtonText;
126  u16 rightButtonText;
127  u8 dicFlag; ///< Enables dictionary usage when non-zero (including the system dictionary).
128  u8 pad_x1b;
129  u32 keySetDisableBitmask; ///< See SwkbdKeyDisableBitmask_*.
130  u32 initialCursorPos; ///< Initial cursor position in the string: 0 = start, 1 = end.
131  u16 headerText[130/2];
132  u16 subText[258/2];
133  u16 guideText[514/2];
134  u16 pad_x3aa;
135  u32 stringLenMax; ///< When non-zero, specifies the max string length. When the input is too long, swkbd will stop accepting more input until text is deleted via the B button (Backspace). See also \ref SwkbdTextDrawType.
136  u32 stringLenMin; ///< When non-zero, specifies the min string length. When the input is too short, swkbd will display an icon and disable the ok-button.
137  u32 passwordFlag; ///< Use password: 0 = disable, 1 = enable.
138  SwkbdTextDrawType textDrawType; ///< See \ref SwkbdTextDrawType.
139  u16 returnButtonFlag; ///< Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
140  u8 blurBackground; ///< When enabled with value 1, the background is blurred.
141  u8 pad_x3bf;
142  u32 initialStringOffset;
143  u32 initialStringSize;
144  u32 userDicOffset;
145  s32 userDicEntries;
146  u8 textCheckFlag;
148 
149 typedef struct {
150  SwkbdArgCommon arg;
151  u8 pad_x3d1[7];
152  SwkbdTextCheckCb textCheckCb; ///< This really doesn't belong in a struct sent to another process, but official sw does this.
153 } SwkbdArgV0;
154 
155 /// Arg struct for version 0x30007+.
156 typedef struct {
157  SwkbdArgV0 arg;
158  u32 textGrouping[8]; ///< When set and enabled via \ref SwkbdTextDrawType, controls displayed text grouping (inserts spaces, without affecting output string).
159 } SwkbdArgV7;
160 
161 /// Arg struct for version 0x6000B+.
162 typedef struct {
163  SwkbdArgCommon arg;
164  u8 pad_x3d1[3];
165  u32 textGrouping[8]; ///< Same as SwkbdArgV7::textGrouping.
166  u64 entries[0x18]; ///< This is SwkbdCustomizedDictionarySet::entries.
167  u8 total_entries; ///< This is SwkbdCustomizedDictionarySet::total_entries.
168  u8 unkFlag; ///< [8.0.0+]
169  u8 pad_x4b6[0xD];
170  u8 trigger; ///< [8.0.0+]
171  u8 pad_x4c4[4];
172 } SwkbdArgVB;
173 
174 typedef struct {
175  SwkbdArgV7 arg;
176 
177  u8* workbuf;
178  size_t workbuf_size;
179  s32 max_dictwords;
180 
181  SwkbdCustomizedDictionarySet customizedDictionarySet;
182 
183  u8 unkFlag;
184  u8 trigger;
185 
186  u32 version;
187 } SwkbdConfig;
188 
189 /// Rect
190 typedef struct {
191  s16 x; ///< X
192  s16 y; ///< Y
193  s16 width; ///< Width
194  s16 height; ///< Height
195 } SwkbdRect;
196 
197 /// InitializeArg for SwkbdInline.
198 typedef struct {
199  u32 unk_x0;
200  u8 mode; ///< See \ref SwkbdInlineMode. (u8 bool)
201  u8 unk_x5; ///< Only set on [5.0.0+].
202  u8 pad[2];
204 
205 typedef struct {
206  SwkbdType type; ///< See \ref SwkbdType.
207  u16 okButtonText[9];
208  u16 leftButtonText;
209  u16 rightButtonText;
210  u8 dicFlag; ///< Enables dictionary usage when non-zero (including the system dictionary).
211  u8 unk_x1b;
212  u32 keySetDisableBitmask; ///< See SwkbdKeyDisableBitmask_*.
213  s32 stringLenMax; ///< When non-negative and non-zero, specifies the max string length. When the input is too long, swkbd will stop accepting more input until text is deleted via the B button (Backspace).
214  s32 stringLenMin; ///< When non-negative and non-zero, specifies the min string length. When the input is too short, swkbd will display an icon and disable the ok-button.
215  u8 returnButtonFlag; ///< Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
216  u8 unk_x29; ///< [10.0.0+] When value 1-2, \ref swkbdInlineAppear / \ref swkbdInlineAppearEx will set keytopAsFloating=0 and footerScalable=1.
217  u8 unk_x2a;
218  u8 unk_x2b;
219  u32 flags; ///< Bitmask 0x4: unknown.
220  u8 unk_x30;
221  u8 unk_x31[0x17];
223 
224 typedef struct {
225  u32 unk_x0;
226  u16 size; ///< Size of this struct.
227  u8 unk_x6;
228  u8 unk_x7;
229  u64 flags;
230  SwkbdInitializeArg initArg; ///< Flags bitmask 0x1.
231  float volume; ///< Flags bitmask 0x2.
232  s32 cursorPos; ///< Flags bitmask 0x10.
233  SwkbdAppearArg appearArg;
234  u16 inputText[0x3f4/2]; ///< Flags bitmask 0x8.
235  u8 utf8Mode; ///< Flags bitmask 0x20.
236  u8 unk_x45d;
237  u8 enableBackspace; ///< Flags bitmask 0x8000. Only available with [5.0.0+].
238  u8 unk_x45f[3];
239  u8 keytopAsFloating; ///< Flags bitmask 0x200.
240  u8 footerScalable; ///< Flags bitmask 0x100.
241  u8 alphaEnabledInInputMode; ///< Flags bitmask 0x100.
242  u8 inputModeFadeType; ///< Flags bitmask 0x100.
243  u8 disableTouch; ///< Flags bitmask 0x200.
244  u8 disableHardwareKeyboard; ///< Flags bitmask 0x800.
245  u8 unk_x468[5];
246  u8 unk_x46d;
247  u8 unk_x46e;
248  u8 unk_x46f;
249  float keytopScaleX; ///< Flags bitmask 0x200.
250  float keytopScaleY; ///< Flags bitmask 0x200.
251  float keytopTranslateX; ///< Flags bitmask 0x200.
252  float keytopTranslateY; ///< Flags bitmask 0x200.
253  float keytopBgAlpha; ///< Flags bitmask 0x100.
254  float footerBgAlpha; ///< Flags bitmask 0x100.
255  float balloonScale; ///< Flags bitmask 0x200.
256  float unk_x48c;
257  u8 unk_x490[0xc];
258  u8 seGroup; ///< Flags bitmask: enable=0x2000, disable=0x4000. Only available with [5.0.0+].
259  u8 triggerFlag; ///< [6.0.0+] Enables using the trigger field when set.
260  u8 trigger; ///< [6.0.0+] Trigger
261  u8 pad_x49f;
263 
264 /// Struct data for SwkbdInline Interactive reply storage ChangedString*, at the end following the string.
265 typedef struct {
266  u32 stringLen; ///< String length in characters, without NUL-terminator.
267  s32 dicStartCursorPos; ///< Starting cursorPos for the current dictionary word in the current text string. -1 for none.
268  s32 dicEndCursorPos; ///< Ending cursorPos for the current dictionary word in the current text string. -1 for none.
269  s32 cursorPos; ///< Cursor position.
271 
272 /// Struct data for SwkbdInline Interactive reply storage MovedCursor*, at the end following the string.
273 typedef struct {
274  u32 stringLen; ///< String length in characters, without NUL-terminator.
275  s32 cursorPos; ///< Cursor position.
277 
278 /// Struct data for SwkbdInline Interactive reply storage MovedTab*, at the end following the string.
279 typedef struct {
280  u32 unk_x0;
281  u32 unk_x4;
283 
284 /// Struct data for SwkbdInline Interactive reply storage DecidedEnter*, at the end following the string.
285 typedef struct {
286  u32 stringLen; ///< String length in characters, without NUL-terminator.
288 
289 /// This callback is used by \ref swkbdInlineUpdate when handling ChangedString* replies (text changed by the user or by \ref swkbdInlineSetInputText).
290 /// str is the UTF-8 string for the current text.
291 typedef void (*SwkbdChangedStringCb)(const char* str, SwkbdChangedStringArg* arg);
292 
293 /// This callback is used by \ref swkbdInlineUpdate when handling ChangedString*V2 replies (text changed by the user or by \ref swkbdInlineSetInputText).
294 /// str is the UTF-8 string for the current text.
295 typedef void (*SwkbdChangedStringV2Cb)(const char* str, SwkbdChangedStringArg* arg, bool flag);
296 
297 /// This callback is used by \ref swkbdInlineUpdate when handling MovedCursor* replies.
298 /// str is the UTF-8 string for the current text.
299 typedef void (*SwkbdMovedCursorCb)(const char* str, SwkbdMovedCursorArg* arg);
300 
301 /// This callback is used by \ref swkbdInlineUpdate when handling MovedCursor*V2 replies.
302 /// str is the UTF-8 string for the current text.
303 typedef void (*SwkbdMovedCursorV2Cb)(const char* str, SwkbdMovedCursorArg* arg, bool flag);
304 
305 /// This callback is used by \ref swkbdInlineUpdate when handling MovedTab* replies.
306 /// str is the UTF-8 string for the current text.
307 typedef void (*SwkbdMovedTabCb)(const char* str, SwkbdMovedTabArg* arg);
308 
309 /// This callback is used by \ref swkbdInlineUpdate when handling DecidedEnter* replies (when the final text was submitted via the button).
310 /// str is the UTF-8 string for the current text.
311 typedef void (*SwkbdDecidedEnterCb)(const char* str, SwkbdDecidedEnterArg* arg);
312 
313 /// InlineKeyboard
314 typedef struct {
315  u32 version;
316  AppletHolder holder;
317  SwkbdInlineCalcArg calcArg;
318  bool directionalButtonAssignFlag;
319  SwkbdState state;
320 
321  bool dicCustomInitialized;
322  bool customizedDictionariesInitialized;
323  AppletStorage dicStorage;
324 
325  bool wordInfoInitialized;
326  AppletStorage wordInfoStorage;
327 
328  u8* interactive_tmpbuf;
329  size_t interactive_tmpbuf_size;
330  char* interactive_strbuf;
331  size_t interactive_strbuf_size;
332 
333  VoidFn finishedInitializeCb;
334  VoidFn decidedCancelCb;
335  SwkbdChangedStringCb changedStringCb;
336  SwkbdChangedStringV2Cb changedStringV2Cb;
337  SwkbdMovedCursorCb movedCursorCb;
338  SwkbdMovedCursorV2Cb movedCursorV2Cb;
339  SwkbdMovedTabCb movedTabCb;
340  SwkbdDecidedEnterCb decidedEnterCb;
341  VoidFn releasedUserWordInfoCb;
342 } SwkbdInline;
343 
344 /**
345  * @brief Creates a SwkbdConfig struct.
346  * @param c SwkbdConfig struct.
347  * @param max_dictwords Max \ref SwkbdDictWord entries, 0 for none.
348  */
349 Result swkbdCreate(SwkbdConfig* c, s32 max_dictwords);
350 
351 /**
352  * @brief Closes a SwkbdConfig struct.
353  * @param c SwkbdConfig struct.
354  */
355 void swkbdClose(SwkbdConfig* c);
356 
357 /**
358  * @brief Clears the args in the SwkbdConfig struct and initializes it with the Default Preset.
359  * @note Do not use this before \ref swkbdCreate.
360  * @note Uses the following: swkbdConfigSetType() with \ref SwkbdType_QWERTY, swkbdConfigSetInitialCursorPos() with value 1, swkbdConfigSetReturnButtonFlag() with value 1, and swkbdConfigSetBlurBackground() with value 1. Pre-5.0.0: swkbdConfigSetTextDrawType() with \ref SwkbdTextDrawType_Box.
361  * @param c SwkbdConfig struct.
362  */
364 
365 /**
366  * @brief Clears the args in the SwkbdConfig struct and initializes it with the Password Preset.
367  * @note Do not use this before \ref swkbdCreate.
368  * @note Uses the following: swkbdConfigSetType() with \ref SwkbdType_QWERTY, swkbdConfigSetInitialCursorPos() with value 1, swkbdConfigSetPasswordFlag() with value 1, and swkbdConfigSetBlurBackground() with value 1.
369  * @param c SwkbdConfig struct.
370  */
372 
373 /**
374  * @brief Clears the args in the SwkbdConfig struct and initializes it with the UserName Preset.
375  * @note Do not use this before \ref swkbdCreate.
376  * @note Uses the following: swkbdConfigSetType() with \ref SwkbdType_Normal, swkbdConfigSetKeySetDisableBitmask() with SwkbdKeyDisableBitmask_UserName, swkbdConfigSetInitialCursorPos() with value 1, and swkbdConfigSetBlurBackground() with value 1.
377  * @param c SwkbdConfig struct.
378  */
380 
381 /**
382  * @brief Clears the args in the SwkbdConfig struct and initializes it with the DownloadCode Preset.
383  * @note Do not use this before \ref swkbdCreate.
384  * @note Uses the following: swkbdConfigSetType() with \ref SwkbdType_Normal (\ref SwkbdType_QWERTY on [5.0.0+]), swkbdConfigSetKeySetDisableBitmask() with SwkbdKeyDisableBitmask_DownloadCode, swkbdConfigSetInitialCursorPos() with value 1, and swkbdConfigSetBlurBackground() with value 1. [5.0.0+]: swkbdConfigSetStringLenMax() with value 16, swkbdConfigSetStringLenMin() with value 1, and swkbdConfigSetTextDrawType() with SwkbdTextDrawType_DownloadCode. Uses swkbdConfigSetTextGrouping() for [0-2] with: 0x3, 0x7, and 0xb.
385  * @param c SwkbdConfig struct.
386  */
388 
389 /**
390  * @brief Sets the Ok button text. The default is "".
391  * @param c SwkbdConfig struct.
392  * @param str UTF-8 input string.
393  */
394 void swkbdConfigSetOkButtonText(SwkbdConfig* c, const char* str);
395 
396 /**
397  * @brief Sets the LeftOptionalSymbolKey, for \ref SwkbdType_NumPad. The default is "".
398  * @param c SwkbdConfig struct.
399  * @param str UTF-8 input string.
400  */
401 void swkbdConfigSetLeftOptionalSymbolKey(SwkbdConfig* c, const char* str);
402 
403 /**
404  * @brief Sets the RightOptionalSymbolKey, for \ref SwkbdType_NumPad. The default is "".
405  * @param c SwkbdConfig struct.
406  * @param str UTF-8 input string.
407  */
408 void swkbdConfigSetRightOptionalSymbolKey(SwkbdConfig* c, const char* str);
409 
410 /**
411  * @brief Sets the Header text. The default is "".
412  * @note See SwkbdArgCommon::stringLenMax.
413  * @param c SwkbdConfig struct.
414  * @param str UTF-8 input string.
415  */
416 void swkbdConfigSetHeaderText(SwkbdConfig* c, const char* str);
417 
418 /**
419  * @brief Sets the Sub text. The default is "".
420  * @note See SwkbdArgCommon::stringLenMax.
421  * @param c SwkbdConfig struct.
422  * @param str UTF-8 input string.
423  */
424 void swkbdConfigSetSubText(SwkbdConfig* c, const char* str);
425 
426 /**
427  * @brief Sets the Guide text. The default is "".
428  * @note The swkbd applet only displays this when the current displayed cursor position is 0.
429  * @param c SwkbdConfig struct.
430  * @param str UTF-8 input string.
431  */
432 void swkbdConfigSetGuideText(SwkbdConfig* c, const char* str);
433 
434 /**
435  * @brief Sets the Initial text. The default is "".
436  * @param c SwkbdConfig struct.
437  * @param str UTF-8 input string.
438  */
439 void swkbdConfigSetInitialText(SwkbdConfig* c, const char* str);
440 
441 /**
442  * @brief Sets the user dictionary.
443  * @param c SwkbdConfig struct.
444  * @param input Input data.
445  * @param entries Total entries in the buffer.
446  */
447 void swkbdConfigSetDictionary(SwkbdConfig* c, const SwkbdDictWord *input, s32 entries);
448 
449 /**
450  * @brief Sets the CustomizedDictionaries.
451  * @note Only available on [6.0.0+].
452  * @param c SwkbdConfig struct.
453  * @param dic Input \ref SwkbdCustomizedDictionarySet
454  */
456 
457 /**
458  * @brief Sets the TextCheck callback.
459  * @param c SwkbdConfig struct.
460  * @param cb \ref SwkbdTextCheckCb callback.
461  */
463 
464 /**
465  * @brief Sets SwkbdArgCommon::SwkbdType.
466  * @param c SwkbdConfig struct.
467  * @param type \ref SwkbdType
468  */
469 static inline void swkbdConfigSetType(SwkbdConfig* c, SwkbdType type) {
470  c->arg.arg.arg.type = type;
471 }
472 
473 /**
474  * @brief Sets SwkbdArgCommon::dicFlag.
475  * @param c SwkbdConfig struct.
476  * @param flag Flag
477  */
478 static inline void swkbdConfigSetDicFlag(SwkbdConfig* c, u8 flag) {
479  c->arg.arg.arg.dicFlag = flag;
480 }
481 
482 /**
483  * @brief Sets SwkbdArgCommon::keySetDisableBitmask.
484  * @param c SwkbdConfig struct.
485  * @param keySetDisableBitmask keySetDisableBitmask
486  */
487 static inline void swkbdConfigSetKeySetDisableBitmask(SwkbdConfig* c, u32 keySetDisableBitmask) {
488  c->arg.arg.arg.keySetDisableBitmask = keySetDisableBitmask;
489 }
490 
491 /**
492  * @brief Sets SwkbdArgCommon::initialCursorPos.
493  * @param c SwkbdConfig struct.
494  * @param initialCursorPos initialCursorPos
495  */
496 static inline void swkbdConfigSetInitialCursorPos(SwkbdConfig* c, u32 initialCursorPos) {
497  c->arg.arg.arg.initialCursorPos = initialCursorPos;
498 }
499 
500 /**
501  * @brief Sets SwkbdArgCommon::stringLenMax.
502  * @param c SwkbdConfig struct.
503  * @param stringLenMax stringLenMax
504  */
505 static inline void swkbdConfigSetStringLenMax(SwkbdConfig* c, u32 stringLenMax) {
506  c->arg.arg.arg.stringLenMax = stringLenMax;
507 }
508 
509 /**
510  * @brief Sets SwkbdArgCommon::stringLenMin.
511  * @param c SwkbdConfig struct.
512  * @param stringLenMin stringLenMin
513  */
514 static inline void swkbdConfigSetStringLenMin(SwkbdConfig* c, u32 stringLenMin) {
515  c->arg.arg.arg.stringLenMin = stringLenMin;
516 }
517 
518 /**
519  * @brief Sets SwkbdArgCommon::passwordFlag.
520  * @param c SwkbdConfig struct.
521  * @param flag Flag
522  */
523 static inline void swkbdConfigSetPasswordFlag(SwkbdConfig* c, u32 flag) {
524  c->arg.arg.arg.passwordFlag = flag;
525 }
526 
527 /**
528  * @brief Sets SwkbdArgCommon::textDrawType.
529  * @param c SwkbdConfig struct.
530  * @param textDrawType \ref SwkbdTextDrawType
531  */
532 static inline void swkbdConfigSetTextDrawType(SwkbdConfig* c, SwkbdTextDrawType textDrawType) {
533  c->arg.arg.arg.textDrawType = textDrawType;
534 }
535 
536 /**
537  * @brief Sets SwkbdArgCommon::returnButtonFlag.
538  * @param c SwkbdConfig struct.
539  * @param flag Flag
540  */
541 static inline void swkbdConfigSetReturnButtonFlag(SwkbdConfig* c, u16 flag) {
542  c->arg.arg.arg.returnButtonFlag = flag;
543 }
544 
545 /**
546  * @brief Sets SwkbdArgCommon::blurBackground.
547  * @param c SwkbdConfig struct.
548  * @param blurBackground blurBackground
549  */
550 static inline void swkbdConfigSetBlurBackground(SwkbdConfig* c, u8 blurBackground) {
551  c->arg.arg.arg.blurBackground = blurBackground;
552 }
553 
554 /**
555  * @brief Sets SwkbdArgV7::textGrouping.
556  * @param index Array index.
557  * @param value Value to write.
558  */
559 static inline void swkbdConfigSetTextGrouping(SwkbdConfig* c, u32 index, u32 value) {
560  if (index >= sizeof(c->arg.textGrouping)/sizeof(u32)) return;
561  c->arg.textGrouping[index] = value;
562 }
563 
564 /**
565  * @brief Sets SwkbdConfig::unkFlag, default is 0. Copied to SwkbdArgVB::unkFlag with [8.0.0+].
566  * @param flag Flag
567  */
568 static inline void swkbdConfigSetUnkFlag(SwkbdConfig* c, u8 flag) {
569  c->unkFlag = flag;
570 }
571 
572 /**
573  * @brief Sets SwkbdConfig::trigger, default is 0. Copied to SwkbdArgVB::trigger with [8.0.0+].
574  * @param trigger Trigger
575  */
576 static inline void swkbdConfigSetTrigger(SwkbdConfig* c, u8 trigger) {
577  c->trigger = trigger;
578 }
579 
580 /**
581  * @brief Launch swkbd with the specified config. This will return once swkbd is finished running.
582  * @note The string buffer is also used for the buffer passed to the \ref SwkbdTextCheckCb, when it's set. Hence, in that case this buffer should be large enough to handle TextCheck string input/output. The size passed to the callback is the same size passed here, -1.
583  * @param c SwkbdConfig struct.
584  * @param out_string UTF-8 Output string buffer.
585  * @param out_string_size UTF-8 Output string buffer size, including NUL-terminator.
586  */
587 Result swkbdShow(SwkbdConfig* c, char* out_string, size_t out_string_size);
588 
589 /**
590  * @brief Creates a SwkbdInline object. Only available on [2.0.0+].
591  * @note This is essentially an asynchronous version of the regular swkbd.
592  * @note This calls \ref swkbdInlineSetUtf8Mode internally with flag=true.
593  * @param s SwkbdInline object.
594  */
596 
597 /**
598  * @brief Closes a SwkbdInline object. If the applet is running, this will tell the applet to exit, then wait for the applet to exit + applet exit handling.
599  * @param s SwkbdInline object.
600  */
602 
603 /**
604  * @brief Does setup for \ref SwkbdInitializeArg and launches the applet with the SwkbdInline object.
605  * @note The initArg is cleared, and on [5.0.0+] unk_x5 is set to 1.
606  * @param s SwkbdInline object.
607  */
609 
610 /**
611  * @brief Same as \ref swkbdInlineLaunch, except mode and unk_x5 for \ref SwkbdInitializeArg are set to the input params.
612  * @param s SwkbdInline object.
613  * @param mode Value for SwkbdInitializeArg::mode.
614  * @param unk_x5 Value for SwkbdInitializeArg::unk_x5.
615  */
617 
618 /**
619  * @brief GetWindowSize
620  * @param[out] width Output width.
621  * @param[out] height Output height.
622  */
624  *width = 1280;
625  *height = 720;
626 }
627 
628 /**
629  * @brief GetImageMemoryRequirement
630  * @note Wrapper for \ref viGetIndirectLayerImageRequiredMemoryInfo.
631  * @param[out] out_size Output size.
632  * @param[out] out_alignment Output alignment.
633  */
634 Result swkbdInlineGetImageMemoryRequirement(u64 *out_size, u64 *out_alignment);
635 
636 /**
637  * @brief GetImage
638  * @note Only available with ::SwkbdInlineMode_UserDisplay.
639  * @note For width/height, see \ref swkbdInlineGetWindowSize.
640  * @param s SwkbdInline object.
641  * @param[out] buffer Output RGBA8 image buffer, this must use the alignment from \ref swkbdInlineGetImageMemoryRequirement.
642  * @param[in] size Output buffer size, this must match the size from \ref swkbdInlineGetImageMemoryRequirement.
643  * @param[out] data_available Whether data is available.
644  */
645 Result swkbdInlineGetImage(SwkbdInline* s, void* buffer, u64 size, bool *data_available);
646 
647 /**
648  * @brief Gets the image max height, relative to the bottom of the screen.
649  * @param s SwkbdInline object.
650  */
652 
653 /**
654  * @brief Gets the MiniaturizedHeight, relative to the bottom of the screen.
655  * @param s SwkbdInline object.
656  */
658 
659 /**
660  * @brief GetTouchRectangles. Returns number of valid Rects: 1 for only keytop, 2 for keytop/footer.
661  * @param s SwkbdInline object.
662  * @param[out] keytop \ref SwkbdRect for keytop. Optional, can be NULL.
663  * @param[out] footer \ref SwkbdRect for footer. Optional, can be NULL.
664  */
666 
667 /**
668  * @brief Gets whether the input x/y are within the output from \ref swkbdInlineGetTouchRectangles.
669  * @param s SwkbdInline object.
670  * @param[out] x X
671  * @param[out] y Y
672  */
674 
675 /**
676  * @brief Handles updating SwkbdInline state, this should be called periodically.
677  * @note Handles applet exit if needed, and also sends the \ref SwkbdInlineCalcArg to the applet if needed. Hence, this should be called at some point after writing to \ref SwkbdInlineCalcArg.
678  * @note Handles applet Interactive storage output when needed.
679  * @param s SwkbdInline object.
680  * @param out_state Optional output \ref SwkbdState.
681  */
683 
684 /**
685  * @brief Sets the FinishedInitialize callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
686  * @param s SwkbdInline object.
687  * @param cb Callback
688  */
690 
691 /**
692  * @brief Sets the DecidedCancel callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
693  * @param s SwkbdInline object.
694  * @param cb Callback
695  */
697 
698 /**
699  * @brief Sets the ChangedString callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
700  * @note This clears the callback set by \ref swkbdInlineSetChangedStringV2Callback.
701  * @note This should be called after \ref swkbdInlineLaunch / \ref swkbdInlineLaunchForLibraryApplet.
702  * @param s SwkbdInline object.
703  * @param cb \ref SwkbdChangedStringCb Callback
704  */
706 
707 /**
708  * @brief Sets the ChangedStringV2 callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
709  * @note Only available with [8.0.0+].
710  * @note This must be called after \ref swkbdInlineLaunch / \ref swkbdInlineLaunchForLibraryApplet.
711  * @param s SwkbdInline object.
712  * @param cb \ref SwkbdChangedStringV2Cb Callback
713  */
715 
716 /**
717  * @brief Sets the MovedCursor callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
718  * @note This clears the callback set by \ref swkbdInlineSetMovedCursorV2Callback.
719  * @note This should be called after \ref swkbdInlineLaunch / \ref swkbdInlineLaunchForLibraryApplet.
720  * @param s SwkbdInline object.
721  * @param cb \ref SwkbdMovedCursorCb Callback
722  */
724 
725 /**
726  * @brief Sets the MovedCursorV2 callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
727  * @note Only available with [8.0.0+].
728  * @note This must be called after \ref swkbdInlineLaunch / \ref swkbdInlineLaunchForLibraryApplet.
729  * @param s SwkbdInline object.
730  * @param cb \ref SwkbdMovedCursorV2Cb Callback
731  */
733 
734 /**
735  * @brief Sets the MovedTab callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
736  * @param s SwkbdInline object.
737  * @param cb \ref SwkbdMovedTabCb Callback
738  */
740 
741 /**
742  * @brief Sets the DecidedEnter callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
743  * @param s SwkbdInline object.
744  * @param cb \ref SwkbdDecidedEnterCb Callback
745  */
747 
748 /**
749  * @brief Sets the ReleasedUserWordInfo callback, used by \ref swkbdInlineUpdate. The default is NULL for none.
750  * @param s SwkbdInline object.
751  * @param cb Callback
752  */
754 
755 /**
756  * @brief Appear the kbd and set \ref SwkbdAppearArg.
757  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
758  * @note Wrapper for \ref swkbdInlineAppearEx, with trigger=0.
759  * @param s SwkbdInline object.
760  * @param arg Input SwkbdAppearArg.
761  */
762 void swkbdInlineAppear(SwkbdInline* s, const SwkbdAppearArg* arg);
763 
764 /**
765  * @brief Appear the kbd and set \ref SwkbdAppearArg.
766  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
767  * @param s SwkbdInline object.
768  * @param arg Input SwkbdAppearArg.
769  * @param trigger Trigger, default is 0. Requires [6.0.0+], on eariler versions this will always use value 0 internally.
770  */
771 void swkbdInlineAppearEx(SwkbdInline* s, const SwkbdAppearArg* arg, u8 trigger);
772 
773 /**
774  * @brief Disappear the kbd.
775  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
776  * @param s SwkbdInline object.
777  */
779 
780 /**
781  * @brief Creates a \ref SwkbdAppearArg which can then be passed to \ref swkbdInlineAppear. arg is initialized with the defaults, with type being set to the input type.
782  * @param arg Output \ref SwkbdAppearArg.
783  * @param type \ref SwkbdType type
784  */
786 
787 /**
788  * @brief Sets okButtonText for the specified SwkbdAppearArg, which was previously initialized with \ref swkbdInlineMakeAppearArg.
789  * @param arg \ref SwkbdAppearArg
790  * @param str Input UTF-8 string for the Ok button text, this can be empty/NULL to use the default.
791  */
792 void swkbdInlineAppearArgSetOkButtonText(SwkbdAppearArg* arg, const char* str);
793 
794 /**
795  * @brief Sets the LeftButtonText, for \ref SwkbdType_NumPad. The default is "". Equivalent to \ref swkbdConfigSetLeftOptionalSymbolKey.
796  * @param arg \ref SwkbdAppearArg, previously initialized by \ref swkbdInlineMakeAppearArg.
797  * @param str UTF-8 input string.
798  */
799 void swkbdInlineAppearArgSetLeftButtonText(SwkbdAppearArg* arg, const char* str);
800 
801 /**
802  * @brief Sets the RightButtonText, for \ref SwkbdType_NumPad. The default is "". Equivalent to \ref swkbdConfigSetRightOptionalSymbolKey.
803  * @param arg \ref SwkbdAppearArg, previously initialized by \ref swkbdInlineMakeAppearArg.
804  * @param str UTF-8 input string.
805  */
806 void swkbdInlineAppearArgSetRightButtonText(SwkbdAppearArg* arg, const char* str);
807 
808 /**
809  * @brief Sets the stringLenMax for the specified SwkbdAppearArg, which was previously initialized with \ref swkbdInlineMakeAppearArg.
810  * @param arg \ref SwkbdAppearArg
811  * @param stringLenMax Max string length
812  */
813 static inline void swkbdInlineAppearArgSetStringLenMax(SwkbdAppearArg* arg, s32 stringLenMax) {
814  arg->stringLenMax = stringLenMax;
815 }
816 
817 /**
818  * @brief Sets the stringLenMin for the specified SwkbdAppearArg, which was previously initialized with \ref swkbdInlineMakeAppearArg.
819  * @param arg \ref SwkbdAppearArg
820  * @param stringLenMin Min string length
821  */
822 static inline void swkbdInlineAppearArgSetStringLenMin(SwkbdAppearArg* arg, s32 stringLenMin) {
823  arg->stringLenMin = stringLenMin;
824 }
825 
826 /**
827  * @brief Sets the audio volume.
828  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
829  * @param s SwkbdInline object.
830  * @param volume Volume
831  */
832 void swkbdInlineSetVolume(SwkbdInline* s, float volume);
833 
834 /**
835  * @brief Sets the current input text string. Overrides the entire user input string if the user previously entered any text.
836  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
837  * @note This will not affect the cursor position, see \ref swkbdInlineSetCursorPos for that.
838  * @param s SwkbdInline object.
839  * @param str UTF-8 input string.
840  */
841 void swkbdInlineSetInputText(SwkbdInline* s, const char* str);
842 
843 /**
844  * @brief Sets the cursor character position in the string.
845  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
846  * @param s SwkbdInline object.
847  * @param pos Position
848  */
850 
851 /**
852  * @brief Sets the UserWordInfo.
853  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized. Can't be used if this was already used previously.
854  * @note The specified buffer must not be used after this, until \ref swkbdInlineClose is used.
855  * @note \ref swkbdInlineUpdate must be called at some point afterwards.
856  * @note If input==NULL or total_entries==0, this will just call \ref swkbdInlineUnsetUserWordInfo internally.
857  * @param s SwkbdInline object.
858  * @param input Input data.
859  * @param entries Total entries in the buffer.
860  */
862 
863 /**
864  * @brief Request UnsetUserWordInfo.
865  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
866  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized.
867  * @param s SwkbdInline object.
868  */
870 
871 /**
872  * @brief Sets the utf8Mode.
873  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
874  * @note Automatically used internally by \ref swkbdInlineCreate.
875  * @param s SwkbdInline object.
876  * @param flag Flag
877  */
878 void swkbdInlineSetUtf8Mode(SwkbdInline* s, bool flag);
879 
880 /**
881  * @brief Sets the CustomizeDic.
882  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized. Can't be used if this or \ref swkbdInlineSetCustomizedDictionaries was already used previously.
883  * @note The specified buffer must not be used after this, until \ref swkbdInlineClose is used. However, it will also become available once \ref swkbdInlineUpdate handles SwkbdReplyType_UnsetCustomizeDic internally.
884  * @param s SwkbdInline object.
885  * @param buffer 0x1000-byte aligned buffer.
886  * @param size 0x1000-byte aligned buffer size.
887  * @param info Input \ref SwkbdCustomizeDicInfo
888  */
889 Result swkbdInlineSetCustomizeDic(SwkbdInline* s, void* buffer, size_t size, SwkbdCustomizeDicInfo *info);
890 
891 /**
892  * @brief Request UnsetCustomizeDic.
893  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
894  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized.
895  * @param s SwkbdInline object.
896  */
898 
899 /**
900  * @brief Sets the CustomizedDictionaries.
901  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized. Can't be used if this or \ref swkbdInlineSetCustomizeDic was already used previously.
902  * @note The specified buffer in dic must not be used after this, until \ref swkbdInlineClose is used. However, it will also become available once \ref swkbdInlineUpdate handles SwkbdReplyType_UnsetCustomizedDictionaries internally.
903  * @note Only available on [6.0.0+].
904  * @param s SwkbdInline object.
905  * @param dic Input \ref SwkbdCustomizedDictionarySet
906  */
908 
909 /**
910  * @brief Request UnsetCustomizedDictionaries.
911  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized.
912  * @note Only available on [6.0.0+].
913  * @param s SwkbdInline object.
914  */
916 
917 /**
918  * @brief Sets InputModeFadeType.
919  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
920  * @param s SwkbdInline object.
921  * @param type Type
922  */
924 
925 /**
926  * @brief Sets AlphaEnabledInInputMode.
927  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
928  * @param s SwkbdInline object.
929  * @param flag Flag
930  */
932 
933 /**
934  * @brief Sets KeytopBgAlpha.
935  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
936  * @param s SwkbdInline object.
937  * @param alpha Alpha, clamped to range 0.0f..1.0f.
938  */
939 void swkbdInlineSetKeytopBgAlpha(SwkbdInline* s, float alpha);
940 
941 /**
942  * @brief Sets FooterBgAlpha.
943  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
944  * @param s SwkbdInline object.
945  * @param alpha Alpha, clamped to range 0.0f..1.0f.
946  */
947 void swkbdInlineSetFooterBgAlpha(SwkbdInline* s, float alpha);
948 
949 /**
950  * @brief Sets gfx scaling. Configures KeytopScale* and BalloonScale based on the input value.
951  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
952  * @note The BalloonScale is not updated when \ref SwkbdState is above ::SwkbdState_Initialized.
953  * @param s SwkbdInline object.
954  * @param scale Scale
955  */
956 void swkbdInlineSetKeytopScale(SwkbdInline* s, float scale);
957 
958 /**
959  * @brief Sets gfx translation for the displayed swkbd image position.
960  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
961  * @param s SwkbdInline object.
962  * @param x X
963  * @param y Y
964  */
965 void swkbdInlineSetKeytopTranslate(SwkbdInline* s, float x, float y);
966 
967 /**
968  * @brief Sets KeytopAsFloating.
969  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
970  * @note Not avilable when \ref SwkbdState is above ::SwkbdState_Initialized.
971  * @param s SwkbdInline object.
972  * @param flag Flag
973  */
974 void swkbdInlineSetKeytopAsFloating(SwkbdInline* s, bool flag);
975 
976 /**
977  * @brief Sets FooterScalable.
978  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
979  * @param s SwkbdInline object.
980  * @param flag Flag
981  */
982 void swkbdInlineSetFooterScalable(SwkbdInline* s, bool flag);
983 
984 /**
985  * @brief Sets whether touch is enabled. The default is enabled.
986  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
987  * @param s SwkbdInline object.
988  * @param flag Flag
989  */
990 void swkbdInlineSetTouchFlag(SwkbdInline* s, bool flag);
991 
992 /**
993  * @brief Sets whether Hardware-keyboard is enabled. The default is enabled.
994  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
995  * @param s SwkbdInline object.
996  * @param flag Flag
997  */
999 
1000 /**
1001  * @brief Sets whether DirectionalButtonAssign is enabled. The default is disabled.
1002  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
1003  * @note Only available on [4.0.0+].
1004  * @param s SwkbdInline object.
1005  * @param flag Flag
1006  */
1008 
1009 /**
1010  * @brief Sets whether the specified SeGroup (sound effect) is enabled. The default is enabled.
1011  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect. If called again with a different seGroup, \ref swkbdInlineUpdate must be called prior to calling this again.
1012  * @note Only available on [5.0.0+].
1013  * @param s SwkbdInline object.
1014  * @param seGroup SeGroup
1015  * @param flag Flag
1016  */
1017 void swkbdInlineSetSeGroup(SwkbdInline* s, u8 seGroup, bool flag);
1018 
1019 /**
1020  * @brief Sets whether the backspace button is enabled. The default is enabled.
1021  * @note \ref swkbdInlineUpdate must be called at some point afterwards for this to take affect.
1022  * @note Only available on [5.0.0+].
1023  * @param s SwkbdInline object.
1024  * @param flag Flag
1025  */
1026 void swkbdInlineSetBackspaceFlag(SwkbdInline* s, bool flag);
1027 
swkbdInlineGetMiniaturizedHeight
s32 swkbdInlineGetMiniaturizedHeight(SwkbdInline *s)
Gets the MiniaturizedHeight, relative to the bottom of the screen.
SwkbdCustomizedDictionarySet::buffer_size
u32 buffer_size
0x1000-byte aligned buffer size.
Definition: swkbd.h:116
swkbdConfigSetType
static void swkbdConfigSetType(SwkbdConfig *c, SwkbdType type)
Sets SwkbdArgCommon::SwkbdType.
Definition: swkbd.h:469
SwkbdAppearArg::returnButtonFlag
u8 returnButtonFlag
Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
Definition: swkbd.h:215
swkbdClose
void swkbdClose(SwkbdConfig *c)
Closes a SwkbdConfig struct.
swkbdInlineClose
Result swkbdInlineClose(SwkbdInline *s)
Closes a SwkbdInline object.
SwkbdInlineCalcArg::keytopAsFloating
u8 keytopAsFloating
Flags bitmask 0x200.
Definition: swkbd.h:239
SwkbdAppearArg::stringLenMin
s32 stringLenMin
When non-negative and non-zero, specifies the min string length. When the input is too short,...
Definition: swkbd.h:214
SwkbdInitializeArg::unk_x5
u8 unk_x5
Only set on [5.0.0+].
Definition: swkbd.h:201
SwkbdType_QWERTY
@ SwkbdType_QWERTY
QWERTY (and variants) keyboard only.
Definition: swkbd.h:23
SwkbdKeyDisableBitmask_Percent
@ SwkbdKeyDisableBitmask_Percent
Disable ''.
Definition: swkbd.h:37
SwkbdChangedStringCb
void(* SwkbdChangedStringCb)(const char *str, SwkbdChangedStringArg *arg)
This callback is used by swkbdInlineUpdate when handling ChangedString* replies (text changed by the ...
Definition: swkbd.h:291
swkbdInlineSetTouchFlag
void swkbdInlineSetTouchFlag(SwkbdInline *s, bool flag)
Sets whether touch is enabled.
SwkbdReplyType
SwkbdReplyType
SwkbdInline Interactive output storage reply ID.
Definition: swkbd.h:65
swkbdConfigSetTextCheckCallback
void swkbdConfigSetTextCheckCallback(SwkbdConfig *c, SwkbdTextCheckCb cb)
Sets the TextCheck callback.
swkbdConfigSetOkButtonText
void swkbdConfigSetOkButtonText(SwkbdConfig *c, const char *str)
Sets the Ok button text.
swkbdConfigSetDictionary
void swkbdConfigSetDictionary(SwkbdConfig *c, const SwkbdDictWord *input, s32 entries)
Sets the user dictionary.
swkbdInlineAppear
void swkbdInlineAppear(SwkbdInline *s, const SwkbdAppearArg *arg)
Appear the kbd and set SwkbdAppearArg.
SwkbdInlineCalcArg::seGroup
u8 seGroup
Flags bitmask: enable=0x2000, disable=0x4000. Only available with [5.0.0+].
Definition: swkbd.h:258
swkbdInlineSetMovedCursorV2Callback
void swkbdInlineSetMovedCursorV2Callback(SwkbdInline *s, SwkbdMovedCursorV2Cb cb)
Sets the MovedCursorV2 callback, used by swkbdInlineUpdate.
SwkbdInlineCalcArg
Definition: swkbd.h:224
swkbdInlineSetFinishedInitializeCallback
void swkbdInlineSetFinishedInitializeCallback(SwkbdInline *s, VoidFn cb)
Sets the FinishedInitialize callback, used by swkbdInlineUpdate.
SwkbdArgVB
Arg struct for version 0x6000B+.
Definition: swkbd.h:162
SwkbdArgCommon::blurBackground
u8 blurBackground
When enabled with value 1, the background is blurred.
Definition: swkbd.h:140
SwkbdMovedTabCb
void(* SwkbdMovedTabCb)(const char *str, SwkbdMovedTabArg *arg)
This callback is used by swkbdInlineUpdate when handling MovedTab* replies.
Definition: swkbd.h:307
SwkbdArgV0
Definition: swkbd.h:149
swkbdConfigMakePresetUserName
void swkbdConfigMakePresetUserName(SwkbdConfig *c)
Clears the args in the SwkbdConfig struct and initializes it with the UserName Preset.
swkbdInlineUnsetCustomizedDictionaries
Result swkbdInlineUnsetCustomizedDictionaries(SwkbdInline *s)
Request UnsetCustomizedDictionaries.
u8
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
SwkbdTextCheckResult_Silent
@ SwkbdTextCheckResult_Silent
Failure, invalid string. With value 3 and above, swkbd will silently not accept the string,...
Definition: swkbd.h:16
NX_CONSTEXPR
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:88
SwkbdAppearArg::stringLenMax
s32 stringLenMax
When non-negative and non-zero, specifies the max string length. When the input is too long,...
Definition: swkbd.h:213
swkbdInlineSetUtf8Mode
void swkbdInlineSetUtf8Mode(SwkbdInline *s, bool flag)
Sets the utf8Mode.
swkbdConfigSetGuideText
void swkbdConfigSetGuideText(SwkbdConfig *c, const char *str)
Sets the Guide text.
s16
int16_t s16
16-bit signed integer.
Definition: types.h:26
swkbdConfigSetHeaderText
void swkbdConfigSetHeaderText(SwkbdConfig *c, const char *str)
Sets the Header text.
swkbdConfigMakePresetPassword
void swkbdConfigMakePresetPassword(SwkbdConfig *c)
Clears the args in the SwkbdConfig struct and initializes it with the Password Preset.
SwkbdConfig
Definition: swkbd.h:174
swkbdInlineLaunch
Result swkbdInlineLaunch(SwkbdInline *s)
Does setup for SwkbdInitializeArg and launches the applet with the SwkbdInline object.
SwkbdArgV7
Arg struct for version 0x30007+.
Definition: swkbd.h:156
SwkbdRect
Rect.
Definition: swkbd.h:190
swkbdConfigSetUnkFlag
static void swkbdConfigSetUnkFlag(SwkbdConfig *c, u8 flag)
Sets SwkbdConfig::unkFlag, default is 0.
Definition: swkbd.h:568
SwkbdKeyDisableBitmask_UserName
@ SwkbdKeyDisableBitmask_UserName
Used for swkbdConfigMakePresetUserName. Disables '@', '', and '\'.
Definition: swkbd.h:42
swkbdShow
Result swkbdShow(SwkbdConfig *c, char *out_string, size_t out_string_size)
Launch swkbd with the specified config.
AppletHolder
LibraryApplet state.
Definition: applet.h:241
swkbdInlineSetMovedCursorCallback
void swkbdInlineSetMovedCursorCallback(SwkbdInline *s, SwkbdMovedCursorCb cb)
Sets the MovedCursor callback, used by swkbdInlineUpdate.
swkbdConfigSetStringLenMax
static void swkbdConfigSetStringLenMax(SwkbdConfig *c, u32 stringLenMax)
Sets SwkbdArgCommon::stringLenMax.
Definition: swkbd.h:505
swkbdInlineSetCustomizedDictionaries
Result swkbdInlineSetCustomizedDictionaries(SwkbdInline *s, const SwkbdCustomizedDictionarySet *dic)
Sets the CustomizedDictionaries.
SwkbdKeyDisableBitmask_Space
@ SwkbdKeyDisableBitmask_Space
Disable space-bar.
Definition: swkbd.h:35
SwkbdInlineCalcArg::initArg
SwkbdInitializeArg initArg
Flags bitmask 0x1.
Definition: swkbd.h:230
swkbdConfigMakePresetDefault
void swkbdConfigMakePresetDefault(SwkbdConfig *c)
Clears the args in the SwkbdConfig struct and initializes it with the Default Preset.
SwkbdInlineCalcArg::footerScalable
u8 footerScalable
Flags bitmask 0x100.
Definition: swkbd.h:240
SwkbdInlineCalcArg::cursorPos
s32 cursorPos
Flags bitmask 0x10.
Definition: swkbd.h:232
SwkbdState_Disappearing
@ SwkbdState_Disappearing
The user pressed the ok or cancel button, causing the applet to disappear.
Definition: swkbd.h:90
swkbdInlineSetHardwareKeyboardFlag
void swkbdInlineSetHardwareKeyboardFlag(SwkbdInline *s, bool flag)
Sets whether Hardware-keyboard is enabled.
SwkbdKeyDisableBitmask_Backslash
@ SwkbdKeyDisableBitmask_Backslash
Disable '\'.
Definition: swkbd.h:39
swkbdConfigSetInitialCursorPos
static void swkbdConfigSetInitialCursorPos(SwkbdConfig *c, u32 initialCursorPos)
Sets SwkbdArgCommon::initialCursorPos.
Definition: swkbd.h:496
swkbdInlineMakeAppearArg
void swkbdInlineMakeAppearArg(SwkbdAppearArg *arg, SwkbdType type)
Creates a SwkbdAppearArg which can then be passed to swkbdInlineAppear.
s32
int32_t s32
32-bit signed integer.
Definition: types.h:27
SwkbdTextDrawType_Box
@ SwkbdTextDrawType_Box
The text will be displayed in a box.
Definition: swkbd.h:48
SwkbdInlineMode_AppletDisplay
@ SwkbdInlineMode_AppletDisplay
LibAppletMode_Background. The applet will handle displaying gfx on the screen.
Definition: swkbd.h:98
SwkbdAppearArg::type
SwkbdType type
See SwkbdType.
Definition: swkbd.h:206
swkbdInlineCreate
Result swkbdInlineCreate(SwkbdInline *s)
Creates a SwkbdInline object.
swkbdInlineSetInputModeFadeType
void swkbdInlineSetInputModeFadeType(SwkbdInline *s, u8 type)
Sets InputModeFadeType.
SwkbdArgVB::trigger
u8 trigger
[8.0.0+]
Definition: swkbd.h:170
swkbdConfigSetLeftOptionalSymbolKey
void swkbdConfigSetLeftOptionalSymbolKey(SwkbdConfig *c, const char *str)
Sets the LeftOptionalSymbolKey, for SwkbdType_NumPad.
SwkbdAppearArg::dicFlag
u8 dicFlag
Enables dictionary usage when non-zero (including the system dictionary).
Definition: swkbd.h:210
SwkbdArgCommon::stringLenMin
u32 stringLenMin
When non-zero, specifies the min string length. When the input is too short, swkbd will display an ic...
Definition: swkbd.h:136
swkbdInlineGetTouchRectangles
s32 swkbdInlineGetTouchRectangles(SwkbdInline *s, SwkbdRect *keytop, SwkbdRect *footer)
GetTouchRectangles.
swkbdInlineSetKeytopAsFloating
void swkbdInlineSetKeytopAsFloating(SwkbdInline *s, bool flag)
Sets KeytopAsFloating.
SwkbdArgCommon::initialCursorPos
u32 initialCursorPos
Initial cursor position in the string: 0 = start, 1 = end.
Definition: swkbd.h:130
swkbdInlineAppearArgSetRightButtonText
void swkbdInlineAppearArgSetRightButtonText(SwkbdAppearArg *arg, const char *str)
Sets the RightButtonText, for SwkbdType_NumPad.
SwkbdArgVB::total_entries
u8 total_entries
This is SwkbdCustomizedDictionarySet::total_entries.
Definition: swkbd.h:167
SwkbdInlineCalcArg::keytopScaleX
float keytopScaleX
Flags bitmask 0x200.
Definition: swkbd.h:249
swkbdConfigSetBlurBackground
static void swkbdConfigSetBlurBackground(SwkbdConfig *c, u8 blurBackground)
Sets SwkbdArgCommon::blurBackground.
Definition: swkbd.h:550
SwkbdTextCheckResult_Prompt
@ SwkbdTextCheckResult_Prompt
Failure, invalid string. Error message is displayed in a message-box, pressing Cancel will return to ...
Definition: swkbd.h:15
SwkbdRect::height
s16 height
Height.
Definition: swkbd.h:194
swkbdInlineSetMovedTabCallback
void swkbdInlineSetMovedTabCallback(SwkbdInline *s, SwkbdMovedTabCb cb)
Sets the MovedTab callback, used by swkbdInlineUpdate.
swkbdInlineSetSeGroup
void swkbdInlineSetSeGroup(SwkbdInline *s, u8 seGroup, bool flag)
Sets whether the specified SeGroup (sound effect) is enabled.
SwkbdAppearArg
Definition: swkbd.h:205
SwkbdArgVB::unkFlag
u8 unkFlag
[8.0.0+]
Definition: swkbd.h:168
SwkbdInlineCalcArg::inputModeFadeType
u8 inputModeFadeType
Flags bitmask 0x100.
Definition: swkbd.h:242
swkbdConfigSetSubText
void swkbdConfigSetSubText(SwkbdConfig *c, const char *str)
Sets the Sub text.
SwkbdInlineMode
SwkbdInlineMode
Value for SwkbdInitializeArg mode. Controls the LibAppletMode when launching the applet.
Definition: swkbd.h:96
swkbdInlineAppearArgSetOkButtonText
void swkbdInlineAppearArgSetOkButtonText(SwkbdAppearArg *arg, const char *str)
Sets okButtonText for the specified SwkbdAppearArg, which was previously initialized with swkbdInline...
SwkbdKeyDisableBitmask_DownloadCode
@ SwkbdKeyDisableBitmask_DownloadCode
Used for swkbdConfigMakePresetDownloadCode.
Definition: swkbd.h:41
swkbdInlineGetImage
Result swkbdInlineGetImage(SwkbdInline *s, void *buffer, u64 size, bool *data_available)
GetImage.
SwkbdDecidedEnterArg::stringLen
u32 stringLen
String length in characters, without NUL-terminator.
Definition: swkbd.h:286
swkbdConfigSetRightOptionalSymbolKey
void swkbdConfigSetRightOptionalSymbolKey(SwkbdConfig *c, const char *str)
Sets the RightOptionalSymbolKey, for SwkbdType_NumPad.
swkbdConfigSetTextDrawType
static void swkbdConfigSetTextDrawType(SwkbdConfig *c, SwkbdTextDrawType textDrawType)
Sets SwkbdArgCommon::textDrawType.
Definition: swkbd.h:532
swkbdInlineIsUsedTouchPointByKeyboard
bool swkbdInlineIsUsedTouchPointByKeyboard(SwkbdInline *s, s32 x, s32 y)
Gets whether the input x/y are within the output from swkbdInlineGetTouchRectangles.
SwkbdDictWord
User dictionary word.
Definition: swkbd.h:105
swkbdInlineUnsetUserWordInfo
Result swkbdInlineUnsetUserWordInfo(SwkbdInline *s)
Request UnsetUserWordInfo.
swkbdConfigSetTrigger
static void swkbdConfigSetTrigger(SwkbdConfig *c, u8 trigger)
Sets SwkbdConfig::trigger, default is 0.
Definition: swkbd.h:576
SwkbdKeyDisableBitmask_ForwardSlash
@ SwkbdKeyDisableBitmask_ForwardSlash
Disable '/'.
Definition: swkbd.h:38
SwkbdArgCommon
Base swkbd arg struct.
Definition: swkbd.h:122
swkbdInlineSetReleasedUserWordInfoCallback
void swkbdInlineSetReleasedUserWordInfoCallback(SwkbdInline *s, VoidFn cb)
Sets the ReleasedUserWordInfo callback, used by swkbdInlineUpdate.
swkbdInlineAppearArgSetLeftButtonText
void swkbdInlineAppearArgSetLeftButtonText(SwkbdAppearArg *arg, const char *str)
Sets the LeftButtonText, for SwkbdType_NumPad.
SwkbdTextDrawType
SwkbdTextDrawType
Value for SwkbdArgCommon::textDrawType. Only applies when stringLenMax is 1..32, otherwise swkbd will...
Definition: swkbd.h:46
swkbdInlineDisappear
void swkbdInlineDisappear(SwkbdInline *s)
Disappear the kbd.
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
SwkbdCustomizeDicInfo
Input data for SwkbdInline request SetCustomizeDic.
Definition: swkbd.h:110
SwkbdInlineCalcArg::volume
float volume
Flags bitmask 0x2.
Definition: swkbd.h:231
swkbdConfigSetKeySetDisableBitmask
static void swkbdConfigSetKeySetDisableBitmask(SwkbdConfig *c, u32 keySetDisableBitmask)
Sets SwkbdArgCommon::keySetDisableBitmask.
Definition: swkbd.h:487
SwkbdDecidedEnterCb
void(* SwkbdDecidedEnterCb)(const char *str, SwkbdDecidedEnterArg *arg)
This callback is used by swkbdInlineUpdate when handling DecidedEnter* replies (when the final text w...
Definition: swkbd.h:311
SwkbdArgCommon::keySetDisableBitmask
u32 keySetDisableBitmask
See SwkbdKeyDisableBitmask_*.
Definition: swkbd.h:129
swkbdInlineUnsetCustomizeDic
void swkbdInlineUnsetCustomizeDic(SwkbdInline *s)
Request UnsetCustomizeDic.
swkbdInlineSetDecidedCancelCallback
void swkbdInlineSetDecidedCancelCallback(SwkbdInline *s, VoidFn cb)
Sets the DecidedCancel callback, used by swkbdInlineUpdate.
swkbdConfigSetCustomizedDictionaries
Result swkbdConfigSetCustomizedDictionaries(SwkbdConfig *c, const SwkbdCustomizedDictionarySet *dic)
Sets the CustomizedDictionaries.
SwkbdTextCheckResult_Bad
@ SwkbdTextCheckResult_Bad
Failure, invalid string. Error message is displayed in a message-box, pressing OK will return to swkb...
Definition: swkbd.h:14
SwkbdRect::width
s16 width
Width.
Definition: swkbd.h:193
SwkbdType_ZhHant
@ SwkbdType_ZhHant
Chinese Traditional keyboard only.
Definition: swkbd.h:27
SwkbdTextCheckResult_OK
@ SwkbdTextCheckResult_OK
Success, valid string.
Definition: swkbd.h:13
u64
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
SwkbdType
SwkbdType
Type of keyboard.
Definition: swkbd.h:20
SwkbdChangedStringArg::dicEndCursorPos
s32 dicEndCursorPos
Ending cursorPos for the current dictionary word in the current text string. -1 for none.
Definition: swkbd.h:268
SwkbdType_Unknown3
@ SwkbdType_Unknown3
The same as SwkbdType_Normal keyboard.
Definition: swkbd.h:24
SwkbdMovedCursorCb
void(* SwkbdMovedCursorCb)(const char *str, SwkbdMovedCursorArg *arg)
This callback is used by swkbdInlineUpdate when handling MovedCursor* replies.
Definition: swkbd.h:299
swkbdConfigSetReturnButtonFlag
static void swkbdConfigSetReturnButtonFlag(SwkbdConfig *c, u16 flag)
Sets SwkbdArgCommon::returnButtonFlag.
Definition: swkbd.h:541
SwkbdInlineCalcArg::trigger
u8 trigger
[6.0.0+] Trigger
Definition: swkbd.h:260
SwkbdTextCheckCb
SwkbdTextCheckResult(* SwkbdTextCheckCb)(char *tmp_string, size_t tmp_string_size)
TextCheck callback set by swkbdConfigSetTextCheckCallback, for validating the input string when the s...
Definition: swkbd.h:102
swkbdInlineSetUserWordInfo
Result swkbdInlineSetUserWordInfo(SwkbdInline *s, const SwkbdDictWord *input, s32 entries)
Sets the UserWordInfo.
SwkbdMovedCursorArg
Struct data for SwkbdInline Interactive reply storage MovedCursor*, at the end following the string.
Definition: swkbd.h:273
SwkbdInlineCalcArg::size
u16 size
Size of this struct.
Definition: swkbd.h:226
SwkbdKeyDisableBitmask_At
@ SwkbdKeyDisableBitmask_At
Disable '@'.
Definition: swkbd.h:36
Result
u32 Result
Function error code result type.
Definition: types.h:44
swkbdInlineSetKeytopTranslate
void swkbdInlineSetKeytopTranslate(SwkbdInline *s, float x, float y)
Sets gfx translation for the displayed swkbd image position.
swkbdInlineSetCursorPos
void swkbdInlineSetCursorPos(SwkbdInline *s, s32 pos)
Sets the cursor character position in the string.
SwkbdState
SwkbdState
SwkbdInline State.
Definition: swkbd.h:85
SwkbdInlineCalcArg::triggerFlag
u8 triggerFlag
[6.0.0+] Enables using the trigger field when set.
Definition: swkbd.h:259
SwkbdMovedCursorArg::stringLen
u32 stringLen
String length in characters, without NUL-terminator.
Definition: swkbd.h:274
SwkbdArgCommon::stringLenMax
u32 stringLenMax
When non-zero, specifies the max string length. When the input is too long, swkbd will stop accepting...
Definition: swkbd.h:135
SwkbdRect::y
s16 y
Y.
Definition: swkbd.h:192
SwkbdArgV7::textGrouping
u32 textGrouping[8]
When set and enabled via SwkbdTextDrawType, controls displayed text grouping (inserts spaces,...
Definition: swkbd.h:158
swkbdInlineSetVolume
void swkbdInlineSetVolume(SwkbdInline *s, float volume)
Sets the audio volume.
SwkbdType_Latin
@ SwkbdType_Latin
All Latin like languages keyboard only (without CJK keyboard).
Definition: swkbd.h:25
SwkbdInline
InlineKeyboard.
Definition: swkbd.h:314
swkbdInlineSetDirectionalButtonAssignFlag
void swkbdInlineSetDirectionalButtonAssignFlag(SwkbdInline *s, bool flag)
Sets whether DirectionalButtonAssign is enabled.
SwkbdChangedStringArg::stringLen
u32 stringLen
String length in characters, without NUL-terminator.
Definition: swkbd.h:266
swkbdInlineSetKeytopBgAlpha
void swkbdInlineSetKeytopBgAlpha(SwkbdInline *s, float alpha)
Sets KeytopBgAlpha.
swkbdInlineSetFooterScalable
void swkbdInlineSetFooterScalable(SwkbdInline *s, bool flag)
Sets FooterScalable.
swkbdInlineSetFooterBgAlpha
void swkbdInlineSetFooterBgAlpha(SwkbdInline *s, float alpha)
Sets FooterBgAlpha.
SwkbdState_Initialized
@ SwkbdState_Initialized
Applet is initialized but hidden.
Definition: swkbd.h:87
SwkbdState_Shown
@ SwkbdState_Shown
Applet is fully shown and ready to accept text input.
Definition: swkbd.h:89
SwkbdCustomizedDictionarySet::buffer
void * buffer
0x1000-byte aligned buffer.
Definition: swkbd.h:115
SwkbdMovedCursorV2Cb
void(* SwkbdMovedCursorV2Cb)(const char *str, SwkbdMovedCursorArg *arg, bool flag)
This callback is used by swkbdInlineUpdate when handling MovedCursor*V2 replies.
Definition: swkbd.h:303
AppletStorage
applet IStorage
Definition: applet.h:235
SwkbdInlineCalcArg::disableTouch
u8 disableTouch
Flags bitmask 0x200.
Definition: swkbd.h:243
SwkbdChangedStringArg
Struct data for SwkbdInline Interactive reply storage ChangedString*, at the end following the string...
Definition: swkbd.h:265
swkbdInlineSetKeytopScale
void swkbdInlineSetKeytopScale(SwkbdInline *s, float scale)
Sets gfx scaling.
swkbdInlineGetWindowSize
static void swkbdInlineGetWindowSize(s32 *width, s32 *height)
GetWindowSize.
Definition: swkbd.h:623
SwkbdType_Unknown9
@ SwkbdType_Unknown9
Unknown.
Definition: swkbd.h:30
SwkbdRect::x
s16 x
X.
Definition: swkbd.h:191
swkbdInlineGetImageMemoryRequirement
Result swkbdInlineGetImageMemoryRequirement(u64 *out_size, u64 *out_alignment)
GetImageMemoryRequirement.
SwkbdAppearArg::keySetDisableBitmask
u32 keySetDisableBitmask
See SwkbdKeyDisableBitmask_*.
Definition: swkbd.h:212
swkbdInlineLaunchForLibraryApplet
Result swkbdInlineLaunchForLibraryApplet(SwkbdInline *s, u8 mode, u8 unk_x5)
Same as swkbdInlineLaunch, except mode and unk_x5 for SwkbdInitializeArg are set to the input params.
SwkbdRequestCommand
SwkbdRequestCommand
SwkbdInline Interactive input storage request ID.
Definition: swkbd.h:53
SwkbdArgCommon::textDrawType
SwkbdTextDrawType textDrawType
See SwkbdTextDrawType.
Definition: swkbd.h:138
SwkbdInlineCalcArg::utf8Mode
u8 utf8Mode
Flags bitmask 0x20.
Definition: swkbd.h:235
SwkbdInlineCalcArg::alphaEnabledInInputMode
u8 alphaEnabledInInputMode
Flags bitmask 0x100.
Definition: swkbd.h:241
swkbdInlineSetAlphaEnabledInInputMode
void swkbdInlineSetAlphaEnabledInInputMode(SwkbdInline *s, bool flag)
Sets AlphaEnabledInInputMode.
SwkbdState_Inactive
@ SwkbdState_Inactive
Default state from swkbdInlineCreate, before a state is set by swkbdInlineUpdate when a reply is rece...
Definition: swkbd.h:86
SwkbdInlineCalcArg::balloonScale
float balloonScale
Flags bitmask 0x200.
Definition: swkbd.h:255
SwkbdInlineCalcArg::keytopTranslateY
float keytopTranslateY
Flags bitmask 0x200.
Definition: swkbd.h:252
swkbdInlineSetCustomizeDic
Result swkbdInlineSetCustomizeDic(SwkbdInline *s, void *buffer, size_t size, SwkbdCustomizeDicInfo *info)
Sets the CustomizeDic.
SwkbdTextCheckResult
SwkbdTextCheckResult
Output result returned by SwkbdTextCheckCb.
Definition: swkbd.h:12
SwkbdArgCommon::type
SwkbdType type
See SwkbdType.
Definition: swkbd.h:123
swkbdInlineSetChangedStringCallback
void swkbdInlineSetChangedStringCallback(SwkbdInline *s, SwkbdChangedStringCb cb)
Sets the ChangedString callback, used by swkbdInlineUpdate.
swkbdInlineAppearArgSetStringLenMin
static void swkbdInlineAppearArgSetStringLenMin(SwkbdAppearArg *arg, s32 stringLenMin)
Sets the stringLenMin for the specified SwkbdAppearArg, which was previously initialized with swkbdIn...
Definition: swkbd.h:822
SwkbdArgV0::textCheckCb
SwkbdTextCheckCb textCheckCb
This really doesn't belong in a struct sent to another process, but official sw does this.
Definition: swkbd.h:152
SwkbdAppearArg::flags
u32 flags
Bitmask 0x4: unknown.
Definition: swkbd.h:219
SwkbdAppearArg::unk_x29
u8 unk_x29
[10.0.0+] When value 1-2, swkbdInlineAppear / swkbdInlineAppearEx will set keytopAsFloating=0 and foo...
Definition: swkbd.h:216
SwkbdKeyDisableBitmask_Numbers
@ SwkbdKeyDisableBitmask_Numbers
Disable numbers.
Definition: swkbd.h:40
PACKED
#define PACKED
Packs a struct so that it won't include padding bytes.
Definition: types.h:59
swkbdConfigSetInitialText
void swkbdConfigSetInitialText(SwkbdConfig *c, const char *str)
Sets the Initial text.
SwkbdInlineMode_UserDisplay
@ SwkbdInlineMode_UserDisplay
LibAppletMode_BackgroundIndirect. This is the default. The user-process must handle displaying the sw...
Definition: swkbd.h:97
SwkbdChangedStringArg::cursorPos
s32 cursorPos
Cursor position.
Definition: swkbd.h:269
SwkbdMovedTabArg
Struct data for SwkbdInline Interactive reply storage MovedTab*, at the end following the string.
Definition: swkbd.h:279
SwkbdDecidedEnterArg
Struct data for SwkbdInline Interactive reply storage DecidedEnter*, at the end following the string.
Definition: swkbd.h:285
SwkbdChangedStringV2Cb
void(* SwkbdChangedStringV2Cb)(const char *str, SwkbdChangedStringArg *arg, bool flag)
This callback is used by swkbdInlineUpdate when handling ChangedString*V2 replies (text changed by th...
Definition: swkbd.h:295
BIT
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
SwkbdArgCommon::passwordFlag
u32 passwordFlag
Use password: 0 = disable, 1 = enable.
Definition: swkbd.h:137
swkbdConfigMakePresetDownloadCode
void swkbdConfigMakePresetDownloadCode(SwkbdConfig *c)
Clears the args in the SwkbdConfig struct and initializes it with the DownloadCode Preset.
swkbdCreate
Result swkbdCreate(SwkbdConfig *c, s32 max_dictwords)
Creates a SwkbdConfig struct.
swkbdConfigSetPasswordFlag
static void swkbdConfigSetPasswordFlag(SwkbdConfig *c, u32 flag)
Sets SwkbdArgCommon::passwordFlag.
Definition: swkbd.h:523
swkbdInlineAppearArgSetStringLenMax
static void swkbdInlineAppearArgSetStringLenMax(SwkbdAppearArg *arg, s32 stringLenMax)
Sets the stringLenMax for the specified SwkbdAppearArg, which was previously initialized with swkbdIn...
Definition: swkbd.h:813
SwkbdType_Normal
@ SwkbdType_Normal
Normal keyboard.
Definition: swkbd.h:21
SwkbdTextDrawType_Line
@ SwkbdTextDrawType_Line
The text will be displayed on a line. Also enables displaying the Header and Sub text.
Definition: swkbd.h:47
swkbdInlineSetBackspaceFlag
void swkbdInlineSetBackspaceFlag(SwkbdInline *s, bool flag)
Sets whether the backspace button is enabled.
swkbdConfigSetStringLenMin
static void swkbdConfigSetStringLenMin(SwkbdConfig *c, u32 stringLenMin)
Sets SwkbdArgCommon::stringLenMin.
Definition: swkbd.h:514
SwkbdArgCommon::dicFlag
u8 dicFlag
Enables dictionary usage when non-zero (including the system dictionary).
Definition: swkbd.h:127
SwkbdInlineCalcArg::keytopBgAlpha
float keytopBgAlpha
Flags bitmask 0x100.
Definition: swkbd.h:253
SwkbdTextDrawType_DownloadCode
@ SwkbdTextDrawType_DownloadCode
Used by swkbdConfigMakePresetDownloadCode on [5.0.0+]. Enables using SwkbdArgV7 unk_x3e0.
Definition: swkbd.h:49
swkbdInlineSetChangedStringV2Callback
void swkbdInlineSetChangedStringV2Callback(SwkbdInline *s, SwkbdChangedStringV2Cb cb)
Sets the ChangedStringV2 callback, used by swkbdInlineUpdate.
SwkbdArgCommon::returnButtonFlag
u16 returnButtonFlag
Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
Definition: swkbd.h:139
SwkbdType_ZhHans
@ SwkbdType_ZhHans
Chinese Simplified keyboard only.
Definition: swkbd.h:26
SwkbdInlineCalcArg::keytopTranslateX
float keytopTranslateX
Flags bitmask 0x200.
Definition: swkbd.h:251
swkbdConfigSetDicFlag
static void swkbdConfigSetDicFlag(SwkbdConfig *c, u8 flag)
Sets SwkbdArgCommon::dicFlag.
Definition: swkbd.h:478
SwkbdInlineCalcArg::footerBgAlpha
float footerBgAlpha
Flags bitmask 0x100.
Definition: swkbd.h:254
swkbdInlineGetMaxHeight
s32 swkbdInlineGetMaxHeight(SwkbdInline *s)
Gets the image max height, relative to the bottom of the screen.
SwkbdInitializeArg
InitializeArg for SwkbdInline.
Definition: swkbd.h:198
SwkbdState_Appearing
@ SwkbdState_Appearing
Applet is appearing.
Definition: swkbd.h:88
SwkbdType_Korean
@ SwkbdType_Korean
Korean keyboard only.
Definition: swkbd.h:28
SwkbdInlineCalcArg::keytopScaleY
float keytopScaleY
Flags bitmask 0x200.
Definition: swkbd.h:250
VoidFn
void(* VoidFn)(void)
Function without arguments nor return value.
Definition: types.h:46
SwkbdType_All
@ SwkbdType_All
All language keyboards.
Definition: swkbd.h:29
swkbdInlineSetInputText
void swkbdInlineSetInputText(SwkbdInline *s, const char *str)
Sets the current input text string.
SwkbdType_NumPad
@ SwkbdType_NumPad
Number pad. The buttons at the bottom left/right are only available when they're set by swkbdConfigSe...
Definition: swkbd.h:22
u16
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
swkbdConfigSetTextGrouping
static void swkbdConfigSetTextGrouping(SwkbdConfig *c, u32 index, u32 value)
Sets SwkbdArgV7::textGrouping.
Definition: swkbd.h:559
swkbdInlineSetDecidedEnterCallback
void swkbdInlineSetDecidedEnterCallback(SwkbdInline *s, SwkbdDecidedEnterCb cb)
Sets the DecidedEnter callback, used by swkbdInlineUpdate.
SwkbdInitializeArg::mode
u8 mode
See SwkbdInlineMode. (u8 bool)
Definition: swkbd.h:200
SwkbdChangedStringArg::dicStartCursorPos
s32 dicStartCursorPos
Starting cursorPos for the current dictionary word in the current text string. -1 for none.
Definition: swkbd.h:267
SwkbdInlineCalcArg::enableBackspace
u8 enableBackspace
Flags bitmask 0x8000. Only available with [5.0.0+].
Definition: swkbd.h:237
SwkbdMovedCursorArg::cursorPos
s32 cursorPos
Cursor position.
Definition: swkbd.h:275
SwkbdInlineCalcArg::disableHardwareKeyboard
u8 disableHardwareKeyboard
Flags bitmask 0x800.
Definition: swkbd.h:244
swkbdInlineAppearEx
void swkbdInlineAppearEx(SwkbdInline *s, const SwkbdAppearArg *arg, u8 trigger)
Appear the kbd and set SwkbdAppearArg.
SwkbdCustomizedDictionarySet
Definition: swkbd.h:114
swkbdInlineUpdate
Result swkbdInlineUpdate(SwkbdInline *s, SwkbdState *out_state)
Handles updating SwkbdInline state, this should be called periodically.