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

#ifndef BOXUI_H
#define BOXUI_H

#include "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(char *title,int defaultw, int defaulth, int flags);
void boxui_free(boxui_t *boxui);

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

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);

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

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


#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

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



#endif