X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-imf-manager.h;h=70493542a4e5be2603ccb95198692d059d999489;hb=a68dbe03813fd3db34c81f4e6960572e8882930b;hp=2da670a2952ee1edce32e32ac6a07eb40956115c;hpb=30f6ca1e541089b19f2b349a8a12d8a5bcaf2f9e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h index 2da670a..7049354 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.h @@ -1,26 +1,27 @@ -#ifndef _DALI_ADAPTOR_IMF_MANAGER_H_ -#define _DALI_ADAPTOR_IMF_MANAGER_H_ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +#ifndef __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__ +#define __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__ + +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // EXTERNAL INCLUDES -#define IMFMANAGER_H +#define __DALI_IMF_MANAGER_H__ #include -#include +#include namespace Dali DALI_IMPORT_API { @@ -33,194 +34,229 @@ class ImfManager; } } -typedef void* ImfContext; - /** * @brief The ImfManager class + * * Specifically manages the ecore input method framework which enables the virtual or hardware keyboards. */ class ImfManager : public BaseHandle { public: + /** + * @brief Events that are generated by the IMF. + */ enum ImfEvent { - VOID, - PREEDIT, - COMMIT, - DELETESURROUNDING, - GETSURROUNDING + VOID, ///< No event + PREEDIT, ///< Pre-Edit changed + COMMIT, ///< Commit recieved + DELETESURROUNDING, ///< Event to delete a range of characters from the string + GETSURROUNDING ///< Event to query string and cursor position }; /** - * This structure is used to pass on data from the IMF regarding predictive text. + * @brief This structure is used to pass on data from the IMF regarding predictive text. */ struct ImfEventData { /** - * Default Constructor. + * @brief Default Constructor. */ ImfEventData() - : eventName( VOID ), - predictiveString(""), + : predictiveString(), + eventName( VOID ), cursorOffset( 0 ), numberOfChars ( 0 ) { }; /** - * Constructor + * @brief Constructor + * * @param[in] aEventName The name of the event from the IMF. * @param[in] aPredictiveString The pre-edit or commit string. * @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. */ - ImfEventData(ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset,int aNumberOfChars ) - : eventName(aEventName), predictiveString(aPredictiveString), cursorOffset( aCursorOffset ), numberOfChars( aNumberOfChars ) + ImfEventData( ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars ) + : predictiveString( aPredictiveString ), + eventName( aEventName ), + cursorOffset( aCursorOffset ), + numberOfChars( aNumberOfChars ) { } // Data - ImfEvent eventName; // The name of the event from the IMF. - std::string predictiveString; // The pre-edit or commit string. - int cursorOffset; // Start position from the current cursor position to start deleting characters. - int numberOfChars; //number of characters to delete from the cursorOffset. + std::string predictiveString; ///< The pre-edit or commit string. + ImfEvent eventName; ///< The name of the event from the IMF. + int cursorOffset; ///< Start position from the current cursor position to start deleting characters. + int numberOfChars; ///< number of characters to delete from the cursorOffset. }; /** - * Data required my IMF from the callback + * @brief Data required by IMF from the callback */ struct ImfCallbackData { - ImfCallbackData( ) - : update( false ), cursorPosition( 0 ), preeditResetRequired ( false ) + /** + * @brief Constructor + */ + ImfCallbackData() + : currentText(), + cursorPosition( 0 ), + update( false ), + preeditResetRequired( false ) { } - ImfCallbackData(bool aUpdate, int aCursorPosition, std::string aCurrentText, bool aPreeditResetRequired ) - : update(aUpdate), cursorPosition(aCursorPosition), currentText( aCurrentText ), preeditResetRequired( aPreeditResetRequired ) + /** + * @brief Constructor + * @param[in] aUpdate True if cursor position needs to be updated + * @param[in] aCursorPosition new position of cursor + * @param[in] aCurrentText current text string + * @param[in] aPreeditResetRequired flag if preedit reset is required. + */ + ImfCallbackData( bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired ) + : currentText( aCurrentText ), + cursorPosition( aCursorPosition ), + update( aUpdate ), + preeditResetRequired( aPreeditResetRequired ) { } - bool update; // if cursor position needs to be updated - int cursorPosition; // new position of cursor - std::string currentText; // current text string - bool preeditResetRequired; // 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 SignalV2< void (ImfManager&) > ImfManagerSignalV2; - - typedef SignalV2< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalV2; + typedef Signal< void (ImfManager&) > ImfManagerSignalType; ///< Keyboard actived signal + typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType; ///< keyboard events public: /** - * Retrieve a handle to the instance of ImfManager. + * @brief Retrieve a handle to the instance of ImfManager. * @return A handle to the ImfManager. */ static ImfManager Get(); /** - * Get the current imf context. - * @return current imf context. - */ - ImfContext GetContext(); - - /** - * Activate the IMF. + * @brief Activate the IMF. + * * It means that the text editing is started at somewhere. * If the H/W keyboard isn't connected then it will show the virtual keyboard. */ void Activate(); /** - * Deactivate the IMF. + * @brief Deactivate the IMF. + * * It means that the text editing is finished at somewhere. */ void Deactivate(); /** - * Get the restoration status, which controls if the keyboard is restored after the focus lost then regained. + * @brief Get the restoration status, which controls if the keyboard is restored after the focus lost then regained. + * * If true then keyboard will be restored (activated) after focus is regained. * @return restoration status. */ bool RestoreAfterFocusLost() const; /** - * Set status whether the IMF has to restore the keyboard after losing focus. + * @brief Set status whether the IMF has to restore the keyboard after losing focus. + * * @param[in] toggle True means that keyboard should be restored after focus lost and regained. */ - void SetRestoreAferFocusLost( bool toggle ); + void SetRestoreAfterFocusLost( bool toggle ); /** - * Send message reset the pred-edit state / imf module. Used to interupt pre-edit state maybe due to a touch input. + * @brief Send message reset the pred-edit state / imf module. + * + * Used to interupt pre-edit state maybe due to a touch input. */ void Reset(); /** - * Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation + * @brief Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation. */ void NotifyCursorPosition(); /** - * Sets cursor position stored in VirtualKeyboard, this is required by the IMF context + * @brief Sets cursor position stored in VirtualKeyboard, this is required by the IMF context. + * * @param[in] cursorPosition position of cursor */ void SetCursorPosition( unsigned int cursorPosition ); /** - * Gets cursor position stored in VirtualKeyboard, this is required by the IMF context + * @brief Gets cursor position stored in VirtualKeyboard, this is required by the IMF context. + * * @return current position of cursor */ - int GetCursorPosition(); + unsigned int GetCursorPosition() const; /** - * Method to store the string required by the IMF, this is used to provide predictive word suggestions. + * @brief Method to store the string required by the IMF, this is used to provide predictive word suggestions. + * * @param[in] text The text string surrounding the current cursor point. */ - void SetSurroundingText( std::string text ); + void SetSurroundingText( const std::string& text ); /** - * Gets current text string set within the IMF manager, this is used to offer predictive suggestions + * @brief Gets current text string set within the IMF manager, this is used to offer predictive suggestions. + * * @return current position of cursor */ - std::string GetSurroundingText(); + const std::string& GetSurroundingText() const; + + /** + * @brief Notifies IMF context that text input is set to multi line or not + */ + void NotifyTextInputMultiLine( bool multiLine ); public: // Signals /** - * This is emitted when the virtual keyboard is connected to or the hardware keyboard is activated. + * @brief This is emitted when the virtual keyboard is connected to or the hardware keyboard is activated. + * * @return The IMF Activated signal. */ - ImfManagerSignalV2& ActivatedSignal(); + ImfManagerSignalType& ActivatedSignal(); /** - * This is emitted when the IMF manager receives an event from the IMF + * @brief This is emitted when the IMF manager receives an event from the IMF. + * * @return The Event signal containing the event data. */ - ImfEventSignalV2& EventReceivedSignal(); + ImfEventSignalType& EventReceivedSignal(); // Construction & Destruction /** - * Constructor + * @brief Constructor. */ ImfManager(); /** - * Virtual destructor. + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. */ - virtual ~ImfManager(); + ~ImfManager(); /** - * This constructor is used by ImfManager::Get(). + * @brief This constructor is used by ImfManager::Get(). + * * @param[in] imfManager A pointer to the imf Manager. */ - ImfManager( Internal::Adaptor::ImfManager* imfManager ); + explicit ImfManager( Internal::Adaptor::ImfManager* imfManager ); }; } // namespace Dali -#endif // _DALI_ADAPTOR_IMF_MANAGER_H_ +#endif // __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__