X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fdisplay.h;h=092abbe1404afa2fe303883ed49cce9f5cfbe478;hb=130d5570e08c32d9db9d3e5324c2c8e99d1cdb02;hp=d311ba73c75f36ded3fe02e0401518638e88d2e2;hpb=1aca77b93853ee127ac3bbf6886f7f04920542ef;p=libs%2Fgui.git diff --git a/source/graphics/display.h b/source/graphics/display.h index d311ba7..092abbe 100644 --- a/source/graphics/display.h +++ b/source/graphics/display.h @@ -4,40 +4,31 @@ #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; + sigc::signal signal_got_focus; + sigc::signal signal_lost_focus; + private: + std::list monitors; + Monitor *primary_monitor; std::list modes; - VideoMode orig_mode; Private *priv; + ErrorDialog *err_dialog; + Window *focus_window; public: Display(const std::string &disp_name = std::string()); @@ -48,11 +39,21 @@ 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; +private: + void window_got_focus(Window &); + void window_lost_focus(); +public: + Window *get_focus_window() const { return focus_window; } + +public: void tick(); private: bool process_events();