Fixed P130320-7993 and N_SE-31927.
authorclone <ingyou.park@samsung.com>
Wed, 10 Apr 2013 22:51:45 +0000 (07:51 +0900)
committerclone <ingyou.park@samsung.com>
Thu, 11 Apr 2013 14:45:14 +0000 (23:45 +0900)
Change-Id: I50cb319085b16ac9bb752e2a4b5abb34af92412f
Signed-off-by: clone <ingyou.park@samsung.com>
src/ui/controls/FUiCtrl_ContextMenu.cpp
src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp
src/ui/controls/FUiCtrl_ContextMenuItem.cpp
src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp
src/ui/inc/FUiCtrl_ContextMenu.h
src/ui/inc/FUiCtrl_ContextMenuItem.h

index 060f25e..9c07616 100644 (file)
@@ -1205,6 +1205,22 @@ _ContextMenu::OnChangeLayout(_ControlOrientation orientation)
        __layout = orientation;
 }
 
+void
+_ContextMenu::OnOwnerChanged(_Control* pOldOwner)
+{
+       _Control* pOwner = GetOwner();
+
+       if (pOldOwner != null)
+       {
+               pOldOwner->UnlockInputEvent();
+       }
+
+       if (pOwner != null)
+       {
+               pOwner->LockInputEvent();
+       }
+}
+
 _AccessibilityElement*
 _ContextMenu::GetAccessibilityElement(const int mainIndex) const
 {
index 1f396ac..2429894 100755 (executable)
@@ -846,7 +846,7 @@ _ContextMenuGridPresenter::AdjustItemLayoutIconStyle(void)
                        }
 
                        pItem->SetDrawRect(drawRect);
-                       pItem->SetDivider(drawDivider);
+                       pItem->SetLowerDivider(drawDivider);
                }
        }
 
@@ -906,7 +906,7 @@ _ContextMenuGridPresenter::AdjustItemLayoutTabStyle(void)
                        _ContextMenuItem* pPreviousItem = __pModel->GetItem(i - 1);
                        if (pPreviousItem != null)
                        {
-                               pPreviousItem->SetDivider(false);
+                               pPreviousItem->SetLowerDivider(false);
                        }
 
                        x = 0.0f;
@@ -919,7 +919,7 @@ _ContextMenuGridPresenter::AdjustItemLayoutTabStyle(void)
 
                FloatRectangle drawRect(x, y, itemSize.width, itemSize.height);
                pItem->SetDrawRect(drawRect);
-               pItem->SetDivider(true);
+               pItem->SetLowerDivider(true);
 
                x = x + itemSize.width + __itemGap;
                lineWidth = lineWidth + itemSize.width + __itemGap;
@@ -943,7 +943,7 @@ _ContextMenuGridPresenter::AdjustItemLayoutTabStyle(void)
        // last item
        if (pItem != null)
        {
-               pItem->SetDivider(false);
+               pItem->SetLowerDivider(false);
        }
 
        FloatDimension layoutSize(__itemWidth, __itemHeight);
@@ -1134,14 +1134,14 @@ _ContextMenuGridPresenter::DrawBackground(Canvas* pCanvas)
        }
        else
        {
-               if (pBackgroundEffectBitmap != null)
+               if (pBackgroundNormalBitmap != null)
                {
-                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundEffectBitmap);
+                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundNormalBitmap);
                }
 
-               if (pBackgroundNormalBitmap != null)
+               if (pBackgroundEffectBitmap != null)
                {
-                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundNormalBitmap);
+                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundEffectBitmap);
                }
        }
 
@@ -1161,15 +1161,15 @@ _ContextMenuGridPresenter::DrawArrow(Canvas* pCanvas)
        const Bitmap* pArrowNormalBitmap = __pContextMenu->GetArrowNormalBitmap(dropPosition);
        const Bitmap* pEffectArrowBitmap = __pContextMenu->GetArrowEffectBitmap(dropPosition);
 
-       if (pEffectArrowBitmap != null)
-       {
-               r = DrawBitmap(*pCanvas, arrowRect, *pEffectArrowBitmap);
-       }
        if (pArrowNormalBitmap != null)
        {
                r = DrawBitmap(*pCanvas, arrowRect, *pArrowNormalBitmap);
        }
 
