Implemented the backkey functionality to close the messagebox.
authorsriram.k <sriram.k@samsung.com>
Mon, 24 Jun 2013 16:42:02 +0000 (22:12 +0530)
committersriram.k <sriram.k@samsung.com>
Mon, 24 Jun 2013 16:45:21 +0000 (22:15 +0530)
Signed-off-by: sriram.k <sriram.k@samsung.com>
Change-Id: Ic1601a1d4bf325238d0962bcf0e98b920241e18c

src/ui/controls/FUiCtrl_MessageBox.cpp
src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp
src/ui/inc/FUiCtrl_MessageBox.h
src/ui/inc/FUiCtrl_MessageBoxPresenter.h

index 26f3201..e725f4d 100644 (file)
@@ -569,6 +569,12 @@ _MessageBox::OnAccessibilityValueDecreased(const _AccessibilityContainer& contro
        return false;
 }
 
+bool
+_MessageBox::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+       return __pMsgboxPresenter->OnKeyReleased(source,keyInfo);
+}
+
 Bitmap*
 _MessageBox::GetButtonBackgroundBitmap(void)
 {
index c90e50d..c850cdc 100644 (file)
@@ -265,6 +265,7 @@ _MessageBoxPresenter::Initialize(_MessageBox& msgbox)
 
        __titleBgBounds= FloatRectangle(transLeftMargin, transTopMargin, _CoordinateSystemUtils::ConvertToFloat(defaultWidth) - (2 * transLeftMargin), titleHeight);
 
+
        // TitleText
        if (__pMessageBox->HasTitle() == true)
        {
@@ -1435,6 +1436,23 @@ _MessageBoxPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& tou
 
 }
 
+bool
+_MessageBoxPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       if (keyCode == _KEY_ESC || keyCode == _KEY_BACK)
+       {
+               if ((__pButtonListener->GetBeginModal() == true) || (__beginModal == true))
+               {
+                       _ModalLoopManager::GetInstance()->EndMainLoop(MSGBOX_RESULT_CLOSE, false);
+                       __beginModal = false;
+               }
+               return true;
+       }
+
+       return false;
+}
 
 ////////////////////////////////////////////////////////////////////////
 ///////////////////////////MsgBoxButtonListener/////////////////////////
index 03765b2..76014e8 100644 (file)
@@ -88,6 +88,9 @@ public:
        virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
        virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
 
+       bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo){return false;}
+       bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+
        Tizen::Graphics::Bitmap* GetButtonBackgroundBitmap(void);
        Tizen::Graphics::Bitmap* GetButtonBackgroundEffectBitmap(void);
        Tizen::Graphics::Bitmap* GetTitleBackgroundBitmap(void);
index 695ec01..d8ce625 100644 (file)
@@ -76,6 +76,8 @@ public:
        virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
        virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
 
+       bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+
        void UpdateButtonString(void);
 
        void InitializeAccessibilityElement(void);