Tizen 2.0 Release
[apps/osp/Internet.git] / src / IntDefaultCustomItem.cpp
1 //
2
3 // Copyright (c) 2012 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 // !Internet
19 /*@file:    IntDefaultCustomItem
20  *@brief:
21  *
22  */
23
24 #include <FUiControls.h>
25 #include "IntDefaultCustomItem.h"
26 #include "IntTypes.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui::Controls;
31
32 const int DefaultCustomItem::IDA_FORMAT_STRING = 101;
33
34 DefaultCustomItem::DefaultCustomItem(void)
35 {
36         __width = 0;
37         __height = 0;
38         __text = L"";
39 }
40
41 DefaultCustomItem::~DefaultCustomItem(void)
42 {
43
44 }
45
46 result
47 DefaultCustomItem::Construct(int width, int height)
48 {
49         result r = E_FAILURE;
50         __width = width;
51         __height = height;
52         const Dimension dim(width, height);
53         r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
54         return r;
55
56 }
57
58 void
59 DefaultCustomItem::SetText(String& text)
60 {
61         __text = text;
62 }
63
64 String
65 DefaultCustomItem::GetText(void)
66 {
67         return __text;
68 }
69
70
71 result
72 DefaultCustomItem::Make(void)
73 {
74         result r = E_SUCCESS;
75         const Color pressedTextColor = Color(249, 249, 249);
76         const int textSize = 40;
77         const int x_Margin_Element = 26;
78         const int y_Margin_Element = 26;
79         const int width_Element = __width - 60;
80
81         r = AddElement(Rectangle(x_Margin_Element, y_Margin_Element, width_Element,60), IDA_FORMAT_STRING, __text, textSize, CUSTOM_COLOR_TRANSPARENT, pressedTextColor, pressedTextColor, true);
82         TryCatch( !IsFailed(r),,"DefaultCustomItem::Make %s",GetErrorMessage(r));
83
84         SetElementSelectionEnabled(IDA_FORMAT_STRING, true);
85
86         CATCH:return r;
87 }