summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-17 18:43:20 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-17 18:43:20 +0200
commit7e393a4fda482d01252bd1a6e84ca8149bcc278e (patch)
tree3f4d5be987f7c2fd5fd3fcd8a2d97d7fb3cae8db /src/ui/widget.c
parentdb264802503606fd2d8a02fd761ad0914c28818a (diff)
Improved menu button behavior
Clicking a menu button while the menu is open should just close the menu. Menus should not close if the mouse pointer leaves the window.
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index f3e73ee7..1d2aecf0 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -728,6 +728,17 @@ size_t childIndex_Widget(const iWidget *d, const iAnyObject *child) {
728 return iInvalidPos; 728 return iInvalidPos;
729} 729}
730 730
731iAny *hitChild_Widget(const iWidget *d, iInt2 coord) {
732 iConstForEach(ObjectList, i, d->children) {
733 iAny *found = hitChild_Widget(constAs_Widget(i.object), coord);
734 if (found) return found;
735 }
736 if (contains_Widget(d, coord)) {
737 return iConstCast(iWidget *, d);
738 }
739 return NULL;
740}
741
731iAny *findChild_Widget(const iWidget *d, const char *id) { 742iAny *findChild_Widget(const iWidget *d, const char *id) {
732 if (cmp_String(id_Widget(d), id) == 0) { 743 if (cmp_String(id_Widget(d), id) == 0) {
733 return iConstCast(iAny *, d); 744 return iConstCast(iAny *, d);