2 #include "desktop/widget.h"
3 #include "desktop/widget_button.h"
4 #include "gui/basics.h"
5 #include "io/serial_port.h"
7 void destroy_widget_button(
Widget_t* widget);
9 void widget_button_renderer(
struct Widget*
this,
struct Window* container) {
20 draw_rectangle(this->x, this->y, this->width, this->height, 0);
21 draw_rectangle(this->x-1, this->y-1, this->width+1, this->height+1, 0);
22 draw_filled_rectangle(
24 this->width, this->height,
28 draw_vga_str(this_object->label,
strlen(this_object->label),
30 this->y + (this->height - 16)/2,
31 this_object->label_color
36 Widget_t* new_widget_button(
char* label, uint32_t color, uint32_t label_color) {
38 &widget_button_renderer,
39 &destroy_widget_button,
47 wgt_data->label = label;
48 wgt_data->label_color = label_color;
49 wgt_data->color = color;
51 qemu_log(
"Created Widget Button at: %x", wgt);
52 qemu_log(
"Created Widget Button DATA at: %x", wgt->custom_widget_data);
57 void destroy_widget_button(
Widget_t* widget) {
58 qemu_log(
"Widget button destroy its data at: %x", widget->custom_widget_data);
59 kfree(widget->custom_widget_data);
size_t strlen(const char *str)
Возращает длину строки