#include <gui.h>
#include <gui/button.h>
#include <gui_private.h>
#include <gui_button_private.h>
#include <gfx.h>
#include <stdio.h>

int gui_button_render_sprite(const struct gui_button *const b)
{
    sprite_get_or_ret(s, -1);

    if (sprite_clone(b->u.sprite.s, s))
        return -1;

    gui_coords(&b->common, &s->x, &s->y);

    const int ret = sprite_sort(s);

    if (ret)
        fprintf(stderr, "%s: sprite_sort failed\n", __func__);

    return ret;
}

void gui_button_get_dim_sprite(const struct gui_button *const b,
    short *const w, short *const h)
{
    const struct sprite *const s = b->u.sprite.s;

    *w = s->w;
    *h = s->h;
}

void gui_button_init_sprite(struct gui_button *const b)
{
}
