}
pItem->SetDrawRect(drawRect);
- pItem->SetDivider(drawDivider);
+ pItem->SetLowerDivider(drawDivider);
}
}
_ContextMenuItem* pPreviousItem = __pModel->GetItem(i - 1);
if (pPreviousItem != null)
{
- pPreviousItem->SetDivider(false);
+ pPreviousItem->SetLowerDivider(false);
}
x = 0.0f;
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;
// last item
if (pItem != null)
{
- pItem->SetDivider(false);
+ pItem->SetLowerDivider(false);
}
FloatDimension layoutSize(__itemWidth, __itemHeight);
}
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);
}
}
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;
}
FloatRectangle rect = pItem->GetDrawRect();
// divder
- bool drawDivider = pItem->GetDivider();
+ bool drawDivider = pItem->HasLowerDivider();
if (drawDivider == true)
{
float x = rect.x + rect.width;
_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)
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*
}
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
DrawItem();
}
-
void
_ContextMenuItem::DrawItem(void)
{
+ if (__upperDividerLine)
+ {
+ DrawItemUpperDivider();
+ }
+
if(__selected)
{
Color selectedBgColor;
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
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));
}
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);
}
}
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;
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);
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
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