+       if (pEffectArrowBitmap != null)
+       {
+               r = DrawBitmap(*pCanvas, arrowRect, *pEffectArrowBitmap);
+       }
 
        return r;
 }
@@ -1211,7 +1211,7 @@ _ContextMenuGridPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas)
                FloatRectangle rect = pItem->GetDrawRect();
 
                // divder
-               bool drawDivider = pItem->GetDivider();
+               bool drawDivider = pItem->HasLowerDivider();
                if (drawDivider == true)
                {
                        float x = rect.x + rect.width;
index 573a629..b64fcc5 100644 (file)
@@ -36,21 +36,31 @@ namespace Tizen { namespace Ui { namespace Controls
 _ContextMenuItem::_ContextMenuItem(void)
        : __type(CONTEXT_MENU_ITEM_DRAWING_TYPE_NONE)
        , __actionId(-1)
-       , __divider(false)
+       , __upperDividerLine(false)
+       , __lowerDividerLine(false)
        , __selected(false)
        , __parentScrollEnable(false)
+       , __leftMargin(0.0f)
+       , __rightMargin(0.0f)
+       , __dividerHeight(0.0f)
        , __textSize(0.0f)
        , __text(L"")
        , __size(FloatDimension(0.0f, 0.0f))
        , __drawRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
        , __pBitmapLabel(null)
        , __pTextLabel(null)
-       , __pDividerLineLabel1(null)
-       , __pDividerLineLabel2(null)
+       , __pUpperDividerLineLabel(null)
+       , __pLowerDividerLineLabel(null)
 {
        __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL] = null;
        __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_PRESSED] = null;
        __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED] = null;
+
+       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_LEFT_MARGIN,  _CONTROL_ORIENTATION_PORTRAIT, __leftMargin);
+       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __rightMargin);
+       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);
+       GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_01_NORMAL, __lowerDividerLineColor);    // lower divider of item n and
+       GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_02_NORMAL, __upperDividerLineColor);    // upper divider of item n+1 are bonded together.
 }
 
 _ContextMenuItem::~_ContextMenuItem(void)
@@ -72,6 +82,20 @@ _ContextMenuItem::~_ContextMenuItem(void)
                delete __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED];
                __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED] = null;
        }
+
+       if (__pUpperDividerLineLabel != null)
+       {
+               DetachChild(*__pUpperDividerLineLabel);
+               delete __pUpperDividerLineLabel;
+               __pUpperDividerLineLabel = null;
+       }
+
+       if (__pLowerDividerLineLabel != null)
+       {
+               DetachChild(*__pLowerDividerLineLabel);
+               delete __pLowerDividerLineLabel;
+               __pLowerDividerLineLabel = null;
+       }
 }
 
 _ContextMenuItem*
@@ -132,14 +156,27 @@ _ContextMenuItem::GetActionId(void) const
 }
 
 void
-_ContextMenuItem::SetDivider(bool drawDivider)
+_ContextMenuItem::SetUpperDivider(bool drawDivider)
+{
+       __upperDividerLine = drawDivider;
+}
+
+void
+_ContextMenuItem::SetLowerDivider(bool drawDivider)
+{
+       __lowerDividerLine = drawDivider;
+}
+
+bool
+_ContextMenuItem::HasUpperDivider(void) const
 {
-       __divider = drawDivider;
+       return __upperDividerLine;
 }
+
 bool
-_ContextMenuItem::GetDivider(void) const
+_ContextMenuItem::HasLowerDivider(void) const
 {
-       return __divider;
+       return __lowerDividerLine;
 }
 
 void
@@ -244,10 +281,14 @@ _ContextMenuItem::OnDraw(void)
        DrawItem();
 }
 
-
 void
 _ContextMenuItem::DrawItem(void)
 {
+       if (__upperDividerLine)
+       {
+               DrawItemUpperDivider();
+       }
+
        if(__selected)
        {
                Color selectedBgColor;
@@ -259,52 +300,60 @@ _ContextMenuItem::DrawItem(void)
                SetBackgroundColor(Color(0, 0, 0, 0));
        }
 
-       DrawItemDivider();
+       if (__lowerDividerLine)
+       {
+               DrawItemLowerDivider();
+       }
 }
 
 void
