Initialize Tizen 2.3
[apps/osp/Gallery.git] / src / GlSettingToggleCustomItem.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.1 (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 //!Internet SettingToggleCustomItem class
19 /*@file:         SettingToggleCustomItem.cpp
20  *@brief:        The SettingToggleCustomItem
21  *
22  */
23
24 #include <FUiControls.h>
25
26 #include "GlSettingToggleCustomItem.h"
27
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Ui::Controls;
32
33 static const int IDA_FORMAT_STRING = 101;
34
35 SettingToggleCustomItem::SettingToggleCustomItem(void)
36         : __width(0)
37         , __height(0)
38 {
39 }
40
41 SettingToggleCustomItem::~SettingToggleCustomItem(void)
42 {
43 }
44
45 result
46 SettingToggleCustomItem::Construct(int width, int height)
47 {
48         result r = E_FAILURE;
49
50         __width = width;
51         __height = height;
52         const Dimension dim(width, height);
53         r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_ONOFF_SLIDING);
54
55         return r;
56 }
57
58 void
59 SettingToggleCustomItem::SetText(const Tizen::Base::String& text)
60 {
61         __text = text;
62 }
63
64 String
65 SettingToggleCustomItem::GetText(void) const
66 {
67         return __text;
68 }
69
70 result
71 SettingToggleCustomItem::Make(int fontSize)
72 {
73         const Color textColor = CUSTOM_COLOR_TRANSPARENT;
74         const Color pressedTextColor = CUSTOM_COLOR_TRANSPARENT;
75         const int X_Margin = 26;
76         const int Y_Margin = 26;
77
78         AddElement(Rectangle(X_Margin, Y_Margin, __width - 200, __height - 2* Y_Margin), IDA_FORMAT_STRING, __text, fontSize, textColor, pressedTextColor, pressedTextColor, true);
79
80         return E_SUCCESS;
81 }