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 FUi_CustomControlBaseImpl.cpp
20 * @brief This is the implementation for the _CustomControlBaseImpl class and default transformer.
23 #include <FBaseSysLog.h>
24 #include "FUi_LayoutImpl.h"
25 #include "FUi_CustomControlBaseImpl.h"
26 #include "FUi_Control.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Ui;
30 using namespace Tizen::Graphics;
32 namespace Tizen { namespace Ui
35 _CustomControlBaseImpl::~_CustomControlBaseImpl(void)
39 _CustomControlBaseImpl*
40 _CustomControlBaseImpl::CreateCustomControlBaseImplN(CustomControlBase* pPublic, const Rectangle& bounds,
41 const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout,
42 bool resizable, bool movable)
46 _Control* pCore = _Control::CreateControlN();
47 SysTryReturn(NID_UI, pCore, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
49 _CustomControlBaseImpl* pImpl =
50 new (std::nothrow) _CustomControlBaseImpl(pPublic, pCore, bounds,
51 pPublicPortraitLayout, pPublicLandscapeLayout,
53 r = CheckConstruction(pCore, pImpl);
54 SysTryReturn(NID_UI, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
61 _CustomControlBaseImpl::_CustomControlBaseImpl(CustomControlBase* pCustomControlBase, _Control* pCore, const Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable)
62 : _ContainerImpl(pCustomControlBase, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
72 bool allOrNone = (pPublicPortraitLayout && pPublicLandscapeLayout) || (!pPublicPortraitLayout && !pPublicLandscapeLayout);
75 r = SetBounds(bounds);
76 SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
78 pCore->SetResizable(resizable);
79 pCore->SetMovable(movable);
83 _CustomControlBaseImpl::GetPublicClassName(void) const
85 return "Tizen::Ui::CustomControlBase";
88 const CustomControlBase&
89 _CustomControlBaseImpl::GetPublic(void) const
91 return static_cast <const CustomControlBase&>(_ControlImpl::GetPublic());
95 _CustomControlBaseImpl::GetPublic(void)
97 return static_cast <CustomControlBase&>(_ControlImpl::GetPublic());
100 _CustomControlBaseImpl*
101 _CustomControlBaseImpl::GetInstance(CustomControlBase& pCustomControlBase)
103 return static_cast<_CustomControlBaseImpl*>(pCustomControlBase._pControlImpl);
106 const _CustomControlBaseImpl*
107 _CustomControlBaseImpl::GetInstance(const CustomControlBase& pCustomControlBase)
109 return static_cast<const _CustomControlBaseImpl*>(pCustomControlBase._pControlImpl);
115 _CustomControlBaseImpl::OnBoundsChanging(const Rectangle& bounds)
117 __oldBounds = GetBounds();
118 return GetPublic().PrepareBoundsChange(__oldBounds, bounds);
122 _CustomControlBaseImpl::OnBoundsChanged(void)
124 GetPublic().OnBoundsChanged(__oldBounds, GetBounds());
128 _CustomControlBaseImpl::OnEvaluateSize(Dimension& evaluatedSize)
130 GetPublic().EvaluateSize(evaluatedSize.width, evaluatedSize.height);