2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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 <FUiControls.h>
25 #include "GlDropDownCustomItem.h"
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Ui::Controls;
33 const int DropDownCustomItem::IDA_FORMAT_BITMAP = 101;
34 const int DropDownCustomItem::IDA_FORMAT_MAIN_STRING = 102;
35 const int DropDownCustomItem::IDA_FORMAT_SUB_STRING = 103;
36 const int DropDownCustomItem::IDA_FORMAT_DROPPER = 104;
38 DropDownCustomItem::DropDownCustomItem(void)
39 : __currentState(DROP_DOWN__ITEM_STATE_CLOSED)
45 DropDownCustomItem::~DropDownCustomItem(void)
50 DropDownCustomItem::Construct(int width)
55 Dimension dim(__width, __height);
56 r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
61 DropDownCustomItem::SetMainText(const Tizen::Base::String& text)
67 DropDownCustomItem::GetMainText(void)
73 DropDownCustomItem::SetSubText(const Tizen::Base::String& text)
79 DropDownCustomItem::GetSubText(void)
85 DropDownCustomItem::Make()
87 AppLogDebug("DropDownCustomItem::Make entered");
89 Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
90 Tizen::Graphics::Bitmap* pDropperBitmapPressed = null;
92 AddElement(Rectangle(26, 22, __width - 126, 54), IDA_FORMAT_MAIN_STRING,__mainText,44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT);
93 AddElement(Rectangle(26, 76, __width - 126, 42), IDA_FORMAT_SUB_STRING,__subText,34,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY);
95 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
98 if (GetCurState() == DROP_DOWN__ITEM_STATE_CLOSED)
100 pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED, BITMAP_PIXEL_FORMAT_ARGB8888);
101 pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_CLOSED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
105 pDropperBitmapNormal = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED, BITMAP_PIXEL_FORMAT_ARGB8888);
106 pDropperBitmapPressed = pAppResource->GetBitmapN(IDB_LIST_EXPAND_OPENED_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);
109 AddElement(Rectangle(__width - 95, (__height - 74) / 2, 74, 74), IDA_FORMAT_DROPPER, *pDropperBitmapNormal, pDropperBitmapPressed, pDropperBitmapNormal);
110 delete pDropperBitmapNormal;
111 delete pDropperBitmapPressed;
114 SetElementSelectionEnabled(IDA_FORMAT_MAIN_STRING, true);
115 SetElementSelectionEnabled(IDA_FORMAT_SUB_STRING, true);
116 SetElementSelectionEnabled(IDA_FORMAT_DROPPER, true);
122 DropDownCustomItem::GetCurState(void)
124 return __currentState;
128 DropDownCustomItem::SetCurState(DropDownItemState state)
130 __currentState = state;