From 977a9d85078c525147f417822d9f76a284b59150 Mon Sep 17 00:00:00 2001 From: "youseong.ji" Date: Wed, 29 May 2013 22:11:15 +0900 Subject: [PATCH] Modify for naming, and a focusing rectangle is appeared properly in section table view. Change-Id: I2501c490bb62a0f857ed973393a41501ed1ee2b6 Signed-off-by: youseong.ji --- src/ui/controls/FUiCtrl_TableViewItem.cpp | 101 +++++++++++-------------- src/ui/controls/FUiCtrl_TableViewPresenter.cpp | 1 - src/ui/inc/FUiCtrl_TableViewItem.h | 4 +- 3 files changed, 48 insertions(+), 58 deletions(-) diff --git a/src/ui/controls/FUiCtrl_TableViewItem.cpp b/src/ui/controls/FUiCtrl_TableViewItem.cpp index a27672f..86ac35b 100644 --- a/src/ui/controls/FUiCtrl_TableViewItem.cpp +++ b/src/ui/controls/FUiCtrl_TableViewItem.cpp @@ -210,9 +210,9 @@ _TableViewItem::_TableViewItem(float itemHeight) , __pHeaderFooterItemText(null) , __pDimLayer(null) , __touchStartPosition(0.0f, 0.0f) - , __annexOnOffTouchPosition(0) + , __annexTouchStartPosition(0) , __annexOnOffHandlerMoved(false) - , __annexOnOffHandlerLastPosition(0.0f) + , __annexOnOffHandlerPositionX(0.0f) , __childControlCenterAlign(false) , __customHeight(0.0f) , __animationCount(0) @@ -578,7 +578,7 @@ _TableViewItem::CreateItemCover(void) __pItemCover = _TableViewItemControl::CreateTableViewItemControlN(); r = GetLastResult(); SysTryReturn(NID_UI_CTRL, __pItemCover != null, r, r, "[%s] Propagating.", GetErrorMessage(r)); - + __pItemCover->SetFocusable(false); AttachSystemChild(*__pItemCover); } @@ -1185,7 +1185,7 @@ _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchin } __annexOnOffHandlerMoved = false; - __touchStartPosition = touchinfo.GetCurrentPosition(); // +++ check floating + __touchStartPosition = touchinfo.GetCurrentPosition(); if (&source == this) { @@ -1198,7 +1198,7 @@ _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchin if (__annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING || __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER) { - __annexOnOffTouchPosition = touchinfo.GetCurrentPosition().x; // +++ check floating + __annexTouchStartPosition = touchinfo.GetCurrentPosition().x; } } else if (IsIndividualSelectionEnabled(source)) @@ -1451,7 +1451,7 @@ _TableViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo __annexStyle == TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING_WITH_DIVIDER) { __annexOnOffHandlerMoved = true; - DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x); // +++ check floating + DrawAnnexOnOffHandler(touchinfo.GetCurrentPosition().x); retVal = true; } else @@ -1559,6 +1559,16 @@ _TableViewItem::OnChildAttached(const _Control& child) _Control* pControl = const_cast<_Control*>(&child); pControl->SetTouchPressThreshold(SENSITIVE); + FloatRectangle bounds = child.GetBoundsF(); + + if (__pDrawingProperty != null && __pDrawingProperty->groupedLookEnabled) + { + float groupedBarMargin = 0.0f; + GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_BAR_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, groupedBarMargin); + + bounds.x += groupedBarMargin; + } + if ((__annexStyle == TABLE_VIEW_ANNEX_STYLE_MARK) || (__annexStyle == TABLE_VIEW_ANNEX_STYLE_RADIO)) { if (GetLabelCore(__pItemAnnex) == &child) @@ -1566,7 +1576,6 @@ _TableViewItem::OnChildAttached(const _Control& child) return; } - FloatRectangle bounds = child.GetBoundsF(); float leftMargin = 0.0f; float annexWidth = 0.0f; @@ -1574,8 +1583,9 @@ _TableViewItem::OnChildAttached(const _Control& child) GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth); bounds.x += (leftMargin * 2) + annexWidth; - pControl->SetBounds(bounds); } + + pControl->SetBounds(bounds); } void @@ -2779,17 +2789,14 @@ _TableViewItem::AdjustAnnexOnOffHandlerPosition() float annexHeight = 0.0f; float annexMargin = 0.0f; - float annexStartPosition = 0.0f; - float annexEndPosition = 0.0f; - float finalEndPosition = 0.0f; + float annexStartPositionX = 0.0f; + float annexEndPositionX = 0.0f; + float handlerPositionX = 0.0f; FloatRectangle handlerBounds; result r = E_SUCCESS; GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin); - annexStartPosition = __pItemAnnex->GetBoundsF().x; - annexEndPosition = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin; - Bitmap* pOnOffButtonHandler = null; r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed"); @@ -2797,34 +2804,24 @@ _TableViewItem::AdjustAnnexOnOffHandlerPosition() GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, annexWidth); GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight); + annexStartPositionX = __pItemAnnex->GetBoundsF().x; + annexEndPositionX = annexStartPositionX + annexWidth + annexMargin; + handlerBounds = CalculateAnnexBitmapBounds(annexWidth, annexHeight, *pOnOffButtonHandler); if(__annexOnOffHandlerMoved) { - if(annexStartPosition < __annexOnOffHandlerLastPosition - && annexEndPosition > __annexOnOffHandlerLastPosition) - { - if(((annexEndPosition - annexStartPosition) / 2) < __annexOnOffHandlerLastPosition - annexStartPosition + (handlerBounds.width / 2)) // +++ check floating - { - finalEndPosition = annexEndPosition; - SetChecked(true); - } - else - { - finalEndPosition = annexStartPosition; - SetChecked(false); - } - } - else + if(annexStartPositionX <= __annexOnOffHandlerPositionX + && annexEndPositionX >= __annexOnOffHandlerPositionX) { - if(annexEndPosition < __annexOnOffHandlerLastPosition) + if(((annexEndPositionX - annexStartPositionX) / 2) < (__annexOnOffHandlerPositionX + (handlerBounds.width / 2)) - annexStartPositionX ) { - finalEndPosition = annexEndPosition; + handlerPositionX = annexEndPositionX; SetChecked(true); } else { - finalEndPosition = annexStartPosition; + handlerPositionX = annexStartPositionX; SetChecked(false); } } @@ -2834,15 +2831,15 @@ _TableViewItem::AdjustAnnexOnOffHandlerPosition() SetChecked(!IsChecked()); if(IsChecked()) { - finalEndPosition = annexEndPosition; + handlerPositionX = annexEndPositionX; } else { - finalEndPosition = annexStartPosition; + handlerPositionX = annexStartPositionX; } } - DrawAnnexOnOffHandler(finalEndPosition); + DrawAnnexOnOffHandler(handlerPositionX); CATCH: delete pOnOffButtonHandler; @@ -2851,7 +2848,7 @@ CATCH: } void -_TableViewItem::DrawAnnexOnOffHandler(float position) +_TableViewItem::DrawAnnexOnOffHandler(float touchEndPosition) { if (__pItemAnnex == null) { @@ -2864,15 +2861,13 @@ _TableViewItem::DrawAnnexOnOffHandler(float position) Canvas* pCanvas = null; result r = E_SUCCESS; - FloatRectangle bounds; FloatRectangle backgroundBounds; FloatRectangle handlerBounds; float annexWidth = 0.0f; float annexHeight = 0.0f; float annexMargin = 0.0f; - float annexAbsoluteBoundsStart = 0.0f; - float annexAbsoluteBoundsEnd = 0.0f; - float nextHandlerBounds = 0; + float annexX = 0.0f; + float nextHandlerX = 0.0f; r = GET_BITMAP_CONFIG_N(TABLEVIEW::ONOFFBUTTON_HANDLER, BITMAP_PIXEL_FORMAT_ARGB8888, pOnOffButtonHandler); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS) && (pOnOffButtonHandler != null), , E_SYSTEM, "[E_SYSTEM] OnOffHandlerButton button image load failed"); @@ -2891,12 +2886,10 @@ _TableViewItem::DrawAnnexOnOffHandler(float position) GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, annexHeight); GET_SHAPE_CONFIG(TABLEVIEW::ITEM_ANNEX_ONOFF_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, annexMargin); - bounds.SetBounds(0, 0, annexWidth, annexHeight); - 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(bounds); + pCanvas->Construct(FloatRectangle(0, 0, annexWidth, annexHeight)); pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); pCanvas->Clear(); @@ -2915,31 +2908,30 @@ _TableViewItem::DrawAnnexOnOffHandler(float position) handlerBounds.x = backgroundBounds.x + annexMargin; } - nextHandlerBounds = handlerBounds.x + (position - __annexOnOffTouchPosition); - annexAbsoluteBoundsStart = __pItemAnnex->GetBoundsF().x; - annexAbsoluteBoundsEnd = __pItemAnnex->GetBoundsF().x + __pItemAnnex->GetBoundsF().width + annexMargin; + nextHandlerX = handlerBounds.x + (touchEndPosition - __annexTouchStartPosition); + annexX = __pItemAnnex->GetBoundsF().x; - if((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width) < annexAbsoluteBoundsEnd && - (annexAbsoluteBoundsStart + nextHandlerBounds) > annexAbsoluteBoundsStart) + if((annexX + nextHandlerX + handlerBounds.width) < (annexX + annexWidth + annexMargin) + && (annexX + nextHandlerX) > annexX) { - handlerBounds.x = nextHandlerBounds; - __annexOnOffHandlerLastPosition = annexAbsoluteBoundsStart + nextHandlerBounds; + handlerBounds.x = nextHandlerX; } - else if(_FloatCompareGE((annexAbsoluteBoundsStart + nextHandlerBounds + handlerBounds.width), annexAbsoluteBoundsEnd)) + else if(_FloatCompareGE((annexX + nextHandlerX + handlerBounds.width), (annexX + annexWidth + annexMargin))) { handlerBounds.x = backgroundBounds.width - handlerBounds.width - annexMargin; } - else if(_FloatCompareLE((annexAbsoluteBoundsStart + nextHandlerBounds), annexAbsoluteBoundsStart)) + else if(_FloatCompareLE((annexX + nextHandlerX), annexX)) { handlerBounds.x = backgroundBounds.x + annexMargin; } + __annexOnOffHandlerPositionX = annexX + handlerBounds.x; 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); + pMergeBitmap->Construct(*pCanvas, FloatRectangle(0, 0, annexWidth, annexHeight)); _BitmapImpl::ConvertToNonpremultiplied(*pMergeBitmap, true); __pItemAnnex->SetBackgroundBitmap(*pMergeBitmap); @@ -3631,7 +3623,7 @@ _TableViewItem::SetSectionHeaderFooterContents(const Tizen::Base::String& text, __pHeaderFooterItemText->SetBackgroundColor(Color(0, 0, 0, 0)); _Label* pHeaderFooterItemTextCore = GetLabelCore(__pHeaderFooterItemText); - pHeaderFooterItemTextCore->SetFocusable(true); + pHeaderFooterItemTextCore->SetFocusable(false); AttachChild(*pHeaderFooterItemTextCore); } @@ -4555,7 +4547,6 @@ _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) _KeyCode keyCode = keyInfo.GetKeyCode(); _Control* pFocusedControl = GetFocused(); _Control* pChildControl = null; - _TableViewItem* pItem = null; switch (keyCode) { diff --git a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp index 99b970d..8f4a58f 100644 --- a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp @@ -1530,7 +1530,6 @@ _TableViewPresenter::LoadItem(int groupIndex, int itemIndex) SetItemType(pItem, itemPosition); SetItemLayout(pItem, itemPosition); pItem->SetReorderMode(__pTableView->IsReorderModeEnabled()); - pItem->AdjustChildControlMargin(); __lockLoadItemWithScroll = false; } diff --git a/src/ui/inc/FUiCtrl_TableViewItem.h b/src/ui/inc/FUiCtrl_TableViewItem.h index 5a4cc2f..146e6d7 100644 --- a/src/ui/inc/FUiCtrl_TableViewItem.h +++ b/src/ui/inc/FUiCtrl_TableViewItem.h @@ -418,9 +418,9 @@ private: _Label* __pDimLayer; Tizen::Graphics::FloatPoint __touchStartPosition; - float __annexOnOffTouchPosition; + float __annexTouchStartPosition; bool __annexOnOffHandlerMoved; - float __annexOnOffHandlerLastPosition; + float __annexOnOffHandlerPositionX; bool __childControlCenterAlign; float __customHeight; int __animationCount; -- 2.7.4