]> git.tdb.fi Git - libs/gui.git/blobdiff - source/gbase/window.h
Header updates
[libs/gui.git] / source / gbase / window.h
index f422296f8d3be7e98f6a33ad31932d9197b3b85f..a390b8cf4543da9d06ac7dfda37c9e1a9a3a3d4c 100644 (file)
@@ -1,16 +1,9 @@
-/* $Id$
-
-This file is part of libmspgbase
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GBASE_WINDOW_H_
 #define MSP_GBASE_WINDOW_H_
 
 #include <string>
 #include <sigc++/signal.h>
-#include "types.h"
+#include "eventsource.h"
 
 namespace Msp {
 namespace Graphics {
@@ -27,53 +20,47 @@ struct WindowOptions
        WindowOptions();
 };
 
-class Window
+class Window: public EventSource
 {
 public:
-       sigc::signal<void, int, int, unsigned, unsigned> signal_button_press;
-       sigc::signal<void, int, int, unsigned, unsigned> signal_button_release;
-       sigc::signal<void, int, int> signal_pointer_motion;
-       sigc::signal<void, unsigned, unsigned, unsigned> signal_key_press;
-       sigc::signal<void, unsigned, unsigned> signal_key_release;
-       sigc::signal<void, unsigned, unsigned> signal_resize;
+       struct Private;
+       struct Event;
+
        sigc::signal<void> signal_close;
 
 protected:
        Display &display;
        WindowOptions options;
-       WindowHandle window;
-#ifndef WIN32
-       Atom wm_delete_window;
-       Cursor invisible_cursor;
-#endif
+       bool visible;
+       bool kbd_autorepeat;
+       bool resizing;
+       Private *priv;
 
 public:
-       Window(Display &, unsigned w, unsigned h, bool fs=false);
+       Window(Display &, unsigned w, unsigned h, bool fs = false);
        Window(Display &, const WindowOptions &);
-       ~Window();
+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; }
-       unsigned get_width() const  { return options.width; }
-       unsigned get_height() const { return options.height; }
-       WindowHandle get_handle() const { return window; }
+       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();
 
-#ifndef WIN32
-       void event(const XEvent &ev);
-#endif
-protected:
-       void init();
-#ifdef WIN32
-       int wndproc(UINT, WPARAM, LPARAM);
-       static LRESULT CALLBACK wndproc_(HWND, UINT, WPARAM, LPARAM);
-#endif
+       bool event(const Event &evnt);
 };
 
 } // namespace Graphics