Merge "use modern construct '= default' for special functions." into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / events / key-event.cpp
index 0a329a0..fe6bfcf 100644 (file)
-//
-// 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.
-//
+/*
+ * 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.
+ * 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.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/public-api/events/key-event.h>
 
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/key-event-impl.h>
+
 namespace Dali
 {
+KeyEvent::KeyEvent()
+: BaseHandle()
+{
+}
+
+KeyEvent::KeyEvent(const KeyEvent& rhs) = default;
+
+KeyEvent::KeyEvent(KeyEvent&& rhs) = default;
+
+KeyEvent::~KeyEvent() = default;
+
+KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) = default;
 
-namespace
+KeyEvent& KeyEvent::operator=(KeyEvent&& rhs) = default;
+
+bool KeyEvent::IsShiftModifier() const
 {
-const unsigned int MODIFIER_SHIFT = 0x1;
-const unsigned int MODIFIER_CTRL  = 0x2;
-const unsigned int MODIFIER_ALT   = 0x4;
-const int KEY_INVALID_CODE = -1;
+  return GetImplementation(*this).IsShiftModifier();
+}
 
+bool KeyEvent::IsCtrlModifier() const
+{
+  return GetImplementation(*this).IsCtrlModifier();
 }
 
-KeyEvent::KeyEvent()
-: keyPressedName(""),
-  keyPressed(""),
-  keyCode(KEY_INVALID_CODE),
-  keyModifier(0),
-  cursorOffset(0),
-  numberOfChars(0),
-  state(KeyEvent::Down)
+bool KeyEvent::IsAltModifier() const
 {
+  return GetImplementation(*this).IsAltModifier();
 }
 
-KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyPressed, const int& keyModifier, const int& offset, const int& characters, const State& keyState)
-: keyPressedName(keyName),
-  keyPressed(keyPressed),
-  keyCode(KEY_INVALID_CODE),
-  keyModifier(keyModifier),
-  cursorOffset(offset),
-  numberOfChars(characters),
-  time(0),
-  state(keyState)
+const std::string& KeyEvent::GetCompose() const
 {
+  return GetImplementation(*this).GetCompose();
 }
 
-KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, const int& keyCode, const int& keyModifier, const int& cursorOffset, const int& numberOfChars, const State& keyState)
-: keyPressedName(keyName),
-  keyPressed(keyString),
-  keyCode(keyCode),
-  keyModifier(keyModifier),
-  cursorOffset(cursorOffset),
-  numberOfChars(numberOfChars),
-  time(0),
-  state(keyState)
+const std::string& KeyEvent::GetDeviceName() const
 {
+  return GetImplementation(*this).GetDeviceName();
 }
 
-KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, const int& keyCode, const int& keyModifier, const int& cursorOffset, const int& numberOfChars, const unsigned long& timeStamp, const State& keyState)
-: keyPressedName(keyName),
-  keyPressed(keyString),
-  keyCode(keyCode),
-  keyModifier(keyModifier),
-  cursorOffset(cursorOffset),
-  numberOfChars(numberOfChars),
-  time(timeStamp),
-  state(keyState)
+Device::Class::Type KeyEvent::GetDeviceClass() const
 {
+  return GetImplementation(*this).GetDeviceClass();
 }
 
-KeyEvent::~KeyEvent()
+Device::Subclass::Type KeyEvent::GetDeviceSubclass() const
 {
+  return GetImplementation(*this).GetDeviceSubclass();
 }
 
-bool KeyEvent::IsShiftModifier() const
+const std::string& KeyEvent::GetKeyName() const
 {
-  if ((MODIFIER_SHIFT & keyModifier) == MODIFIER_SHIFT)
-  {
-    return true;
-  }
+  return GetImplementation(*this).GetKeyName();
+}
 
-  return false;
+const std::string& KeyEvent::GetKeyString() const
+{
+  return GetImplementation(*this).GetKeyString();
 }
 
-bool KeyEvent::IsCtrlModifier() const
+const std::string& KeyEvent::GetLogicalKey() const
 {
-  if ((MODIFIER_CTRL & keyModifier) == MODIFIER_CTRL)
-  {
-    return true;
-  }
+  return GetImplementation(*this).GetLogicalKey();
+}
 
-  return false;
+int32_t KeyEvent::GetKeyCode() const
+{
+  return GetImplementation(*this).GetKeyCode();
 }
 
-bool KeyEvent::IsAltModifier() const
+int32_t KeyEvent::GetKeyModifier() const
 {
-  if ((MODIFIER_ALT & keyModifier) == MODIFIER_ALT)
-  {
-    return true;
-  }
+  return GetImplementation(*this).GetKeyModifier();
+}
 
-  return false;
+unsigned long KeyEvent::GetTime() const
+{
+  return GetImplementation(*this).GetTime();
+}
+
+KeyEvent::State KeyEvent::GetState() const
+{
+  return GetImplementation(*this).GetState();
+}
+
+KeyEvent::KeyEvent(Internal::KeyEvent* internal)
+: BaseHandle(internal)
+{
 }
 
 } // namespace Dali