From 406af09ade55553e2b064506c3ba3c89bd965d73 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 4 Mar 2021 19:11:42 -0500 Subject: start of a c++ widget toolkit, c++ runtime --- src/user/raleigh/window.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/user/raleigh/window.cpp (limited to 'src/user/raleigh/window.cpp') diff --git a/src/user/raleigh/window.cpp b/src/user/raleigh/window.cpp new file mode 100644 index 0000000..4373b06 --- /dev/null +++ b/src/user/raleigh/window.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +namespace raleigh { + window::window(widget &root) + : size(root.size), root(root) { + root.w = this; + root.window_offset = coord(0, 0); + root.notify_window_change(); + + pixbuf = (_pixel_t *)get_block(size.x * size.y * sizeof(_pixel_t)); + + root.paint(pixbuf, size.x); + handle = _new_window(size.x, size.y, pixbuf); + + open_windows.add_front(*this); + } + + window::try_actions_return_t window::try_actions() { + struct window_action wa; + window::try_actions_return_t got = NONE; + while (1) { + _get_win_action(handle, &wa); + if (!wa.action_type) + return got; + if ((wa.action_type == wa.KEY_DOWN) && + (wa.as_key.modifiers & wa.as_key.ALTS) && + (wa.as_key.key_id == wa.as_key.KEY_F4)) + return DELETE; + got = GOOD; + //TODO + } + } +} \ No newline at end of file -- cgit v1.2.3