Provides access to the system software keyboard.
This class provides two-way communication with the system software keyboard. The software keyboard can be shown or hidden and this state can be queried. The current text and cursor position can also be set on the system keyboard, which is important if the platform provides suggestions or auto correct. Input can be received using the CYIKeyboardInputBridge::Receiver.
An instance of this class must be obtained through CYIInputBridgeLocator.
#include <platform/YiKeyboardInputBridge.h>
Classes | |
class | Receiver |
Provides an interface to interact with the system software keyboard. More... | |
Public Types | |
enum | InputType { InputType::Text, InputType::Phone, InputType::Number, InputType::Email, InputType::URI } |
The preferred input type. More... | |
enum | ReturnKeyType { ReturnKeyType::Default, ReturnKeyType::Go, ReturnKeyType::Search, ReturnKeyType::Next, ReturnKeyType::Done } |
The preferred return key type. More... | |
enum | InputModifiers { InputModifiers::None = 0x0, InputModifiers::NoSuggestions = 0x1, InputModifiers::MaskInput = 0x2 } |
The preferred modifiers for the platform keyboard. More... | |
Public Member Functions | |
CYIKeyboardInputBridge () | |
virtual | ~CYIKeyboardInputBridge () |
void | ResetKeyboard (Receiver *pSource) |
virtual bool | ShowKeyboard (Receiver *pSource) |
virtual bool | HideKeyboard () |
bool | IsKeyboardShowing () const |
bool | IsHardwareKeyboardAvailable () const |
bool | ShouldShowKeyboardForActivationEvent (CYIKeyEvent *pKeyEvent) const |
void | OnTextChanged (const CYIString &text, Receiver *pSource) |
void | OnCursorPositionChanged (size_t cursor, Receiver *pSource) |
void | OnCursorPositionWillChange (Receiver *pSource) |
Receiver * | GetCurrentReceiver () |
void | ShowSelectionMenu (bool textSelected, YI_RECT rect) |
void | HideSelectionMenu () |
Public Attributes | |
CYISignal | KeyboardShown |
CYISignal | KeyboardHidden |
Protected Types | |
enum | KeyboardTextInputDirection { KeyboardTextInputDirection::LeftToRight, KeyboardTextInputDirection::RightToLeft, KeyboardTextInputDirection::Unknown } |
The keyboard text input direction. More... | |
Static Protected Member Functions | |
static CYIKeyboardInputBridge::KeyboardTextInputDirection | GetDirectionFromLanguageCode (const CYIString &languageCode) |
Protected Attributes | |
CYISignal< KeyboardTextInputDirection > | KeyboardTextInputDirectionChanged |
|
strong |
The preferred modifiers for the platform keyboard.
This bitmask may be used to tell the platform keyboard if it is expected to behave a particular way.
Enumerator | |
---|---|
None | No modifiers are applied to the platform keyboard. |
NoSuggestions | The platform keyboard is expected to not display input suggestions to the user. |
MaskInput | Requests that the platform keyboard mask its input. This is distinct from CYITextEditView::EnablePasswordMode, which enables masking for the CYISceneView rather than the platform keyboard.
|
|
strong |
The preferred input type.
This will alter the type of keyboard shown by the system, if applicable. Suggestions and auto-correct may also be affected.
|
strongprotected |
The keyboard text input direction.
This enum indicates the text direction based on the keyboard text input source language.
Enumerator | |
---|---|
LeftToRight | Indicates Left to Right direction. |
RightToLeft | Indicates Right to Left direction. |
Unknown | Indicates that direction couldn't be determined. |
|
strong |
The preferred return key type.
This will alter the type of return key to be used by the system keyboard, if applicable. It will also modify the behaviour when the return key is used.
CYIKeyboardInputBridge::CYIKeyboardInputBridge | ( | ) |
|
virtual |
|
protectedvirtual |
Override to add a Url for creating an AccessoryImage.
|
protectedvirtual |
Returns the current text input direction based on the keyboard input language.
Receiver* CYIKeyboardInputBridge::GetCurrentReceiver | ( | ) |
Returns the current receiver of keyboard input, if there is one.
|
staticprotected |
Returns text direction based on the provided language code. languageCode is the ISO 639 code for the language.
|
protectedvirtual |
Returns true if the platform supports displaying an image above the keyboard.
|
virtual |
Request the system software keyboard be hidden. Returns true if the keyboard was sucessfully hidden.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
void CYIKeyboardInputBridge::HideSelectionMenu | ( | ) |
Call this to let the system hide a menu pertaining to the current selection.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
bool CYIKeyboardInputBridge::IsHardwareKeyboardAvailable | ( | ) | const |
Returns true if a hardware keyboard is available.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
bool CYIKeyboardInputBridge::IsKeyboardShowing | ( | ) | const |
Returns true if the software keyboard is currently showing.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
Call this to let the system keyboard know the current cursor positon has changed from the UI side. For example, as a result of a "touch" in a text field being edited.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
void CYIKeyboardInputBridge::OnCursorPositionWillChange | ( | Receiver * | pSource | ) |
Call this to let the system keyboard know the current cursor positon will change from the UI side. For example, as a result of a "touch" in a text field being edited.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
|
protectedvirtual |
|
protectedvirtual |
Call this to let the system keyboard know the text being entered was changed from the UI side. For example, a "clear" button on the UI was pressed.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
|
protectedvirtual |
Override to remove a Url for creating an AccessoryImage.
void CYIKeyboardInputBridge::ResetKeyboard | ( | Receiver * | pSource | ) |
Request that the contents of the keyboard be reset.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
|
protectedvirtual |
bool CYIKeyboardInputBridge::ShouldShowKeyboardForActivationEvent | ( | CYIKeyEvent * | pKeyEvent | ) | const |
Returns true if pKeyEvent should cause the keyboard to be shown.
|
protectedvirtual |
Reimplemented in CYIOnScreenKeyboardInputBridge.
|
virtual |
Request that the system software keyboard be displayed. Returns true if the keyboard was successfully displayed.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
void CYIKeyboardInputBridge::ShowSelectionMenu | ( | bool | textSelected, |
YI_RECT | rect | ||
) |
Call this to let the system show a menu pertaining to the current selection. If there is text on the clipboard then a Paste command will displayed. Selection is not currently supported so Copy and Cut commands will not be displayed, but placeholders are added for future implementation. The selection rect (cursor rect) is required for iOS, even when nothing is selected, so that the Paste menu can be displayed next to the text.
|
protectedpure virtual |
Implemented in CYIOnScreenKeyboardInputBridge.
CYISignal CYIKeyboardInputBridge::KeyboardHidden |
Fired when the soft keyboard is hidden. On platforms that animate the soft keyboard out, best attempt is made to fire the signal before the animation starts.
CYISignal CYIKeyboardInputBridge::KeyboardShown |
Fired when the soft keyboard is shown. On platforms that animate the soft keyboard in, best attempt is made to fire the signal before the animation starts.
|
protected |
Emitted when the keyboard text input language direction is changed by the user at runtime.