2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file: RadioCustomItem.cpp
19 *@brief: The RadioCustomItem
23 #include <FUiControls.h>
25 #include "GlRadioCustomItem.h"
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui::Controls;
32 static const wchar_t* IDB_BUTTON_RADIO_PRESS2 = L"00_button_radio_selected.png";
33 static const wchar_t* IDB_BUTTON_RADIO_PRESS1 = L"00_button_radio.png";
35 const int RadioCustomItem::IDA_FORMAT_STRING = 500;
36 const int RadioCustomItem::IDA_FORMAT_RADIO_BUTTON = 501;
38 RadioCustomItem::RadioCustomItem(void)
45 RadioCustomItem::~RadioCustomItem(void)
50 RadioCustomItem::Construct(int width, int height)
54 const Dimension dim(width, height);
55 result r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
61 RadioCustomItem::SetText(const Tizen::Base::String& text)
67 RadioCustomItem::GetText(void) const
73 RadioCustomItem::Make(int fontSize)
76 Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2;
77 Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT;
78 Bitmap* pBitmap = null;
80 if (__isSelected == true)
82 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS2);
86 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS1);
91 AddElement(Rectangle(26, (__height - pBitmap->GetHeight()) / 2, pBitmap->GetWidth(), pBitmap->GetHeight()),
92 IDA_FORMAT_RADIO_BUTTON, *pBitmap, null);
93 AppLogDebug("RadioCustomItem::the text is %ls", __text.GetPointer());
95 r = AddElement(Rectangle(26 + pBitmap->GetWidth() + 10, 5, __width - 26 - 10 - pBitmap->GetWidth(),
96 __height), IDA_FORMAT_STRING, __text, fontSize, textColor, textColor, textColor, true);
99 TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
106 RadioCustomItem::SetSelected(const bool selectedValue)
108 __isSelected = selectedValue;
112 RadioCustomItem::GetSelected(void) const