diff options
Diffstat (limited to 'src/tk')
-rw-r--r-- | src/tk/button.c | 4 | ||||
-rw-r--r-- | src/tk/check.c | 4 | ||||
-rw-r--r-- | src/tk/style.h | 12 | ||||
-rw-r--r-- | src/tk/text.c | 16 |
4 files changed, 24 insertions, 12 deletions
diff --git a/src/tk/button.c b/src/tk/button.c index 47f59f6..c0a0c61 100644 --- a/src/tk/button.c +++ b/src/tk/button.c @@ -113,8 +113,8 @@ _mftk_button_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) rect.w = w->w; rect.h = w->h; if (SDL_SetRenderDrawColor(renderer, - MFTK_COLOR_BUTN_R, MFTK_COLOR_BUTN_G, - MFTK_COLOR_BUTN_B, MFTK_COLOR_BUTN_A) < 0 || + 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", diff --git a/src/tk/check.c b/src/tk/check.c index b24db0b..3746761 100644 --- a/src/tk/check.c +++ b/src/tk/check.c @@ -38,8 +38,8 @@ struct mftk_check { }; static SDL_Color _mftk_check_butn_color = { - .r = MFTK_COLOR_CHKB_R, .g = MFTK_COLOR_CHKB_G, - .b = MFTK_COLOR_CHKB_B, .a = MFTK_COLOR_CHKB_A + .r = MFTK_COLOR_BACK_R, .g = MFTK_COLOR_BACK_G, + .b = MFTK_COLOR_BACK_B, .a = MFTK_COLOR_BACK_A }; static SDL_Color _mftk_check_mark_color = { .r = MFTK_COLOR_CHKM_R, .g = MFTK_COLOR_CHKM_G, diff --git a/src/tk/style.h b/src/tk/style.h index 95bbf00..14a1ea4 100644 --- a/src/tk/style.h +++ b/src/tk/style.h @@ -28,18 +28,14 @@ #define MFTK_COLOR_FBDR_G 0x00 #define MFTK_COLOR_FBDR_B 0x00 #define MFTK_COLOR_FBDR_A 0xFF +#define MFTK_COLOR_BACK_R 0xAF /* Widget fill color */ +#define MFTK_COLOR_BACK_G 0xAF +#define MFTK_COLOR_BACK_B 0xAF +#define MFTK_COLOR_BACK_A 0xFF #define MFTK_COLOR_FORE_R 0x00 /* Text color */ #define MFTK_COLOR_FORE_G 0x00 #define MFTK_COLOR_FORE_B 0x00 #define MFTK_COLOR_FORE_A 0xFF -#define MFTK_COLOR_BUTN_R 0xAF /* Button fill color */ -#define MFTK_COLOR_BUTN_G 0xAF -#define MFTK_COLOR_BUTN_B 0xAF -#define MFTK_COLOR_BUTN_A 0xFF -#define MFTK_COLOR_CHKB_R 0xAF /* Radio button and check box button fill color */ -#define MFTK_COLOR_CHKB_G 0xAF -#define MFTK_COLOR_CHKB_B 0xAF -#define MFTK_COLOR_CHKB_A 0xFF #define MFTK_COLOR_CHKM_R 0x00 /* Radio button and check box mark fill color */ #define MFTK_COLOR_CHKM_G 0x00 #define MFTK_COLOR_CHKM_B 0x00 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; |