Add InterceptKeyEvent 68/276868/4
authorjoogab.yun <joogab.yun@samsung.com>
Fri, 1 Jul 2022 06:18:46 +0000 (15:18 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Fri, 1 Jul 2022 06:18:46 +0000 (15:18 +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 c6ffb56..43565ed 100644 (file)
@@ -269,6 +269,11 @@ const TouchEvent& GetLastTouchEvent(Window window)
   return GetImplementation(window).GetLastTouchEvent();
 }
 
+InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window)
+{
+  return GetImplementation(window).InterceptKeyEventSignal();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 20bcc75..883cdaa 100644 (file)
@@ -36,23 +36,16 @@ struct TouchPoint;
 
 namespace DevelWindow
 {
-typedef Signal<void()> EventProcessingFinishedSignalType; ///< Event Processing finished signal type
-
-typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< Key event signal type
-
-typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< Touch signal type
-
-typedef Signal<void(const WheelEvent&)> WheelEventSignalType; ///< Touched signal type
-
-typedef Signal<void(Window, bool)> VisibilityChangedSignalType; ///< Visibility changed signal type
-
-typedef Signal<void(Window, WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType; ///< Effect signal type and state
-
-typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
-
-typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType; ///< Auxiliary message signal type
-
-typedef Signal<void(Window, bool)> AccessibilityHighlightSignalType; ///< Accessibility Highlight signal type
+typedef Signal<void()>                                                               EventProcessingFinishedSignalType;       ///< Event Processing finished signal type
+typedef Signal<void(const KeyEvent&)>                                                KeyEventSignalType;                      ///< Key event signal type
+typedef Signal<void(const TouchEvent&)>                                              TouchEventSignalType;                    ///< Touch signal type
+typedef Signal<void(const WheelEvent&)>                                              WheelEventSignalType;                    ///< Wheel signal type
+typedef Signal<void(Window, bool)>                                                   VisibilityChangedSignalType;             ///< Visibility changed signal type
+typedef Signal<void(Window, WindowEffectState, WindowEffectType)>                    TransitionEffectEventSignalType;         ///< Effect signal type and state
+typedef Signal<void()>                                                               KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type
+typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;              ///< Auxiliary message signal type
+typedef Signal<void(Window, bool)>                                                   AccessibilityHighlightSignalType;        ///< Accessibility Highlight signal type
+typedef Signal<bool(const KeyEvent&)>                                                InterceptKeyEventSignalType;             ///< Intercept Key event signal type
 
 /**
  * @brief Creates an initialized handle to a new Window.
@@ -528,6 +521,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 7eff6f5..196e0d9 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).
    *