summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 14:32:56 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 14:32:56 +0200
commit0fdf297a5750f736eddbdbfe73cdb86522cb302c (patch)
treeb0025f66393a8443f5c5e8edfe2b3a61475b11f4 /src/ui/widget.c
parente73a338c66cdd68c56fa289ca46dd169b324ca9c (diff)
Widget: Inserting children at a specific index
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c22
1 files changed, 22 insertions, 0 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
768iAny *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
785iAny *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
768iAny *addChildFlags_Widget(iWidget *d, iAnyObject *child, int64_t childFlags) { 790iAny *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);