X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fdisplay.h;h=23ab57113ef0f626d8c4120468da6f60e6159c2b;hb=72ed51af9656b47a331cf29565a0bdfd35f19847;hp=d311ba73c75f36ded3fe02e0401518638e88d2e2;hpb=1aca77b93853ee127ac3bbf6886f7f04920542ef;p=libs%2Fgui.git diff --git a/source/graphics/display.h b/source/graphics/display.h index d311ba7..23ab571 100644 --- a/source/graphics/display.h +++ b/source/graphics/display.h @@ -1,43 +1,34 @@ #ifndef MSP_GRAPHICS_DISPLAY_H_ #define MSP_GRAPHICS_DISPLAY_H_ -#include #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 modes; - VideoMode orig_mode; - Private *priv; + std::vector monitors; + Monitor *primary_monitor = nullptr; + std::vector modes; + Private *priv = nullptr; + ErrorDialog *err_dialog = nullptr; + Window *focus_window = nullptr; 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_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 std::vector &get_monitors() const { return monitors; } + const std::vector &get_modes() const { return modes; } + 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();