//
// 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
//
//
/**
- *@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)
+DropDownCustomItem::Construct(int width, int height)
{
- result r = E_SUCCESS;
__width = width;
- __height = 140;
+ __height = height + 28;
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(int fontsize, int itemHeight)
{
AppLogDebug("DropDownCustomItem::Make entered");
+ int xMargin = 26;
+ int yMargin = 22;
+ int subTextHeight = 42;
+ int mainTextHeight = itemHeight - yMargin - subTextHeight + 15;
+
Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
- Tizen::Graphics::Bitmap* pDropperBitmapPressed = null;
- 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);
+ AddElement(Rectangle(xMargin, yMargin, __width - 126, mainTextHeight), IDA_FORMAT_MAIN_STRING,__mainText, fontsize,
+ CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT);
+ AddElement(Rectangle(xMargin, yMargin + mainTextHeight, __width - 126, subTextHeight), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY,
+ CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY);
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);
-
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;
}