Fixed 1px overlap of GUI and itemRect.
authorclone <ingyou.park@samsung.com>
Mon, 29 Apr 2013 22:58:49 +0000 (07:58 +0900)
committerclone <ingyou.park@samsung.com>
Tue, 30 Apr 2013 05:01:14 +0000 (14:01 +0900)
Change-Id: Ie3a6efb843e3f34168927c93c288238c8d7fdc1d
Signed-off-by: clone <ingyou.park@samsung.com>
src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp
src/ui/controls/FUiCtrl_ContextMenuItem.cpp
src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp
src/ui/inc/FUiCtrl_ContextMenuGridPresenter.h
src/ui/inc/FUiCtrl_ContextMenuListPresenter.h
src/ui/inc/FUi_ResourceContextMenuConfig.h
src/ui/resource/FUi_ResourceContextMenuConfig.cpp

index df97ed5..aecba62 100644 (file)
@@ -82,6 +82,7 @@ _ContextMenuGridPresenter::_ContextMenuGridPresenter(_ContextMenu* pContextMenu)
        , __itemFontSize(0.0f)
        , __dividerHeight(0.0f)
        , __bgPressedMargin(0.0f)
+       , __anchorPopupOverlap(0.0f)
 {
 
 }
@@ -174,6 +175,7 @@ _ContextMenuGridPresenter::LoadShape(void)
        GET_SHAPE_CONFIG(CONTEXTMENU::GRID_ICON_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __itemBitmapHeight);
        GET_SHAPE_CONFIG(CONTEXTMENU::GRID_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);
        GET_SHAPE_CONFIG(CONTEXTMENU::ITEM_BG_PRESSED_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bgPressedMargin);
+       GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_POPUP_OVERLAP, _CONTROL_ORIENTATION_PORTRAIT, __anchorPopupOverlap);
 }
 
 _ContextMenuItem*
@@ -518,7 +520,7 @@ _ContextMenuGridPresenter::CalculateRect(void)
                windowRect.height = bodyRect.height + arrowRect.height;
 
                bodyRect.x = 0.0f;
-               bodyRect.y = __arrowTopMargin;
+               bodyRect.y = __arrowTopMargin - __anchorPopupOverlap;
 
                // Set arrow position
                arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
@@ -574,7 +576,7 @@ _ContextMenuGridPresenter::CalculateRect(void)
                windowRect.height = bodyRect.height + arrowRect.height;
 
                bodyRect.x = 0.0f;
-               bodyRect.y = arrowRect.height - __arrowBottomMargin;
+               bodyRect.y = arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
 
                // Set arrow position
                arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
@@ -635,7 +637,7 @@ _ContextMenuGridPresenter::CalculateRect(void)
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;
 
-               bodyRect.x = __arrowRightMargin;
+               bodyRect.x = __arrowRightMargin - __anchorPopupOverlap;
                bodyRect.y = 0.0f;
 
                // Set arrow position
@@ -667,7 +669,7 @@ _ContextMenuGridPresenter::CalculateRect(void)
                }
 
                // Set body position x
-               bodyRect.x = anchorPosition.x + arrowRect.width;
+               bodyRect.x = anchorPosition.x;
                //  - Check left margin
                if (bodyRect.x <= leftBoundary)
                {
@@ -691,12 +693,12 @@ _ContextMenuGridPresenter::CalculateRect(void)
                        bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
-               windowRect.x = bodyRect.x - arrowRect.width;
+               windowRect.x = bodyRect.x;
                windowRect.y = bodyRect.y;
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;
 
-               bodyRect.x = arrowRect.width - __arrowLeftMargin;
+               bodyRect.x = arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
                bodyRect.y = 0.0f;
 
                // Set arrow position
@@ -704,8 +706,8 @@ _ContextMenuGridPresenter::CalculateRect(void)
                arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y;
        }
 
-       itemRect.x      = bodyLeftMargin;
-       itemRect.y      = bodyTopMargin + bodyBottomMargin;
+       itemRect.x      = bodyRect.x + bodyLeftMargin;
+       itemRect.y      = bodyRect.y + bodyTopMargin;
        itemRect.width  = __layoutSize.width;
        itemRect.height = __layoutSize.height;
 
