From: Bhavya Kumili Date: Mon, 27 May 2013 06:37:57 +0000 (+0530) Subject: Merge master code to tizen for slider X-Git-Tag: submit/tizen_2.2/20130714.153149~693^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=172b8e90e653248e8b6a766891401119dcf3afad;p=framework%2Fosp%2Fuifw.git Merge master code to tizen for slider Change-Id: I5c757a9c3cff46d197a363019f520878931f2402 Signed-off-by: Ayush --- diff --git a/src/ui/controls/FUiCtrl_SliderPresenter.cpp b/src/ui/controls/FUiCtrl_SliderPresenter.cpp index 5cc11be..0a42589 100644 --- a/src/ui/controls/FUiCtrl_SliderPresenter.cpp +++ b/src/ui/controls/FUiCtrl_SliderPresenter.cpp @@ -86,6 +86,7 @@ _SliderPresenter::_SliderPresenter(void) , __handleX(0) , __prevSliderValue(0) , __isSliderPressed(false) + , __isFocusModeStateChanged(false) , __isNeedToBeUpdated(true) , __isResourceLoaded(false) , __isCustomHandle(false) @@ -250,7 +251,6 @@ _SliderPresenter::Resize(void) float offset = 0.0f; float minimumHeight = 0.0f; float minimumWidth = 0.0f; - float topMargin = 0.0f; float iconRightMargin = 0.0f; float titleHeight = 0.0f; FloatRectangle titleTextBounds; @@ -303,9 +303,6 @@ _SliderPresenter::Resize(void) } __rect = FloatRectangle(0.0f, 0.0f, __pSlider->GetBoundsF().width, __pSlider->GetBoundsF().height); - r = GET_SHAPE_CONFIG(SLIDER::BAR_TOP_MARGIN, orientation, topMargin); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - r = GET_SHAPE_CONFIG(SLIDER::ICON_RIGHT_MARGIN, orientation, iconRightMargin); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -344,7 +341,7 @@ _SliderPresenter::Resize(void) minimumHeight = minimumHeight + titleHeight; } - if (__rect.height < minimumHeight ) + if (__rect.height < minimumHeight) { __rect.height = minimumHeight; } @@ -1058,18 +1055,12 @@ _SliderPresenter::DrawSliderBar(Canvas& canvas) } } } - else if (__isSliderPressed == true) // pressed + else if (__isSliderPressed == true) // pressed { pHandleBitmap = __pHandlePressedBitmap; pHandleEffectBitmap = __pHandlePressedEffectBitmap; isCustomHandleBitmap = IS_CUSTOM_BITMAP(SLIDER::HANDLE_BG_PRESSED); } - else if (__pSlider->IsFocused() == true) - { - pHandleBitmap = __pHandleHighlightedBitmap; - pHandleEffectBitmap = __pHandleHighlightedEffectBitmap; - isCustomHandleBitmap = IS_CUSTOM_BITMAP(SLIDER::HANDLE_BG_HIGHLIGHTED); - } else //(__isSliderPressed == false) // normal state { pHandleBitmap = __pHandleNormalBitmap; @@ -1134,14 +1125,14 @@ _SliderPresenter::DrawSliderBar(Canvas& canvas) DrawBitmap(canvas, __barBgRect, __pBarBgColorReplacementBitmap); if (isCustomBarBitmap == false) { - DrawBitmap(canvas, __barBgRect, __pBarBgResourceEffectBitmap); + DrawBitmap(canvas, __barBgRect, __pBarBgResourceEffectBitmap); } isCustomBarBitmap = IS_CUSTOM_BITMAP(SLIDER::BAR_NORMAL); DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarColorReplacementBitmap); if (isCustomBarBitmap == false) { - DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarResourceEffectBitmap); + DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarResourceEffectBitmap); } __handleRect.x = __touchRect.x + __handleX; @@ -1170,8 +1161,8 @@ _SliderPresenter::DrawSliderBar(Canvas& canvas) SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); if (isCustomHandleBitmap == false) { - r = DrawBitmap(*pHandleCanvas, FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), pHandleEffectBitmap); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + r = DrawBitmap(*pHandleCanvas, FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), pHandleEffectBitmap); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); } } else @@ -1179,7 +1170,7 @@ _SliderPresenter::DrawSliderBar(Canvas& canvas) bitmapWidth = pHandleBitmap->GetWidth(); bitmapHeight = pHandleBitmap->GetHeight(); - if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pHandleBitmap) == false) + if (!_BitmapImpl::CheckNinePatchedBitmapStrictly(*pHandleBitmap)) { // to clip the center portion of the larger bitmap. if( bitmapWidth > __handleRect.width ) @@ -1203,6 +1194,23 @@ _SliderPresenter::DrawSliderBar(Canvas& canvas) SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); } + if ((__pSlider->IsFocused()) && (__isFocusModeStateChanged == true)) + { + if (__pHandleHighlightedBitmap) + { + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pHandleHighlightedBitmap)) + { + r = pHandleCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), *__pHandleHighlightedBitmap); + } + else + { + r = pHandleCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), *__pHandleHighlightedBitmap); + } + + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + } + } + r = __pSlider->UpdateHandle(__handleRect); if (r != E_SUCCESS) { @@ -1319,7 +1327,7 @@ _SliderPresenter::DrawTitleText(Canvas& canvas) if (__pTitleTextObject == null) { __pTitleTextObject = new (std::nothrow) TextObject(); - SysTryReturn(NID_UI_CTRL, __pTitleTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, __pTitleTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); __pTitleTextObject->Construct(); } @@ -1408,7 +1416,7 @@ _SliderPresenter::GetTitleTextBounds(void) const r = GET_SHAPE_CONFIG(SLIDER::TITLE_TEXT_POSITION_X, orientation, titleTextBounds.x); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, FloatRectangle(), r, "[%s] Propagating.", GetErrorMessage(r)); - r = GET_SHAPE_CONFIG(SLIDER::BAR_TOP_MARGIN, orientation, topMargin); + r = GET_SHAPE_CONFIG(SLIDER::TITLE_TEXT_POSITION_Y, orientation, topMargin); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, FloatRectangle(), r, "[%s] Propagating.", GetErrorMessage(r)); titleTextBounds.y = topMargin; @@ -1778,6 +1786,18 @@ _SliderPresenter::SetGroupStyle(GroupStyle groupStyle) return; } +void +_SliderPresenter::SetFocusMode(bool focusmode) +{ + __isFocusModeStateChanged = focusmode; +} + +bool +_SliderPresenter::GetFocusMode(void) +{ + return __isFocusModeStateChanged; +} + result _SliderPresenter::SetThumbBitmap(SliderThumbStatus status, const Bitmap& bitmap) { @@ -1814,8 +1834,8 @@ _SliderPresenter::SetThumbBitmap(SliderThumbStatus status, const Bitmap& bitmap) delete __pHandleHighlightedEffectBitmap; __pHandleHighlightedEffectBitmap = null; - delete __pHandleHighlightedEffectBitmap; - __pHandleHighlightedEffectBitmap = pThumbBitmap; + delete __pHandleHighlightedBitmap; + __pHandleHighlightedBitmap = pThumbBitmap; break; case SLIDER_THUMB_STATUS_NORMAL: diff --git a/src/ui/inc/FUiCtrl_SliderPresenter.h b/src/ui/inc/FUiCtrl_SliderPresenter.h index 9518758..0143d2e 100644 --- a/src/ui/inc/FUiCtrl_SliderPresenter.h +++ b/src/ui/inc/FUiCtrl_SliderPresenter.h @@ -70,7 +70,8 @@ public: static _SliderPresenter* CreateInstanceN(const _Slider& slider); result SetThumbBitmap(SliderThumbStatus status, const Tizen::Graphics::Bitmap& bitmap); void SetThumbTextColor(SliderThumbStatus status, const Tizen::Graphics::Color& color); - + void SetFocusMode(bool focusmode); + bool GetFocusMode(void); virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); private: @@ -157,6 +158,7 @@ private: int __handleX; int __prevSliderValue; bool __isSliderPressed; + bool __isFocusModeStateChanged; bool __isNeedToBeUpdated; bool __isResourceLoaded; diff --git a/src/ui/inc/FUi_ResourceSliderConfig.h b/src/ui/inc/FUi_ResourceSliderConfig.h index 319ab5e..7616397 100644 --- a/src/ui/inc/FUi_ResourceSliderConfig.h +++ b/src/ui/inc/FUi_ResourceSliderConfig.h @@ -67,7 +67,7 @@ DECLARE_UI_CONFIG(SLIDER); DECLARE_SHAPE_CONFIG(HANDLE_THREE_DIGIT_TEXT_SIZE, 6); DECLARE_SHAPE_CONFIG(BAR_HEIGHT, 7); DECLARE_SHAPE_CONFIG(BAR_LEFT_MARGIN, 8); - DECLARE_SHAPE_CONFIG(BAR_TOP_MARGIN, 9); + DECLARE_SHAPE_CONFIG(TITLE_TEXT_POSITION_Y, 9); DECLARE_SHAPE_CONFIG(BAR_OFFSET, 10); DECLARE_SHAPE_CONFIG(ICON_WIDTH, 11); DECLARE_SHAPE_CONFIG(ICON_HEIGHT, 12); diff --git a/src/ui/resource/FUi_ResourceSliderConfig.cpp b/src/ui/resource/FUi_ResourceSliderConfig.cpp index f46fb61..ecc2dfb 100644 --- a/src/ui/resource/FUi_ResourceSliderConfig.cpp +++ b/src/ui/resource/FUi_ResourceSliderConfig.cpp @@ -34,7 +34,7 @@ START_UI_CONFIG(SLIDER); ADD_COLOR_CONFIG(HANDLE_BG_NORMAL, $W0641); ADD_COLOR_CONFIG(HANDLE_BG_PRESSED, $W0641P); ADD_COLOR_CONFIG(HANDLE_BG_DISABLED, $W0641D); - ADD_COLOR_CONFIG(HANDLE_BG_HIGHLIGHTED, $W0641); + ADD_COLOR_CONFIG(HANDLE_BG_HIGHLIGHTED, $W161); ADD_COLOR_CONFIG(HANDLE_NUMBER_TEXT_DISABLED, $W0611D); ADD_COLOR_CONFIG(HANDLE_NUMBER_TEXT_NORMAL, $W0611); @@ -50,7 +50,7 @@ START_UI_CONFIG(SLIDER); ADD_IMAGE_CONFIG(HANDLE_BG_NORMAL, #00_slider_handle.png); ADD_IMAGE_CONFIG(HANDLE_BG_PRESSED, #00_slider_handle.png); ADD_IMAGE_CONFIG(HANDLE_BG_DISABLED, #00_slider_handle.png); - ADD_IMAGE_CONFIG(HANDLE_BG_HIGHLIGHTED, #00_slider_handle.png); + ADD_IMAGE_CONFIG(HANDLE_BG_HIGHLIGHTED, #00_slider_handle_focus.png); ADD_IMAGE_CONFIG(HANDLE_BG_EFFECT_NORMAL, #00_slider_handle_ef.png); ADD_IMAGE_CONFIG(HANDLE_BG_EFFECT_PRESSED, #00_slider_handle_ef_press.png); @@ -82,7 +82,6 @@ START_UI_CONFIG(SLIDER); ADD_SHAPE_CONFIG(BAR_HEIGHT, 36); ADD_SHAPE_CONFIG(BAR_LEFT_MARGIN_WITH_ICON, 26); ADD_SHAPE_CONFIG(BAR_LEFT_MARGIN, 36); - ADD_SHAPE_CONFIG(BAR_TOP_MARGIN, 16); ADD_SHAPE_CONFIG(BAR_OFFSET, 9); ADD_SHAPE_CONFIG(ICON_WIDTH, 72); @@ -91,6 +90,7 @@ START_UI_CONFIG(SLIDER); ADD_SHAPE_CONFIG(ICON_RIGHT_MARGIN, 16); ADD_SHAPE_CONFIG(TITLE_TEXT_POSITION_X, 12); + ADD_SHAPE_CONFIG(TITLE_TEXT_POSITION_Y, 16); ADD_SHAPE_CONFIG(TITLE_TEXT_SIZE, 32); ADD_SHAPE_CONFIG(TITLE_TEXT_HEIGHT, 49);