summaryrefslogtreecommitdiffstats
path: root/src/tk
diff options
context:
space:
mode:
Diffstat (limited to 'src/tk')
-rw-r--r--src/tk/text.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tk/text.c b/src/tk/text.c
index 99ec76a..2b9a026 100644
--- a/src/tk/text.c
+++ b/src/tk/text.c
@@ -40,6 +40,7 @@ struct mftk_text {
int line_skip;
int ascent;
SDL_Texture *texture;
+ int padding;
int border;
int editable;
int blink_state;
@@ -307,6 +308,8 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y)
}
}
+ x += t->padding;
+ y += t->padding;
rect.x = x;
rect.y = t->y + y;
rect.w = t->w;
@@ -362,7 +365,7 @@ _mftk_text_destroy(struct mftk_widget *w)
struct mftk_widget *
mftk_text_new(const char *allowed_chars, int len, const char *val,
- TTF_Font *font, int border, int editable,
+ TTF_Font *font, int padding, int border, int editable,
int (*action)(void *, const char *), int (*submit)(void *),
void *user_data)
{
@@ -383,6 +386,7 @@ mftk_text_new(const char *allowed_chars, int len, const char *val,
t->line_skip = TTF_FontLineSkip(font);
t->ascent = TTF_FontAscent (font);
t->texture = NULL;
+ t->padding = padding;
t->border = border;
t->editable = editable;
t->blink_state = SDL_TRUE;
@@ -431,8 +435,8 @@ mftk_text_new(const char *allowed_chars, int len, const char *val,
}
w->h = t->line_skip;
if (editable == SDL_TRUE) {
- w->w += border * 2;
- w->h += border * 2;
+ w->w += padding * 2 + border * 2;
+ w->h += padding * 2 + border * 2;
}
return w;