3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Flora License, Version 1.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.tizenopensource.org/license
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an AS IS BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
18 #include "LocalContent.h"
\r
19 #include "MainForm.h"
\r
21 using namespace Osp::App;
\r
22 using namespace Osp::Base;
\r
23 using namespace Osp::System;
\r
24 using namespace Osp::Ui::Controls;
\r
26 LocalContent::LocalContent(void)
\r
30 LocalContent::~LocalContent(void)
\r
35 LocalContent::CreateInstance(void)
\r
37 // Create the instance through the constructor.
\r
38 return new (std::nothrow) LocalContent();
\r
42 LocalContent::OnAppInitializing(AppRegistry& appRegistry)
\r
45 // Initialize UI resources and application specific data.
\r
46 // The application's permanent data and context can be obtained from the appRegistry.
\r
48 // If this method is successful, return true; otherwise, return false.
\r
49 // If this method returns false, the application will be terminated.
\r
52 Frame* pFrame = null;
\r
53 MainForm *pForm = null;
\r
55 pForm = new (std::nothrow) MainForm();
\r
56 TryReturn(pForm != null, false, "pForm is null.");
\r
58 pForm->Initialize();
\r
60 // Add the form to the frame
\r
61 pFrame = GetAppFrame()->GetFrame();
\r
62 pFrame->AddControl(*pForm);
\r
64 // Set the current form
\r
65 pFrame->SetCurrentForm(*pForm);
\r
67 // Draw and Show the form
\r
70 pForm->SetDefaultContentType();
\r
72 // Uncomment the following statement to listen to the screen on/off events.
\r
73 //PowerManager::SetScreenEventListener(*this);
\r
79 LocalContent::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
\r
82 // Deallocate resources allocated by this application for termination.
\r
83 // The application's permanent data and context can be saved via appRegistry.
\r
88 LocalContent::OnForeground(void)
\r
91 // Start or resume drawing when the application is moved to the foreground.
\r
95 LocalContent::OnBackground(void)
\r
98 // Stop drawing when the application is moved to the background.
\r
102 LocalContent::OnLowMemory(void)
\r
105 // Free unused resources or close the application.
\r
109 LocalContent::OnBatteryLevelChanged(BatteryLevel batteryLevel)
\r
112 // Handle any changes in battery level here.
\r
113 // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL.
\r
117 LocalContent::OnScreenOn (void)
\r
120 // Get the released resources or resume the operations that were paused or stopped in OnScreenOff().
\r
124 LocalContent::OnScreenOff (void)
\r
127 // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery.
\r
128 // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode.
\r
129 // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one.
\r