- Added GetLogicalKey API to get the logical key.
(eg. '1' key of NumberPad -> logicalKey : "KP_1")
Change-Id: I1f0424d31646c310a1471f745e5172c8e9cdbbf1
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
Integration::KeyEvent keyEvent;
DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
DALI_TEST_CHECK( keyEvent.keyName == std::string() );
- DALI_TEST_CHECK( keyEvent.key == std::string() );
+ DALI_TEST_CHECK( keyEvent.logicalKey == std::string() );
DALI_TEST_CHECK( keyEvent.keyString == std::string() );
DALI_TEST_EQUALS( keyEvent.keyCode, -1, TEST_LOCATION );
DALI_TEST_EQUALS( keyEvent.keyModifier, 0, TEST_LOCATION );
{
const std::string keyName("keyName");
- const std::string key("key");
+ const std::string logicalKey("logicalKey");
const std::string keyString("keyString");
const int keyCode(333);
const int keyModifier(312);
const Device::Class::Type deviceClass = Device::Class::KEYBOARD;
const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE;
- Integration::KeyEvent keyEvent(keyName, key, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );
+ Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );
DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
DALI_TEST_CHECK( keyEvent.keyName == keyName );
- DALI_TEST_CHECK( keyEvent.key == key );
+ DALI_TEST_CHECK( keyEvent.logicalKey == logicalKey );
DALI_TEST_CHECK( keyEvent.keyString == keyString );
DALI_TEST_EQUALS( keyEvent.keyCode, keyCode, TEST_LOCATION );
DALI_TEST_EQUALS( keyEvent.keyModifier, keyModifier, TEST_LOCATION );
DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
DALI_TEST_CHECK( keyEvent.keyName == TEST_STRING_1 );
- DALI_TEST_CHECK( keyEvent.key == "" );
+ DALI_TEST_CHECK( keyEvent.logicalKey == "" );
DALI_TEST_CHECK( keyEvent.keyString == "i" );
DALI_TEST_EQUALS( keyEvent.keyCode, 99, TEST_LOCATION );
DALI_TEST_EQUALS( keyEvent.keyModifier, SHIFT_MODIFIER, TEST_LOCATION );
${CMAKE_CURRENT_SOURCE_DIR}/common/hash.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/stage-devel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/events/hit-test-algorithm.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/events/key-event-devel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/events/touch-data-devel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/images/distance-field.cpp
${CMAKE_CURRENT_SOURCE_DIR}/images/texture-set-image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/common/stage-devel.h
${CMAKE_CURRENT_SOURCE_DIR}/events/hit-test-algorithm.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/events/key-event-devel.h
${CMAKE_CURRENT_SOURCE_DIR}/events/touch-data-devel.h
${CMAKE_CURRENT_SOURCE_DIR}/events/mouse-button.h
--- /dev/null
+/*\r
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/devel-api/events/key-event-devel.h>\r
+#include <dali/internal/event/events/key-event-impl.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelKeyEvent\r
+{\r
+\r
+std::string GetLogicalKey( KeyEvent keyEvent )\r
+{\r
+ return GetImplementation( &keyEvent )->GetLogicalKey();\r
+}\r
+\r
+} // namespace DevelKeyEvent\r
+\r
+} // namespace Dali\r
+\r
--- /dev/null
+#ifndef DALI_KEY_EVENT_DEVEL_H\r
+#define DALI_KEY_EVENT_DEVEL_H\r
+\r
+/*\r
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/public-api/events/key-event.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelKeyEvent\r
+{\r
+\r
+/**\r
+ * @brief Gets the logical key string.\r
+ *\r
+ * For example, when the user presses 'shift' key and '1' key together, the logical key is "exclamation".\r
+ * Plus, the keyPressedName is "1", and the keyPressed is "!".\r
+ *\r
+ * @param[in] keyEvent The instance of KeyEvent.\r
+ * @return The logical key symbol\r
+ */\r
+DALI_CORE_API std::string GetLogicalKey( KeyEvent keyEvent );\r
+\r
+} // namespace DevelKeyEvent\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_KEY_EVENT_DEVEL_H\r
$(devel_api_src_dir)/common/hash.cpp \
$(devel_api_src_dir)/common/stage-devel.cpp \
$(devel_api_src_dir)/events/hit-test-algorithm.cpp \
+ $(devel_api_src_dir)/events/key-event-devel.cpp \
${devel_api_src_dir}/events/touch-data-devel.cpp \
$(devel_api_src_dir)/images/distance-field.cpp \
$(devel_api_src_dir)/images/texture-set-image.cpp \
devel_api_core_events_header_files = \
$(devel_api_src_dir)/events/hit-test-algorithm.h \
+ $(devel_api_src_dir)/events/key-event-devel.h \
${devel_api_src_dir}/events/touch-data-devel.h \
${devel_api_src_dir}/events/mouse-button.h
KeyEvent::KeyEvent()
: Event( Key ),
keyName(),
- key(),
+ logicalKey(),
keyString(),
keyCode( -1 ),
keyModifier( 0 ),
{
}
-KeyEvent::KeyEvent( const std::string& keyName, const std::string& key, const std::string& keyString, int keyCode, int keyModifier,
+KeyEvent::KeyEvent( const std::string& keyName, const std::string& logicalKey, const std::string& keyString, int keyCode, int keyModifier,
unsigned long timeStamp, const State& keyState, const std::string& compose, const std::string& deviceName,
const Device::Class::Type deviceClass, const Device::Subclass::Type deviceSubclass )
: Event( Key ),
keyName( keyName ),
- key( key ),
+ logicalKey( logicalKey ),
keyString( keyString ),
keyCode( keyCode ),
keyModifier( keyModifier ),
KeyEvent::KeyEvent( const Dali::KeyEvent& event )
: Event( Key ),
keyName( event.keyPressedName ),
- key( "" ),
+ logicalKey( "" ),
keyString( event.keyPressed ),
keyCode( event.keyCode ),
keyModifier( event.keyModifier ),
deviceSubclass( Device::Subclass::NONE )
{
const Internal::KeyEventImpl* keyEventImpl = GetImplementation( &event );
- key = keyEventImpl->GetKey();
+ logicalKey = keyEventImpl->GetLogicalKey();
compose = keyEventImpl->GetCompose();
deviceName = keyEventImpl->GetDeviceName();
deviceClass = keyEventImpl->GetDeviceClass();
/**
* Constructor
* @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] key The logical key symbol (eg. shift + 1 == "exclamation")
+ * @param[in] logicalKey The logical key symbol (eg. shift + 1 == "exclamation")
* @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] deviceSubclass Subclass of device KeyEvent originated from
*/
KeyEvent(const std::string& keyName,
- const std::string& key,
+ const std::string& logicalKey,
const std::string& keyString,
int keyCode,
int keyModifier,
/**
* The logical key symbol
*/
- std::string key;
+ std::string logicalKey;
/**
*@copydoc Dali::KeyEvent::keyPressed
{
KeyEventImpl::KeyEventImpl( KeyEvent* keyEvent )
-: mKey( "" ),
+: mLogicalKey( "" ),
mCompose( "" ),
mDeviceName( "" ),
mDeviceClass( Device::Class::NONE ),
{
if( this != &rhs )
{
- mKey = rhs.mKey;
+ mLogicalKey = rhs.mLogicalKey;
mCompose = rhs.mCompose;
mDeviceName = rhs.mDeviceName;
mDeviceClass = rhs.mDeviceClass;
return *this;
}
-std::string KeyEventImpl::GetKey() const
+std::string KeyEventImpl::GetLogicalKey() const
{
- return mKey;
+ return mLogicalKey;
}
-void KeyEventImpl::SetKey( const std::string& key )
+void KeyEventImpl::SetLogicalKey( const std::string& logicalKey )
{
- mKey = key;
+ mLogicalKey = logicalKey;
}
std::string KeyEventImpl::GetCompose() const
* @brief Get the key symbol string.
* @return The key symbol
*/
- std::string GetKey() const;
+ std::string GetLogicalKey() const;
/**
* @brief Set the key symbol string to the KeyEvent.
* @param[in] key The key symbol to set
*/
- void SetKey( const std::string& key );
+ void SetLogicalKey( const std::string& logicalKey );
/**
* @brief Get the compose string.
private:
- std::string mKey;
+ std::string mLogicalKey;
std::string mCompose;
std::string mDeviceName;
Device::Class::Type mDeviceClass;
{
KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state));
- GetImplementation( &keyEvent )->SetKey( event.key );
+ GetImplementation( &keyEvent )->SetLogicalKey( event.logicalKey );
GetImplementation( &keyEvent )->SetCompose( event.compose );
GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
GetImplementation( &keyEvent )->SetDeviceClass( event.deviceClass );