diff options
Diffstat (limited to 'src/user/include')
-rw-r--r-- | src/user/include/cxx/raleigh/w/entry.h | 52 | ||||
-rw-r--r-- | src/user/include/knob/format.h | 8 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/user/include/cxx/raleigh/w/entry.h b/src/user/include/cxx/raleigh/w/entry.h new file mode 100644 index 0000000..7ea2973 --- /dev/null +++ b/src/user/include/cxx/raleigh/w/entry.h @@ -0,0 +1,52 @@ +#ifndef RALEIGH_W_ENTRY_H +#define RALEIGH_W_ENTRY_H + +#include <raleigh/widget.h> +#include <libfont/fonts.h> + +namespace raleigh { + class entry : public widget { + public: + //default_text's data is copied, so it's okay if it changes or if the memory is freed + entry(uint32_t rows, uint32_t cols, const char *default_text="", + const char *font="fixed-10", _pixel_t bg=RGB(ff, ff, ff), + _pixel_t fg=RGB(00, 00, 00), _pixel_t border_color=RGB(00, 00, 00)); + + void notify_window_change(); + void paint(_pixel_t *pixbuf, uint32_t pitch); + bool try_handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up); + void notify_has_opaque_parent(widget *parent); + private: + uint32_t rows; + uint32_t cols; + _pixel_t bg; + _pixel_t fg; + _pixel_t border_color; + + struct font_info *fi; + char *data; + //line_indices[end_y + 1] == end_d + uint32_t *line_indices; + + uint32_t cur_y; + uint32_t cur_x; + uint32_t cur_d; + + //the row of the last character + uint32_t end_y; + //the column after the last character + uint32_t end_x; + //the index of the null terminator + uint32_t end_d; + + bool first_paint; + bool text_changed_since_last_paint; + uint32_t cur_y_last_paint; + uint32_t cur_x_last_paint; + uint32_t cur_d_last_paint; + + void paint_text(_pixel_t *pixbuf, uint32_t pitch); + }; +} + +#endif
\ No newline at end of file diff --git a/src/user/include/knob/format.h b/src/user/include/knob/format.h index fed31c7..6ce7aad 100644 --- a/src/user/include/knob/format.h +++ b/src/user/include/knob/format.h @@ -1,6 +1,10 @@ #ifndef KNOB_FORMAT_H #define KNOB_FORMAT_H +#ifdef __cplusplus +extern "C" { +#endif + #include <knob/heap.h> #include <stdint.h> @@ -26,4 +30,8 @@ uint32_t try_swtou(const char *from, uint32_t *i_out); //returns 0 on failure uint32_t try_swtoh(const char *from, uint32_t *i_out); +#ifdef __cplusplus +} +#endif + #endif
\ No newline at end of file |