]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/display.h
9c62b51ee854d1fe3fb98858a4f924f97cdce5d4
[libs/gui.git] / source / graphics / display.h
1 #ifndef MSP_GRAPHICS_DISPLAY_H_
2 #define MSP_GRAPHICS_DISPLAY_H_
3
4 #include <list>
5 #include <stdexcept>
6 #include <string>
7 #include "errordialog.h"
8 #include "monitor.h"
9 #include "videomode.h"
10
11 namespace Msp {
12 namespace Graphics {
13
14 class Window;
15
16 class Display
17 {
18 public:
19         struct Private;
20
21 private:
22         std::list<Monitor> monitors;
23         Monitor *primary_monitor;
24         std::list<VideoMode> modes;
25         Private *priv;
26         ErrorDialog *err_dialog;
27
28 public:
29         Display(const std::string &disp_name = std::string());
30         ~Display();
31
32         const Private &get_private() const { return *priv; }
33
34         void add_window(Window &);
35         void remove_window(Window &);
36
37         const std::list<Monitor> &get_monitors() const { return monitors; }
38         const std::list<VideoMode> &get_modes() const { return modes; }
39         const VideoMode &get_desktop_mode() const;
40         void set_mode(const VideoMode &, bool = false);
41         void restore_mode();
42         const VideoMode *find_mode(const VideoMode &, float = 0.5f) const;
43         const VideoMode *find_mode(unsigned, unsigned) const;
44
45         void tick();
46 private:
47         bool process_events();
48 public:
49         void check_error();
50 };
51
52 } // namespace Graphics
53 } // namespace Msp
54
55 #endif