summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 16:47:15 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 16:47:15 +0300
commit4f840655fcb69f151c73121d790344296f6b43e6 (patch)
treeea1defea0ee3ca17cd60263e4528c976d97fcf3d /src/ui
parent992e3d00aa407d0d1d481051e2504bc56395dfb8 (diff)
Widget: Added a utility method
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/widget.c9
-rw-r--r--src/ui/widget.h2
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
1356iBool 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
1356void setFocus_Widget(iWidget *d) { 1365void 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 *);
221iBool isSelected_Widget (const iAnyObject *); 221iBool isSelected_Widget (const iAnyObject *);
222iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd); 222iBool isCommand_Widget (const iWidget *d, const SDL_Event *ev, const char *cmd);
223iBool hasParent_Widget (const iWidget *d, const iWidget *someParent); 223iBool hasParent_Widget (const iWidget *d, const iWidget *someParent);
224iBool isAffectedByVisualOffset_Widget
225 (const iWidget *);
224void setId_Widget (iWidget *, const char *id); 226void setId_Widget (iWidget *, const char *id);
225void setFlags_Widget (iWidget *, int64_t flags, iBool set); 227void setFlags_Widget (iWidget *, int64_t flags, iBool set);
226void setPos_Widget (iWidget *, iInt2 pos); 228void setPos_Widget (iWidget *, iInt2 pos);