#ifndef SAFFRON_API_H #define SAFFRON_API_H #include "saffron_widget.h" /* satisfy the lsp and also if someone includes api without the saffron.h wrapper (you lunatic) then it still works */ #include "saffron_window.h" #include "saffron_layout.h" #include "saffron_text.h" #include "saffron_button.h" #include #include #include #include #include #include bool saffron_init(void); void saffron_quit(void); void saffron_widget_draw(SaffronWidget* widget, SDL_Renderer *renderer); void saffron_widget_add_child(SaffronWidget* parent, SaffronWidget* child); void saffron_widget_init(SaffronWidget* widget); /* generic primitive for generic widgets as said below. saffron_widget_new just calls this under the hood */ SaffronWidget* saffron_widget_new(); /* generic primitive for generic widgets, e.g. the window root. ideally window root is a hbox/vbox/box once those are implemented */ void saffron_widget_free(SaffronWidget* widget); SaffronWindow* saffron_window_new(const char* title, int w, int h); void saffron_window_free(SaffronWindow* window); void saffron_window_show(SaffronWindow* window); void saffron_window_main(SaffronWindow* window); SaffronWidget* saffron_widget_hit_test(SaffronWidget* widget, int x, int y); SaffronBox* saffron_box_new(SaffronOrientation orientation, SaffronHorizontalAlignment halign, SaffronVerticalAlignment valign, int spacing, int padding, int margin, int width, int height); void saffron_box_layout(SaffronBox* box); SaffronText* saffron_text_new(const char* text, TTF_Font* font); void saffron_text_set_text(SaffronText* text, const char* new_text); SaffronButton* saffron_button_new(bool enabled, void (*callback)(SaffronButton* self), int w, int h); SaffronButton* saffron_button_new_with_text(SaffronText* text, bool enabled, void (*callback)(SaffronButton* self), int w, int h); void saffron_widget_set_theme(SaffronWidget* widget, SaffronTheme* theme); /* very special function for special things * also because i need an event hook that somewhat works * for kiwihacks hackathon (wpewebkit bindings thing) */ void saffron_hook_sdl_all_events(SaffronWindow* window, bool (*callback)(SDL_Event* event), int priority); SDL_GLContext saffron_window_get_gl_context(SaffronWindow* window); void saffron_window_detach_gl_context(SaffronWindow* window); void saffron_window_reattach_gl_context(SaffronWindow* window); #endif