diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-12 20:04:47 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-12 20:05:18 +0200 |
commit | 9d73378d21f4644bf0e39fb09025553a0fff7cc4 (patch) | |
tree | 8b0f4aa0e24e2f68409ae9d31167a5bafb51ca7b /src/ui/inputwidget.c | |
parent | b10410f1c1858f3617f62dee07d5289cca418279 (diff) |
InputWidget: Set/get content padding
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 06bb9474..eac195b9 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -205,6 +205,10 @@ const iString *text_InputWidget(const iInputWidget *d) { | |||
205 | return collectNew_String(); | 205 | return collectNew_String(); |
206 | } | 206 | } |
207 | 207 | ||
208 | iInputWidgetContentPadding contentPadding_InputWidget(const iInputWidget *d) { | ||
209 | return (iInputWidgetContentPadding){ d->leftPadding, d->rightPadding }; | ||
210 | } | ||
211 | |||
208 | void setMaxLen_InputWidget(iInputWidget *d, size_t maxLen) { | 212 | void setMaxLen_InputWidget(iInputWidget *d, size_t maxLen) { |
209 | d->maxLen = maxLen; | 213 | d->maxLen = maxLen; |
210 | d->mode = (maxLen == 0 ? insert_InputMode : overwrite_InputMode); | 214 | d->mode = (maxLen == 0 ? insert_InputMode : overwrite_InputMode); |
@@ -637,7 +641,8 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
637 | if (ev->type == SDL_MOUSEMOTION && isHover_Widget(d)) { | 641 | if (ev->type == SDL_MOUSEMOTION && isHover_Widget(d)) { |
638 | const iInt2 local = localCoord_Widget(w, init_I2(ev->motion.x, ev->motion.y)); | 642 | const iInt2 local = localCoord_Widget(w, init_I2(ev->motion.x, ev->motion.y)); |
639 | setCursor_Window(get_Window(), | 643 | setCursor_Window(get_Window(), |
640 | local.x >= 2 * gap_UI + d->leftPadding && local.x < width_Widget(w) - d->rightPadding | 644 | local.x >= 2 * gap_UI + d->leftPadding && |
645 | local.x < width_Widget(w) - d->rightPadding | ||
641 | ? SDL_SYSTEM_CURSOR_IBEAM | 646 | ? SDL_SYSTEM_CURSOR_IBEAM |
642 | : SDL_SYSTEM_CURSOR_ARROW); | 647 | : SDL_SYSTEM_CURSOR_ARROW); |
643 | } | 648 | } |