]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/window.h
Consistently label the graphics part as graphics
[libs/gui.git] / source / graphics / window.h
diff --git a/source/graphics/window.h b/source/graphics/window.h
new file mode 100644 (file)
index 0000000..38b9217
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef MSP_GRAPHICS_WINDOW_H_
+#define MSP_GRAPHICS_WINDOW_H_
+
+#include <string>
+#include <sigc++/signal.h>
+#include "eventsource.h"
+
+namespace Msp {
+namespace Graphics {
+
+class Display;
+
+struct WindowOptions
+{
+       unsigned width;
+       unsigned height;
+       bool fullscreen;
+       bool resizable;
+
+       WindowOptions();
+};
+
+class Window: public EventSource
+{
+public:
+       struct Private;
+       struct Event;
+
+       sigc::signal<void> signal_close;
+
+protected:
+       Display &display;
+       WindowOptions options;
+       bool visible;
+       bool kbd_autorepeat;
+       bool resizing;
+       Private *priv;
+
+public:
+       Window(Display &, unsigned w, unsigned h, bool fs = false);
+       Window(Display &, const WindowOptions &);
+private:
+       void init();
+public:
+       virtual ~Window();
+
+       void set_title(const std::string &);
+       void reconfigure(const WindowOptions &);
+       void set_keyboard_autorepeat(bool);
+       bool get_keyboard_autorepeat() const { return kbd_autorepeat; }
+       void show_cursor(bool);
+       void warp_pointer(int, int);
+
+       Display &get_display() const { return display; }
+       const WindowOptions &get_options() const { return options; }
+       virtual unsigned get_width() const { return options.width; }
+       virtual unsigned get_height() const { return options.height; }
+       const Private &get_private() const { return *priv; }
+
+       void show();
+       void hide();
+
+       bool event(const Event &evnt);
+};
+
+} // namespace Graphics
+} // namespace Msp
+
+#endif