summaryrefslogtreecommitdiff
path: root/src/user/raleigh/w/label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/raleigh/w/label.cpp')
-rw-r--r--src/user/raleigh/w/label.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/user/raleigh/w/label.cpp b/src/user/raleigh/w/label.cpp
index 047126d..5b74175 100644
--- a/src/user/raleigh/w/label.cpp
+++ b/src/user/raleigh/w/label.cpp
@@ -3,25 +3,32 @@
#include <knob/block.h>
namespace raleigh {
- label::label(const char *value, const char *font, _pixel_t bg, _pixel_t fg)
- : value(value), fi(get_font(font)), bg(bg), fg(fg) {
- size = coord(
- fi->space_width * (strlen(value) - 1) + fi->char_width,
- fi->char_height
- );
+ label::label(const char *value, const char *font, bool bg_transparent, _pixel_t fg, _pixel_t bg)
+ : value(value), fi(get_font(font)), bg_transparent(bg_transparent), fg(fg), bg(bg) {
+ size = coord(fi->space_width * (strlen(value) - 1) + fi->char_width, fi->char_height);
+ closest_opaque = 0;
}
void label::notify_window_change() {}
void label::paint(_pixel_t *pixbuf, uint32_t pitch) {
- for (uint32_t y = window_offset.y; 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] = bg;
-
+ if (!bg_transparent)
+ for (uint32_t y = window_offset.y; 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] = bg;
_pixel_t *ptr = pixbuf + window_offset.y * pitch + window_offset.x;
for (const char *c = value; *c; ++c) {
- put_char(fi, *c, ptr, pitch, bg, fg);
+ put_char_no_bg(fi, *c, ptr, pitch, fg);
ptr += fi->space_width;
}
}
+
+ __attribute__ ((const))
+ bool label::try_handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) {
+ return false;
+ }
+
+ void label::notify_has_opaque_parent(widget *parent) {
+ closest_opaque = parent;
+ }
} \ No newline at end of file