From 7e4dd3e1c514a505cdf4b23531b14004ba9632b2 Mon Sep 17 00:00:00 2001 From: clone Date: Sat, 20 Apr 2013 02:57:13 +0900 Subject: [PATCH] Fixed N_SE-35294; ContextMenu list style scrollable fires event of the item out of sight. Change-Id: Ie9819a452855eecb74c3cbfe88b7a4302f4c9d4d Signed-off-by: clone --- src/ui/controls/FUiCtrl_ContextMenu.cpp | 26 +++++++++++++++++----- .../controls/FUiCtrl_ContextMenuGridPresenter.cpp | 20 +++++++++++------ .../controls/FUiCtrl_ContextMenuListPresenter.cpp | 26 +++++++++++++++------- src/ui/inc/FUiCtrl_ContextMenu.h | 15 ++++++++----- 4 files changed, 61 insertions(+), 26 deletions(-) diff --git a/src/ui/controls/FUiCtrl_ContextMenu.cpp b/src/ui/controls/FUiCtrl_ContextMenu.cpp index 8d46ddb..ef7e4fe 100644 --- a/src/ui/controls/FUiCtrl_ContextMenu.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenu.cpp @@ -55,9 +55,10 @@ _ContextMenu::_ContextMenu(const FloatPoint& point, enum ContextMenuCoreStyle st , __isAttachedToMainTree(false) , __ownerInputEnableState(false) , __anchorPoint(point) + , __windowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f)) , __bodyRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f)) , __arrowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f)) - , __windowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f)) + , __itemRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f)) , __pActionEvent(null) , __pBackgroundNormalBitmap(null) , __pBackgroundEffectBitmap(null) @@ -267,6 +268,7 @@ void _ContextMenu::OnDraw() { __pContextMenuPresenter->Draw(); + if(unlikely((_AccessibilityManager::IsActivated()))) { _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM); @@ -537,6 +539,20 @@ _ContextMenu::GetAnchorPosition(void) const } result +_ContextMenu::SetWindowRect(const FloatRectangle& rect) +{ + __windowRect = rect; + + return E_SUCCESS; +} + +FloatRectangle +_ContextMenu::GetWindowRect(void) const +{ + return __windowRect; +} + +result _ContextMenu::SetBodyRect(const FloatRectangle& rect) { __bodyRect = rect; @@ -565,17 +581,17 @@ _ContextMenu::GetArrowRect(void) const } result -_ContextMenu::SetWindowRect(const FloatRectangle& rect) +_ContextMenu::SetItemRect(const FloatRectangle& rect) { - __windowRect = rect; + __itemRect = rect; return E_SUCCESS; } FloatRectangle -_ContextMenu::GetWindowRect(void) const +_ContextMenu::GetItemRect(void) const { - return __windowRect; + return __itemRect; } result diff --git a/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp b/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp index 3f2cf2f..dc7642d 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp @@ -415,9 +415,10 @@ _ContextMenuGridPresenter::ApplyColorProperty(void) result _ContextMenuGridPresenter::CalculateRect(void) { - Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // Window Rect is bodyRect + arrowRect - Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu rect except arrowRect - Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // Arrow rect of the ContextMenu + Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself + Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window + Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + Tizen::Graphics::FloatRectangle itemRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window float bodyTopMargin = __topMargin; float bodyBottomMargin = __bottomMargin; @@ -703,9 +704,15 @@ _ContextMenuGridPresenter::CalculateRect(void) arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y; } + itemRect.x = bodyLeftMargin; + itemRect.y = bodyTopMargin + bodyBottomMargin; + itemRect.width = __layoutSize.width; + itemRect.height = __layoutSize.height; + + __pContextMenu->SetWindowRect(windowRect); __pContextMenu->SetBodyRect(bodyRect); __pContextMenu->SetArrowRect(arrowRect); - __pContextMenu->SetWindowRect(windowRect); + __pContextMenu->SetItemRect(itemRect); __pContextMenu->SetMovable(true); __pContextMenu->SetResizable(true); @@ -1413,9 +1420,9 @@ bool _ContextMenuGridPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo) { FloatPoint touchPosition = touchinfo.GetCurrentPosition(); - FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); + FloatRectangle itemRect = __pContextMenu->GetItemRect(); - if (bodyRect.Contains(touchPosition) == false) + if (itemRect.Contains(touchPosition) == false) { __selectedIndex = -1; __pressedIndex = -1; @@ -1442,7 +1449,6 @@ bool _ContextMenuGridPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo) { FloatPoint touchPosition = touchinfo.GetCurrentPosition(); - FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); if (__touchOutRect == true) { diff --git a/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp b/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp index 9b639df..3ef5b6e 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp @@ -409,9 +409,10 @@ _ContextMenuListPresenter::ApplyColorProperty(void) result _ContextMenuListPresenter::CalculateRect(void) { - Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // Window Rect is bodyRect + arrowRect - Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu rect except arrowRect - Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // Arrow rect of the ContextMenu + Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself + Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window + Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + Tizen::Graphics::FloatRectangle itemRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window float bodyTopMargin = __topMargin; float bodyBottomMargin = __bottomMargin; @@ -694,9 +695,15 @@ _ContextMenuListPresenter::CalculateRect(void) arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y; } + itemRect.x = bodyLeftMargin; + itemRect.y = bodyTopMargin + bodyBottomMargin; + itemRect.width = __layoutSize.width; + itemRect.height = __layoutSize.height; + + __pContextMenu->SetWindowRect(windowRect); __pContextMenu->SetBodyRect(bodyRect); __pContextMenu->SetArrowRect(arrowRect); - __pContextMenu->SetWindowRect(windowRect); + __pContextMenu->SetItemRect(itemRect); // _ScrollPanel API call sequence: SetBounds() -> SetScrollAreaBounds() // _Scroll visual interaction if Bounds < ScrollAreaBounds @@ -953,9 +960,9 @@ bool _ContextMenuListPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo) { FloatPoint touchPosition = touchinfo.GetCurrentPosition(); - FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); + FloatRectangle itemRect = __pContextMenu->GetItemRect(); - if (!bodyRect.Contains(touchPosition)) + if (!itemRect.Contains(touchPosition)) { __selectedIndex = -1; __touchOutRect = true; @@ -980,10 +987,13 @@ _ContextMenuListPresenter::OnTouchReleased(const _Control& source, const _TouchI if (__touchOutRect) { - FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); - if (!bodyRect.Contains(touchPosition)) + FloatRectangle itemRect = __pContextMenu->GetItemRect(); + if (!itemRect.Contains(touchPosition)) { + __selectedIndex = -1; __pContextMenu->SetVisibleState(false); + + return true; } } diff --git a/src/ui/inc/FUiCtrl_ContextMenu.h b/src/ui/inc/FUiCtrl_ContextMenu.h index 74a2317..1d1eeb6 100644 --- a/src/ui/inc/FUiCtrl_ContextMenu.h +++ b/src/ui/inc/FUiCtrl_ContextMenu.h @@ -159,12 +159,14 @@ public: int GetItemActionIdAt(int index) const; result SetAnchorPosition(float x, float y); Tizen::Graphics::FloatPoint GetAnchorPosition(void) const; + result SetWindowRect(const Tizen::Graphics::FloatRectangle& rect); + Tizen::Graphics::FloatRectangle GetWindowRect(void) const; result SetBodyRect(const Tizen::Graphics::FloatRectangle& rect); Tizen::Graphics::FloatRectangle GetBodyRect(void) const; result SetArrowRect(const Tizen::Graphics::FloatRectangle& rect); Tizen::Graphics::FloatRectangle GetArrowRect(void) const; - result SetWindowRect(const Tizen::Graphics::FloatRectangle& rect); - Tizen::Graphics::FloatRectangle GetWindowRect(void) const; + result SetItemRect(const Tizen::Graphics::FloatRectangle& rect); + Tizen::Graphics::FloatRectangle GetItemRect(void) const; result SetTextColor(enum ContextMenuCoreItemStatus status, const Tizen::Graphics::Color& color); Tizen::Graphics::Color GetTextColor(enum ContextMenuCoreItemStatus status) const; result SetColor(const Tizen::Graphics::Color& color); @@ -236,10 +238,11 @@ private: bool __ownerInputEnableState; // attribute for position fo the window - Tizen::Graphics::FloatPoint __anchorPoint; // the anchor point on whole screen area. - Tizen::Graphics::FloatRectangle __bodyRect; // the body area of the ContextMenu area. - Tizen::Graphics::FloatRectangle __arrowRect; // the arrow area of the ContextMenu area. - Tizen::Graphics::FloatRectangle __windowRect; // the ContextMenu area on whole screen area. + Tizen::Graphics::FloatPoint __anchorPoint; // anchor point in the whole screen area + Tizen::Graphics::FloatRectangle __windowRect; // ContextMenu window in the whole screen area + Tizen::Graphics::FloatRectangle __bodyRect; // body area relative to window + Tizen::Graphics::FloatRectangle __arrowRect; // arrow area of relative to window + Tizen::Graphics::FloatRectangle __itemRect; // item area relative to window // attribute for event _ActionEvent* __pActionEvent; -- 2.7.4