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.
17 #include "FormManager.h"
20 using namespace Osp::App;
21 using namespace Osp::Base;
22 using namespace Osp::Graphics;
23 using namespace Osp::Ui;
24 using namespace Osp::Ui::Controls;
26 MainForm::MainForm(void)
30 MainForm::~MainForm(void)
35 MainForm::Initialize()
37 Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
38 SetFormBackEventListener(this);
44 MainForm::OnInitializing(void)
47 __pHeader = GetHeader();
48 __pHeader->SetTitleText(L"EffectsApp");
50 Footer* pFooter = Form::GetFooter();
52 pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
53 pFooter->SetBackButton();
55 __listViewMainMenuNameArray[0] = L"Interactive effect";
56 __listViewMainMenuNameArray[1] = L"Time based single effect";
58 __pListViewMainMenu = new ListView();
59 __pListViewMainMenu->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, false);
60 __pListViewMainMenu->SetItemProvider(*this);
61 __pListViewMainMenu->AddListViewItemEventListener(*this);
62 AddControl(*__pListViewMainMenu);
68 MainForm::OnTerminating(void)
76 MainForm::OnFormBackRequested(Osp::Ui::Controls::Form& source)
78 UiApp* pApp = UiApp::GetInstance();
84 MainForm::GetItemCount(void)
86 return LIST_VIEW_MAIN_MENU_COUNT;
89 Osp::Ui::Controls::ListItemBase*
90 MainForm::CreateItem(int index, int itemWidth)
92 SimpleItem* pItem = new SimpleItem();
93 pItem->Construct(Osp::Graphics::Dimension(itemWidth, 100), LIST_ANNEX_STYLE_NORMAL);
94 pItem->SetElement(__listViewMainMenuNameArray[index], null);
100 MainForm::DeleteItem(int index, Osp::Ui::Controls::ListItemBase *pItem, int itemWidth)
108 MainForm::OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status)
110 Frame* pFrame = UiApp::GetInstance()->GetFrameAt(0);
113 FormManager* pFormManager = static_cast<FormManager*>(pFrame->GetControl(L"FormManager"));
115 if (pFormManager != null)
120 pFormManager->SendUserEvent(FormManager::REQUEST_ID_INTERACTIVE_PHYSICS_EFFECT_FORM, null);
123 pFormManager->SendUserEvent(FormManager::REQUEST_ID_TIME_BASED_SINGLE_EFFECT_FORM, null);