[Tizen] Add InterceptKeyEvent 91/280491/1 accepted/tizen/6.5/unified/20220831.133905 submit/tizen_6.5/20220831.054421
authorjoogab.yun <joogab.yun@samsung.com>
Fri, 1 Jul 2022 06:18:46 +0000 (15:18 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Wed, 31 Aug 2022 01:59:07 +0000 (10:59 +0900)
dependency : https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-core/+/276883/

Change-Id: I57c8858d5f2492e7c18135624cb3e44f6149e3a7

dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/integration-api/adaptor-framework/scene-holder-impl.h
dali/integration-api/adaptor-framework/scene-holder.cpp
dali/integration-api/adaptor-framework/scene-holder.h

index e2f22fc..fe0e873 100644 (file)
@@ -234,6 +234,11 @@ const TouchEvent& GetLastTouchEvent(Window window)
   return GetImplementation(window).GetLastTouchEvent();
 }
 
+InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window)
+{
+  return GetImplementation(window).InterceptKeyEventSignal();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index f6e49b3..edf0356 100644 (file)
@@ -36,7 +36,6 @@ struct TouchPoint;
 
 namespace DevelWindow
 {
-
 typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
 
 typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
@@ -53,6 +52,8 @@ typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard re
 
 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType; ///< Auxiliary message signal type
 
+typedef Signal<bool(const KeyEvent&)> InterceptKeyEventSignalType; ///< Intercept Key event signal type
+
 /**
  * @brief Creates an initialized handle to a new Window.
  *
@@ -439,6 +440,17 @@ DALI_ADAPTOR_API const KeyEvent& GetLastKeyEvent(Window window);
  */
 DALI_ADAPTOR_API const TouchEvent& GetLastTouchEvent(Window window);
 
+/**
+ * @brief The user would connect to this signal to intercept a KeyEvent at window.
+ *
+ * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
+ * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
+ *
+ * @param[in] window The window instance.
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window);
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 39626ca..c5008b4 100644 (file)
@@ -249,6 +249,14 @@ public:
   }
 
   /**
+   * @copydoc Dali::Integration::SceneHolder::InterceptKeyEventSignal()
+   */
+  Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& InterceptKeyEventSignal()
+  {
+    return mScene.InterceptKeyEventSignal();
+  }
+
+  /**
    * @copydoc Dali::Integration::SceneHolder::TouchedSignal()
    */
   Dali::Integration::SceneHolder::TouchEventSignalType& TouchedSignal()
index 6d4d282..0fbf66e 100644 (file)
@@ -119,6 +119,11 @@ SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
   return GetImplementation(*this).KeyEventGeneratedSignal();
 }
 
+SceneHolder::KeyEventGeneratedSignalType& SceneHolder::InterceptKeyEventSignal()
+{
+  return GetImplementation(*this).InterceptKeyEventSignal();
+}
+
 SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
 {
   return GetImplementation(*this).TouchedSignal();
index d660509..eed2515 100644 (file)
@@ -188,6 +188,19 @@ public:
   KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
 
   /**
+   * @brief This signal is emitted when key event is received.
+   * Intercepts KeyEvents in the window before dispatching KeyEvents to the control.
+   * If a KeyEvent is consumed, no KeyEvent is delivered to the control.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallbackName(const KeyEvent& event);
+   * @endcode
+   * @return The signal to connect to
+   */
+  KeyEventGeneratedSignalType& InterceptKeyEventSignal();
+
+  /**
    * @brief This signal is emitted when the screen is touched and when the touch ends
    * (i.e. the down & up touch events only).
    *