-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.h
67 lines (47 loc) · 1.5 KB
/
application.h
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
#ifndef TUTORIAL_APPLICATION_H_
#define TUTORIAL_APPLICATION_H_
class View;
namespace Awesomium {
class WebCore;
}
// Common class that sets up an application, creates the WebCore, handles
// the Run loop, and abstracts platform-specific details.
class Application {
public:
// Listener interface to be used to handle various application events.
class Listener {
public:
virtual ~Listener() {}
// Event is fired when app (and WebCore) have been loaded.
virtual void OnLoaded() = 0;
// Event is fired for each iteration of the Run loop.
virtual void OnUpdate() = 0;
// Event is fired when the app is shutting down.
virtual void OnShutdown() = 0;
};
virtual ~Application() {}
// Platform-specific factory constructor
static Application* Create();
// Begin the Run loop.
virtual void Run() = 0;
// Ends the Run loop.
virtual void Quit() = 0;
// Create a platform-specific, windowed View
virtual View* CreateView(int width, int height) = 0;
// Destroy a View
virtual void DestroyView(View* view) = 0;
// Show a modal message box
virtual void ShowMessage(const char* message) = 0;
// Get the WebCore
virtual Awesomium::WebCore* web_core() { return web_core_; }
// Get the Listener.
Listener* listener() { return listener_; }
// Set the Listener for various app events.
void set_listener(Listener* listener) { listener_ = listener; }
protected:
Application() { }
virtual void Load() = 0;
Listener* listener_;
Awesomium::WebCore* web_core_;
};
#endif // TUTORIAL_APPLICATION_H_