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: DropDownCustomItem
19 *@brief: To create Drop Down custom item
24 #include "GlDropDownCustomItem.h"
27 using namespace Tizen::App;
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui::Controls;
32 const int DropDownCustomItem::IDA_FORMAT_BITMAP = 101;
33 const int DropDownCustomItem::IDA_FORMAT_MAIN_STRING = 102;
34 const int DropDownCustomItem::IDA_FORMAT_SUB_STRING = 103;
35 const int DropDownCustomItem::IDA_FORMAT_DROPPER = 104;
37 DropDownCustomItem::DropDownCustomItem(void)
38 : __currentState(DROP_DOWN_ITEM_STATE_CLOSED)
44 DropDownCustomItem::~DropDownCustomItem(void)
49 DropDownCustomItem::Construct(int width, int height)
52 __height = height + 28;
53 Dimension dim(__width, __height);
54 result r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
59 DropDownCustomItem::SetMainText(const Tizen::Base::String& text)
65 DropDownCustomItem::GetMainText(void) const
71 DropDownCustomItem::SetSubText(const Tizen::Base::String& text)
77 DropDownCustomItem::GetSubText(void) const
83 DropDownCustomItem::Make(int fontsize, int itemHeight)
85 AppLogDebug("DropDownCustomItem::Make entered");
89 int subTextHeight = 42;
90 int mainTextHeight = itemHeight - yMargin - subTextHeight;
92 Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
94 AddElement(Rectangle(xMargin, yMargin, __width - 126, mainTextHeight), IDA_FORMAT_MAIN_STRING,__mainText, fontsize,
95 CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT);
96 AddElement(Rectangle(xMargin, yMargin + mainTextHeight, __width - 126, subTextHeight), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY,
97 CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY);
99 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
102 if (GetCurState() == DROP_DOWN_ITEM_STATE_CLOSED)
104 pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED, BITMAP_PIXEL_FORMAT_ARGB8888);
108 pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED, BITMAP_PIXEL_FORMAT_ARGB8888);
111 AddElement(Rectangle(__width - 95, (__height - 74) / 2, 74, 74), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapNormal, pDropperBitmapNormal);
112 delete pDropperBitmapNormal;
119 DropDownCustomItem::GetCurState(void) const
121 return __currentState;
125 DropDownCustomItem::SetCurState(const DropDownItemState state)
127 __currentState = state;