X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-input-method-context.h;h=deb9a2d2511051b1c04ba172f60d5738cc4fc847;hp=cb4e085f2c7cb85739295e30ac87c708a44df254;hb=bee78157f19fa54ae961081782a2f6537cc8dd5a;hpb=aff52b6dbc13a5be62bbd5db2e4c76d3746d9e40 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h index cb4e085..deb9a2d 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H__ -#define __DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H__ +#ifndef DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H +#define DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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,7 +19,8 @@ */ // EXTERNAL INCLUDES -#define __DALI_INPUT_METHOD_CONTEXT_H__ +#define DALI_INPUT_METHOD_CONTEXT_H +#include #include #include #include @@ -46,20 +47,91 @@ class InputMethodContext : public BaseHandle 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 { - 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 + SELECTION_SET ///< input method needs to set the selection + }; + + /** + * @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 + 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 }; /** - * @brief This structure is used to pass on data from the input method cotext regarding predictive text. + * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text. */ struct EventData { @@ -70,7 +142,9 @@ public: : predictiveString(), eventName( VOID ), cursorOffset( 0 ), - numberOfChars ( 0 ) + numberOfChars ( 0 ), + startIndex ( 0 ), + endIndex ( 0 ) { }; @@ -86,15 +160,36 @@ public: : predictiveString( aPredictiveString ), eventName( aEventName ), cursorOffset( aCursorOffset ), - numberOfChars( aNumberOfChars ) + numberOfChars( aNumberOfChars ), + startIndex ( 0 ), + endIndex ( 0 ) + { + } + + /** + * @brief Constructor + * + * @param[in] aEventName The name of the event from the InputMethodContext. + * @param[in] aStartIndex The start index of selection. + * @param[in] aEndIndex The end index of selection. + */ + EventData(EventType aEventName, int aStartIndex, int aEndIndex) + : predictiveString(), + eventName(aEventName), + cursorOffset(0), + numberOfChars(0), + startIndex(aStartIndex), + endIndex(aEndIndex) { } // Data std::string predictiveString; ///< The pre-edit or commit string. - EventType eventName; ///< The name of the event from the input method context. + EventType eventName; ///< The name of the event from the input method context. int cursorOffset; ///< Start position from the current cursor position to start deleting characters. int numberOfChars; ///< number of characters to delete from the cursorOffset. + int startIndex; ///< The start index of selection. + int endIndex; ///< The end index of selection. }; /** @@ -139,6 +234,8 @@ public: typedef Signal< void () > VoidSignalType; typedef Signal< void (bool) > StatusSignalType; + using PreEditAttributeDataContainer = Vector< Dali::InputMethodContext::PreeditAttributeData >; + public: /** @@ -148,6 +245,14 @@ public: static InputMethodContext New(); /** + * @brief Create a handle to the instance of InputMethodContext. + * + * @param[in] actor The actor that uses the new InputMethodContext instance. + * @return A handle to the InputMethodContext. + */ + static InputMethodContext New( Actor actor ); + + /** * @brief Finalize the InputMethodContext. * * It means that the context will be deleted. @@ -243,6 +348,20 @@ public: */ 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 attributes data. + * + * @param[out] attrs The preedit attributes data. + */ + void GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const; + public: // Signals @@ -306,4 +425,4 @@ public: } // namespace Dali -#endif // __DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H__ +#endif // DALI_TOOLKIT_TOOLKIT_INPUT_METHOD_CONTEXT_H