]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/android/window.cpp
Track the currently focused window in Display
[libs/gui.git] / source / graphics / android / window.cpp
1 #include "display.h"
2 #include "display_private.h"
3 #include "window.h"
4 #include "window_private.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace Graphics {
10
11 void Window::platform_init()
12 {
13         priv->window = 0;
14 }
15
16 void Window::platform_cleanup()
17 {
18 }
19
20 void Window::set_title(const string &)
21 {
22 }
23
24 void Window::platform_reconfigure(bool)
25 {
26 }
27
28 void Window::show_cursor(bool)
29 {
30 }
31
32 void Window::warp_pointer(int, int)
33 {
34 }
35
36 void Window::platform_set_touch_input()
37 {
38 }
39
40 void Window::platform_show()
41 {
42 }
43
44 void Window::platform_hide()
45 {
46 }
47
48 bool Window::event(const Event &evnt)
49 {
50         switch(evnt.type)
51         {
52         case INPUT_EVENT:
53                 signal_input_event.emit(evnt);
54                 break;
55         case WINDOW_CREATED:
56                 priv->window = display.get_private().native_window;
57                 display.remove_window(*this);
58                 display.add_window(*this);
59                 priv->signal_window_acquired.emit(priv->window);
60                 signal_got_focus.emit();
61                 break;
62         case WINDOW_RESIZED:
63                 options.width = ANativeWindow_getWidth(priv->window);
64                 options.height = ANativeWindow_getHeight(priv->window);
65                 signal_resize.emit(options.width, options.height);
66                 break;
67         case WINDOW_DESTROYED:
68                 signal_lost_focus.emit();
69                 priv->signal_window_lost.emit();
70                 priv->window = 0;
71                 display.remove_window(*this);
72                 display.add_window(*this);
73                 break;
74         default:
75                 return false;
76         }
77
78         return true;
79 }
80
81 } // namespace Graphics
82 } // namespace Msp