From: Myung Jin Kim Date: Wed, 24 Apr 2013 09:44:35 +0000 (+0900) Subject: fix header selected X-Git-Tag: accepted/tizen_2.1/20130425.033138~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29a684b4aab51f6c4a6b4fb5279f8946a6d3e3fc;p=platform%2Fframework%2Fnative%2Fuifw.git fix header selected Change-Id: Ic91a1405b6cb9602c03be15ff3d9c42e3b497719 --- diff --git a/src/ui/controls/FUiCtrl_ToolbarPresenter.cpp b/src/ui/controls/FUiCtrl_ToolbarPresenter.cpp index e199d94..0adbf04 100644 --- a/src/ui/controls/FUiCtrl_ToolbarPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ToolbarPresenter.cpp @@ -959,6 +959,20 @@ _ToolbarPresenter::SetDescriptionText(const String& description) result _ToolbarPresenter::SetItemSelected(int itemIndex) { + ToolbarStyle style = __pToolbar->GetStyle(); + + if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX) + { + if (itemIndex <= __pToolbar->GetItemCount() - SEGMENTED_ITEM_MAX) + { + SetItemFit(itemIndex); + } + else + { + SetItemFit(__pToolbar->GetItemCount() - SEGMENTED_ITEM_MAX); + } + } + return __pToolbarModel->SetSelectedItemIndex(itemIndex); } @@ -1182,7 +1196,7 @@ _ToolbarPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& tou } else { - if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) && __pToolbar->GetItemCount() > 4) + if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX) { if (__pressedItemIndex != -1) { @@ -1277,7 +1291,7 @@ _ToolbarPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchi FloatRectangle itemBounds = pCurrentButton->GetBoundsF(); - if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) && __pToolbar->GetItemCount() > 4) + if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX) { if (itemBounds.Contains(touchPoint)) { @@ -1535,7 +1549,7 @@ _ToolbarPresenter::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture) { ToolbarStyle style = __pToolbar->GetStyle(); - if (!(style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) || __pToolbar->GetItemCount() <= 4 || __beingEdited == true || __tabMoved == false) + if (!(style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE) || __pToolbar->GetItemCount() <= SEGMENTED_ITEM_MAX || __beingEdited == true || __tabMoved == false) { return true; } @@ -1954,6 +1968,11 @@ _ToolbarPresenter::CalculateProgress(float timeProgress) const void _ToolbarPresenter::SetItemFit(int index) { + if (index < 0) + { + return ; + } + FloatPoint pt(0.0f, 0.0f); FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);