From: Kyusung Cho Date: Tue, 2 Jul 2013 08:20:38 +0000 (+0900) Subject: back key handling refarding popup X-Git-Tag: 2.2_release~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c5d92c3ff8cc317e555b93027cd2895b66283c9;p=samples%2Fnative%2FImageFeatureManager.git back key handling refarding popup Change-Id: Ie9dde125aa02bccba6f43e0db5f594fce2abc464 Signed-off-by: Kyusung Cho --- diff --git a/project/inc/MainForm.h b/project/inc/MainForm.h index 1c6b1ba..45da38a 100644 --- a/project/inc/MainForm.h +++ b/project/inc/MainForm.h @@ -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); diff --git a/project/src/MainForm.cpp b/project/src/MainForm.cpp index 1127d98..6b27282 100644 --- a/project/src/MainForm.cpp +++ b/project/src/MainForm.cpp @@ -105,6 +105,7 @@ MainForm::OnInitializing(void) __pMessagePopup = new Popup(); __pMessagePopup->Construct(IDC_MESSAGE_POPUP); + __pMessagePopup->SetPropagatedKeyEventListener(this); __pMessageLabel = static_cast(__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) {