@@ -1566,6 +1568,18 @@ _ContextMenuGridPresenter::SetAllAccessibilityElement(void)
        _AccessibilityContainer* pContainer = __pContextMenu->GetAccessibilityContainer();
        if (pContainer != null)
        {
+               /* not confirmed yet
+               _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
+               if (pElement != null)
+               {
+                       pElement->SetTrait(L"Contextual popup");
+                       pElement->SetHint(L"double tap to close");
+                       pElement->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
+                       pContainer->AddElement(*pElement);
+                       __pContextMenu->AddAccessibilityElement(*pElement);
+               }
+               */
+
                int itemCount = __pModel->GetItemCount();
                for (int i = 0; i < itemCount; i++)
                {
@@ -1573,18 +1587,18 @@ _ContextMenuGridPresenter::SetAllAccessibilityElement(void)
                        _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
                        if (pItem != null && pElement != null)
                        {
-                               pElement->SetLabel(pItem->GetText());
-//                             pElement->SetTrait(ACCESSIBILITY_TRAITS_CONTEXTMENU);
-                               pElement->SetTrait(ACCESSIBILITY_TRAITS_LIST);  // not yet
-                               pElement->SetBounds(pItem->GetDrawRect());
-                               if (i == 0)
+                               pElement->SetName(L"ContextMenuItem" + Integer::ToString(i));
+                               if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP)
                                {
-                                       pElement->SetHint(L"The first of Contextual popup");
+                                       pElement->SetLabel(L"icon");
                                }
-                               else if(i == itemCount - 1)
+                               else
                                {
-                                       pElement->SetHint(L"The last of Contextual popup");
+                                       pElement->SetLabel(pItem->GetText());
                                }
+
+                               pElement->SetTrait(L"Contextual popup");
+                               pElement->SetBounds(pItem->GetDrawRect());
                                pContainer->AddElement(*pElement);
                                __pContextMenu->AddAccessibilityElement(*pElement);
                        }
index 91ef524..328e307 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <FBaseSysLog.h>
 #include <FGrp_BitmapImpl.h>
+#include "FUi_AccessibilityContainer.h"
+#include "FUi_AccessibilityElement.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_ResourceManager.h"
 
@@ -352,6 +354,12 @@ _ContextMenuItem::DrawItemUpperDivider(void)
 
        __pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
        __pUpperDividerLineLabel->Invalidate();
+
+       _AccessibilityContainer* pContainer = __pUpperDividerLineLabel->GetAccessibilityContainer();
+       if (pContainer)
+       {
+               pContainer->Activate(false);
+       }
 }
 
 void
@@ -397,6 +405,12 @@ _ContextMenuItem::DrawItemBackground(void)
        BgBitmap = null;
 
        __pBackgroundLabel->Invalidate();
+
+       _AccessibilityContainer* pContainer = __pBackgroundLabel->GetAccessibilityContainer();
+       if (pContainer)
+       {
+               pContainer->Activate(false);
+       }
 }
 
 void
@@ -421,6 +435,12 @@ _ContextMenuItem::DrawItemLowerDivider(void)
 
        __pLowerDividerLineLabel->SetBackgroundColor(dividerLineColor);
        __pLowerDividerLineLabel->Invalidate();
+
+       _AccessibilityContainer* pContainer = __pLowerDividerLineLabel->GetAccessibilityContainer();
+       if (pContainer)
+       {
+               pContainer->Activate(false);
+       }
 }
 
 _UiTouchEventDelivery
index bebd566..036e1bb 100644 (file)
@@ -82,6 +82,7 @@ _ContextMenuListPresenter::_ContextMenuListPresenter(_ContextMenu* pContextMenu)
        , __itemBitmapHeight(0.0f)
        , __itemFontSize(0.0f)
        , __dividerHeight(0.0f)
+       , __anchorPopupOverlap(0.0f)
 {
 
 }
@@ -154,6 +155,7 @@ _ContextMenuListPresenter::LoadShape(void)
 
        GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, __itemFontSize);
        GET_SHAPE_CONFIG(CONTEXTMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);
+       GET_SHAPE_CONFIG(CONTEXTMENU::ANCHOR_POPUP_OVERLAP, _CONTROL_ORIENTATION_PORTRAIT, __anchorPopupOverlap);
 
        __itemWidth = __itemMinWidth;
 }
@@ -509,7 +511,7 @@ _ContextMenuListPresenter::CalculateRect(void)
                windowRect.height = bodyRect.height + arrowRect.height;
 
                bodyRect.x = 0.0f;
-               bodyRect.y = __arrowTopMargin;
+               bodyRect.y = __arrowTopMargin - __anchorPopupOverlap;
 
                // Set arrow position
                arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
@@ -565,7 +567,7 @@ _ContextMenuListPresenter::CalculateRect(void)
                windowRect.height = bodyRect.height + arrowRect.height;
 
                bodyRect.x = 0.0f;
-               bodyRect.y = arrowRect.height - __arrowBottomMargin;
+               bodyRect.y = arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
 
                // Set arrow position
                arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
@@ -626,7 +628,7 @@ _ContextMenuListPresenter::CalculateRect(void)
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;
 
-               bodyRect.x = __arrowRightMargin;
+               bodyRect.x = __arrowRightMargin - __anchorPopupOverlap;
                bodyRect.y = 0.0f;
 
                // Set arrow position
@@ -658,7 +660,7 @@ _ContextMenuListPresenter::CalculateRect(void)
                }
 
                // Set body position x
-               bodyRect.x = anchorPosition.x + arrowRect.width;
+               bodyRect.x = anchorPosition.x;
                //  - Check left margin
                if (bodyRect.x <= leftBoundary)
                {
@@ -682,12 +684,12 @@ _ContextMenuListPresenter::CalculateRect(void)
                        bodyRect.y = bottomBoundary - bodyRect.height;
                }
 
