Fixed Nabi Issues N_SE-56908,56903,56917,56940
[apps/osp/Internet.git] / src / IntRadioCustomItem.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 RadioCustomItem class
19 /*@file:        RadioCustomItem.cpp
20  *@brief:       The RadioCustomItem
21  */
22 #include <FApp.h>
23 #include <FUiControls.h>
24
25 #include "IntCommonLib.h"
26 #include "IntRadioCustomItem.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 const int RadioCustomItem::IDA_FORMAT_STRING = 500;
34
35 RadioCustomItem::RadioCustomItem(void)
36 {
37         __width = 0;
38         __height = 0;
39         __text = L"";
40 }
41
42 RadioCustomItem::~RadioCustomItem(void)
43 {
44
45 }
46
47 result
48 RadioCustomItem::Construct(int width, int height)
49 {
50         result r = E_FAILURE;
51         __fontSize = CommonUtil::GetFontSize();
52         __width = width;
53         __height = height;
54         const Dimension dim(width, height);
55         r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_RADIO);
56
57         return r;
58 }
59
60 void
61 RadioCustomItem::SetText(Tizen::Base::String& text)
62 {
63         __text = text;
64 }
65
66 String
67 RadioCustomItem::GetText(void)
68 {
69         return __text;
70 }
71
72 result
73 RadioCustomItem::Make(void)
74 {
75         result r = E_FAILURE;
76         Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2;
77         Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT;
78
79         AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer());
80         r = AddElement(Rectangle(16, 5, __width - 120 , __height), IDA_FORMAT_STRING, __text, __fontSize, textColor, textColor, textColor, true);
81         TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
82
83         CATCH:
84         return r;
85 }