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.
18 * @file FUi_CustomControlBaseImpl.cpp
19 * @brief This is the implementation for the _CustomControlBaseImpl class and default transformer.
22 #include <FBaseSysLog.h>
23 #include "FUi_LayoutImpl.h"
24 #include "FUi_CustomControlBaseImpl.h"
25 #include "FUi_Control.h"
27 using namespace Tizen::Base;
28 using namespace Tizen::Ui;
29 using namespace Tizen::Graphics;
31 namespace Tizen { namespace Ui
34 _CustomControlBaseImpl::~_CustomControlBaseImpl(void)
38 _CustomControlBaseImpl*
39 _CustomControlBaseImpl::CreateCustomControlBaseImplN(CustomControlBase* pPublic, const Rectangle& bounds,
40 const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout,
41 bool resizable, bool movable)
45 _Control* pCore = _Control::CreateControlN();
46 SysTryReturn(NID_UI, pCore, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
48 _CustomControlBaseImpl* pImpl =
49 new (std::nothrow) _CustomControlBaseImpl(pPublic, pCore, bounds,
50 pPublicPortraitLayout, pPublicLandscapeLayout,
52 r = CheckConstruction(pCore, pImpl);
53 SysTryReturn(NID_UI, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
60 _CustomControlBaseImpl::_CustomControlBaseImpl(CustomControlBase* pCustomControlBase, _Control* pCore, const Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable)
61 : _ContainerImpl(pCustomControlBase, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
71 bool allOrNone = (pPublicPortraitLayout && pPublicLandscapeLayout) || (!pPublicPortraitLayout && !pPublicLandscapeLayout);
74 r = SetBounds(bounds);
75 SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
77 pCore->SetResizable(resizable);
78 pCore->SetMovable(movable);
82 _CustomControlBaseImpl::GetPublicClassName(void) const
84 return "Tizen::Ui::CustomControlBase";
87 const CustomControlBase&
88 _CustomControlBaseImpl::GetPublic(void) const
90 return static_cast <const CustomControlBase&>(_ControlImpl::GetPublic());
94 _CustomControlBaseImpl::GetPublic(void)
96 return static_cast <CustomControlBase&>(_ControlImpl::GetPublic());
99 _CustomControlBaseImpl*
100 _CustomControlBaseImpl::GetInstance(CustomControlBase& pCustomControlBase)
102 return static_cast<_CustomControlBaseImpl*>(pCustomControlBase._pControlImpl);
105 const _CustomControlBaseImpl*
106 _CustomControlBaseImpl::GetInstance(const CustomControlBase& pCustomControlBase)
108 return static_cast<const _CustomControlBaseImpl*>(pCustomControlBase._pControlImpl);
114 _CustomControlBaseImpl::OnBoundsChanging(const Rectangle& bounds)
116 __oldBounds = GetBounds();
117 return GetPublic().PrepareBoundsChange(__oldBounds, bounds);
121 _CustomControlBaseImpl::OnBoundsChanged(void)
123 GetPublic().OnBoundsChanged(__oldBounds, GetBounds());
127 _CustomControlBaseImpl::OnEvaluateSize(Dimension& evaluatedSize)
129 GetPublic().EvaluateSize(evaluatedSize.width, evaluatedSize.height);