-               windowRect.x = bodyRect.x - arrowRect.width;
+               windowRect.x = bodyRect.x;
                windowRect.y = bodyRect.y;
                windowRect.width = bodyRect.width + arrowRect.width;
                windowRect.height = bodyRect.height;
 
-               bodyRect.x = arrowRect.width - __arrowLeftMargin;
+               bodyRect.x = arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
                bodyRect.y = 0.0f;
 
                // Set arrow position
@@ -695,8 +697,8 @@ _ContextMenuListPresenter::CalculateRect(void)
                arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y;
        }
 
-       itemRect.x      = bodyLeftMargin;
-       itemRect.y      = bodyTopMargin + bodyBottomMargin;
+       itemRect.x      = bodyRect.x + bodyLeftMargin;
+       itemRect.y      = bodyRect.y + bodyTopMargin;
        itemRect.width  = __layoutSize.width;
        itemRect.height = __layoutSize.height;
 
@@ -1082,6 +1084,18 @@ _ContextMenuListPresenter::SetAllAccessibilityElement(void)
        _AccessibilityContainer* pContainer = __pContextMenu->GetAccessibilityContainer();
        if (pContainer != null)
        {
+               /* not confirmed yet
+               _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
+               if (pElement != null)
+               {
+                       pElement->SetTrait(L"Contextual popup");
+                       pElement->SetHint(L"double tap to close");
+                       pElement->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
+                       pContainer->AddElement(*pElement);
+                       __pContextMenu->AddAccessibilityElement(*pElement);
+               }
+               */
+
                int itemCount = __pModel->GetItemCount();
                for (int i = 0; i < itemCount; i++)
                {
@@ -1089,18 +1103,18 @@ _ContextMenuListPresenter::SetAllAccessibilityElement(void)
                        _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
                        if (pItem != null && pElement != null)
                        {
-                               pElement->SetLabel(pItem->GetText());
-//                             pElement->SetTrait(ACCESSIBILITY_TRAITS_CONTEXTMENU);
-                               pElement->SetTrait(ACCESSIBILITY_TRAITS_LIST);  // not yet
-                               pElement->SetBounds(pItem->GetDrawRect());
-                               if (i == 0)
+                               pElement->SetName(L"ContextMenuItem" + Integer::ToString(i));
+                               if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP)
                                {
-                                       pElement->SetHint(L"The first of Contextual popup");
+                                       pElement->SetLabel(L"icon " + pItem->GetText());
                                }
-                               else if(i == itemCount - 1)
+                               else
                                {
-                                       pElement->SetHint(L"The last of Contextual popup");
+                                       pElement->SetLabel(pItem->GetText());
                                }
+
+                               pElement->SetTrait(L"Contextual popup");
+                               pElement->SetBounds(pItem->GetDrawRect());
                                pContainer->AddElement(*pElement);
                                __pContextMenu->AddAccessibilityElement(*pElement);
                        }
index 2a7eb32..2fbed2b 100644 (file)
@@ -144,6 +144,7 @@ private:
        float __itemFontSize;
        float __dividerHeight;
        float __bgPressedMargin;
+       float __anchorPopupOverlap;
 }; // _ContextMenuGridPresenter
 
 }}} // Tizen::Ui: Control
index 5b628d8..ea45322 100644 (file)
@@ -138,6 +138,7 @@ private:
        float __itemBitmapHeight;
        float __itemFontSize;
        float __dividerHeight;
+       float __anchorPopupOverlap;
 }; // _ContextMenuListPresenter
 
 }}} // Tizen::Ui: Control
index 2f07bcd..642acdd 100644 (file)
@@ -86,6 +86,7 @@ DECLARE_UI_CONFIG(CONTEXTMENU);
        DECLARE_SHAPE_CONFIG(ANCHOR_LEFT_MARGIN, 41);
        DECLARE_SHAPE_CONFIG(ANCHOR_RIGHT_MARGIN, 42);
        DECLARE_SHAPE_CONFIG(ITEM_BG_PRESSED_MARGIN, 43);
+       DECLARE_SHAPE_CONFIG(ANCHOR_POPUP_OVERLAP, 44);
        DECLARE_FIXED_VALUE_CONFIG(GRID_ITEM_GAP, 1);
 DECLARE_END_UI_CONFIG(CONTEXTMENU);
 
index 66d0972..ce6c245 100644 (file)
@@ -109,6 +109,7 @@ START_UI_CONFIG(CONTEXTMENU);
                ADD_SHAPE_CONFIG(APPEARING_ANIMATION_DISTANCE_X, 40);
                ADD_SHAPE_CONFIG(APPEARING_ANIMATION_DISTANCE_Y, 40);
                ADD_SHAPE_CONFIG(ITEM_BG_PRESSED_MARGIN, 4);
+               ADD_SHAPE_CONFIG(ANCHOR_POPUP_OVERLAP, 1);
        END_UI_CONFIG_MODE(720x1280);
 
        START_UI_CONFIG_MODE(1280x720);