Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / controls / FUiCtrl_DateTimeBarItem.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19  * @file                FUiCtrl_DateTimeBarItem.cpp
20  * @brief               This is the implementation file for the _DateTimeBarItem class.
21  */
22
23 #include "FUi_ResourceManager.h"
24 #include "FUiCtrl_DateTimeBarItem.h"
25
26 using namespace Tizen::Graphics;
27
28 namespace Tizen { namespace Ui { namespace Controls
29 {
30 _DateTimeBarItem::_DateTimeBarItem(void)
31         : __actionId(-1)
32         , __text()
33         , __status(DATETIMEBAR_ITEM_STATUS_NORMAL)
34         , __bounds(Rectangle())
35 {
36         ClearLastResult();
37 }
38
39 _DateTimeBarItem::~_DateTimeBarItem(void)
40 {
41 }
42
43 _DateTimeBarItem*
44 _DateTimeBarItem::CreateInstanceN(_DateTimeBarAlignment alignment, int itemWidth)
45 {
46         _DateTimeBarItem* pItem = new (std::nothrow) _DateTimeBarItem;
47         SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
48
49         result r = E_SUCCESS;
50
51         if (alignment == DATETIME_BAR_ALIGN_DOWN)
52         {
53                 r = GET_SHAPE_CONFIG(DATETIMEBAR::ARROW_HEIGHT, _ControlManager::GetInstance()->GetOrientation(), pItem->__bounds.y);
54                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
55         }
56
57         pItem->__bounds.width = itemWidth;
58
59         r = GET_SHAPE_CONFIG(DATETIMEBAR::ITEM_HEIGHT, _ControlManager::GetInstance()->GetOrientation(), pItem->__bounds.height);
60         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
61
62         return pItem;
63
64 CATCH:
65         delete pItem;
66         return null;
67 }
68
69 void
70 _DateTimeBarItem::SetActionId(int actionId)
71 {
72         __actionId = actionId;
73         return;
74 }
75
76 int
77 _DateTimeBarItem::GetActionId(void) const
78 {
79         return __actionId;
80 }
81
82 void
83 _DateTimeBarItem::SetText(const Tizen::Base::String& text)
84 {
85         __text = text;
86         return;
87 }
88
89 Tizen::Base::String
90 _DateTimeBarItem::GetText(void) const
91 {
92         return __text;
93 }
94
95 void
96 _DateTimeBarItem::SetStatus(_DateTimeBarItemStatus status)
97 {
98         __status = status;
99         return;
100 }
101
102 _DateTimeBarItemStatus
103 _DateTimeBarItem::GetStatus(void) const
104 {
105         return __status;
106 }
107
108 void
109 _DateTimeBarItem::SetBounds(const Tizen::Graphics::Rectangle& bounds)
110 {
111         __bounds = bounds;
112         return;
113 }
114
115 Rectangle
116 _DateTimeBarItem::GetBounds(void) const
117 {
118         return __bounds;
119 }
120
121 }}} // Tizen::Ui::Controls