X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fdisplay.h;h=9c62b51ee854d1fe3fb98858a4f924f97cdce5d4;hb=9ffb9f22faf7c540083e6df828500d54aabcbb56;hp=83b18532148c6cc01cafa9547539e9ec80091fa0;hpb=f608cc1e681e16e21325df56cb96d3f17a348e21;p=libs%2Fgui.git diff --git a/source/graphics/display.h b/source/graphics/display.h index 83b1853..9c62b51 100644 --- a/source/graphics/display.h +++ b/source/graphics/display.h @@ -2,43 +2,28 @@ #define MSP_GRAPHICS_DISPLAY_H_ #include -#include #include #include +#include "errordialog.h" +#include "monitor.h" +#include "videomode.h" 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 monitors; + Monitor *primary_monitor; std::list modes; - VideoMode orig_mode; Private *priv; + ErrorDialog *err_dialog; public: Display(const std::string &disp_name = std::string()); @@ -49,12 +34,18 @@ public: void add_window(Window &); void remove_window(Window &); + const std::list &get_monitors() const { return monitors; } const std::list &get_modes() const { return modes; } - const VideoMode &get_desktop_mode() const { return orig_mode; } - void set_mode(const VideoMode &); - void restore_mode() { set_mode(orig_mode); } + const VideoMode &get_desktop_mode() const; + void set_mode(const VideoMode &, bool = false); + void restore_mode(); + const VideoMode *find_mode(const VideoMode &, float = 0.5f) const; + const VideoMode *find_mode(unsigned, unsigned) const; void tick(); +private: + bool process_events(); +public: void check_error(); };