SayoriOS 0.3.3

window.h
1 #pragma once
2
3 #include <common.h>
4 #include "gui/pointutils.h"
5 #include "../../src/lib/libvector/include/vector.h"
6
7 #define WINDOW(idx) ((Window_t*)(windows->data[idx]))
8
9 typedef enum WindowState {
10 NOT_INITIALIZED,
11 HIDDEN,
12 DISPLAYING
13 } WindowState_t;
14
15 typedef enum WindowSignal {
16 WINDOW_CLOSE,
17 WINDOW_CLICK,
18 WINDOW_MINIMIZE
19 } WindowSignal_t;
20
21 struct Window;
22
23 typedef void (*on_close_function_t)(struct Window* window);
24
25 typedef struct Window {
26 size_t id;
27 char* title;
28
29 size_t width, height;
30 size_t x, y;
31
32 bool with_title_bar;
33 WindowState_t state;
34 bool minimizable;
35 bool closable;
36
37 uint32_t canvas_bgcolor;
38
39 vector_t* widgets;
40
41 on_close_function_t on_close;
42 void* data; // Data, used by application to unify window's data
43 } Window_t;
44
45 Window_t* window_new(char* title);
46 vector_t * get_window_list();
47 void _window_add_to_list(Window_t* window);
48 size_t get_window_count();
49 void window_destroy(Window_t* win);
50 void window_send_signal(Window_t* window, WindowSignal_t signal, void* data);
51 void destroy_all_windows();
common.h
Основные определения ядра
Window
Definition: window.h:25
vector
Definition: vector.h:7