summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/inputwidget.c7
-rw-r--r--src/ui/inputwidget.h11
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
208iInputWidgetContentPadding contentPadding_InputWidget(const iInputWidget *d) {
209 return (iInputWidgetContentPadding){ d->leftPadding, d->rightPadding };
210}
211
208void setMaxLen_InputWidget(iInputWidget *d, size_t maxLen) { 212void 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
35iDeclareType(InputWidgetContentPadding)
36
37struct Impl_InputWidgetContentPadding {
38 int left;
39 int right;
40};
41
35void setHint_InputWidget (iInputWidget *, const char *hintText); 42void setHint_InputWidget (iInputWidget *, const char *hintText);
36void setMode_InputWidget (iInputWidget *, enum iInputMode mode); 43void setMode_InputWidget (iInputWidget *, enum iInputMode mode);
37void setMaxLen_InputWidget (iInputWidget *, size_t maxLen); 44void setMaxLen_InputWidget (iInputWidget *, size_t maxLen);
@@ -50,7 +57,9 @@ void setUrlContent_InputWidget (iInputWidget *, iBool isUrl);
50void setNotifyEdits_InputWidget (iInputWidget *, iBool notifyEdits); 57void setNotifyEdits_InputWidget (iInputWidget *, iBool notifyEdits);
51void setEatEscape_InputWidget (iInputWidget *, iBool eatEscape); 58void setEatEscape_InputWidget (iInputWidget *, iBool eatEscape);
52 59
53const iString * text_InputWidget (const iInputWidget *); 60const iString * text_InputWidget (const iInputWidget *);
61iInputWidgetContentPadding
62 contentPadding_InputWidget (const iInputWidget *);
54 63
55iLocalDef iInputWidget *newHint_InputWidget(size_t maxLen, const char *hint) { 64iLocalDef iInputWidget *newHint_InputWidget(size_t maxLen, const char *hint) {
56 iInputWidget *d = new_InputWidget(maxLen); 65 iInputWidget *d = new_InputWidget(maxLen);