- Currently, only Underline is supported for Preedit style.
But, Highlight and Reverse style should be added later.
- Added PreeditStyle::NONE as default preedit style.
Change-Id: I7fe9e3258eba425e8ad408c6c6222d96f54e162d
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
controller->GetText( text );
DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
+ // for coverage
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::UNDERLINE );
+
// Send PRE_EDIT event
imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "wo", 6, 2 );
controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
const std::string& GetSurroundingText() const;
void ApplyOptions( const InputMethodOptions& options );
bool FilterEventKey( const Dali::KeyEvent& keyEvent );
+ void SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type );
+ Dali::InputMethodContext::PreeditStyle GetPreeditStyle() const;
public: // Signals
ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
InputMethodOptions mOptions;
+ Dali::InputMethodContext::PreeditStyle mPreeditStyle;
ActivatedSignalType mActivatedSignal;
KeyboardEventSignalType mEventSignal;
: mIMFCursorPosition( 0 ),
mSurroundingText(),
mRestoreAfterFocusLost( false ),
- mIdleCallbackConnected( false )
+ mIdleCallbackConnected( false ),
+ mPreeditStyle( Dali::InputMethodContext::PreeditStyle::NONE )
{
CreateContext( /*ecoreXwin*/ );
ConnectCallbacks();
{
return false;
}
+
+void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
+{
+ mPreeditStyle = type;
+}
+
+Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
+{
+ return mPreeditStyle;
+}
} // Adaptor
} // Internal
return Internal::Adaptor::InputMethodContext::GetImplementation(*this).FilterEventKey( keyEvent );
}
+void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
+{
+ Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetPreeditStyle( type );
+}
+
+Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
+{
+ return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetPreeditStyle();
+}
+
+// Signals
InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal()
{
return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal();
public:
/**
- * @brief Events that are generated by the input method context.
+ * @brief The direction of text.
+ */
+ enum TextDirection
+ {
+ LeftToRight,
+ RightToLeft,
+ };
+
+ /**
+ * @brief Events that are generated by the InputMethodContext.
*/
enum EventType
{
};
/**
- * @brief This structure is used to pass on data from the input method cotext regarding predictive text.
+ * @brief Enumeration for state of the input panel.
+ */
+ enum State
+ {
+ DEFAULT = 0, ///< Unknown state
+ SHOW, ///< Input panel is shown
+ HIDE, ///< Input panel is hidden
+ WILL_SHOW ///< Input panel in process of being shown
+ };
+
+ /**
+ * @brief Enumeration for the type of Keyboard.
+ */
+ enum KeyboardType
+ {
+ SOFTWARE_KEYBOARD, ///< Software keyboard (Virtual keyboard) is default
+ HARDWARE_KEYBOARD ///< Hardware keyboard
+ };
+
+ /**
+ * @brief Enumeration for the language mode of the input panel.
+ */
+ enum class InputPanelLanguage
+ {
+ AUTOMATIC, ///< IME Language automatically set depending on the system display
+ ALPHABET ///< Latin alphabet at all times
+ };
+
+ /**
+ * @brief Enumeration for the preedit style types.
+ */
+ enum class PreeditStyle
+ {
+ NONE, ///< None style
+ UNDERLINE, ///< Underline substring style
+ REVERSE, ///< Reverse substring style
+ HIGHLIGHT ///< Highlight substring style
+ };
+
+ /**
+ * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text.
*/
struct EventData
{
*/
bool FilterEventKey( const Dali::KeyEvent& keyEvent );
+ /**
+ * @brief Sets the preedit type.
+ *
+ * @param[in] type The preedit style type
+ */
+ void SetPreeditStyle( PreeditStyle type );
+
+ /**
+ * @brief Gets the preedit type.
+ *
+ * @return The preedit style type
+ */
+ PreeditStyle GetPreeditStyle() const;
+
public:
// Signals
mEventData->mPreEditFlag &&
( 0u != mModel->mVisualModel->mCharactersToGlyph.Count() ) )
{
- // Add the underline for the pre-edit text.
- const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
+ Dali::InputMethodContext::PreeditStyle type = mEventData->mInputMethodContext.GetPreeditStyle();
- const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mEventData->mPreEditStartPosition );
- const CharacterIndex lastPreEditCharacter = mEventData->mPreEditStartPosition + ( ( mEventData->mPreEditLength > 0u ) ? mEventData->mPreEditLength - 1u : 0u );
- const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter );
- const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u );
+ switch( type )
+ {
+ case Dali::InputMethodContext::PreeditStyle::UNDERLINE:
+ {
+ // Add the underline for the pre-edit text.
+ const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
- GlyphRun underlineRun;
- underlineRun.glyphIndex = glyphStart;
- underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
+ const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mEventData->mPreEditStartPosition );
+ const CharacterIndex lastPreEditCharacter = mEventData->mPreEditStartPosition + ( ( mEventData->mPreEditLength > 0u ) ? mEventData->mPreEditLength - 1u : 0u );
+ const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter );
+ const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u );
- // TODO: At the moment the underline runs are only for pre-edit.
- mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = glyphStart;
+ underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
+
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ // TODO : At this moment, other styles for preedit are not implemented yet.
+ case Dali::InputMethodContext::PreeditStyle::REVERSE:
+ case Dali::InputMethodContext::PreeditStyle::HIGHLIGHT:
+ case Dali::InputMethodContext::PreeditStyle::NONE:
+ default:
+ break;
+ }
}
// The estimated number of lines. Used to avoid reallocations when layouting.