-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
70 lines (61 loc) · 1.12 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <ma.h>
#include <mavsprintf.h>
#include <MAUtil/Moblet.h>
#include <NativeUI/Widgets.h>
#include <NativeUI/WidgetUtil.h>
#include "MainScreen.h"
using namespace MAUtil;
using namespace NativeUI;
/**
* Moblet to be used as a template for a Native UI application.
*/
class NativeUIMoblet : public Moblet
{
public:
/**
* The constructor creates the user interface.
*/
NativeUIMoblet()
{
createUI();
}
/**
* Destructor.
*/
virtual ~NativeUIMoblet()
{
// All the children will be deleted.
delete mScreen;
}
/**
* Create the user interface.
*/
void createUI()
{
// Create a NativeUI screen that will hold layout and widgets.
mScreen = new MainScreen();
//Show the screen
mScreen->show();
}
/**
* Called when a key is pressed.
*/
void keyPressEvent(int keyCode, int nativeCode)
{
if (MAK_BACK == keyCode || MAK_0 == keyCode)
{
// Call close to exit the application.
close();
}
}
private:
Screen* mScreen; //A Native UI screen
};
/**
* Main function that is called when the program starts.
*/
extern "C" int MAMain()
{
Moblet::run(new NativeUIMoblet());
return 0;
}