2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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 FUiCtrlOverlayRegion.cpp
20 * @brief This is the implementation file for OverlayRegion class.
23 #include <FUiCtrlOverlayRegion.h>
24 #include <FSys_SystemInfoImpl.h>
25 #include "FUi_Control.h"
26 #include "FUiCtrl_OverlayAgent.h"
27 #include "FUi_ResourceManager.h"
28 #include "FUi_CoordinateSystemUtils.h"
29 #include "FUiCtrl_OverlayRegionImpl.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Ui;
36 using namespace Tizen::Ui::Controls;
38 namespace Tizen { namespace Ui { namespace Controls
41 OverlayRegion::OverlayRegion(void)
42 : __pOverlayRegionImpl(null)
46 OverlayRegion::~OverlayRegion(void)
48 delete __pOverlayRegionImpl;
49 __pOverlayRegionImpl = null;
53 OverlayRegion::GetBounds(void) const
55 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
57 return _CoordinateSystemUtils::ConvertToInteger(__pOverlayRegionImpl->GetBounds());
61 OverlayRegion::GetBoundsF(void) const
63 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
65 return __pOverlayRegionImpl->GetBounds();
69 OverlayRegion::GetBounds(int& x, int& y, int& width, int& height) const
71 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
72 Rectangle rect = _CoordinateSystemUtils::ConvertToInteger(__pOverlayRegionImpl->GetBounds());
81 OverlayRegion::GetBounds(float& x, float& y, float& width, float& height) const
83 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
85 __pOverlayRegionImpl->GetBounds(x, y, width, height);
91 OverlayRegion::SetInputBuffer(const ByteBuffer& srcBuffer, const Dimension& sourceDim, OverlayRegionBufferPixelFormat srcFormat)
93 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
95 result r = __pOverlayRegionImpl->SetInputBuffer(srcBuffer, sourceDim, srcFormat);
96 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
102 OverlayRegion::GetBackgroundBufferInfo(BufferInfo& info) const
104 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
106 result r = __pOverlayRegionImpl->GetBackgroundBufferInfo(info);
107 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
113 OverlayRegion::Show(void)
115 SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
121 OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, Rectangle& rect, bool& modified)
123 FloatRectangle convertedRect = _CoordinateSystemUtils::ConvertToFloat(rect);
124 bool ret = EvaluateBounds(option, convertedRect, modified);
128 rect = _CoordinateSystemUtils::ConvertToInteger(convertedRect);
135 OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, FloatRectangle& rect, bool& modified)
137 result r = E_SUCCESS;
141 case OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN:
143 r = _OverlayAgent::EvaluateBounds(OVERLAY_AGENT_EVALUATION_OPTION_GREATER_THAN, rect, modified);
144 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
147 case OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN:
149 r = _OverlayAgent::EvaluateBounds(OVERLAY_AGENT_EVALUATION_OPTION_LESS_THAN, rect, modified);
150 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
157 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The input OverlayRegionEvaluationOption is invalid.");
162 OverlayRegion::GetWidthUnit(void)
164 int widthUnit = _OverlayAgent::GetWidthUnit();
165 SysTryReturn(NID_UI_CTRL, widthUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] Failed to get width unit of OverlayRegion.");
171 OverlayRegion::GetHeightUnit(void)
173 int heightUnit = _OverlayAgent::GetHeightUnit();
174 SysTryReturn(NID_UI_CTRL, heightUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] Failed to get height unit of OverlayRegion.");
180 OverlayRegion::GetMaxCount(void)
182 int maxCount = _OverlayAgent::GetMaxCount();
183 SysTryReturn(NID_UI_CTRL, maxCount != -1, -1, E_SYSTEM, "[E_SYSTEM]Failed to get maximum count of OverlayRegion.");
188 IListT<OverlayRegionBufferPixelFormat>*
189 OverlayRegion::GetSupportedBufferPixelFormatListN(void)
191 return _OverlayRegionImpl::GetSupportedBufferPixelFormatListN();
194 } } } // Tizen::Ui::Controls