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