X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fevents%2Fkey-event.h;h=d853c91c4ebc726ec1b22ecf9ad5a01853f6d7d1;hb=0b501ba800a263b97d99adf224fc42d0c2aa8b37;hp=8aaadad38994158bd6fb03bf03ba7ee323e0ac35;hpb=8bccadc96b3773fb10c562a5ccdf1b071b2efe8e;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/events/key-event.h b/dali/public-api/events/key-event.h old mode 100755 new mode 100644 index 8aaadad..d853c91 --- a/dali/public-api/events/key-event.h +++ b/dali/public-api/events/key-event.h @@ -1,8 +1,8 @@ -#ifndef __DALI_KEY_EVENT_H__ -#define __DALI_KEY_EVENT_H__ +#ifndef DALI_KEY_EVENT_H +#define DALI_KEY_EVENT_H /* - * Copyright (c) 2018 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,21 +19,28 @@ */ // EXTERNAL INCLUDES +#include // int32_t #include // INTERNAL INCLUDES #include #include +#include namespace Dali { +namespace Internal DALI_INTERNAL +{ +class KeyEvent; +} + /** * @addtogroup dali_core_events * @{ */ /** - * @brief The key event structure is used to store a key press. + * @brief The key event class is used to store a key press. * * It facilitates processing of these key presses and passing to other * libraries like Toolkit. The keyString is the actual character you @@ -47,54 +54,60 @@ namespace Dali * module. * @SINCE_1_0.0 */ -struct DALI_CORE_API KeyEvent +class DALI_CORE_API KeyEvent : public BaseHandle { +public: // Enumerations /** * @brief Enumeration for specifying the state of the key event. - * @SINCE_1_0.0 + * @SINCE_1_9.27 */ enum State { - Down, ///< Key down @SINCE_1_0.0 - Up, ///< Key up @SINCE_1_0.0 - Last + DOWN, ///< Key down @SINCE_1_9.27 + UP, ///< Key up @SINCE_1_9.27 }; /** - * @brief Default constructor. + * @brief An uninitialized KeyEvent instance. + * + * Calling member functions with an uninitialized KeyEvent handle is not allowed. * @SINCE_1_0.0 */ KeyEvent(); /** - * @brief Constructor. + * @brief Copy constructor. + * @SINCE_1_2.36 + * @param[in] rhs A reference to the copied handle + */ + KeyEvent(const KeyEvent& rhs); + + /** + * @brief Move constructor. * - * @SINCE_1_0.0 - * @param[in] keyName The name of the key pressed or command from the IMF, if later then the some following parameters will be needed - * @param[in] keyString A string of input characters or key pressed - * @param[in] keyCode The unique key code for the key pressed - * @param[in] keyModifier The key modifier for special keys like shift and alt - * @param[in] timeStamp The time (in ms) that the key event occurred - * @param[in] keyState The state of the key event + * @SINCE_1_9.27 + * @param[in] rhs A reference to the moved handle */ - KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, unsigned long timeStamp, const State& keyState); + KeyEvent(KeyEvent&& rhs) noexcept; /** - * @brief Copy constructor. + * @brief Copy assignment operator. * @SINCE_1_2.36 * @param[in] rhs A reference to the copied handle + * @return A reference to this */ - KeyEvent( const KeyEvent& rhs ); + KeyEvent& operator=(const KeyEvent& rhs); /** - * @brief Assignment operator. - * @SINCE_1_2.36 - * @param[in] rhs A reference to the copied handle + * @brief Move assignment operator. + * + * @SINCE_1_9.27 + * @param[in] rhs A reference to the moved handle * @return A reference to this */ - KeyEvent& operator=( const KeyEvent& rhs ); + KeyEvent& operator=(KeyEvent&& rhs) noexcept; /** * @brief Destructor. @@ -129,18 +142,18 @@ struct DALI_CORE_API KeyEvent /** * @brief Get the key compose string. * - * @SINCE_1_3.22 + * @SINCE_1_9.27 * @return The compose string */ - std::string GetCompose() const; + const std::string& GetCompose() const; /** * @brief Get the device name the key event originated from. * - * @SINCE_1_2.60 + * @SINCE_1_9.27 * @return The device name */ - std::string GetDeviceName() const; + const std::string& GetDeviceName() const; /** * @brief Get the device class the key event originated from. @@ -160,45 +173,82 @@ struct DALI_CORE_API KeyEvent */ Device::Subclass::Type GetDeviceSubclass() const; - // Data + /** + * @brief Get the name given to the key pressed or command from the IMF + * + * @SINCE_1_9.27 + * @return The name given to the key pressed. + */ + const std::string& GetKeyName() const; /** - * @brief Name given to the key pressed. + * @brief Get the actual string of input characters that should be used for input editors. + * + * @SINCE_1_9.27 + * @return The actual string of input characters */ - std::string keyPressedName; + const std::string& GetKeyString() const; /** - * @brief The actual string returned that should be used for input editors. + * @brief Gets the logical key string. + * + * For example, when the user presses 'shift' key and '1' key together, the logical key is "exclamation". + * Plus, the key name is "1", and the key string is "!". + * + * @SINCE_1_9.27 + * @return The logical key symbol */ - std::string keyPressed; + const std::string& GetLogicalKey() const; /** - * @brief Keycode for the key pressed. + * @brief Get the unique key code for the key pressed. * - * @remarks We recommend not to use this key code value - * directly because its meaning might be changed in the future. Currently, it means a - * platform-specific key code. You need to use IsKey() to know what a key event means - * instead of direct comparison of key code value. + * @SINCE_1_9.27 + * @return The unique key code for the key pressed + * + * @remarks We recommend not to use this key code value directly because its meaning + * might be changed in the future. Currently, it means a platform-specific key code. + * You need to use IsKey() to know what a key event means instead of direct comparison + * of key code value. */ - int keyCode; + int32_t GetKeyCode() const; /** - * @brief special keys like shift, alt and control which modify the next key pressed. + * @brief Return the key modifier for special keys like Shift, Alt and Ctrl which modify the next key pressed. + * + * @SINCE_1_9.27 + * @return The key modifier */ - int keyModifier; + int32_t GetKeyModifier() const; /** - * @brief The time (in ms) that the key event occurred. + * @brief Get the time (in ms) that the key event occurred. + * + * @SINCE_1_9.27 + * @return The time (in ms) */ - unsigned long time; + unsigned long GetTime() const; /** - * @brief State of the key event. + * @brief Get the state of the key event. * * @see State + * + * @SINCE_1_9.27 + * @return The state of the key event */ - State state; + State GetState() const; +public: // Not intended for application developers + /// @cond internal + /** + * @brief This constructor is used internally to Create an initialized KeyEvent handle. + * + * @SINCE_1_9.27 + * @param[in] keyEvent A pointer to a newly allocated Dali resource + */ + explicit DALI_INTERNAL KeyEvent(Internal::KeyEvent* keyEvent); + /// @endcond }; /** @@ -206,4 +256,4 @@ struct DALI_CORE_API KeyEvent */ } // namespace Dali -#endif // __DALI_KEY_EVENT_H__ +#endif // DALI_KEY_EVENT_H