LibreSplit/include/gui/component/components.h
Penaz 3f2ba7f54c Restructuring project folders
This should allow for plugins to refer to LibreSplit's functions without
having to pull in half of the codebase.
2026-03-25 21:57:10 +01:00

44 lines
1.4 KiB
C

#ifndef __COMPONENTS_H__
#define __COMPONENTS_H__
#include <ctype.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include "include/gui/utils.h"
#include "include/timer.h"
typedef struct LSComponentOps LSComponentOps; // forward declaration
typedef struct LSComponent {
LSComponentOps* ops;
} LSComponent;
typedef struct LSComponentOps {
void (*delete)(LSComponent* self);
GtkWidget* (*widget)(LSComponent* self);
void (*resize)(LSComponent* self, int win_width, int win_height);
void (*show_game)(LSComponent* self, const ls_game* game, const ls_timer* timer);
void (*clear_game)(LSComponent* self);
void (*draw)(LSComponent* self, const ls_game* game, const ls_timer* timer);
void (*start_split)(LSComponent* self, const ls_timer* timer);
void (*skip)(LSComponent* self, const ls_timer* timer);
void (*unsplit)(LSComponent* self, const ls_timer* timer);
void (*stop_reset)(LSComponent* self, ls_timer* timer);
void (*pause)(LSComponent* self, ls_timer* timer);
void (*unpause)(LSComponent* self, ls_timer* timer);
void (*cancel_run)(LSComponent* self, ls_timer* timer);
} LSComponentOps;
typedef struct LSComponentAvailable {
char* name;
LSComponent* (*new)(void);
} LSComponentAvailable;
// A NULL-terminated array of all available components
extern LSComponentAvailable ls_components[];
#endif /* __COMPONENTS_H__ */