diff options
author | Benji Dial <benji6283@gmail.com> | 2021-03-05 18:07:48 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-03-05 18:07:48 -0500 |
commit | 76e39eac8cee2175ec62a191f7c91ca53857e80c (patch) | |
tree | 156946f6e8f491235453aa3cbecfda43d6baa2a7 /src/user/raleigh/w/padding.cpp | |
parent | 5e5e524f08ad653a7bf5d6e97f3a49f6c27d08fa (diff) | |
download | portland-os-76e39eac8cee2175ec62a191f7c91ca53857e80c.tar.gz |
more raleigh, including button and vbox widgets
Diffstat (limited to 'src/user/raleigh/w/padding.cpp')
-rw-r--r-- | src/user/raleigh/w/padding.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/user/raleigh/w/padding.cpp b/src/user/raleigh/w/padding.cpp index 6833c5d..3dd027b 100644 --- a/src/user/raleigh/w/padding.cpp +++ b/src/user/raleigh/w/padding.cpp @@ -1,9 +1,10 @@ #include <raleigh/w/padding.h> namespace raleigh { - padding::padding(uint32_t pad_by, _pixel_t color, widget &inner) - : pad_by(pad_by), color(color), inner(inner) { + padding::padding(widget &inner, uint32_t pad_by) + : inner(inner), pad_by(pad_by) { size = coord(inner.size.x + pad_by * 2, inner.size.y + pad_by * 2); + closest_opaque = 0; } void padding::notify_window_change() { @@ -13,19 +14,18 @@ namespace raleigh { } void padding::paint(_pixel_t *pixbuf, uint32_t pitch) { - for (uint32_t y = window_offset.y; y < window_offset.y + pad_by; ++y) - for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) - pixbuf[y * pitch + x] = color; - for (uint32_t y = window_offset.y + size.y - pad_by; y < window_offset.y + size.y; ++y) - for (uint32_t x = window_offset.x; x < window_offset.x + size.x; ++x) - pixbuf[y * pitch + x] = color; - for (uint32_t y = window_offset.y + pad_by; y < window_offset.y + size.y - pad_by; ++y) { - for (uint32_t x = window_offset.x; x < window_offset.x + pad_by; ++x) - pixbuf[y * pitch + x] = color; - for (uint32_t x = window_offset.x + size.x - pad_by; x < window_offset.x + size.x; ++x) - pixbuf[y * pitch + x] = color; - } - inner.paint(pixbuf, pitch); } + + bool padding::try_handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) { + return (window_coords.x >= inner.window_offset.x) && + (window_coords.y >= inner.window_offset.y) && + (window_coords.x < inner.window_offset.x + inner.size.x) && + (window_coords.y < inner.window_offset.y + inner.size.y) && + inner.try_handle_click(window_coords, click_type, up); + } + + void padding::notify_has_opaque_parent(widget *parent) { + closest_opaque = parent; + } }
\ No newline at end of file |