]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/display.h
Consistently label the graphics part as graphics
[libs/gui.git] / source / graphics / display.h
diff --git a/source/graphics/display.h b/source/graphics/display.h
new file mode 100644 (file)
index 0000000..b47a550
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef MSP_GRAPHICS_DISPLAY_H_
+#define MSP_GRAPHICS_DISPLAY_H_
+
+#include <list>
+#include <map>
+#include <stdexcept>
+#include <string>
+
+namespace Msp {
+namespace Graphics {
+
+class Window;
+
+struct VideoMode
+{
+       unsigned width;
+       unsigned height;
+       unsigned rate;
+
+       VideoMode(): width(0), height(0), rate(0) { }
+       VideoMode(unsigned w, unsigned h): width(w), height(h), rate(0) { }
+};
+
+
+class unsupported_video_mode: public std::runtime_error
+{
+public:
+       unsupported_video_mode(const VideoMode &);
+       virtual ~unsupported_video_mode() throw () { }
+};
+
+
+class Display
+{
+public:
+       struct Private;
+
+private:
+       std::list<VideoMode> modes;
+       VideoMode orig_mode;
+       Private *priv;
+
+public:
+       Display(const std::string &disp_name = std::string());
+       ~Display();
+
+       const Private &get_private() const { return *priv; }
+
+       void add_window(Window &);
+       void remove_window(Window &);
+
+       const std::list<VideoMode> &get_modes() const { return modes; }
+       void set_mode(const VideoMode &);
+       void restore_mode() { set_mode(orig_mode); }
+
+       void tick();
+       void check_error();
+};
+
+} // namespace Graphics
+} // namespace Msp
+
+#endif