Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Template / Tizen C++ / Tab-based Application / tabapp / project / src / App.cpp
1 /**
2  * Name        : $(projectName)
3  * Version     :
4  * Vendor      :
5  * Description :
6  */
7
8
9 #include "$(projectName).h"
10 #include "$(projectName)Frame.h"
11
12 using namespace Osp::App;
13 using namespace Osp::Base;
14 using namespace Osp::System;
15 using namespace Osp::Ui;
16 using namespace Osp::Ui::Controls;
17
18 $(projectName)App::$(projectName)App(void)
19 {
20 }
21
22 $(projectName)App::~$(projectName)App(void)
23 {
24 }
25
26 UiApp*
27 $(projectName)App::CreateInstance(void)
28 {
29         // Create the instance through the constructor.
30         return new $(projectName)App();
31 }
32
33 bool
34 $(projectName)App::OnAppInitializing(AppRegistry& appRegistry)
35 {
36         // TODO:
37         // Initialize Frame and App specific data.
38         // The App's permanent data and context can be obtained from the appRegistry.
39         //
40         // If this method is successful, return true; otherwise, return false.
41         // If this method returns false, the App will be terminated.
42
43         // Uncomment the following statement to listen to the screen on/off events.
44         //PowerManager::SetScreenEventListener(*this);
45
46         // TODO:
47         // Add your initialization code here
48         return true;
49 }
50
51 bool
52 $(projectName)App::OnAppInitialized(void)
53 {
54         // TODO:
55         // Comment.
56
57         // Create a Frame
58         $(projectName)Frame* p$(projectName)Frame = new $(projectName)Frame();
59         p$(projectName)Frame->Construct();
60         p$(projectName)Frame->SetName(L"$(projectName)");
61         AddFrame(*p$(projectName)Frame);
62
63         return true;
64 }
65
66 bool
67 $(projectName)App::OnAppWillTerminate(void)
68 {
69         // TODO:
70         // Comment.
71         return true;
72 }
73
74
75 bool
76 $(projectName)App::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
77 {
78         // TODO:
79         // Deallocate resources allocated by this App for termination.
80         // The App's permanent data and context can be saved via appRegistry.
81         return true;
82 }
83
84 void
85 $(projectName)App::OnForeground(void)
86 {
87         // TODO:
88         // Start or resume drawing when the application is moved to the foreground.
89 }
90
91 void
92 $(projectName)App::OnBackground(void)
93 {
94         // TODO:
95         // Stop drawing when the application is moved to the background.
96 }
97
98 void
99 $(projectName)App::OnLowMemory(void)
100 {
101         // TODO:
102         // Free unused resources or close the application.
103 }
104
105 void
106 $(projectName)App::OnBatteryLevelChanged(BatteryLevel batteryLevel)
107 {
108         // TODO:
109         // Handle any changes in battery level here.
110         // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL.
111 }
112
113 void
114 $(projectName)App::OnScreenOn(void)
115 {
116         // TODO:
117         // Get the released resources or resume the operations that were paused or stopped in OnScreenOff().
118 }
119
120 void
121 $(projectName)App::OnScreenOff(void)
122 {
123         // TODO:
124         // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device
125         // to enter the sleep mode to save the battery.
126         // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a
127         // callback before the device enters the sleep mode.
128         // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.
129 }