Fixed prevent issue
[apps/osp/Gallery.git] / src / GlRadioCustomItem.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file:       RadioCustomItem.cpp
19  *@brief:       The RadioCustomItem
20  */
21
22 #include <FApp.h>
23 #include <FUiControls.h>
24
25 #include "GlRadioCustomItem.h"
26
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui::Controls;
31
32
33 const int RadioCustomItem::IDA_FORMAT_STRING = 500;
34
35
36 RadioCustomItem::RadioCustomItem(void)
37         : __isSelected(false)
38         , __width(0)
39         , __height(0)
40 {
41 }
42
43 RadioCustomItem::~RadioCustomItem(void)
44 {
45 }
46
47 result
48 RadioCustomItem::Construct(int width, int height)
49 {
50         result r = E_FAILURE;
51         __width = width;
52         __height = height;
53         const Dimension dim(width, height);
54         r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_RADIO);
55
56         return r;
57 }
58
59 void
60 RadioCustomItem::SetText(const Tizen::Base::String& text)
61 {
62         __text = text;
63 }
64
65 String
66 RadioCustomItem::GetText(void) const
67 {
68         return __text;
69 }
70
71 result
72 RadioCustomItem::Make(int fontSize)
73 {
74         result r = E_FAILURE;
75         Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2;
76         Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT;
77
78         AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer());
79         r = AddElement(Rectangle(16, 5, __width - 85 - 16, __height), IDA_FORMAT_STRING, __text, fontSize, textColor, textColor, textColor, true);
80         TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
81
82         CATCH:
83         return r;
84 }
85