blob: 0f932168d759bbe61d6568a9711fe5bbe5ad9d06 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <raleigh/w/padding.h>
namespace raleigh {
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() {
inner.w = w;
inner.window_offset = coord(window_offset.x + pad_by, window_offset.y + pad_by);
inner.notify_window_change();
}
void padding::paint(_pixel_t *pixbuf, uint32_t pitch) {
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;
inner.notify_has_opaque_parent(parent);
}
}
|