Changing IKeyEventListener to IPropagatedKeyEventListener
authorAbhismita Ghosh <g.abhismita@samsung.com>
Sat, 29 Jun 2013 07:42:45 +0000 (16:42 +0900)
committerAbhismita Ghosh <g.abhismita@samsung.com>
Sat, 29 Jun 2013 08:00:40 +0000 (17:00 +0900)
Change-Id: I6692d825cb8c9c67df89c98d909327df8df3760b

inc/VpSoundPathPopup.h
inc/VpVolumeSettingPopup.h
src/VpSoundPathPopup.cpp
src/VpVolumeSettingPopup.cpp

index 3e982c1..20bbb4e 100644 (file)
@@ -29,7 +29,7 @@
 class SoundPathPopup
        : public Tizen::Ui::Controls::Popup
        , public Tizen::Ui::IActionEventListener
-       , public Tizen::Ui::IKeyEventListener
+       , public Tizen::Ui::IPropagatedKeyEventListener
 {
 public:
        SoundPathPopup(void);
@@ -41,9 +41,10 @@ public:
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
        virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
 
-       virtual void OnKeyLongPressed (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode){}
-       virtual void OnKeyPressed (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode){}
-       virtual void OnKeyReleased (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode);
+       virtual bool OnKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
+       virtual bool OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo);
+       virtual bool OnPreviewKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
+       virtual bool OnPreviewKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
 
 private:
        enum AudioRouteMode
index 271e4a2..604ff4b 100644 (file)
@@ -32,6 +32,7 @@ class VolumeSettingPopup
        , public Tizen::Ui::IActionEventListener
        , public Tizen::Ui::IAdjustmentEventListener
        , public Tizen::Ui::IKeyEventListener
+       , public Tizen::Ui::IPropagatedKeyEventListener
        , public Tizen::Ui::ITouchEventListener
        , public Tizen::Ui::Controls::ISliderEventListener
 {
@@ -53,6 +54,11 @@ public:
        virtual void OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
        virtual void OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
 
+       virtual bool OnKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
+       virtual bool OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo);
+       virtual bool OnPreviewKeyPressed(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
+       virtual bool OnPreviewKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo){};
+
        virtual void OnTouchDoublePressed(const Tizen::Ui::Control& source,
                        const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo){}
        virtual void OnTouchLongPressed(const Tizen::Ui::Control& source,
@@ -77,4 +83,4 @@ private:
        int __volumeLevel;
 };
 
-#endif // _VP_VOLUME_SETTING_POPUP_H_
\ No newline at end of file
+#endif // _VP_VOLUME_SETTING_POPUP_H_
index ce64050..d1ab5ac 100755 (executable)
@@ -80,7 +80,7 @@ SoundPathPopup::Construct(int currentOutputDevice, String bluetoothA2dpName, int
        r = Popup::Construct(true, Dimension(W_SOUNDPATH_POPUP, H_SOUNDPATH_POPUP));
        TryCatch(r == E_SUCCESS, , "Popup::Construct() Failed:%s", GetErrorMessage(r));
 
-       Popup::AddKeyEventListener(*this);
+       Popup::SetPropagatedKeyEventListener(this);
        __pCheckButton1st = new (std::nothrow) CheckButton();
        __pCheckButton2nd = new (std::nothrow) CheckButton();
        __pCloseButton = new (std::nothrow) Button();
@@ -465,15 +465,15 @@ SoundPathPopup::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
        }
 }
 
-void
-SoundPathPopup::OnKeyReleased (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode)
+bool
+SoundPathPopup::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
 {
        AppLogDebug("ENTER");
 
-       if (keyCode == KEY_BACK)
+       if (keyEventInfo.GetKeyCode() == KEY_BACK)
        {
                SetShowState(false);
        }
        AppLogDebug("EXIT");
-
+       return true;
 }
index 7ed66f6..2872b85 100755 (executable)
@@ -230,17 +230,6 @@ void
 VolumeSettingPopup::OnKeyReleased(const Control& source, KeyCode keyCode)
 {
        AppLogDebug("OnKeyReleased Control : %ls, KeyCode : %d", source.GetName().GetPointer(), keyCode);
-
-       if (keyCode == KEY_BACK && GetShowState() == true)
-       {
-               result r = E_FAILURE;
-
-               r = __pCloseTimer->Cancel();
-               TryReturnVoid(r == E_SUCCESS, "__pCloseTimer->Start() failed:%s", GetErrorMessage(r));
-
-               r = SetShowState(false);
-               TryReturnVoid(r == E_SUCCESS, "SetShowState() failed:%s", GetErrorMessage(r));
-       }
 }
 
 void
@@ -255,6 +244,19 @@ VolumeSettingPopup::OnKeyLongPressed(const Control& source, KeyCode keyCode)
        }
 }
 
+bool
+VolumeSettingPopup::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
+{
+       AppLogDebug("OnKeyReleased Control : %ls, KeyCode : %d", source.GetName().GetPointer(), keyEventInfo.GetKeyCode());
+
+       if (keyEventInfo.GetKeyCode() == KEY_BACK && GetShowState() == true)
+       {
+               __pCloseTimer->Cancel();
+               SetShowState(false);
+       }
+       return true;
+}
+
 void
 VolumeSettingPopup::OnAdjustmentValueChanged(const Control& source, int adjustment)
 {