/*
 * boxui.h
 *
 * Multiplatform UI library for SDL3.
 *
 * HEADER FILE
 *
 * (c) 2023-2024 Dario Rodriguez <antartica@box-ui.org>
 * Licensed under the terms of the GNU GPL v3.
 */

#ifndef BOXUI_H
#define BOXUI_H

#include "SDL3/SDL.h"

typedef void boxui_t;

#define _F __FILE__
#define _L __LINE__

#if defined(DEBUG) && defined(LINUX)
#define DEBUG_FPRINTF(a) fprintf a
#else
#define DEBUG_FPRINTF(a)
#endif

boxui_t *boxui_init(SDL_Window *window, SDL_Renderer *renderer, int width, int height);
void boxui_free(boxui_t *boxui);

int boxui_resize(boxui_t *boxui, int width, int height);

int boxui_setuserptr(boxui_t *boxui, void *userptr);
void *boxui_getuserptr(boxui_t *boxui);

int boxui_setsignal(boxui_t *boxui, int signalno, char *actionstr);

int boxui_event(boxui_t *boxui, SDL_Event *event);

int boxui_tick(boxui_t *boxui);

int boxui_haschanged(boxui_t *paramboxui);

SDL_Texture *boxui_gettexture(boxui_t *boxui);

char *boxui_getevent(boxui_t *boxui, char **eventdata);
char *boxui_getaction(boxui_t *boxui, char **actiondata);

#ifndef __GNUC__
int boxui_putaction(boxui_t *boxui, char *firstelem, ...);
#else
        int boxui_putaction(boxui_t *boxui, char *firstelem, ...) __attribute__((sentinel));
#endif

#ifndef __GNUC__
char *boxui_add(boxui_t *boxui, char *filedebug, int linedebug, char *classwiname, char *format, ...);
char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...);
#else
        char *boxui_add(boxui_t *boxui, char *filedebug, int linedebug, char *classwiname, char *format, ...) __attribute__((format(printf,5,6)));
        char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6)));
#endif

int boxuiutil_datacmp(char *datastr,char *key,char *value);

#ifndef __GNUC__
int boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...);
#else
        int boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6)));
#endif

#if 0 //if0
int boxui_setfps(boxui_t *boxui, int fps);
int boxui_getfps(boxui_t *boxui);
int boxui_tick(boxui_t *boxui);
int boxui_ghostrender(boxui_t *boxui);

int boxui_refreshevents(boxui_t *boxui);
int boxui_getevent(boxui_t *boxui, SDL_Event *event);

int boxui_event_isquit(boxui_t *boxui, SDL_Event *event);
int boxui_event_iskeydown(boxui_t *boxui, SDL_Event *event, int *keycode);
int boxui_event_isresize(boxui_t *boxui, SDL_Event *event, int *neww, int *newh);

void boxui_resize(boxui_t *boxui, int neww, int newh);

char *boxui_getactionstr(boxui_t *boxui, char **secondelemtoend);



#endif //if0



#endif