2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.tizenopensource.org/license
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 using namespace Osp::App;
21 using namespace Osp::Base;
22 using namespace Osp::Base::Collection;
23 using namespace Osp::Media;
24 using namespace Osp::Ui;
25 using namespace Osp::Ui::Controls;
26 using namespace Osp::Graphics;
27 using namespace Osp::Base::Runtime;
30 __timerStatus(TIMER_INIT),
46 for (int i = 0; i < 8; i++)
47 delete __pProgressBitmap[i];
51 Panel3::Construct(Osp::Graphics::Rectangle rect)
54 Panel::Construct(rect);
56 // Create a Start Button
57 __pStartButton = new Button();
58 __pStartButton->Construct(Rectangle(20, rect.height-90, 210, 80));
59 __pStartButton->SetText(L"Start");
60 __pStartButton->SetActionId(ID_BUTTON_START);
61 __pStartButton->AddActionEventListener(*this);
62 AddControl(*__pStartButton);
64 // Create a Stop Button
65 __pStopButton = new Button();
66 __pStopButton->Construct(Rectangle(250, rect.height-90, 210, 80));
67 __pStopButton->SetText(L"Stop");
68 __pStopButton->SetActionId(ID_BUTTON_STOP);
69 __pStopButton->AddActionEventListener(*this);
70 __pStopButton->SetEnabled(false);
71 AddControl(*__pStopButton);
73 AppResource *pAppResource = Application::GetInstance()->GetAppResource();
77 __pHome = pAppResource->GetBitmapN(L"home_type3.png");
78 __pMsg = pAppResource->GetBitmapN(L"message_type3.png");
79 __pAlarm = pAppResource->GetBitmapN(L"alarm_type3.png");
81 __pProgressBitmap[0] = pAppResource->GetBitmapN("blue/progressing00_big.png");
82 __pProgressBitmap[1] = pAppResource->GetBitmapN("blue/progressing01_big.png");
83 __pProgressBitmap[2] = pAppResource->GetBitmapN("blue/progressing02_big.png");
84 __pProgressBitmap[3] = pAppResource->GetBitmapN("blue/progressing03_big.png");
85 __pProgressBitmap[4] = pAppResource->GetBitmapN("blue/progressing04_big.png");
86 __pProgressBitmap[5] = pAppResource->GetBitmapN("blue/progressing05_big.png");
87 __pProgressBitmap[6] = pAppResource->GetBitmapN("blue/progressing06_big.png");
88 __pProgressBitmap[7] = pAppResource->GetBitmapN("blue/progressing07_big.png");
91 __pTimer = new Timer();
92 __pTimer->Construct(*this);
94 // Create a CustomList
95 __pListView = new ListView();
96 __pListView->Construct(Rectangle(0, 0, rect.width, rect.height-100), true, false);
97 __pListView->SetItemProvider(*this);
98 AddControl(*__pListView);
104 Panel3::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
108 case ID_BUTTON_START:
110 if (TIMER_START != __timerStatus)
112 __pStartButton->SetEnabled(false);
113 __pStopButton->SetEnabled(true);
115 __timerStatus = TIMER_START;
116 __pTimer->Start(INTERVAL);
122 __pStartButton->SetEnabled(true);
123 __pStopButton->SetEnabled(false);
125 __timerStatus = TIMER_STOP;
133 Panel3::OnTimerExpired(Osp::Base::Runtime::Timer & timer)
137 if(__timerStatus == TIMER_STOP)
141 __pStartButton->SetEnabled(true);
142 __pStopButton->SetEnabled(false);
149 r = __pTimer->Start(INTERVAL);
152 AppLogException("Timer Start Fail.");
155 __pListView->RefreshList(0, LIST_REFRESH_TYPE_ITEM_MODIFY);
157 __pStartButton->SetEnabled(false);
158 __pStopButton->SetEnabled(true);
163 Osp::Ui::Controls::ListItemBase*
164 Panel3::CreateItem(int index, int itemWidth)
166 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
167 CustomItem* pItem = new CustomItem();
170 if (index == 0 && __timerStatus == TIMER_START)
172 int index = __progress % 8;
173 pItem->Construct(Osp::Graphics::Dimension(itemWidth,100), style);
174 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pProgressBitmap[index], null, null);
175 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"Animating", true);
185 style = LIST_ANNEX_STYLE_NORMAL;
186 pItem->Construct(Osp::Graphics::Dimension(itemWidth,100), style);
187 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pHome, null, null);
188 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"HOME", true);
192 style = LIST_ANNEX_STYLE_MARK;
193 pItem->Construct(Osp::Graphics::Dimension(itemWidth,100), style);
194 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pMsg, null, null);
195 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"Msg", true);
198 style = LIST_ANNEX_STYLE_ONOFF_SLIDING;
199 pItem->Construct(Osp::Graphics::Dimension(itemWidth,100), style);
200 pItem->AddElement(Rectangle(10, 20, 60, 60), ID_FORMAT_BITMAP, *__pAlarm, null, null);
201 pItem->AddElement(Rectangle(80, 25, 200, 50), ID_FORMAT_STRING, L"Alarm", true);
212 Panel3::DeleteItem(int index, Osp::Ui::Controls::ListItemBase* pItem, int itemWidth)
220 Panel3::GetItemCount(void)