-_ContextMenuItem::DrawItemDivider(void)
+_ContextMenuItem::DrawItemUpperDivider(void)
 {
-       float leftMargin, rightMargin, dividerHeight;
-       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_LEFT_MARGIN,  _CONTROL_ORIENTATION_PORTRAIT, leftMargin);
-       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, rightMargin);
-       GET_SHAPE_CONFIG(CONTEXTMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight);
-
-       if (__pDividerLineLabel1 == null)
+       if (__pUpperDividerLineLabel == null)
        {
-               __pDividerLineLabel1 = _Label::CreateLabelN();
-               SysTryReturnVoidResult(NID_UI_CTRL, __pDividerLineLabel1, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+               __pUpperDividerLineLabel = _Label::CreateLabelN();
+               SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
                FloatRectangle bounds = GetBoundsF();
 
-               __pDividerLineLabel1->SetBounds(FloatRectangle(leftMargin, bounds.height - 2.0f * dividerHeight, bounds.width - leftMargin - rightMargin, dividerHeight));
+               __pUpperDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, 0.0f, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
 
-               Color dividerLineColor;
-               GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_01_NORMAL, dividerLineColor);
-               __pDividerLineLabel1->SetBackgroundColor(dividerLineColor);
+               AttachChild(*__pUpperDividerLineLabel);
+       }
 
-               AttachChild(*__pDividerLineLabel1);
+       Color dividerLineColor = Color(0, 0, 0, 0);
+       if (__selected == false)
+       {
+               dividerLineColor = __upperDividerLineColor;
        }
 
-       __pDividerLineLabel1->Invalidate();
+       __pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
+       __pUpperDividerLineLabel->Invalidate();
+}
 
-       if (__pDividerLineLabel2 == null)
+void
+_ContextMenuItem::DrawItemLowerDivider(void)
+{
+       if (__pLowerDividerLineLabel == null)
        {
-               __pDividerLineLabel2 = _Label::CreateLabelN();
-               SysTryReturnVoidResult(NID_UI_CTRL, __pDividerLineLabel2, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+               __pLowerDividerLineLabel = _Label::CreateLabelN();
+               SysTryReturnVoidResult(NID_UI_CTRL, __pLowerDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
                FloatRectangle bounds = GetBoundsF();
 
-               __pDividerLineLabel2->SetBounds(FloatRectangle(leftMargin, bounds.height - dividerHeight, bounds.width - leftMargin - rightMargin, dividerHeight));
+               __pLowerDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, bounds.height - __dividerHeight, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
 
-               Color dividerLineColor;
-               GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_02_NORMAL, dividerLineColor);
-               __pDividerLineLabel2->SetBackgroundColor(dividerLineColor);
+               AttachChild(*__pLowerDividerLineLabel);
+       }
 
-               AttachChild(*__pDividerLineLabel2);
+       Color dividerLineColor = Color(0, 0, 0, 0);
+       if (__selected == false)
+       {
+               dividerLineColor = __lowerDividerLineColor;
        }
 
-       __pDividerLineLabel2->Invalidate();
+       __pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
+       __pLowerDividerLineLabel->Invalidate();
 }
 
 _UiTouchEventDelivery
index 6a57575..da576f5 100755 (executable)
@@ -803,7 +803,8 @@ _ContextMenuListPresenter::AdjustItemPosition(void)
                FloatRectangle drawRect(x, drawItemY + y, __itemWidth, itemHeight);
 
                pItem->SetDrawRect(drawRect);
-               pItem->SetDivider(true);
+               pItem->SetUpperDivider(i > 0);
+               pItem->SetLowerDivider(i < itemCount - 1);
                pItem->SetParentScrollEnable(__scrollEnable);
                pItem->SetBounds(FloatRectangle(0.0f, drawItemY, drawRect.width, drawRect.height));
 
@@ -897,14 +898,14 @@ _ContextMenuListPresenter::DrawBackground(Canvas* pCanvas)
        }
        else
        {
-               if (pBackgroundEffectBitmap != null)
+               if (pBackgroundNormalBitmap != null)
                {
-                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundEffectBitmap);
+                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundNormalBitmap);
                }
 
