From 8ba3e62614e61e47ca7f8d79cd8c93d547206f74 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 27 Jan 2022 18:24:50 -0500 Subject: tk: Fill text background (if editable) And use the same macros for all background fill colors. --- (limited to 'src/tk/text.c') diff --git a/src/tk/text.c b/src/tk/text.c index 76bb27a..7401777 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -266,6 +266,22 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) return -1; } + if (t->editable == SDL_TRUE) { + rect.x = x; + rect.y = y; + rect.w = w->w; + rect.h = w->h; + if (SDL_SetRenderDrawColor(renderer, + MFTK_COLOR_BACK_R, MFTK_COLOR_BACK_G, + MFTK_COLOR_BACK_B, MFTK_COLOR_BACK_A) < + 0 || SDL_RenderFillRect(renderer, &rect) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't render widget: %s", + SDL_GetError()); + return -1; + } + } + rect.x = x; rect.y = t->y + y; rect.w = t->w; -- cgit v0.9.1