]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/window.h
Use correct keyword in forward declaration
[libs/gui.git] / source / graphics / window.h
1 #ifndef MSP_GRAPHICS_WINDOW_H_
2 #define MSP_GRAPHICS_WINDOW_H_
3
4 #include <string>
5 #include <sigc++/signal.h>
6
7 namespace Msp {
8 namespace Graphics {
9
10 class Display;
11 struct Monitor;
12
13 struct WindowOptions
14 {
15         int x;
16         int y;
17         bool user_position;
18         unsigned width;
19         unsigned height;
20         bool fullscreen;
21         const Monitor *fullscreen_monitor;
22         bool fullscreen_exclusive;
23         bool resizable;
24
25         WindowOptions();
26 };
27
28 class Window
29 {
30 public:
31         struct Private;
32         struct Event;
33
34         /** Provides input events.  The event structure contents are platform-
35         specific.  Applications will want to use the enclosed Keyboard and Mouse
36         objects instead. */
37         sigc::signal<void, const Event &> signal_input_event;
38
39         sigc::signal<void> signal_got_focus;
40         sigc::signal<void> signal_lost_focus;
41
42         sigc::signal<void, int, int> signal_move;
43         sigc::signal<void, unsigned, unsigned> signal_resize;
44         sigc::signal<void, unsigned, unsigned, unsigned, unsigned, const Event &> signal_expose;
45         sigc::signal<void> signal_close;
46
47 protected:
48         Display &display;
49         WindowOptions options;
50         bool visible;
51         bool kbd_autorepeat;
52         bool touch_input;
53         bool resizing;
54         bool moving;
55         Private *priv;
56
57 public:
58         Window(Display &, unsigned w, unsigned h, bool fs = false);
59         Window(Display &, const WindowOptions &);
60 private:
61         void init();
62         void platform_init();
63         void platform_cleanup();
64 public:
65         virtual ~Window();
66
67         void set_title(const std::string &);
68         void reconfigure(const WindowOptions &);
69 private:
70         void set_fullscreen_mode();
71         void platform_reconfigure(bool);
72 public:
73         void set_keyboard_autorepeat(bool);
74         bool get_keyboard_autorepeat() const { return kbd_autorepeat; }
75         void show_cursor(bool);
76         void warp_pointer(int, int);
77         void set_touch_input(bool);
78 private:
79         void platform_set_touch_input();
80 public:
81         bool get_touch_input() const { return touch_input; }
82
83         Display &get_display() const { return display; }
84         const WindowOptions &get_options() const { return options; }
85         virtual unsigned get_width() const { return options.width; }
86         virtual unsigned get_height() const { return options.height; }
87         const Private &get_private() const { return *priv; }
88
89         void show();
90         void hide();
91 private:
92         void platform_show();
93         void platform_hide();
94
95 public:
96         bool event(const Event &evnt);
97 };
98
99 } // namespace Graphics
100 } // namespace Msp
101
102 #endif