You.i Engine
CYIKeyboardInputBridge Class Referenceabstract

Detailed Description

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.

Note
Interaction with the software keyboard is provided automatically by using CYITextEditView.

An instance of this class must be obtained through CYIInputBridgeLocator.

See also
CYIInputBridgeLocator
CYITextEditView

#include <platform/YiKeyboardInputBridge.h>

Classes

class  Receiver
 Provides an interface to interact with the system software keyboard. More...
 

Public Types

enum  INPUT_TYPE {
  INPUT_TEXT,
  INPUT_PHONE,
  INPUT_NUMBER,
  INPUT_EMAIL,
  INPUT_URI,
  INPUT_PASSWORD
}
 The preferred input type. More...
 
enum  RETURN_KEY_TYPE {
  RETURN_KEY_DEFAULT,
  RETURN_KEY_GO,
  RETURN_KEY_SEARCH,
  RETURN_KEY_NEXT,
  RETURN_KEY_DONE
}
 The preferred return key type. 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
 
void OnTextChanged (const CYIString &text, Receiver *pSource)
 
void OnCursorPositionChanged (int32_t nCursor, Receiver *pSource)
 
void OnCursorPositionWillChange (Receiver *pSource)
 
ReceiverGetCurrentReceiver ()
 
void ShowSelectionMenu (bool bTextSelected, YI_RECT rect)
 
void HideSelectionMenu ()
 

Public Attributes

CYISignal KeyboardShown
 
CYISignal KeyboardHidden
 

Protected Member Functions

virtual void ResetKeyboardInternal ()=0
 
virtual bool ShowKeyboardInternal (Receiver *pSource)=0
 
virtual bool HideKeyboardInternal ()=0
 
virtual bool IsKeyboardShowingInternal () const =0
 
virtual bool IsHardwareKeyboardAvailableInternal () const =0
 
virtual void OnCursorPositionWillChangeInternal ()=0
 
virtual void OnCursorPositionChangedInternal (int32_t nStart, int32_t nEnd)=0
 
virtual void OnTextChangedInternal (const CYIString &rText)=0
 
virtual void ShowSelectionMenuInternal (bool bTextSelected, YI_RECT rect)=0
 
virtual void HideSelectionMenuInternal ()=0
 
virtual void OnKeyboardShown ()
 
virtual void OnKeyboardHidden ()
 

Member Enumeration Documentation

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.

Note
This does not directly affect the type of characters that can be input. The displayed keyboard may have a resricted character set but this is not guaranteed. Input from a hardware keyboard is always unresticted.
See also
Receiver::GetInputType
Enumerator
INPUT_TEXT 

Display a keyboard with a full character set and typical QWERTY layout. Suggestions and auto-correct are present if available on the platform.

INPUT_PHONE 

Display a keyboard specialized for entering phone numbers. The displayed keyboard may also have a restricted character set. Suggestions and auto-correct are typically not present.

INPUT_NUMBER 

Display a keyboard specialized for entering numbers. The displayed keyboard may also have a restricted character set. Suggestions and auto-correct are typically not present.

INPUT_EMAIL 

Displays a keyboard specialized for entering email addresses. If suggestions or auto-correct are available they will be tailored for email addresses.

INPUT_URI 

Displays a keyboard specialized for entering URIs. If suggestions or auto-correct are available they will be tailored for URIs.

INPUT_PASSWORD 

Similar to INPUT_TEXT, but suggestions and auto-correct will not be present.

Note
Does not automatically mask characters. CYIPasswordTextEditView must be used for masked input.
See also
CYIPasswordTextEditView

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.

See also
Receiver::GetReturnKeyType
Receiver::SetReturnKeyType
Enumerator
RETURN_KEY_DEFAULT 

Display the system's default return key. The keyboard will be dismissed when pressed.

RETURN_KEY_GO 

The keyboard will be dismissed when pressed.

RETURN_KEY_SEARCH 

