From: youseong.ji Date: Sun, 14 Apr 2013 19:21:53 +0000 (+0900) Subject: Modified to draw the item divider and the annex properly X-Git-Tag: accepted/tizen_2.1/20130425.033138~210^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c03e1d9de8e91e074f268015f90998672da9aafc;p=framework%2Fosp%2Fuifw.git Modified to draw the item divider and the annex properly Change-Id: Ic37d97e8ad3415f245d367e5e9e8843be7b0686e Signed-off-by: youseong.ji --- diff --git a/src/ui/controls/FUiCtrl_TableViewItem.cpp b/src/ui/controls/FUiCtrl_TableViewItem.cpp index 6d1f0d6..180a45e 100644 --- a/src/ui/controls/FUiCtrl_TableViewItem.cpp +++ b/src/ui/controls/FUiCtrl_TableViewItem.cpp @@ -1811,60 +1811,40 @@ _TableViewItem::PlayCheckBoxAnimation(void) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); - if (pCanvas != null) - { - r = pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); - pCanvas->Clear(); - DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg); + r = pCanvas->Construct(bounds); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); + pCanvas->Clear(); - __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox); - if (IsChecked() == true) + DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg); + + __checkedBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox); + if (IsChecked() == true) + { + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox)) { - if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pCheckBox)) - { - FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height); - r = pCanvas->DrawNinePatchedBitmap(_CoordinateSystemUtils::ConvertToInteger(drawingRect), *pCheckBox); // +++ check floating - } - else - { - FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF()); - FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height); - r = pCanvas->DrawBitmap(_CoordinateSystemUtils::ConvertToInteger(drawingRect), *pCheckBox, _CoordinateSystemUtils::ConvertToInteger(bitmapSourceRect)); // +++ check floating - } + FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width, __checkedBounds.height); + r = pCanvas->DrawNinePatchedBitmap(_CoordinateSystemUtils::ConvertToInteger(drawingRect), *pCheckBox); // +++ check floating + } + else + { + FloatRectangle bitmapSourceRect(0.0f, 0.0f, pCheckBox->GetWidthF()*__checkedCount * 0.1, pCheckBox->GetHeightF()); + FloatRectangle drawingRect(__checkedBounds.x, __checkedBounds.y, __checkedBounds.width * __checkedCount * 0.1, __checkedBounds.height); + r = pCanvas->DrawBitmap(_CoordinateSystemUtils::ConvertToInteger(drawingRect), *pCheckBox, _CoordinateSystemUtils::ConvertToInteger(bitmapSourceRect)); // +++ check floating } } pMergeBitmap = new (std::nothrow) Bitmap(); SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - if (pMergeBitmap != null) - { - pMergeBitmap->Construct(*pCanvas, bounds); - } + pMergeBitmap->Construct(*pCanvas, bounds); - if (__pItemAnnex == null) + if(__pItemAnnex) { - __pItemAnnex = _Label::CreateLabelN(); - - r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, __pItemAnnex != null, , r, "[%s] Propagating.", GetErrorMessage(r)); - - float leftMargin = 0.0f; - GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin); - - float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height); - - __pItemAnnex->SetBounds(FloatRectangle(leftMargin, ((itemHeight - annexHeight) / 2), annexWidth, annexHeight)); - __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0)); - - AttachSystemChild(*__pItemAnnex); + __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); + __pItemAnnex->Invalidate(); } - __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); - __pItemAnnex->Invalidate(); - CATCH: delete pCheckBox; delete pCheckBoxBg; @@ -1983,9 +1963,24 @@ _TableViewItem::DrawItemBackground(void) SetBackgroundColor(Color(0, 0, 0, 0)); __pHighlightVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f)); } + else if(__itemType == TABLE_VIEW_ITEM_TYPE_TITLE) + { + Color titleColor; + if((__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED) || (__drawingStatus == TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED)) + { + GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_PRESSED, titleColor); + } + else + { + GET_COLOR_CONFIG(TABLEVIEW::GROUPITEM_BG_NORMAL, titleColor); + } + + __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)titleColor.GetRed() / 255.0f, (float)titleColor.GetGreen() / 255.0f, (float)titleColor.GetBlue() / 255.0f, (float)titleColor.GetAlpha() / 255.0f)); + } else { SetBackgroundColor(__colorItemBg[TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL]); + __pHighlightVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f)); if (__pDrawingProperty->groupedLookEnabled == true) @@ -2070,7 +2065,7 @@ _TableViewItem::DrawSectionStyleBackground(void) { Canvas* pCanvas = null; Bitmap* pSectionBg = null; - Bitmap* pSectionPressedBg = null; + Bitmap* pReplacementSectionPressBg = null; Bitmap* pReplacementSectionBg = null; Color bgColor = __colorItemBg[__drawingStatus]; FloatRectangle bounds = GetBoundsF(); @@ -2128,31 +2123,11 @@ _TableViewItem::DrawSectionStyleBackground(void) Color pressColor; GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_PRESSED, pressColor); - if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE) - { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed"); - } - else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP) - { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed"); - } - else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE) - { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed"); - } - else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM) - { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionPressedBg); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed"); - } + pReplacementSectionPressBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), pressColor); - pSectionPressedBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBg, Color::GetColor(COLOR_ID_MAGENTA), pressColor); GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, dividerHeight); - DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height-dividerHeight * 2), *pSectionPressedBg); + DrawBitmap(*pCanvas, FloatRectangle(0.0f, dividerHeight, bounds.width, bounds.height - dividerHeight * 2), *pReplacementSectionPressBg); } else { @@ -2175,7 +2150,7 @@ _TableViewItem::DrawSectionStyleBackground(void) CATCH: delete pSectionBg; - delete pSectionPressedBg; + delete pReplacementSectionPressBg; delete pReplacementSectionBg; delete pCanvas; } @@ -2183,8 +2158,12 @@ CATCH: void _TableViewItem::DrawSectionStyleBackgroundCover(void) { - Bitmap* pSectionBgCover = null; + Bitmap* pSectionBgCoverEf = null; + Bitmap* pReplacementSectionBgEf = null; Bitmap* pReplacementSectionBg = null; + Bitmap* pSectionBgCoverBg = null; + Bitmap* pMergeBitmap = null; + Canvas* pCanvas = null; if (__pDrawingProperty->sectionStyleEnabled == true) { @@ -2194,19 +2173,41 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void) FloatRectangle bounds = GetBoundsF(); if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE) { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCover); + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf); } else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP) { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCover); + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf); } else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE) { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCover); + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf); } else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM) { - r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCover); + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_COVER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverEf); + } + else + { + r = E_SYSTEM; + } + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] SectionStyle image load failed"); + + if (__itemType == TABLE_VIEW_ITEM_TYPE_ONE) + { + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_SINGLE_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg); + } + else if (__itemType == TABLE_VIEW_ITEM_TYPE_TOP) + { + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_TOP_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg); + } + else if (__itemType == TABLE_VIEW_ITEM_TYPE_MIDDLE) + { + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_CENTER_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg); + } + else if (__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM) + { + r = GET_BITMAP_CONFIG_N(TABLEVIEW::SECTIONITEM_BOTTOM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pSectionBgCoverBg); } else { @@ -2216,25 +2217,44 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void) __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); + Color bgColor; + if (__enabledState) { _TableView* pParent = dynamic_cast<_TableView*>(GetParent()); if (pParent == null) { - delete pSectionBgCover; + delete pSectionBgCoverEf; return; } - pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCover, Color::GetColor(COLOR_ID_MAGENTA), pParent->GetBackgroundColor()); - __pItemCover->SetBackgroundBitmap(*pReplacementSectionBg); + + bgColor = pParent->GetBackgroundColor(); } else { - Color bgColor; GET_COLOR_CONFIG(TABLEVIEW::ITEM_BG_DISABLED, bgColor); - pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCover, Color::GetColor(COLOR_ID_MAGENTA), bgColor); - __pItemCover->SetBackgroundBitmap(*pReplacementSectionBg); } + pReplacementSectionBg = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverBg, Color::GetColor(COLOR_ID_MAGENTA), bgColor); + pReplacementSectionBgEf = Tizen::Graphics::_BitmapImpl::GetColorReplacedBitmapN(*pSectionBgCoverEf, Color::GetColor(COLOR_ID_MAGENTA), bgColor); + + pCanvas = new (std::nothrow) Canvas(); + SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + + pCanvas->Construct(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); + pCanvas->SetBackgroundColor(Color(bgColor.GetRed(), bgColor.GetGreen(), bgColor.GetBlue(), 0)); + pCanvas->Clear(); + + DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBg); + DrawBitmap(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pReplacementSectionBgEf); + + pMergeBitmap = new (std::nothrow) Bitmap(); + SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + + pMergeBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); + + __pItemCover->SetBackgroundBitmap(*pMergeBitmap); + if (__pDrawingProperty->groupedLookEnabled == true) { __pItemCover->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); @@ -2243,8 +2263,12 @@ _TableViewItem::DrawSectionStyleBackgroundCover(void) } CATCH: - delete pSectionBgCover; + delete pSectionBgCoverEf; + delete pReplacementSectionBgEf; delete pReplacementSectionBg; + delete pSectionBgCoverBg; + delete pCanvas; + delete pMergeBitmap; } void @@ -2351,34 +2375,29 @@ _TableViewItem::DrawCheckBox(void) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); - if (pCanvas != null) - { - pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); - pCanvas->Clear(); - DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg); + pCanvas->Construct(bounds); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); + pCanvas->Clear(); - if (__isCheckedAnimationEnabled == true) - { - StartCheckBoxAnimation(); - } - else + DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBoxBg), *pCheckBoxBg); + + if (__isCheckedAnimationEnabled == true) + { + StartCheckBoxAnimation(); + } + else + { + if (IsChecked() == true && pCheckBox != null) { - if (IsChecked() == true && pCheckBox != null) - { - DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox); - } + DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pCheckBox), *pCheckBox); } } pMergeBitmap = new (std::nothrow) Bitmap(); SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - if (pMergeBitmap != null) - { - pMergeBitmap->Construct(*pCanvas, bounds); - } + pMergeBitmap->Construct(*pCanvas, bounds); __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); __pItemAnnex->Invalidate(); @@ -2442,27 +2461,22 @@ _TableViewItem::DrawRadioBox(void) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); - if (pCanvas != null) - { - pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); - pCanvas->Clear(); - DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg); + pCanvas->Construct(bounds); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); + pCanvas->Clear(); - if (pRadioButton != null && IsChecked() == true) - { - DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton); - } + DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButtonBg), *pRadioButtonBg); + + if (pRadioButton != null && IsChecked() == true) + { + DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pRadioButton), *pRadioButton); } pMergeBitmap = new (std::nothrow) Bitmap(); SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - if (pMergeBitmap != null) - { - pMergeBitmap->Construct(*pCanvas, bounds); - } + pMergeBitmap->Construct(*pCanvas, bounds); __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); __pItemAnnex->Invalidate(); @@ -2535,8 +2549,9 @@ _TableViewItem::DrawOnOffButton(void) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); + pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); pCanvas->Clear(); backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton); @@ -2696,8 +2711,9 @@ _TableViewItem::DrawAnnexOnOffHandler(float position) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); + pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); pCanvas->Clear(); backgroundBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButton); @@ -2735,35 +2751,18 @@ _TableViewItem::DrawAnnexOnOffHandler(float position) { handlerBounds.x = backgroundBounds.x + annexMargin; } - } - - DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler); - - pMergeBitmap = new (std::nothrow) Bitmap(); - SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - - pMergeBitmap->Construct(*pCanvas, bounds); - if (__pItemAnnex == null) - { - __pItemAnnex = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pItemAnnex, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult())); - - float leftMargin = 0.0f; - GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, leftMargin); + DrawBitmap(*pCanvas, handlerBounds, *pOnOffButtonHandler); - leftMargin += __pDrawingProperty->scrollMargin; + pMergeBitmap = new (std::nothrow) Bitmap(); + SysTryCatch(NID_UI_CTRL, pMergeBitmap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); - float itemHeight = ((__customHeight > 0) ? __customHeight : GetBoundsF().height); // +++ check floating - __pItemAnnex->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - leftMargin), ((itemHeight - annexHeight) / 2), annexWidth, annexHeight)); - __pItemAnnex->SetBackgroundColor(Color(0, 0, 0, 0)); + pMergeBitmap->Construct(*pCanvas, bounds); - AttachSystemChild(*__pItemAnnex); + __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); + __pItemAnnex->Invalidate(); } - __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); - __pItemAnnex->Invalidate(); - CATCH: delete pOnOffButton; delete pOnOffButtonHandler; @@ -2844,8 +2843,9 @@ _TableViewItem::DrawDetailButton(void) SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_CANVAS_BG_NORMAL, canvasBackgroundColor); + pCanvas->Construct(bounds); - pCanvas->SetBackgroundColor(canvasBackgroundColor); + pCanvas->SetBackgroundColor(Color(canvasBackgroundColor.GetRed(), canvasBackgroundColor.GetGreen(), canvasBackgroundColor.GetBlue(), 0)); pCanvas->Clear(); DrawBitmap(*pCanvas, CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pReplacementDetailBg), *pReplacementDetailBg); @@ -2946,7 +2946,10 @@ _TableViewItem::DrawItemDivider(void) GetItemIndex(groupIndex, itemIndex); if (itemIndex < 1) { - __pItemTopDivider->SetVisibleState(false); + if(__pItemTopDivider) + { + __pItemTopDivider->SetVisibleState(false); + } } GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, dividerColor); @@ -2963,11 +2966,18 @@ _TableViewItem::DrawItemDivider(void) if (__pItemDivider != null ) { - if(__pItemDivider->GetVisibleState()) + if(__itemType == TABLE_VIEW_ITEM_TYPE_BOTTOM) { - __pItemDivider->SetBounds(dividerBottomBounds); - __pItemDivider->SetBackgroundColor(underLineColor); - __pItemDivider->Invalidate(); + __pItemDivider->SetVisibleState(false); + } + else + { + if(__pItemDivider->GetVisibleState()) + { + __pItemDivider->SetBounds(dividerBottomBounds); + __pItemDivider->SetBackgroundColor(underLineColor); + __pItemDivider->Invalidate(); + } } _AccessibilityContainer* pContainer = __pItemDivider->GetAccessibilityContainer(); @@ -3005,7 +3015,8 @@ _TableViewItem::DrawItemAnnexDivider(void) } else { - Color dividerColor; + Color dividerLeftColor; + Color dividerRightColor; FloatRectangle bounds = GetBoundsF(); float dividerHeight = 0; float itemHeight = 0; @@ -3018,7 +3029,8 @@ _TableViewItem::DrawItemAnnexDivider(void) GET_SHAPE_CONFIG(TABLEVIEW::ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemLeftMargin); GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexLeftMargin); GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth); - GET_COLOR_CONFIG(TABLEVIEW::ITEM_DIVIDER_TOP_BG_NORMAL, dividerColor); + GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, dividerLeftColor); + GET_COLOR_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, dividerRightColor); GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, dividerWidth); GET_FIXED_VALUE_CONFIG(TABLEVIEW::ITEM_ANNEX_DIVIDER_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, dividerTopMargin); @@ -3027,11 +3039,11 @@ _TableViewItem::DrawItemAnnexDivider(void) dividerHeight = itemHeight - (dividerTopMargin*2); dividerHeight = (dividerHeight > 0) ? dividerHeight : 0; __pItemAnnexLeftDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - (dividerWidth*2)), dividerTopMargin, dividerWidth, dividerHeight)); - __pItemAnnexLeftDivider->SetBackgroundColor(__pDrawingProperty->dividerColor); + __pItemAnnexLeftDivider->SetBackgroundColor(dividerLeftColor); __pItemAnnexLeftDivider->Invalidate(); __pItemAnnexRightDivider->SetBounds(FloatRectangle((GetBoundsF().width - annexWidth - (itemLeftMargin + annexLeftMargin) - dividerWidth), dividerTopMargin, dividerWidth, dividerHeight)); - __pItemAnnexRightDivider->SetBackgroundColor(dividerColor); + __pItemAnnexRightDivider->SetBackgroundColor(dividerRightColor); __pItemAnnexRightDivider->Invalidate(); } @@ -3071,7 +3083,6 @@ _TableViewItem::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const B result _TableViewItem::SetItemHighlightBounds(_VisualElement& highlightVisualElement, const FloatRectangle& bounds) { -// FloatRectangle veBounds(bounds.x, bounds.y, bounds.width, bounds.height); return highlightVisualElement.SetBounds(bounds); } @@ -3712,8 +3723,14 @@ _TableViewItem::MoveItem(FloatPoint position, int duration, int delay) _VisualElement* pVisualElement = GetVisualElement(); VisualElementValueAnimation* pAnimation = null; String animationName = L"MOVE_ITEM"; + FloatPoint itemPosition = GetPositionF(); result r = E_SUCCESS; + if (position == itemPosition) + { + return false; + } + if (__pMoveItemAnimation == null) { __pMoveItemAnimation = new (std::nothrow) VisualElementValueAnimation; diff --git a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp index f87310d..1084811 100644 --- a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp @@ -1341,8 +1341,8 @@ _TableViewPresenter::SetItemLayout(_TableViewItem* pItem, TableViewItemTag& item itemBounds.width = __pItemDrawingProperty->width - itemBounds.x - itemMargin; } - //itemBounds.height = pItem->GetItemHeight(); - itemBounds.height = pItem->GetSizeF().height; + FloatDimension itemDimension = Tizen::Graphics::CoordinateSystem::AlignToDevice(FloatDimension(pItem->GetSizeF().width, pItem->GetSizeF().height)); + itemBounds.height = itemDimension.height; if (itemPos.groupIndex == 0 && itemPos.itemIndex == -1) { diff --git a/src/ui/inc/FUi_ResourceTableViewConfig.h b/src/ui/inc/FUi_ResourceTableViewConfig.h index 6853e89..0e7f72a 100755 --- a/src/ui/inc/FUi_ResourceTableViewConfig.h +++ b/src/ui/inc/FUi_ResourceTableViewConfig.h @@ -60,6 +60,9 @@ DECLARE_UI_CONFIG(TABLEVIEW); DECLARE_COLOR_CONFIG(SECTIONITEM_BG_NORMAL, 33); DECLARE_COLOR_CONFIG(CONTEXTITEM_BG_NORMAL, 34); DECLARE_COLOR_CONFIG(EMPTY_CONTENTS_TEXT_NORMAL, 35); + DECLARE_COLOR_CONFIG(ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, 36); + DECLARE_COLOR_CONFIG(ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, 37); + DECLARE_COLOR_CONFIG(GROUPITEM_BG_PRESSED, 38); DECLARE_IMAGE_CONFIG(GROUPITEM_BG_NORMAL, 1); DECLARE_IMAGE_CONFIG(GROUPITEM_BG_EFFECT, 2); DECLARE_IMAGE_CONFIG(SECTIONITEM_SINGLE_BG_NORMAL, 3); diff --git a/src/ui/resource/FUi_ResourceTableViewConfig.cpp b/src/ui/resource/FUi_ResourceTableViewConfig.cpp index b4b186a..811bff2 100755 --- a/src/ui/resource/FUi_ResourceTableViewConfig.cpp +++ b/src/ui/resource/FUi_ResourceTableViewConfig.cpp @@ -29,8 +29,8 @@ START_UI_CONFIG(TABLEVIEW); ADD_COLOR_CONFIG(EXPANDABLE_ARROW_DISABLED, $F032L1D); ADD_COLOR_CONFIG(EXPANDABLE_ARROW_PRESSED, $F032L1P); ADD_COLOR_CONFIG(ITEM_DIVIDER_TOP_BG_NORMAL, $B0222); - ADD_COLOR_CONFIG(ITEM_DIVIDER_BOTTOM_BG_NORMAL, $B0221); - ADD_COLOR_CONFIG(ITEM_BG_NORMAL, 0x00000000); + ADD_COLOR_CONFIG(ITEM_DIVIDER_BOTTOM_BG_NORMAL, $B0223); + ADD_COLOR_CONFIG(ITEM_BG_NORMAL, $B0211); ADD_COLOR_CONFIG(ITEM_BG_PRESSED, $B041); ADD_COLOR_CONFIG(ITEM_BG_HIGHLIGHTED, $B041); ADD_COLOR_CONFIG(ITEM_BG_DISABLED, $B0211D); @@ -39,17 +39,17 @@ START_UI_CONFIG(TABLEVIEW); ADD_COLOR_CONFIG(ITEM_TEXT_HIGHLIGHTED, $F011L1P); ADD_COLOR_CONFIG(ITEM_TEXT_DISABLED, $F011L1D); ADD_COLOR_CONFIG(ITEM_DESCRIPTION_TEXT_NORMAL, $F011L21); - ADD_COLOR_CONFIG(ITEM_ANNEX_CANVAS_BG_NORMAL, 0x00ffffff); + ADD_COLOR_CONFIG(ITEM_ANNEX_CANVAS_BG_NORMAL, $B0211); ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_NORMAL, $F032L1); ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_PRESSED, $F032L1P); ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_HIGHLIGHTED, $F032L1P); ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_BG_NORMAL, $W011); - ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_BG_PRESSED, $B041); - ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_BG_HIGHLIGHTED, $B041); - ADD_COLOR_CONFIG(GROUPITEM_BG_NORMAL, $B0217); + ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_BG_PRESSED, $B042); + ADD_COLOR_CONFIG(ITEM_ANNEX_DETAIL_BG_HIGHLIGHTED, $B042); + ADD_COLOR_CONFIG(GROUPITEM_BG_NORMAL, $W021L1); ADD_COLOR_CONFIG(GROUPITEM_TEXT_NORMAL, $W021L3); ADD_COLOR_CONFIG(GROUPITEM_TEXT_PRESSED, $W021L3P); - ADD_COLOR_CONFIG(GROUPITEM_TEXT_HIGHLIGHTED, $W021L3); + ADD_COLOR_CONFIG(GROUPITEM_TEXT_HIGHLIGHTED, $W021L3P); ADD_COLOR_CONFIG(GROUPITEM_INDEX_BAR_NORMAL, $W021L2); ADD_COLOR_CONFIG(GROUPITEM_INDEX_BAR_PRESSED, $W021L2P); ADD_COLOR_CONFIG(GROUPITEM_INDEX_BAR_HIGHLIGHTED, $W021L2P); @@ -59,6 +59,9 @@ START_UI_CONFIG(TABLEVIEW); ADD_COLOR_CONFIG(SECTIONITEM_BG_NORMAL, $B0217); ADD_COLOR_CONFIG(CONTEXTITEM_BG_NORMAL, $B0212); ADD_COLOR_CONFIG(EMPTY_CONTENTS_TEXT_NORMAL, $F011L21); + ADD_COLOR_CONFIG(ITEM_ANNEX_DIVIDER_LEFT_BG_NORMAL, $B0221); + ADD_COLOR_CONFIG(ITEM_ANNEX_DIVIDER_RIGHT_BG_NORMAL, $B0222); + ADD_COLOR_CONFIG(GROUPITEM_BG_PRESSED, $W021L1P); ADD_IMAGE_CONFIG(GROUPITEM_BG_NORMAL, #00_indexlist_bg.#.png); ADD_IMAGE_CONFIG(GROUPITEM_BG_EFFECT, #00_indexlist_bg_ef.#.png); ADD_IMAGE_CONFIG(SECTIONITEM_SINGLE_BG_NORMAL, #00_list_group_bg.#.png);