aboutsummaryrefslogtreecommitdiff
path: root/include/mgui/widget.h
blob: ec19a9833d15fff19db82c510a9a1871909f3d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef MGUI_WIDGET_H
#define MGUI_WIDGET_H

#include <mgl/system/vec.h>

typedef struct mgl_window mgl_window;
typedef struct mgl_event mgl_event;
typedef struct mgui_widget mgui_widget;

typedef enum {
    MGUI_WIDGET_LIST,
    MGUI_WIDGET_BUTTON,
    MGUI_WIDGET_LABEL,
    MGUI_WIDGET_IMAGE
} mgui_widget_type;

typedef struct {
    int left;
    int top;
    int right;
    int bottom;
} mgui_margin;

struct mgui_widget {
    mgui_widget_type type;
    mgui_margin margin;
};

void mgui_widget_init(mgui_widget *self, mgui_widget_type type);

void mgui_widget_set_margin(mgui_widget *self, int left, int top, int right, int bottom);
void mgui_widget_set_position(mgui_widget *self, mgl_vec2i position);
void mgui_widget_set_width(mgui_widget *self, int width);

void mgui_widget_on_event(mgui_widget *self, mgl_window *window, mgl_event *event);
/* Returns the size of the widget */
mgl_vec2i mgui_widget_draw(mgui_widget *self, mgl_window *window);

#endif /* MGUI_WIDGET_H */