]> git.tdb.fi Git - libs/gui.git/blob - source/gbase/window.h
Support mouse wheel on win32
[libs/gui.git] / source / gbase / window.h
1 /* $Id$
2
3 This file is part of libmspgbase
4 Copyright © 2007-2008  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GBASE_WINDOW_H_
9 #define MSP_GBASE_WINDOW_H_
10
11 #include <string>
12 #include <sigc++/signal.h>
13
14 namespace Msp {
15 namespace Graphics {
16
17 class Display;
18
19 struct WindowOptions
20 {
21         unsigned width;
22         unsigned height;
23         bool fullscreen;
24         bool resizable;
25
26         WindowOptions();
27 };
28
29 class Window
30 {
31 public:
32         struct Private;
33         struct Event;
34
35         sigc::signal<void, int, int, unsigned, unsigned> signal_button_press;
36         sigc::signal<void, int, int, unsigned, unsigned> signal_button_release;
37         sigc::signal<void, int, int> signal_pointer_motion;
38         sigc::signal<void, unsigned, unsigned, unsigned> signal_key_press;
39         sigc::signal<void, unsigned, unsigned> signal_key_release;
40         sigc::signal<void, unsigned, unsigned> signal_resize;
41         sigc::signal<void> signal_close;
42
43 protected:
44         Display &display;
45         WindowOptions options;
46         bool visible;
47         bool kbd_autorepeat;
48         Private *priv;
49
50 public:
51         Window(Display &, unsigned w, unsigned h, bool fs=false);
52         Window(Display &, const WindowOptions &);
53 private:
54         void init();
55 public:
56         ~Window();
57
58         void set_title(const std::string &);
59         void reconfigure(const WindowOptions &);
60         void set_keyboard_autorepeat(bool);
61         bool get_keyboard_autorepeat() const { return kbd_autorepeat; }
62         void show_cursor(bool);
63         void warp_pointer(int, int);
64
65         Display &get_display() const { return display; }
66         const WindowOptions &get_options() const { return options; }
67         unsigned get_width() const  { return options.width; }
68         unsigned get_height() const { return options.height; }
69         const Private &get_private() const { return *priv; }
70
71         void show();
72         void hide();
73
74         bool event(const Event &evnt);
75 };
76
77 } // namespace Graphics
78 } // namespace Msp
79
80 #endif