-               if (pBackgroundNormalBitmap != null)
+               if (pBackgroundEffectBitmap != null)
                {
-                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundNormalBitmap);
+                       r = DrawBitmap(*pCanvas, bodyRect, *pBackgroundEffectBitmap);
                }
        }
 
@@ -924,14 +925,14 @@ _ContextMenuListPresenter::DrawArrow(Canvas* pCanvas)
        const Bitmap* pArrowNormalBitmap = __pContextMenu->GetArrowNormalBitmap(dropPosition);
        const Bitmap* pEffectArrowBitmap = __pContextMenu->GetArrowEffectBitmap(dropPosition);
 
-       if (pEffectArrowBitmap != null)
+       if (pArrowNormalBitmap != null)
        {
-               r = DrawBitmap(*pCanvas, arrowRect, *pEffectArrowBitmap);
+               r = DrawBitmap(*pCanvas, arrowRect, *pArrowNormalBitmap);
        }
 
-       if (pArrowNormalBitmap != null)
+       if (pEffectArrowBitmap != null)
        {
-               r = DrawBitmap(*pCanvas, arrowRect, *pArrowNormalBitmap);
+               r = DrawBitmap(*pCanvas, arrowRect, *pEffectArrowBitmap);
        }
 
        return r;
index 5d4dc1c..5d182b2 100644 (file)
@@ -199,6 +199,7 @@ public:
 
        virtual void OnVisibleStateChanged(void);
        virtual void OnChangeLayout(_ControlOrientation orientation);
+       virtual void OnOwnerChanged(_Control* pOldOwner);
 
        virtual bool IsActivatedOnOpen(void) const;
        Tizen::Ui::_AccessibilityElement* GetAccessibilityElement(const int mainIndex) const;
index a702c26..2abf7da 100644 (file)
@@ -77,8 +77,10 @@ public:
        void SetActionId(int actionId);
        int GetActionId(void) const;
 
-       void SetDivider(bool drawDivider);
-       bool GetDivider(void) const;
+       void SetUpperDivider(bool drawDivider);
+       bool HasUpperDivider(void) const;                       // first item has no upper divider in List style
+       void SetLowerDivider(bool drawDivider);
+       bool HasLowerDivider(void) const;                       //  last item has no lower divider in List style
 
        void SetTextSize(float size);
 
@@ -108,7 +110,8 @@ public:
        void DrawItem(void);
        void SetBitmapLabel(_Label* pLabel);
        void SetTextLabel(_Label* pLabel);
-       void DrawItemDivider(void);
+       void DrawItemUpperDivider(void);
+       void DrawItemLowerDivider(void);
 
        void TouchMoved(const _Control& source, const _TouchInfo& touchinfo);
        // event handler for ITouchEventListener
@@ -131,22 +134,30 @@ private:
 private:
        ContextMenuItemDrawingType __type;
        int __actionId;
-       bool __divider;
+       bool __upperDividerLine;
+       bool __lowerDividerLine;
 
        bool __pressed;
        bool __selected;
        bool __parentScrollEnable;
 
+       float __leftMargin;
+       float __rightMargin;
+       float __dividerHeight;
+
        float __textSize;
        Tizen::Base::String __text;
        Tizen::Graphics::Bitmap* __pBitmap[CONTEXT_MENU_ITEM_DRAWING_STATUS_MAX];
        Tizen::Graphics::FloatDimension __size;
        Tizen::Graphics::FloatRectangle __drawRect;
+       Tizen::Graphics::Color __selectedBgColor;
+       Tizen::Graphics::Color __upperDividerLineColor;
+       Tizen::Graphics::Color __lowerDividerLineColor;
 
        _Label* __pBitmapLabel;
        _Label* __pTextLabel;
-       _Label* __pDividerLineLabel1;
-       _Label* __pDividerLineLabel2;
+       _Label* __pUpperDividerLineLabel;
+       _Label* __pLowerDividerLineLabel;
 
 }; // _ContextMenuItem