X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Finput-method-context.h;h=d33464655038ac33242fa833cc1dee15c5873cb1;hb=97568a209c309d5f99bf288afa951a77f7fdcddd;hp=85f754a280db02bfb6a135a658c06bcee5f3f993;hpb=c77f94d478f3897389f85c589d898f3864c44028;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/devel-api/adaptor-framework/input-method-context.h b/dali/devel-api/adaptor-framework/input-method-context.h old mode 100755 new mode 100644 index 85f754a..d334646 --- a/dali/devel-api/adaptor-framework/input-method-context.h +++ b/dali/devel-api/adaptor-framework/input-method-context.h @@ -2,7 +2,7 @@ #define DALI_INPUT_METHOD_CONTEXT_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,23 +19,23 @@ */ // EXTERNAL INCLUDES +#include #include // EXTERNAL INCLUDES +#include #include #include -#include namespace Dali { - namespace Internal DALI_INTERNAL { namespace Adaptor { class InputMethodContext; } -} +} // namespace DALI_INTERNAL class Actor; @@ -47,14 +47,13 @@ class Actor; class DALI_ADAPTOR_API InputMethodContext : public BaseHandle { public: - /** - * @brief The direction of text. - */ + * @brief The direction of text. + */ enum TextDirection { - LeftToRight, - RightToLeft, + LEFT_TO_RIGHT, + RIGHT_TO_LEFT, }; /** @@ -62,12 +61,12 @@ public: */ enum EventType { - VOID, ///< No event - PRE_EDIT, ///< Pre-Edit changed - COMMIT, ///< Commit recieved - DELETE_SURROUNDING, ///< Event to delete a range of characters from the string - GET_SURROUNDING, ///< Event to query string and cursor position - PRIVATE_COMMAND ///< Private command sent from the input panel + VOID, ///< No event + PRE_EDIT, ///< Pre-Edit changed + COMMIT, ///< Commit recieved + DELETE_SURROUNDING, ///< Event to delete a range of characters from the string + GET_SURROUNDING, ///< Event to query string and cursor position + PRIVATE_COMMAND ///< Private command sent from the input panel }; /** @@ -75,10 +74,10 @@ public: */ 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 + DEFAULT = 0, ///< Unknown state + SHOW, ///< Input panel is shown + HIDE, ///< Input panel is hidden + WILL_SHOW ///< Input panel in process of being shown }; /** @@ -86,14 +85,49 @@ public: */ enum KeyboardType { - SOFTWARE_KEYBOARD, ///< Software keyboard (Virtual keyboard) is default - HARDWARE_KEYBOARD ///< Hardware keyboard + 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 + 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 + CUSTOM_PLATFORM_STYLE_1, ///< Custom style for platform + CUSTOM_PLATFORM_STYLE_2, ///< Custom style for platform + CUSTOM_PLATFORM_STYLE_3, ///< Custom style for platform + CUSTOM_PLATFORM_STYLE_4 ///< Custom style for platform + }; + + /** + * @brief This structure is for the preedit style types and indices. + */ + struct PreeditAttributeData + { + PreeditAttributeData() + : preeditType(PreeditStyle::NONE), + startIndex(0), + endIndex(0) + { + } + + PreeditStyle preeditType; /// The preedit style type + unsigned int startIndex; /// The start index of preedit + unsigned int endIndex; /// The end index of preedit }; /** @@ -106,11 +140,9 @@ public: */ EventData() : predictiveString(), - eventName( VOID ), - cursorOffset( 0 ), - numberOfChars ( 0 ) - { - }; + eventName(VOID), + cursorOffset(0), + numberOfChars(0){}; /** * @brief Constructor @@ -120,19 +152,19 @@ public: * @param[in] aCursorOffset Start position from the current cursor position to start deleting characters. * @param[in] aNumberOfChars The number of characters to delete from the cursorOffset. */ - EventData( EventType aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars ) - : predictiveString( aPredictiveString ), - eventName( aEventName ), - cursorOffset( aCursorOffset ), - numberOfChars( aNumberOfChars ) + EventData(EventType aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars) + : predictiveString(aPredictiveString), + eventName(aEventName), + cursorOffset(aCursorOffset), + numberOfChars(aNumberOfChars) { } // Data std::string predictiveString; ///< The pre-edit or commit string. - EventType eventName; ///< The name of the event from the InputMethodContext. - int cursorOffset; ///< Start position from the current cursor position to start deleting characters. - int numberOfChars; ///< number of characters to delete from the cursorOffset. + EventType eventName; ///< The name of the event from the InputMethodContext. + int cursorOffset; ///< Start position from the current cursor position to start deleting characters. + int numberOfChars; ///< number of characters to delete from the cursorOffset. }; /** @@ -145,9 +177,9 @@ public: */ CallbackData() : currentText(), - cursorPosition( 0 ), - update( false ), - preeditResetRequired( false ) + cursorPosition(0), + update(false), + preeditResetRequired(false) { } @@ -158,31 +190,32 @@ public: * @param[in] aCurrentText current text string * @param[in] aPreeditResetRequired flag if preedit reset is required. */ - CallbackData( bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired ) - : currentText( aCurrentText ), - cursorPosition( aCursorPosition ), - update( aUpdate ), - preeditResetRequired( aPreeditResetRequired ) + CallbackData(bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired) + : currentText(aCurrentText), + cursorPosition(aCursorPosition), + update(aUpdate), + preeditResetRequired(aPreeditResetRequired) { } - std::string currentText; ///< current text string - int cursorPosition; ///< new position of cursor - bool update :1; ///< if cursor position needs to be updated - bool preeditResetRequired :1; ///< flag if preedit reset is required. + std::string currentText; ///< current text string + int cursorPosition; ///< new position of cursor + bool update : 1; ///< if cursor position needs to be updated + bool preeditResetRequired : 1; ///< flag if preedit reset is required. }; - typedef Signal< void (InputMethodContext&) > ActivatedSignalType; ///< Keyboard actived signal - typedef Signal< CallbackData ( InputMethodContext&, const EventData& ) > KeyboardEventSignalType; ///< keyboard events - typedef Signal< void () > VoidSignalType; - typedef Signal< void ( bool ) > StatusSignalType; - typedef Signal< void ( KeyboardType ) > KeyboardTypeSignalType; ///< keyboard type - typedef Signal< void ( int ) > KeyboardResizedSignalType; ///< Keyboard resized signal - typedef Signal< void ( int ) > LanguageChangedSignalType; ///< Language changed signal - typedef Signal< void ( const std::string&, const std::string&, const std::string& ) > ContentReceivedSignalType; ///< Content received signal + typedef Signal ActivatedSignalType; ///< Keyboard actived signal + typedef Signal KeyboardEventSignalType; ///< keyboard events + typedef Signal VoidSignalType; + typedef Signal StatusSignalType; + typedef Signal KeyboardTypeSignalType; ///< keyboard type + typedef Signal KeyboardResizedSignalType; ///< Keyboard resized signal + typedef Signal LanguageChangedSignalType; ///< Language changed signal + typedef Signal ContentReceivedSignalType; ///< Content received signal -public: + using PreEditAttributeDataContainer = Vector; +public: /** * @brief Retrieve a handle to the instance of InputMethodContext. * @return A handle to the InputMethodContext. @@ -207,14 +240,14 @@ public: * * @param[in] actor The actor that uses the new InputMethodContext instance. */ - static InputMethodContext New( Actor actor ); + static InputMethodContext New(Actor actor); /** * @brief Copy constructor. * * @param[in] inputMethodContext InputMethodContext to copy. The copied inputMethodContext will point at the same implementation. */ - InputMethodContext( const InputMethodContext& inputMethodContext ); + InputMethodContext(const InputMethodContext& inputMethodContext); /** * @brief Assignment operator. @@ -222,7 +255,7 @@ public: * @param[in] inputMethodContext The InputMethodContext to assign from. * @return The updated InputMethodContext. */ - InputMethodContext& operator=( const InputMethodContext& inputMethodContext ); + InputMethodContext& operator=(const InputMethodContext& inputMethodContext); /** * @brief Downcast a handle to InputMethodContext handle. @@ -233,10 +266,9 @@ public: * @param[in] handle Handle to an object. * @return Handle to an InputMethodContext or an uninitialized handle. */ - static InputMethodContext DownCast( BaseHandle handle ); + static InputMethodContext DownCast(BaseHandle handle); public: - /** * @brief Finalize the InputMethodContext. * @@ -272,7 +304,7 @@ public: * * @param[in] toggle True means that keyboard should be restored after focus lost and regained. */ - void SetRestoreAfterFocusLost( bool toggle ); + void SetRestoreAfterFocusLost(bool toggle); /** * @brief Send message reset the pred-edit state / InputMethodContext module. @@ -291,7 +323,7 @@ public: * * @param[in] cursorPosition position of cursor */ - void SetCursorPosition( unsigned int cursorPosition ); + void SetCursorPosition(unsigned int cursorPosition); /** * @brief Gets cursor position stored in VirtualKeyboard, this is required by the InputMethodContext. @@ -305,7 +337,7 @@ public: * * @param[in] text The text string surrounding the current cursor point. */ - void SetSurroundingText( const std::string& text ); + void SetSurroundingText(const std::string& text); /** * @brief Gets current text string set within the InputMethodContext manager, this is used to offer predictive suggestions. @@ -319,7 +351,7 @@ public: * * @param[in] multiLine True if multiline text input is used */ - void NotifyTextInputMultiLine( bool multiLine ); + void NotifyTextInputMultiLine(bool multiLine); /** * @brief Returns text direction of the keyboard's current input language. @@ -342,13 +374,13 @@ public: * @brief Set one or more of the Input Method options * @param[in] options The options to be applied */ - void ApplyOptions( const InputMethodOptions& options ); + void ApplyOptions(const InputMethodOptions& options); /** * @brief Sets up the input-panel specific data. * @param[in] data The specific data to be set to the input panel */ - void SetInputPanelData( const std::string& data ); + void SetInputPanelData(const std::string& data); /** * @brief Gets the specific data of the current active input panel. @@ -358,7 +390,7 @@ public: * It is just used to get a specific data from the input panel to an application. * @param[in] data The specific data to be got from the input panel */ - void GetInputPanelData( std::string& data ); + void GetInputPanelData(std::string& data); /** * @brief Gets the state of the current active input panel. @@ -372,13 +404,13 @@ public: * The default is true. * @param[in] visible True if the return key is visible(enabled), false otherwise. */ - void SetReturnKeyState( bool visible ); + void SetReturnKeyState(bool visible); /** * @brief Enable to show the input panel automatically when focused. * @param[in] enabled If true, the input panel will be shown when focused */ - void AutoEnableInputPanel( bool enabled ); + void AutoEnableInputPanel(bool enabled); /** * @brief Shows the input panel. @@ -414,7 +446,7 @@ public: * You can receive a media content URI and its MIME type from ContentReceivedSignal(). @see ContentReceivedSignal * @param[in] mimeTypes The allowed MIME types */ - void SetContentMIMETypes( const std::string& mimeTypes ); + void SetContentMIMETypes(const std::string& mimeTypes); /** * @brief Process event key down or up, whether filter a key to isf. @@ -422,14 +454,14 @@ public: * @param[in] keyEvent The event key to be handled. * @return Whether the event key is handled. */ - bool FilterEventKey( const Dali::KeyEvent& keyEvent ); + bool FilterEventKey(const Dali::KeyEvent& keyEvent); /** * @brief Sets whether the IM context should allow to use the text prediction. * * @param[in] prediction Whether to allow text prediction or not. */ - void AllowTextPrediction( bool prediction ); + void AllowTextPrediction(bool prediction); /** * @brief Gets whether the IM context allow to use the text prediction. @@ -444,7 +476,7 @@ public: * This method can be used when you want to show the English keyboard. * @param[in] language The language to be set to the input panel */ - void SetInputPanelLanguage( InputPanelLanguage language ); + void SetInputPanelLanguage(InputPanelLanguage language); /** * @brief Gets the language of the input panel. @@ -459,10 +491,16 @@ public: * @param[in] x The top-left x coordinate of the input panel * @param[in] y The top-left y coordinate of the input panel */ - void SetInputPanelPosition( unsigned int x, unsigned int y ); + void SetInputPanelPosition(unsigned int x, unsigned int y); -public: + /** + * @brief Gets the preedit attributes data. + * + * @param[out] attrs The preedit attributes data. + */ + void GetPreeditStyle(PreEditAttributeDataContainer& attrs) const; +public: // Signals /** @@ -545,18 +583,14 @@ public: ContentReceivedSignalType& ContentReceivedSignal(); public: - /** * @brief This constructor is used by InputMethodContext::New(). * * @param[in] inputMethodContext A pointer to the InputMethodContext. */ - explicit DALI_INTERNAL InputMethodContext( Internal::Adaptor::InputMethodContext* inputMethodContext ); - + explicit DALI_INTERNAL InputMethodContext(Internal::Adaptor::InputMethodContext* inputMethodContext); }; - - } // namespace Dali #endif // DALI_INPUT_METHOD_CONTEXT_H