//
/**
- *@file: DropDownCustomItem
+ *@file: DropDownCustomItem
*@brief: To create Drop Down custom item
*
*/
#include <FApp.h>
-#include <FUiControls.h>
#include "GlDropDownCustomItem.h"
#include "GlTypes.h"
const int DropDownCustomItem::IDA_FORMAT_DROPPER = 104;
DropDownCustomItem::DropDownCustomItem(void)
- : __currentState(DROP_DOWN__ITEM_STATE_CLOSED)
+ : __currentState(DROP_DOWN_ITEM_STATE_CLOSED)
, __height(0)
, __width(0)
{
result
DropDownCustomItem::Construct(int width)
{
- result r = E_SUCCESS;
__width = width;
__height = 140;
Dimension dim(__width, __height);
- r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
+ result r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
return r;
}
}
String
-DropDownCustomItem::GetMainText(void)
+DropDownCustomItem::GetMainText(void) const
{
return __mainText;
}
}
String
-DropDownCustomItem::GetSubText(void)
+DropDownCustomItem::GetSubText(void) const
{
return __subText;
}
result
-DropDownCustomItem::Make()
+DropDownCustomItem::Make(void)
{
AppLogDebug("DropDownCustomItem::Make entered");
- result r = E_FAILURE;
- EnrichedText* pMainEnText = null;
- EnrichedText* pSubEnText = null;
- TextElement* pMainTextElement = null;
- TextElement* pSubTextElement = null;
- Font mainTextFont;
- Font subTextFont;
- Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
- Tizen::Graphics::Bitmap* pDropperBitmapPressed = null;
-
- pMainEnText = new(std::nothrow) EnrichedText();
- r = pMainEnText->Construct(Dimension(__width - 80, 54));
- if(IsFailed(r))
- {
- delete pMainEnText;
- return E_FAILURE;
- }
-
- pMainTextElement = new(std::nothrow) TextElement();
- pMainTextElement->Construct(__mainText);
- mainTextFont.Construct(FONT_STYLE_BOLD, 44);
-
- Color pressedTextColor = CUSTOM_COLOR_LISTVIEW_TEXT;
- pMainTextElement->SetFont(mainTextFont);
- pMainTextElement->SetTextColor(CUSTOM_COLOR_TRANSPARENT);
- pMainEnText->Add(*pMainTextElement);
-
- pSubEnText = new(std::nothrow) EnrichedText();
- r = pSubEnText->Construct(Dimension(__width - 80, 42));
-
- if(IsFailed(r))
- {
- pMainEnText->RemoveAll(true);
- delete pMainEnText;
- delete pSubEnText;
- return E_FAILURE;
- }
-
- pSubTextElement = new(std::nothrow) TextElement();
- pSubTextElement->Construct(__subText);
-
- subTextFont.Construct(FONT_STYLE_PLAIN, 32);
+ Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
- pSubTextElement->SetFont(subTextFont);
- pSubTextElement->SetTextColor(CUSTOM_COLOR_GREY);
- pSubEnText->Add(*pSubTextElement);
+ AddElement(Rectangle(26, 22, __width - 126, 54), IDA_FORMAT_MAIN_STRING,__mainText, 44,
+ CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT);
+ AddElement(Rectangle(26, 76, __width - 126, 42), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY,
+ CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY);
- r = AddElement(Rectangle(26, 22, __width - 126, 54), IDA_FORMAT_MAIN_STRING, *pMainEnText);
- r = AddElement(Rectangle(26, 76, __width - 126, 42), IDA_FORMAT_SUB_STRING, *pSubEnText);
- if(IsFailed(r))
- {
- pMainEnText->RemoveAll(true);
- pSubEnText->RemoveAll(true);
- delete pMainEnText;
- delete pSubEnText;
- return E_FAILURE;
- }
AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
if (pAppResource)
{
- if (GetCurState() == DROP_DOWN__ITEM_STATE_CLOSED)
+ if (GetCurState() == DROP_DOWN_ITEM_STATE_CLOSED)
{
pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED, BITMAP_PIXEL_FORMAT_ARGB8888);
- pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
}
else
{
pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED, BITMAP_PIXEL_FORMAT_ARGB8888);
- pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
}
- AddElement(Rectangle(__width - 95, (__height - 74) / 2, 74, 74), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapPressed, pDropperBitmapNormal);
+ AddElement(Rectangle(__width - 95, (__height - 74) / 2, 74, 74), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapNormal, pDropperBitmapNormal);
delete pDropperBitmapNormal;
- delete pDropperBitmapPressed;
- }
-
- SetElementSelectionEnabled(IDA_FORMAT_MAIN_STRING, true);
- SetElementSelectionEnabled(IDA_FORMAT_SUB_STRING, true);
- SetElementSelectionEnabled(IDA_FORMAT_DROPPER, true);
- pSubEnText->RemoveAllTextElements(true);
- pMainEnText->RemoveAllTextElements(true);
-
- delete pMainEnText;
- delete pSubEnText;
+ }
return E_SUCCESS;
}
DropDownItemState
-DropDownCustomItem::GetCurState(void)
+DropDownCustomItem::GetCurState(void) const
{
return __currentState;
}
void
-DropDownCustomItem::SetCurState(DropDownItemState state)
+DropDownCustomItem::SetCurState(const DropDownItemState state)
{
__currentState = state;
}