Files

73 lines
1.7 KiB
C
Raw Permalink Normal View History

#pragma once
#include "../../os/WAYLAND/wl_context.h"
#include "../../2d_structs.h"
#include "gui_components_list.h"
typedef struct {
int type;
} input_event;
typedef struct {
int w;
int h;
} resize_event;
typedef struct {
ui_dimensions *dimensions;
ui_position *position;
struct wl_surface *surface;
struct xdg_surface *xdg_surface;
}
gui_component_graphics;
typedef struct gui_component_raw {
void ( *draw_callback) ( struct gui_component_raw*, int);
void ( *resize_callback) ( struct gui_component_raw*, resize_event*);
void ( *input_callback) ( struct gui_component_raw*, resize_event*);
struct gui_component_raw *parent;
struct gui_components_list_raw *children;
gui_component_graphics *graphics;
void *specialization;
}
gui_component;
gui_component_graphics* gui_component_graphics_new(
ui_position *pos,
ui_dimensions *dim,
surface_builders *builders
);
/* called for initializing common configs */
gui_component* gui_component_new_begin(
gui_component *parent,
ui_position *pos,
ui_dimensions *dim,
void (*draw_callback) ( gui_component*, int),
void (*resize_callback) ( gui_component*, resize_event*),
void (*input_callback) ( gui_component*, resize_event*),
surface_builders *builders
);
/* must be called after specialized init for completing the configuration */
void gui_component_new_end( gui_component* toComplete);
void gui_component_add_child( gui_component *parent, gui_component *child);
void gui_component_draw( gui_component *c, int deltaTime);
void gui_component_input_event( gui_component *c, input_event *e);
void gui_component_resize_event( gui_component *c, resize_event *e);
/*
draw callback
input callback
resize callback
*/