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.
18 * @file FUi_UiBuilderControlLayout.cpp
19 * @brief This is the implementation file for _UiBuilderControlLayout class.
23 #include <FBaseSysLog.h>
24 #include "FUi_UiBuilder.h"
25 #include "FUi_UiBuilderControlLayout.h"
26 #include "FUi_CoordinateSystemUtils.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui;
32 namespace Tizen { namespace Ui
34 _UiBuilderControlLayout::_UiBuilderControlLayout(void)
35 : __styleInformation(L"")
39 _UiBuilderControlLayout::~_UiBuilderControlLayout(void)
44 _UiBuilderControlLayout::SetStyle(const Tizen::Base::String& style)
46 __styleInformation = style;
50 _UiBuilderControlLayout::SetRect(const Tizen::Base::String& x, const Tizen::Base::String& y, Tizen::Base::String& width, Tizen::Base::String& height)
52 float floatX = 0.0f, floatY = 0.0f, floatWidth = 0.0f, floatHeight = 0.0f;
54 if (x.IsEmpty() == false)
56 floatX = _CoordinateSystemUtils::ConvertToFloat(x);
58 if (y.IsEmpty() == false)
60 floatY = _CoordinateSystemUtils::ConvertToFloat(y);
62 if (width.IsEmpty() == false)
64 floatWidth = _CoordinateSystemUtils::ConvertToFloat(width);
66 if (height.IsEmpty() == false)
68 floatHeight = _CoordinateSystemUtils::ConvertToFloat(height);
71 __floatRect.x = floatX;
72 __floatRect.y = floatY;
73 __floatRect.width = floatWidth;
74 __floatRect.height = floatHeight;
78 _UiBuilderControlLayout::SetRect(const float x, const float y, const float width, const float height)
82 __floatRect.width = width;
83 __floatRect.height = height;
87 _UiBuilderControlLayout::GetStyle(void) const
89 return __styleInformation;
93 _UiBuilderControlLayout::GetRect(void) const
95 return _CoordinateSystemUtils::ConvertToInteger(__floatRect);
99 _UiBuilderControlLayout::GetRectF(void) const
106 _UiBuilderControlLayout::SetLayoutElement(int index, const Tizen::Base::String& name, const Tizen::Base::String& value)
108 if (index >= UIBUILDER_CONTROL_ELEMENT_NUMBER)
113 __layoutElement[index].SetName(name);
114 __layoutElement[index].SetValue(value);
119 _UiBuilderControlLayout::GetLayoutElement(const Tizen::Base::String& layoutElementName, Tizen::Base::String& outValue) const
122 while (layoutElementName.IsEmpty() == false && index < UIBUILDER_CONTROL_ELEMENT_NUMBER)
124 if (layoutElementName.Equals(__layoutElement[index].GetName(), false))
126 if (__layoutElement[index].GetValue().IsEmpty() == false)
128 outValue = __layoutElement[index].GetValue();