Fixed prevent issue
[apps/osp/Gallery.git] / src / GlRadioCustomItem.cpp
index 096ec7e..ce63003 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -29,11 +29,9 @@ using namespace Tizen::Base;
 using namespace Tizen::Graphics;
 using namespace Tizen::Ui::Controls;
 
-static const wchar_t* IDB_BUTTON_RADIO_PRESS2 = L"00_button_radio_selected.png";
-static const wchar_t* IDB_BUTTON_RADIO_PRESS1 = L"00_button_radio.png";
 
 const int RadioCustomItem::IDA_FORMAT_STRING = 500;
-const int RadioCustomItem::IDA_FORMAT_RADIO_BUTTON = 501;
+
 
 RadioCustomItem::RadioCustomItem(void)
        : __isSelected(false)
@@ -50,70 +48,38 @@ result
 RadioCustomItem::Construct(int width, int height)
 {
        result r = E_FAILURE;
-
        __width = width;
        __height = height;
        const Dimension dim(width, height);
-       r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
+       r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_RADIO);
 
        return r;
 }
 
 void
-RadioCustomItem::SetText(Tizen::Base::String& text)
+RadioCustomItem::SetText(const Tizen::Base::String& text)
 {
        __text = text;
 }
 
 String
-RadioCustomItem::GetText(void)
+RadioCustomItem::GetText(void) const
 {
        return __text;
 }
 
 result
-RadioCustomItem::Make(void)
+RadioCustomItem::Make(int fontSize)
 {
        result r = E_FAILURE;
        Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2;
        Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT;
-       Bitmap* pBitmap = null;
-
-       if (__isSelected == true)
-       {
-               pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS2);
-       }
-       else
-       {
-               pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_RADIO_PRESS1);
-       }
-
-       if (pBitmap != NULL)
-       {
-               AddElement(Rectangle(26, (__height-pBitmap->GetHeight())/2, pBitmap->GetWidth(), pBitmap->GetHeight()),
-                               IDA_FORMAT_RADIO_BUTTON, *pBitmap, null);
-               AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer());
-
-               r = AddElement(Rectangle(26 + pBitmap->GetWidth() + 10, 5, __width - 26 - 10 - pBitmap->GetWidth(), __height), IDA_FORMAT_STRING, __text, 40, textColor, textColor, textColor, true);
-               delete pBitmap;
-       }
-       TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
 
-       r = SetElementSelectionEnabled(IDA_FORMAT_STRING, true);
+       AppLogDebug("RadioCustomItem::the text is %ls",__text.GetPointer());
+       r = AddElement(Rectangle(16, 5, __width - 85 - 16, __height), IDA_FORMAT_STRING, __text, fontSize, textColor, textColor, textColor, true);
        TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
 
-CATCH:
+       CATCH:
        return r;
 }
 
-void
-RadioCustomItem::SetSelected(bool selectedValue)
-{
-       __isSelected = selectedValue;
-}
-
-bool
-RadioCustomItem::GetSelected(void)
-{
-       return __isSelected;
-}