]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/cocoa/display.cpp
9c4aa222280479316b708f5f55c624091dd2319d
[libs/gui.git] / source / graphics / cocoa / display.cpp
1 #include <stdexcept>
2 #include "cocoadisplay.h"
3 #include "display.h"
4 #include "display_private.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace Graphics {
10
11 Display::Display(const string &):
12         priv(new Private)
13 {
14         static ErrorDialog err_dlg(0);
15
16         priv->display = create_display();
17 }
18
19 Display::~Display()
20 {
21         destroy_display(priv->display);
22         delete priv;
23 }
24
25 void Display::set_mode(const VideoMode &, bool)
26 {
27         throw runtime_error("video mode switching not supported");
28 }
29
30 bool Display::process_events()
31 {
32         Window::Event event;
33         if(!get_event(priv->display, &event.cevent))
34                 return false;
35
36         map<WindowHandle, Window *>::iterator i = priv->windows.find(event.cevent.any.window);
37         if(i!=priv->windows.end())
38                 i->second->event(event);
39
40         return true;
41 }
42
43 void Display::check_error()
44 {
45 }
46
47 } // namespace Graphics
48 } // namespace Msp