From d0612de07e7d0d9b8739de2d2499db769fd11396 Mon Sep 17 00:00:00 2001 From: Keuckdo Bang Date: Tue, 19 Mar 2013 15:07:10 +0900 Subject: [PATCH] Fixed logic calculating absoulute bounds. Change-Id: I0536e4a7bd43b40b889f5643538325e249d686ad --- src/ui/FUi_Control.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++- src/ui/inc/FUi_Control.h | 1 + 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/ui/FUi_Control.cpp b/src/ui/FUi_Control.cpp index a40edeb..b70ec64 100644 --- a/src/ui/FUi_Control.cpp +++ b/src/ui/FUi_Control.cpp @@ -2887,6 +2887,55 @@ _Control::UpdateBoundsOfVisualElement(const FloatRectangle& controlBounds) return E_SUCCESS; } +result +_Control::AdjustAbsoluteBounds(void) +{ + result r = E_SUCCESS; + + struct _Visitor + : public Visitor + { + _Visitor(_Control* pControl) + : __pControl(pControl){} + + virtual VisitType Visit(_Control& control) + { + result r = E_SUCCESS; + + if (__pControl == &control) + { + return VISIT_DOWNWARD; + } + FloatRectangle fbounds = control.GetBoundsF(); + if (control.IsLayoutChangable() == false) + { + r = control.UpdateBoundsOfVisualElement(FloatRectangle(0.0f, 0.0f, fbounds.width, fbounds.height)); + } + else + { + r = control.UpdateBoundsOfVisualElement(fbounds); + } + + ControlList& children = control.GetChildList(); + + int childrenCount = children.GetCount(); + if (childrenCount <= 0) + { + return VISIT_STOP; + } + else + { + return VISIT_DOWNWARD; + } + } + private : + _Control* __pControl; + }; + + _Visitor visitor(this); + Accept(visitor); +} + bool _Control::IsInSizeRange(const Dimension& size) const { @@ -2930,7 +2979,7 @@ _Control::SetBoundsFinal(const FloatRectangle& newBounds, bool changeLayoutBaseR } } - if ((moved || resized || !changeLayoutBaseRect) && callUpdateBoundsOfVisualElement) + if ((moved || resized) && callUpdateBoundsOfVisualElement) { const FloatRectangle fbounds(bounds.x, bounds.y, bounds.width, bounds.height); if (IsLayoutChangable() == false) @@ -3467,6 +3516,8 @@ _Control::SetClientBounds(const Rectangle& bounds) __clientBounds = _CoordinateSystemUtils::ConvertToFloat(bounds); __isSetClientBounds = true; + AdjustAbsoluteBounds(); + SetUpdateLayoutState(true); return E_SUCCESS; @@ -3483,6 +3534,8 @@ _Control::SetClientBounds(const FloatRectangle& bounds) __clientBounds = bounds; __isSetClientBounds = true; + AdjustAbsoluteBounds(); + SetUpdateLayoutState(true); return E_SUCCESS; diff --git a/src/ui/inc/FUi_Control.h b/src/ui/inc/FUi_Control.h index 931e4fb..0a070d6 100644 --- a/src/ui/inc/FUi_Control.h +++ b/src/ui/inc/FUi_Control.h @@ -544,6 +544,7 @@ private: result SetBoundsInternal(const Tizen::Graphics::FloatRectangle& bounds, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement = true); result SetBoundsFinal(const Tizen::Graphics::FloatRectangle& newBounds, bool changeLayoutBaseRect, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement = true); result UpdateBoundsOfVisualElement(const Tizen::Graphics::FloatRectangle& controlBounds); + result AdjustAbsoluteBounds(void); const ControlList& GetChildList(void) const; ControlList& GetChildList(void); -- 2.7.4