diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-20 16:47:15 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-20 16:47:15 +0300 |
commit | 4f840655fcb69f151c73121d790344296f6b43e6 (patch) | |
tree | ea1defea0ee3ca17cd60263e4528c976d97fcf3d /src/ui | |
parent | 992e3d00aa407d0d1d481051e2504bc56395dfb8 (diff) |
Widget: Added a utility method
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/widget.c | 9 | ||||
-rw-r--r-- | src/ui/widget.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index da7efb57..431d93c2 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -1353,6 +1353,15 @@ iBool hasParent_Widget(const iWidget *d, const iWidget *someParent) { | |||
1353 | return iFalse; | 1353 | return iFalse; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | iBool isAffectedByVisualOffset_Widget(const iWidget *d) { | ||
1357 | for (const iWidget *w = d; w; w = w->parent) { | ||
1358 | if (w->flags & visualOffset_WidgetFlag) { | ||
1359 | return iTrue; | ||
1360 | } | ||
1361 | } | ||
1362 | return iFalse; | ||
1363 | } | ||
1364 | |||
1356 | void setFocus_Widget(iWidget *d) { | 1365 | void setFocus_Widget(iWidget *d) { |
1357 | if (rootData_.focus != d) { | 1366 | if (rootData_.focus != d) { |
1358 | if (rootData_.focus) { | 1367 | if (rootData_.focus) { |
diff --git a/src/ui/widget.h b/src/ui/widget.h index 64e502e6..ab08a9b2 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h | |||
@@ -221,6 +221,8 @@ iBool isHover_Widget (const iAnyObject *); | |||
221 | iBool isSelected_Widget (const iAnyObject *); | 221 | iBool isSelected_Widget (const iAnyObject *); |
222 | iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); | 222 | iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); |
223 | iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); | 223 | iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); |
224 | iBool isAffectedByVisualOffset_Widget | ||
225 | (const iWidget *); | ||
224 | void setId_Widget (iWidget *, const char *id); | 226 | void setId_Widget (iWidget *, const char *id); |
225 | void setFlags_Widget (iWidget *, int64_t flags, iBool set); | 227 | void setFlags_Widget (iWidget *, int64_t flags, iBool set); |
226 | void setPos_Widget (iWidget *, iInt2 pos); | 228 | void setPos_Widget (iWidget *, iInt2 pos); |