Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Sample / Tizen C++ / UiVisualElement / UiVisualElement / project / src / AnimationBaseForm.cpp
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.tizenopensource.org/license
10 //
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.
16 //
17
18 #include "FormManager.h"
19 #include "AnimationBaseForm.h"
20
21 using namespace Osp::App;
22 using namespace Osp::Ui;
23 using namespace Osp::Ui::Controls;
24
25 AnimationBaseForm::AnimationBaseForm(void)
26         : __pVisualElement(null)
27 {
28 }
29
30 AnimationBaseForm::~AnimationBaseForm(void)
31 {
32 }
33
34 bool
35 AnimationBaseForm::Initialize()
36 {
37         Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_FOOTER | FORM_STYLE_INDICATOR);
38         InitializeFooter();
39         SetFormBackEventListener(this);
40
41         return true;
42 }
43
44 result
45 AnimationBaseForm::OnInitializing(void)
46 {
47         result r = E_SUCCESS;
48
49         return r;
50 }
51
52 void
53 AnimationBaseForm::OnActionPerformed(const Control& source, int actionId)
54 {
55         switch(actionId)
56         {
57         case ID_FOOTER_BUTTON_PLAY:
58                         PlayAnimation();
59                 break;
60
61         case ID_FOOTER_BUTTON_STOP:
62                         StopAnimation();
63                 break;
64         default:
65                 break;
66         }
67 }
68
69 void
70 AnimationBaseForm::OnFormBackRequested(Osp::Ui::Controls::Form& source)
71 {
72         Frame* pFrame = UiApp::GetInstance()->GetFrameAt(0);
73         if (pFrame != null)
74         {
75                 FormManager* pFormManager = static_cast<FormManager*>(pFrame->GetControl(L"FormManager"));
76
77                 if (pFormManager != null)
78                 {
79                                 pFormManager->SendUserEvent(FormManager::REQUEST_ID_MAIN_FORM, null);
80                 }
81         }
82 }
83
84 void
85 AnimationBaseForm::InitializeFooter(void)
86 {
87         Footer* pFooter = Form::GetFooter();
88
89         pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
90         pFooter->SetBackButton();
91         pFooter->AddActionEventListener(*this);
92
93         FooterItem  footerItem1;
94         footerItem1.Construct(ID_FOOTER_BUTTON_PLAY);
95         footerItem1.SetText(L"Play");
96
97         FooterItem  footerItem2;
98         footerItem2.Construct(ID_FOOTER_BUTTON_STOP);
99         footerItem2.SetText(L"Stop");
100
101         pFooter->AddItem(footerItem1);
102         pFooter->AddItem(footerItem2);
103 }
104
105 void
106 AnimationBaseForm::PlayAnimation(void)
107 {
108 }
109
110 void
111 AnimationBaseForm::StopAnimation(void)
112 {
113 }
114