SayoriOS  0.3.3
widget.h
1 #pragma once
2 
3 #include <common.h>
4 #include "desktop/window.h"
5 #include "gui/pointutils.h"
6 
7 struct Widget;
8 
9 typedef void (*renderer_func_t)(struct Widget*, struct Window*);
10 typedef void (*destroyer_func_t)(struct Widget*);
11 
12 typedef struct Widget {
13  renderer_func_t renderer;
14  destroyer_func_t destroyer;
15 
16  size_t x, y;
17  size_t width, height;
18 
19  void (*on_click)(struct Widget* this, Coordinates_t* coords);
20 
21  void* custom_widget_data;
22 } Widget_t;
23 
24 typedef enum WidgetNotifyCode {
25  WIDGET_CLICK,
26  WIDGET_MOVE
27 } WidgetNotifyCode_t;
28 
29 Widget_t* new_bare_widget(renderer_func_t renderer, destroyer_func_t destroyer, size_t x, size_t y, size_t width, size_t height);
30 void window_add_widget(Window_t* window, struct Widget* widget);
31 void window_remove_widget(Window_t* window, struct Widget* widget);
32 void destroy_widget(Widget_t* widget);
33 void widget_notify(struct Window* window, struct Widget* widget, WidgetNotifyCode_t code, void* data);
Основные определения ядра
Definition: widget.h:12
Definition: window.h:25