2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnim_VisualElement.cpp
20 * @brief This file contains implementation of _VisualElement class
22 * This file contains implementation _VisualElement class.
25 #include <FBaseSysLog.h>
27 #include "FUiAnim_EflNode.h"
28 #include "FUiAnim_VisualElement.h"
29 #include "FUiAnim_VisualElementImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Graphics;
34 namespace Tizen { namespace Ui { namespace Animations
38 //IMPLEMENT_PROPERTY(_VisualElement);
40 _VisualElement::_VisualElement(void)
46 _VisualElement::~_VisualElement(void)
51 _VisualElement::CloneN(void) const
53 return new (std::nothrow) _VisualElement(*this);
56 _VisualElement::_VisualElement(const _VisualElement& rhs)
63 _VisualElement::GetBackgroundColor(void) const
65 _EflNode* pNativeNode = dynamic_cast< _EflNode* >(_pVisualElementImpl->GetNativeNode());
67 SysTryReturn(NID_UI, pNativeNode, _Colorf(0.0f, 0.0f, 0.0f, 1.0f), E_INVALID_STATE, "[E_INVALID_STATE] No object for background."); // CHECKME: Default BG?
69 return pNativeNode->GetBackgroundColor();
73 _VisualElement::SetBackgroundColor(const _Colorf& color)
76 _EflNode* pNativeNode = dynamic_cast< _EflNode* >(_pVisualElementImpl->GetNativeNode());
78 SysTryReturnResult(NID_UI, pNativeNode, E_INVALID_STATE, "No object for background."); // CHECKME: Default BG?
80 r = pNativeNode->SetBackgroundColor(color);
81 if (_pVisualElementImpl->GetPresentation()) (_pVisualElementImpl->GetPresentation())->InvalidateHierarchyProps((int)_VisualElementImpl::HIERARCHY_PROPERTY_NATIVENODE, false, false);
87 _VisualElement::GetBoundingBox(void)
89 return _pVisualElementImpl->GetBoundingBox();
93 _VisualElement::SetZOrder(const VisualElement* pReference, bool above)
95 const _VisualElementImpl* pImpl = null;
98 pImpl = _VisualElementImpl::GetInstance(*pReference);
101 return _pVisualElementImpl->SetZOrder(pImpl , above);
105 _VisualElement::SetImageSource(const String& fileName)
107 return _pVisualElementImpl->SetImageSource(fileName);
111 _VisualElement::SetContentOpacity(float contentOpacity)
113 return _pVisualElementImpl->SetContentOpacity(contentOpacity);
117 _VisualElement::Capture(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& boundsToDraw, bool withChilren)
119 return _pVisualElementImpl->Capture(canvas, boundsToDraw, withChilren);
123 _VisualElement::GetNativeNode(void) const
125 return _pVisualElementImpl->GetNativeNode();
128 _VisualElement* _VisualElement::GetPresentation(void)
130 return dynamic_cast< _VisualElement* >(_pVisualElementImpl->__pPresentation->__pPublicInstance);
133 _VisualElement* _VisualElement::GetModel(void)
135 return dynamic_cast< _VisualElement* >(_pVisualElementImpl->__pPresentation->__pPublicInstance);
139 _VisualElement::SetControlUserData(void* pUserData)
142 __pUserData = pUserData;
146 _VisualElement::GetControlUserData(void) const
154 _VisualElement::OnPrepareDraw(void)
160 _VisualElement::SetClipToParent(bool clipToParent)
162 return _pVisualElementImpl->SetClipToParent(clipToParent);
166 _VisualElement::SetBackBufferEnabled(bool enable)
168 return _pVisualElementImpl->SetBackBufferEnabled(enable);
172 _VisualElement::SetSurfaceOpaque(bool isSurfaceOpaque)
174 return _pVisualElementImpl->SetSurfaceOpaque(isSurfaceOpaque);
178 _VisualElement::ScrollByPoint(const FloatPoint& pointOffset, bool scrollSelf)
180 return _pVisualElementImpl->ScrollByPoint(pointOffset, scrollSelf);
183 IVisualElementAnimationProvider*
184 _VisualElement::GetAnimationProvider(void) const
186 return _pVisualElementImpl->GetAnimationProvider();
189 IVisualElementContentProvider*
190 _VisualElement::GetContentProvider(void) const
192 return _pVisualElementImpl->GetContentProvider();
196 IVisualElementEventListener*
197 _VisualElement::GetVisualElementEventListener(void) const
199 return _pVisualElementImpl->GetVisualElementEventListener();
203 }}} // Tizen::Ui::Animations