/*---------------------------------------------------------------------------* Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ //------------------------------------------------------------------------------ /** * @file swkbd_AppearArg.h * @brief Keyboard appearance arguments. */ //------------------------------------------------------------------------------ #ifndef NN_SWKBD_APPEAR_ARG_H_ #define NN_SWKBD_APPEAR_ARG_H_ namespace nn { //------------------------------------------------------------------------------ namespace swkbd { //------------------------------------------------------------------------------ /** @ingroup keyboard_single * Parameters for setting keyboard status. */ class ConfigArg { public: explicit ConfigArg() : mLangType( cLangType_Ja ) , mControllerType( cControllerType_Drc ) , mKeyboardMode( cKeyboardMode_Full ) , mKeyboardFlag( cKeyboardFlag_All ) , mFirstKeyboardCondition() , mbFirstSelectCursor( false ) , mOkString( NULL ) , mNumericChar0( 0 /*L'\0'*/ ) , mNumericChar1( 0 /*L'\0'*/ ) , mbPredict( false ) , mInvalidCharFlag( 0 ) , mUserWordArray( NULL ) , mNumUserWord( 0 ) , mFrameRate( 1 ) , mbDrawDpdCursor( false ) , mFirstLockNo( -1 ) { for( s32 i = 0; i < cDicLangType_Max; ++i ) { mLearnDicBuf[i] = NULL; mCustomizeDic[i] = NULL; } } public: LangType mLangType; ///< The language.
You cannot specify a language that is not included in a region. The key map corresponding to the language you specify is used for the USB keyboard. ControllerType mControllerType; ///< Controller type.
Specify the controller type. If you want to display the keyboard on the TV, specify the Wii Remote. For display on the Wii U GamePad, specify the DRC. KeyboardMode mKeyboardMode; ///< Keyboard mode.
Set the keyboard mode. Specify the mode for either the full keyboard or one of the specialized keyboards to enter passwords, numbers, or NNIDs. (See nn::swkbd::KeyboardMode.) u32 mKeyboardFlag; ///< Keyboard flag.
Specify the bit flags representing the keyboard layouts you can switch between when using the full keyboard. (Specify a bitwise OR of nn::swkbd::KeyboardFlag values.) KeyboardCondition mFirstKeyboardCondition; ///< The initial condition of the full keyboard (layout and tab numbers). bool mbFirstSelectCursor; ///< Specifies whether to show the selection cursor at the start.
Defaults to hidden if not set. const char16* mOkString; ///< The string for the OK button.
It can be a maximum of nn::swkbd::cOkStringLengthMax characters. Check for problems in the display of characters by visually checking the actual display. char16 mNumericChar0; ///< The key label character shown to the left of the 0 key on the numerical keypad.
If you are not using this key, specify 0. char16 mNumericChar1; ///< The key label character shown to the right of the 0 key on the numerical keyboard.
If you are not using this key, specify 0. bool mbPredict; ///< Specifies whether to use the predictive text input feature.
Specify true to use the feature. u32 mInvalidCharFlag; ///< Flags for prohibited characters.
Specify the bit flags (the nn::swkbd::InvalidChar values) for the group of characters (keys) you want to prohibit from being entered. UserWord* mUserWordArray; ///< The array of user-registered words.
Do not destroy until the keyboard is closed because the keyboard only remembers the pointer and does not keep a copy of the array. s32 mNumUserWord; ///< The number of user-registered words.
You can specify up to nn::swkbd::cUserWordMax words. void* mLearnDicBuf[cDicLangType_Max]; ///< The learning dictionary data.
Set for each language. Specify NULL if not making any particular specification. If nothing is set, the learning feature will not work when you confirm conversion candidates. const void* mCustomizeDic[cDicLangType_Max]; ///< Customized dictionary data.
Set for each language. Set the created dictionaries as "compressed and customized for a forward-lookup prefix match dictionaries" as defined by the iWnn predictive input library. Specify NULL if not making any particular specification. s32 mFrameRate; /// < Sets the frame rate.
Specify 1 for 60 fps, or 2 for 30 fps. Defaults to 60 fps if not set. bool mbDrawDpdCursor; ///< Sets whether to draw the DPD pointer (the Wii Remote's direct pointing device).
Specify false (the default) to show your own cursor. s32 mFirstLockNo; ///< The initial state of the CAPS LOCK and SHIFT keys in password-entry mode.
The setting is only enabled when nn::swkbd::cKeyboardMode_Password is specified for the mode. Specify 0 for CAPS LOCK and 1 for SHIFT. }; /** @ingroup keyboard_single * Argument for receiving input from the keyboard. */ class ReceiverArg { public: explicit ReceiverArg() : mEventReceiver( NULL ) , mStringBuf( NULL ) , mStringBufSize( 0 ) , mFixedCharNumLimit( -1 ) , mCursorPos( 0 ) , mSelectFrom( -1 ) { } void clear() { mEventReceiver = NULL; mStringBuf = NULL; mStringBufSize = 0; mFixedCharNumLimit = -1; mCursorPos = 0; mSelectFrom = -1; } public: IEventReceiver* mEventReceiver; ///< Class for receiving string change events. char16* mStringBuf; ///< Text string buffer. s32 mStringBufSize; ///< Text string buffer size. s32 mFixedCharNumLimit; ///< Maximum number of characters in a fixed string. If the number of characters exceeds this value, the string is clipped regardless of the buffer size. This argument is required to implement a monospace input form. Specify -1 if not necessary. s32 mCursorPos; ///< Cursor position. s32 mSelectFrom; ///< Selection start position. }; /** @ingroup keyboard_single * Keyboard status configuration arguments. */ class KeyboardArg { public: explicit KeyboardArg() : mConfigArg() , mReceiverArg() { } public: ConfigArg mConfigArg; ///< Keyboard status setting arguments. ReceiverArg mReceiverArg; ///< Argument for receiving input from the keyboard. }; /** @ingroup basic_api * Input form configuration arguments. */ class InputFormArg { public: explicit InputFormArg() : mInputFormType( cInputFormType_Proportional ) , mCursorPos( -1 ) , mFixedString( NULL ) , mGuideString( NULL ) , mTextMax( -1 ) , mPasswordMode( cPasswordMode_Disable ) , mSeparateFlag( 0 ) , mbCursorValid( false ) , mbSelectAllText( false ) , mbCopyPaste( false ) { } public: InputFormType mInputFormType; ///< Input form type.
Specify either monospace mode or positional mode. s32 mCursorPos; ///< The position of the text cursor.
Specifying -1 is like specifying the end. const char16* mFixedString; ///< The default finalized string.
Specify the string entered from the start in the input form. If a default value is not necessary, specify NULL. const char16* mGuideString; ///< Specifies a string if a guide will be displayed.
For example, a guide describing the purpose of the entries. You can specify up to nn::swkbd::cGuideStringLengthMax characters. s32 mTextMax; ///< The maximum valid number of characters that can be input.
If the mode is Proportional, "the number of characters entered"/"the maximum number of characters"is shown as a ratio in the lower right part of the input form. You can specify a value up to 9999.
If the mode is Monospace, the limiting factor is the number of entry fields. You can specify a value up to 40. PasswordMode mPasswordMode; ///< The mode for showing asterisks (***) when entering passwords.
If not specified, the characters are shown as entered. u32 mSeparateFlag; ///< The flag for the display position of the separator.
Only enabled in Monospace mode. Sets the bits for the separation of the border around the monospace text. For example, set this value to 0x00000088 to add a 4, 4, 4 separation around a 12-digit friend code. bool mbCursorValid; ///< The flag to display the cursor.
Only enabled in Monospace mode. Specify true to show the text cursor. bool mbSelectAllText; ///< The Select-All flag.
Only enabled in Proportional mode. Specify true for all text to be selected by default. bool mbCopyPaste; ///< The flag for the copy and paste feature.
Only enabled in Proportional mode. Specify true to enable copy and paste. }; /** @ingroup basic_api * Configuration arguments for the keyboard with the input form */ class AppearArg { public: explicit AppearArg() : mKeyboardArg() , mInputFormArg() { } /// Sets the language. The key map corresponding to the language you specify is used for the USB keyboard. void setLangType( LangType lang ) { mKeyboardArg.mConfigArg.mLangType = lang; } /// Sets the type of controller that will operate the keyboard. If DRC is specified, the keyboard is displayed on the Wii U GamePad. If Wii Remote is specified, the keyboard is displayed on the TV void setControllerType( ControllerType id ) { mKeyboardArg.mConfigArg.mControllerType = id; } /// Configures all the input form and keyboard settings suited for the specified use (the layout type). Settings like the keyboard mode and prohibited characters are overwritten, so we recommend calling this after configuring other settings. void setLayout( LayoutType type, const char16* fixed_string = NULL, const char16* guide_string = NULL ) { if( type == nn::swkbd::cLayoutType_NNID ) { setKeyboardMode( cKeyboardMode_NNID ); setInvalidChar( cInvalidCharFlag_NNID ); setPredict( false ); setInputForm( cInputFormType_Monospace , fixed_string , -1 , guide_string , 16 , cPasswordMode_Disable , 0x00000000 , true); } else if( type == nn::swkbd::cLayoutType_DownloadCode ) { setKeyboardMode( cKeyboardMode_NNID ); setInvalidChar( cInvalidCharFlag_DownloadCode ); setFirstLockNo(0/*CAPS LOCK*/); setPredict( false ); setInputForm( cInputFormType_Monospace , fixed_string , -1 , guide_string , 16 , cPasswordMode_Disable , 0x0000888 , true); } } /// Sets the mode for the keyboard to use. In full keyboard mode, use the nn::swkbd::KeyboardFlag bit flags to specify the keyboard layouts that are available for use. void setKeyboardMode( KeyboardMode mode, u32 flag = cKeyboardFlag_All ) { mKeyboardArg.mConfigArg.mKeyboardMode = mode; mKeyboardArg.mConfigArg.mKeyboardFlag = flag; } /// Sets the initial condition of the full keyboard (layout and tab numbers). void setFirstKeyboardCondition( const KeyboardCondition& condition ) { mKeyboardArg.mConfigArg.mFirstKeyboardCondition = condition; } /// Sets whether to display a selection cursor from the beginning. Defaults to hidden if not set. void setFirstCursor( bool visible ) { mKeyboardArg.mConfigArg.mbFirstSelectCursor = visible; } /// Sets the display label for the OK button in the bottom right of the keyboard. The maximum is nn::swkbd::cOkStringLengthMax characters. Check for problems in the display of characters by visually checking the actual display. void setOkString( const char16* ok_string ) { mKeyboardArg.mConfigArg.mOkString = ok_string; } /// Sets whether to use the predictive text input feature. Specify true to use the feature. void setPredict( bool b ) { mKeyboardArg.mConfigArg.mbPredict = b; } /// Sets the labels for the keys to the left and right of the 0 key on the numerical keyboard. void setNumericChar( char16 c0, char16 c1 ) { mKeyboardArg.mConfigArg.mNumericChar0 = c0; mKeyboardArg.mConfigArg.mNumericChar1 = c1; } /// Sets the flags for prohibited characters. Specify the bit flags (the nn::swkbd::InvalidChar values) for the group of characters (keys) you want to prohibit from being entered. void setInvalidChar( u32 flag ) { mKeyboardArg.mConfigArg.mInvalidCharFlag = flag; } /// Sets the array of user-registered words and the number of such words. Take care not to destroy the UserWord array that is passed to user_word_array while the keyboard is in use. void setUserWord( UserWord* user_word_array, s32 num_user_word ) { mKeyboardArg.mConfigArg.mUserWordArray = user_word_array; mKeyboardArg.mConfigArg.mNumUserWord = num_user_word; } /// Sets the learning dictionary data for each language. If nothing is set, the learning feature will not work when you confirm conversion candidates. void setLearnDicBuf( DicLangType type, void* buf ) { mKeyboardArg.mConfigArg.mLearnDicBuf[type] = buf; } /// Sets the customized dictionaries. Set for each language. Set the created dictionaries as "compressed and customized for a forward-lookup prefix match dictionaries" as defined by the iWnn predictive input library. Specify NULL if not making any particular specification. void setCustomizeDic( DicLangType type, const void* dic ) { mKeyboardArg.mConfigArg.mCustomizeDic[type] = dic; } /// Sets the frame rate. Specify 1 for 60 fps or 2 for 30 fps. Defaults to 60 fps if not set. void setFrameRate( s32 frame_rate ) { mKeyboardArg.mConfigArg.mFrameRate = frame_rate; } /// Sets whether to draw the DPD pointer (the Wii Remote's direct pointing device). Specify false to show your own cursor. (Defaults to false if not set.) void setDrawDpdCursor( bool draw_dpd ) { mKeyboardArg.mConfigArg.mbDrawDpdCursor = draw_dpd; } /// Sets the initial state of the CAPS LOCK and SHIFT key in password-entry mode. The setting is only enabled when nn::swkbd::cKeyboardMode_Password is specified for the mode. Specify 0 in lockNo for CAPS LOCK, and 1 for SHIFT. void setFirstLockNo( s32 lockNo ) { mKeyboardArg.mConfigArg.mFirstLockNo = lockNo; } /// Sets the state of the input form. void setInputForm( InputFormType input_form_type , const char16* fixed_string = NULL , s32 cursor_pos = -1 , const char16* guide_string = NULL , s32 text_max = -1 , PasswordMode mode = cPasswordMode_Disable , u32 separate_flag = 0 , bool cursor_valid = false , bool select_all_text_enable = false , bool copy_paste_enable = false ) { mInputFormArg.mInputFormType = input_form_type; mInputFormArg.mFixedString = fixed_string; mInputFormArg.mCursorPos = cursor_pos; mInputFormArg.mGuideString = guide_string; mInputFormArg.mTextMax = text_max; mInputFormArg.mPasswordMode = mode; mInputFormArg.mSeparateFlag = separate_flag; mInputFormArg.mbCursorValid = cursor_valid; mInputFormArg.mbSelectAllText = select_all_text_enable; mInputFormArg.mbCopyPaste = copy_paste_enable; } public: KeyboardArg mKeyboardArg; InputFormArg mInputFormArg; }; //------------------------------------------------------------------------------ } // namespace swkbd //------------------------------------------------------------------------------ } // namespace nn #endif /* NN_SWKBD_APPEAR_ARG_H_ */