diff options
-rw-r--r-- | src/ui/inputwidget.c | 7 | ||||
-rw-r--r-- | src/ui/inputwidget.h | 11 |
2 files changed, 16 insertions, 2 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 | } |
diff --git a/src/ui/inputwidget.h b/src/ui/inputwidget.h index fc768e05..86484dcc 100644 --- a/src/ui/inputwidget.h +++ b/src/ui/inputwidget.h | |||
@@ -32,6 +32,13 @@ enum iInputMode { | |||
32 | overwrite_InputMode, | 32 | overwrite_InputMode, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | iDeclareType(InputWidgetContentPadding) | ||
36 | |||
37 | struct Impl_InputWidgetContentPadding { | ||
38 | int left; | ||
39 | int right; | ||
40 | }; | ||
41 | |||
35 | void setHint_InputWidget (iInputWidget *, const char *hintText); | 42 | void setHint_InputWidget (iInputWidget *, const char *hintText); |
36 | void setMode_InputWidget (iInputWidget *, enum iInputMode mode); | 43 | void setMode_InputWidget (iInputWidget *, enum iInputMode mode); |
37 | void setMaxLen_InputWidget (iInputWidget *, size_t maxLen); | 44 | void setMaxLen_InputWidget (iInputWidget *, size_t maxLen); |
@@ -50,7 +57,9 @@ void setUrlContent_InputWidget (iInputWidget *, iBool isUrl); | |||
50 | void setNotifyEdits_InputWidget (iInputWidget *, iBool notifyEdits); | 57 | void setNotifyEdits_InputWidget (iInputWidget *, iBool notifyEdits); |
51 | void setEatEscape_InputWidget (iInputWidget *, iBool eatEscape); | 58 | void setEatEscape_InputWidget (iInputWidget *, iBool eatEscape); |
52 | 59 | ||
53 | const iString * text_InputWidget (const iInputWidget *); | 60 | const iString * text_InputWidget (const iInputWidget *); |
61 | iInputWidgetContentPadding | ||
62 | contentPadding_InputWidget (const iInputWidget *); | ||
54 | 63 | ||
55 | iLocalDef iInputWidget *newHint_InputWidget(size_t maxLen, const char *hint) { | 64 | iLocalDef iInputWidget *newHint_InputWidget(size_t maxLen, const char *hint) { |
56 | iInputWidget *d = new_InputWidget(maxLen); | 65 | iInputWidget *d = new_InputWidget(maxLen); |