diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/widget.c | 22 | ||||
-rw-r--r-- | src/ui/widget.h | 8 |
2 files changed, 27 insertions, 3 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index bab35d8d..c1b95130 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -765,6 +765,28 @@ iAny *addChildPos_Widget(iWidget *d, iAnyObject *child, enum iWidgetAddPos addPo | |||
765 | return child; | 765 | return child; |
766 | } | 766 | } |
767 | 767 | ||
768 | iAny *insertChildAfter_Widget(iWidget *d, iAnyObject *child, size_t afterIndex) { | ||
769 | iAssert(child); | ||
770 | iAssert(d != child); | ||
771 | iWidget *widget = as_Widget(child); | ||
772 | iAssert(!widget->parent); | ||
773 | iAssert(d->children); | ||
774 | iAssert(afterIndex < size_ObjectList(d->children)); | ||
775 | iForEach(ObjectList, i, d->children) { | ||
776 | if (afterIndex-- == 0) { | ||
777 | insertAfter_ObjectList(d->children, i.value, child); | ||
778 | break; | ||
779 | } | ||
780 | } | ||
781 | widget->parent = d; | ||
782 | return child; | ||
783 | } | ||
784 | |||
785 | iAny *insertChildAfterFlags_Widget(iWidget *d, iAnyObject *child, size_t afterIndex, int64_t childFlags) { | ||
786 | setFlags_Widget(child, childFlags, iTrue); | ||
787 | return insertChildAfter_Widget(d, child, afterIndex); | ||
788 | } | ||
789 | |||
768 | iAny *addChildFlags_Widget(iWidget *d, iAnyObject *child, int64_t childFlags) { | 790 | iAny *addChildFlags_Widget(iWidget *d, iAnyObject *child, int64_t childFlags) { |
769 | setFlags_Widget(child, childFlags, iTrue); | 791 | setFlags_Widget(child, childFlags, iTrue); |
770 | return addChild_Widget(d, child); | 792 | return addChild_Widget(d, child); |
diff --git a/src/ui/widget.h b/src/ui/widget.h index 0de0890b..52833f86 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h | |||
@@ -208,9 +208,11 @@ void setVisualOffset_Widget (iWidget *d, int value, uint32_t span, int a | |||
208 | void setBackgroundColor_Widget (iWidget *, int bgColor); | 208 | void setBackgroundColor_Widget (iWidget *, int bgColor); |
209 | void setFrameColor_Widget (iWidget *, int frameColor); | 209 | void setFrameColor_Widget (iWidget *, int frameColor); |
210 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); | 210 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); |
211 | iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ | 211 | iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ |
212 | iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); | 212 | iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); |
213 | iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */ | 213 | iAny * addChildFlags_Widget (iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */ |
214 | iAny * insertChildAfter_Widget (iWidget *, iAnyObject *child, size_t afterIndex); | ||
215 | iAny * insertChildAfterFlags_Widget(iWidget *, iAnyObject *child, size_t afterIndex, int64_t childFlags); | ||
214 | iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ | 216 | iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ |
215 | iAny * child_Widget (iWidget *, size_t index); /* O(n) */ | 217 | iAny * child_Widget (iWidget *, size_t index); /* O(n) */ |
216 | size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ | 218 | size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ |