From 5fcf57739e68a8b5053e03778aaee0eed445babd Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 11 Mar 2021 22:00:22 -0500 Subject: settings editor, and lots of changes in service of that --- src/user/include/cxx/raleigh/window.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/user/include/cxx/raleigh/window.h') diff --git a/src/user/include/cxx/raleigh/window.h b/src/user/include/cxx/raleigh/window.h index 2b759d5..3448536 100644 --- a/src/user/include/cxx/raleigh/window.h +++ b/src/user/include/cxx/raleigh/window.h @@ -1,45 +1,50 @@ #ifndef RALEIGH_WINDOW_H #define RALEIGH_WINDOW_H +#include + namespace raleigh { class window; } #include #include -#include -#include #include #include +#include +#include namespace raleigh { + typedef void *window_tag_t; class window { friend void start_runtime(); public: //pass on_close to specify a close handler. if on_close returns false, the window will not be closed. - window(widget &root, _pixel_t bg_color=RGB(bf, bf, bf), bool (*on_close)(window &)=0); - void add_keybind(struct key_packet kp, void (*handler)(window &)); + window(widget &root, _pixel_t bg_color=RGB(bf, bf, bf), bool (*on_close)(window_tag_t)=0, window_tag_t tag=0); + void add_keybind(struct key_packet kp, void (*handler)(window_tag_t)); void notify_needs_paint(widget &from); void notify_widget_size_change(widget &from, coord old_size); void notify_wants_movements(widget &from, enum mouse_packet::mouse_button while_down); - enum try_actions_return_t {NONE, GOOD, DELETE}; - try_actions_return_t try_actions(); + void consume_actions(); void show(); void focus(widget &w); + + protected: + widget &root; private: _window_handle_t handle; _pixel_t *pixbuf; coord size; - widget &root; widget *focussed; widget *drag_reciever; enum mouse_packet::mouse_button drag_until; _pixel_t bg_color; bool needs_repaint; void paint_full(); - bool (*on_close)(window &); - dllist> keybinds; + bool (*on_close)(window_tag_t); + window_tag_t tag; + map keybinds; }; } -- cgit v1.2.3