The keyboard will be dismissed when pressed.

RETURN_KEY_NEXT 

The system will attempt to activate the next input field. If there is no next field, the keyboard will be dismissed.

RETURN_KEY_DONE 

The keyboard will be dismissed when pressed.

Constructor & Destructor Documentation

CYIKeyboardInputBridge::CYIKeyboardInputBridge ( )
virtual CYIKeyboardInputBridge::~CYIKeyboardInputBridge ( )
virtual

Member Function Documentation

Receiver* CYIKeyboardInputBridge::GetCurrentReceiver ( )

Returns the current receiver of keyboard input, if there is one.

virtual bool CYIKeyboardInputBridge::HideKeyboard ( )
virtual

Request the system software keyboard be hidden. Returns true if the keyboard was sucessfully hidden.

virtual bool CYIKeyboardInputBridge::HideKeyboardInternal ( )
protectedpure virtual
void CYIKeyboardInputBridge::HideSelectionMenu ( )

Call this to let the system hide a menu pertaining to the current selection.

virtual void CYIKeyboardInputBridge::HideSelectionMenuInternal ( )
protectedpure virtual
bool CYIKeyboardInputBridge::IsHardwareKeyboardAvailable ( ) const

Returns true if a hardware keyboard is available.

virtual bool CYIKeyboardInputBridge::IsHardwareKeyboardAvailableInternal ( ) const
protectedpure virtual
bool CYIKeyboardInputBridge::IsKeyboardShowing ( ) const

Returns true if the software keyboard is currently showing.

virtual bool CYIKeyboardInputBridge::IsKeyboardShowingInternal ( ) const
protectedpure virtual
void CYIKeyboardInputBridge::OnCursorPositionChanged ( int32_t  nCursor,
Receiver pSource 
)

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.

Note
Calling this when the pSource is not the current receiver may not be desirable in all cases because the platform keyboard is not expecting cursor position changes from a receiver other than the current.
See also
GetCurrentReceiver
virtual void CYIKeyboardInputBridge::OnCursorPositionChangedInternal ( int32_t  nStart,
int32_t  nEnd 
)
protectedpure virtual
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.

Note
Calling this when the pSource is not the current receiver may not be desirable in all cases because the platform keyboard is not expecting cursor position changes from a receiver other than the current.
See also
GetCurrentReceiver
virtual void CYIKeyboardInputBridge::OnCursorPositionWillChangeInternal ( )
protectedpure virtual
virtual void CYIKeyboardInputBridge::OnKeyboardHidden ( )
protectedvirtual
virtual void CYIKeyboardInputBridge::OnKeyboardShown ( )
protectedvirtual
void CYIKeyboardInputBridge::OnTextChanged ( const CYIString text,
Receiver pSource 
)

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.

Note
Calling this when the pSource is not the current receiver may not be desirable in all cases because the platform keyboard is not expecting text changes from a receiver other than the current.
See also
GetCurrentReceiver
virtual void CYIKeyboardInputBridge::OnTextChangedInternal ( const CYIString rText)
protectedpure virtual
void CYIKeyboardInputBridge::ResetKeyboard ( Receiver pSource)

Request that the contents of the keyboard be reset.

virtual void CYIKeyboardInputBridge::ResetKeyboardInternal ( )
protectedpure virtual
virtual bool CYIKeyboardInputBridge::ShowKeyboard ( Receiver pSource)
virtual

Request that the system software keyboard be displayed. Returns true if the keyboard was successfully displayed.

virtual bool CYIKeyboardInputBridge::ShowKeyboardInternal ( Receiver pSource)
protectedpure virtual
void CYIKeyboardInputBridge::ShowSelectionMenu ( bool  bTextSelected,
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.

virtual void CYIKeyboardInputBridge::ShowSelectionMenuInternal ( bool  bTextSelected,
YI_RECT  rect 
)
protectedpure virtual

Member Data Documentation

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.


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