diff options
-rw-r--r-- | src/tk/box.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tk/box.c b/src/tk/box.c index ca60ab2..ced5b3c 100644 --- a/src/tk/box.c +++ b/src/tk/box.c @@ -82,6 +82,22 @@ static int _mftk_box_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) { struct mftk_box *b = (struct mftk_box *) w; + SDL_Rect rect; + + rect.x = b->child_x - b->padding; + rect.y = b->child_y - b->padding; + rect.w = w->w; + rect.h = w->h; + if (SDL_SetRenderDrawColor(renderer, + b->bg_color->r, b->bg_color->g, + b->bg_color->b, b->bg_color->a) < 0 || + SDL_RenderFillRect(renderer, &rect) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't render widget: %s", + SDL_GetError()); + return -1; + } + if (mftk_widget_render(b->child, renderer, x + b->child_x, y + b->child_y) < 0) { |