#define MSP_GRAPHICS_DISPLAY_H_
#include <list>
-#include <map>
#include <stdexcept>
#include <string>
+#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<Monitor> monitors;
+ Monitor *primary_monitor;
std::list<VideoMode> modes;
- VideoMode orig_mode;
Private *priv;
+ ErrorDialog *err_dialog;
public:
Display(const std::string &disp_name = std::string());
void add_window(Window &);
void remove_window(Window &);
+ const std::list<Monitor> &get_monitors() const { return monitors; }
const std::list<VideoMode> &get_modes() const { return modes; }
- 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();
+private:
+ const VideoMode *find_matching_mode(const VideoMode &) const;
+public:
void tick();
+private:
+ bool process_events();
+public:
void check_error();
};