X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgbase%2Fwindow.h;h=a390b8cf4543da9d06ac7dfda37c9e1a9a3a3d4c;hb=dce7552c5e2f64fcf5f58b0c934bb4a01f6cbcf7;hp=f422296f8d3be7e98f6a33ad31932d9197b3b85f;hpb=aeb2546fc11a7e27a02a47e85756746330253742;p=libs%2Fgui.git diff --git a/source/gbase/window.h b/source/gbase/window.h index f422296..a390b8c 100644 --- a/source/gbase/window.h +++ b/source/gbase/window.h @@ -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 #include -#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 signal_button_press; - sigc::signal signal_button_release; - sigc::signal signal_pointer_motion; - sigc::signal signal_key_press; - sigc::signal signal_key_release; - sigc::signal signal_resize; + struct Private; + struct Event; + sigc::signal 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