summaryrefslogtreecommitdiff
path: root/src/user/raleigh/w/multicontainer.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-08 18:06:38 -0500
commitfd4557c4adddf710979a42e9f9d470bc8b3f77bd (patch)
tree485ff6f0514cc1918f8758927a1e2da2198e7d8a /src/user/raleigh/w/multicontainer.cpp
parent920f1f010284d59bad86f78355ed90ac2f3e1d2c (diff)
downloadportland-os-fd4557c4adddf710979a42e9f9d470bc8b3f77bd.tar.gz
hbox, better painting logic in raleigh
Diffstat (limited to 'src/user/raleigh/w/multicontainer.cpp')
-rw-r--r--src/user/raleigh/w/multicontainer.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/user/raleigh/w/multicontainer.cpp b/src/user/raleigh/w/multicontainer.cpp
new file mode 100644
index 0000000..3021deb
--- /dev/null
+++ b/src/user/raleigh/w/multicontainer.cpp
@@ -0,0 +1,53 @@
+#include <raleigh/w/vbox.h>
+
+namespace raleigh {
+ multicontainer::multicontainer(dllist<widget &> widgets)
+ : widgets(widgets) {
+ closest_opaque = 0;
+ }
+
+ void multicontainer::notify_window_change() {
+ set_child_offsets();
+ }
+
+ void multicontainer::paint(_pixel_t *pixbuf, uint32_t pitch) {
+ for (dllist<widget &>::node *n = widgets.first; n; n = n->next) {
+ if (next_paint_full)
+ n->d.next_paint_full = true;
+ n->d.paint(pixbuf, pitch);
+ }
+ if (next_paint_full)
+ next_paint_full = false;
+ }
+
+ void multicontainer::handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) {
+ for (dllist<widget &>::node *n = widgets.first; n; n = n->next)
+ if ((window_coords.x >= n->d.window_offset.x) &&
+ (window_coords.y >= n->d.window_offset.y) &&
+ (window_coords.x < n->d.window_offset.x + n->d.size.x) &&
+ (window_coords.y < n->d.window_offset.y + n->d.size.y))
+ n->d.handle_click(window_coords, click_type, up);
+ }
+
+ void multicontainer::notify_has_opaque_parent(widget *parent) {
+ closest_opaque = parent;
+ for (dllist<widget &>::node *n = widgets.first; n; n = n->next)
+ n->d.notify_has_opaque_parent(parent);
+ }
+
+ void multicontainer::notify_child_size_change(widget &from, coord old_size) {
+ set_size(determine_size());
+ set_child_offsets();
+ }
+
+ void multicontainer::on_mouse_move(coord window_coords) {
+ for (dllist<widget &>::node *n = widgets.first; n; n = n->next)
+ if ((window_coords.x >= n->d.window_offset.x) &&
+ (window_coords.y >= n->d.window_offset.y) &&
+ (window_coords.x < n->d.window_offset.x + n->d.size.x) &&
+ (window_coords.y < n->d.window_offset.y + n->d.size.y)) {
+ n->d.on_mouse_move(window_coords);
+ return;
+ }
+ }
+} \ No newline at end of file