]> git.tdb.fi Git - libs/gui.git/blob - source/display.h
Implement the rest of fullscreen mode (video mode switching, pointer grab)
[libs/gui.git] / source / display.h
1 /* $Id$
2
3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GBASE_DISPLAY_H_
9 #define MSP_GBASE_DISPLAY_H_
10
11 #include <list>
12 #include <map>
13 #include <string>
14 #include "types.h"
15
16 namespace Msp {
17 namespace Graphics {
18
19 class Window;
20
21 struct VideoMode
22 {
23         unsigned width;
24         unsigned height;
25         unsigned rate;
26
27         VideoMode(): width(0), height(0), rate(0) { }
28         VideoMode(unsigned w, unsigned h): width(w), height(h), rate(0) { }
29 };
30
31 class Display
32 {
33 private:
34         ::Display *display;
35         std::list<VideoMode> modes;
36         VideoMode orig_mode;
37         std::map<WindowHandle, Window *> windows;
38
39 public:
40         Display(const std::string &disp_name=std::string());
41         ~Display();
42
43         ::Display *get_display() const { return display; }
44
45         void add_window(Window *);
46         void remove_window(Window *);
47
48         const std::list<VideoMode> &get_modes() const { return modes; }
49         void set_mode(const VideoMode &);
50         void restore_mode() { set_mode(orig_mode); }
51
52         void tick();
53         void check_error();
54 };
55
56 } // namespace Graphics
57 } // namespace Msp
58
59 #endif