summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/widget.c22
-rw-r--r--src/ui/widget.h8
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
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);
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
208void setBackgroundColor_Widget (iWidget *, int bgColor); 208void setBackgroundColor_Widget (iWidget *, int bgColor);
209void setFrameColor_Widget (iWidget *, int frameColor); 209void setFrameColor_Widget (iWidget *, int frameColor);
210void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); 210void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *));
211iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */ 211iAny * addChild_Widget (iWidget *, iAnyObject *child); /* holds a ref */
212iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos); 212iAny * addChildPos_Widget (iWidget *, iAnyObject *child, enum iWidgetAddPos addPos);
213iAny * addChildFlags_Widget(iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */ 213iAny * addChildFlags_Widget (iWidget *, iAnyObject *child, int64_t childFlags); /* holds a ref */
214iAny * insertChildAfter_Widget (iWidget *, iAnyObject *child, size_t afterIndex);
215iAny * insertChildAfterFlags_Widget(iWidget *, iAnyObject *child, size_t afterIndex, int64_t childFlags);
214iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */ 216iAny * removeChild_Widget (iWidget *, iAnyObject *child); /* returns a ref */
215iAny * child_Widget (iWidget *, size_t index); /* O(n) */ 217iAny * child_Widget (iWidget *, size_t index); /* O(n) */
216size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */ 218size_t childIndex_Widget (const iWidget *, const iAnyObject *child); /* O(n) */