back key handling refarding popup
authorKyusung Cho <ks0128.cho@samsung.com>
Tue, 2 Jul 2013 08:20:38 +0000 (17:20 +0900)
committerKyusung Cho <ks0128.cho@samsung.com>
Tue, 2 Jul 2013 08:20:38 +0000 (17:20 +0900)
Change-Id: Ie9dde125aa02bccba6f43e0db5f594fce2abc464
Signed-off-by: Kyusung Cho <ks0128.cho@samsung.com>
project/inc/MainForm.h
project/src/MainForm.cpp

index 1c6b1ba..45da38a 100644 (file)
@@ -25,6 +25,7 @@
 
 class MainForm
     : public Tizen::Ui::Controls::Form
+    , public Tizen::Ui::IPropagatedKeyEventListener
     , public Tizen::Ui::IActionEventListener
     , public Tizen::Ui::Controls::IFormBackEventListener
     , public Tizen::Ui::Controls::IFormMenuEventListener
@@ -43,6 +44,11 @@ public:
 
     virtual result OnInitializing(void);
     virtual result OnTerminating(void);
+    virtual bool OnKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+    virtual bool OnKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+    virtual bool OnPreviewKeyPressed (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+    virtual bool OnPreviewKeyReleased (Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo);
+    virtual bool TranslateKeyEventInfo (Tizen::Ui::Control &source, Tizen::Ui::KeyEventInfo &keyEventInfo);
     virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
     virtual void OnFormMenuRequested(Tizen::Ui::Controls::Form& source);
     virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
index 1127d98..6b27282 100644 (file)
@@ -105,6 +105,7 @@ MainForm::OnInitializing(void)
 
     __pMessagePopup = new Popup();
     __pMessagePopup->Construct(IDC_MESSAGE_POPUP);
+    __pMessagePopup->SetPropagatedKeyEventListener(this);
     __pMessageLabel = static_cast<Label*>(__pMessagePopup->GetControl(IDC_LABEL_MASSEGE_TEXT, true));
 
     __pOptionMenu = new OptionMenu();
@@ -132,6 +133,43 @@ MainForm::OnTerminating(void)
     return r;
 }
 
+bool
+MainForm::OnKeyPressed (Control &source, const KeyEventInfo &keyEventInfo)
+{
+       return true;
+}
+
+bool
+MainForm::OnKeyReleased (Control &source, const KeyEventInfo &keyEventInfo)
+{
+       if(keyEventInfo.GetKeyCode() == KEY_BACK)
+       {
+               if(__pMessagePopup)
+               {
+                       __pMessagePopup->SetShowState(false);
+               }
+       }
+       return true;
+}
+
+bool
+MainForm::OnPreviewKeyPressed (Control &source, const KeyEventInfo &keyEventInfo)
+{
+       return true;
+}
+
+bool
+MainForm::OnPreviewKeyReleased (Control &source, const KeyEventInfo &keyEventInfo)
+{
+       return true;
+}
+
+bool
+MainForm::TranslateKeyEventInfo (Control &source, KeyEventInfo &keyEventInfo)
+{
+       return true;
+}
+
 void
 MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 {