Browse Source

uiInsertBack/uiInsertFront

pull/1/head
Leonard Ritter 10 years ago
parent
commit
de7c405aea
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      oui.h

+ 25
- 0
oui.h View File

@@ -598,6 +598,16 @@ OUI_EXPORT int uiInsert(int item, int child);
// sibling is inserted after item. // sibling is inserted after item.
OUI_EXPORT int uiAppend(int item, int sibling); OUI_EXPORT int uiAppend(int item, int sibling);


// insert child into container item like uiInsert(), but prepend
// it to the first child item, effectively putting it in
// the background.
// it is efficient to call uiInsertBack() repeatedly
// in cases where drawing or layout order doesn't matter.
OUI_EXPORT int uiInsertBack(int item, int child);

// same as uiInsert()
OUI_EXPORT int uiInsertFront(int item, int child);

// set the size of the item; a size of 0 indicates the dimension to be // set the size of the item; a size of 0 indicates the dimension to be
// dynamic; if the size is set, the item can not expand beyond that size. // dynamic; if the size is set, the item can not expand beyond that size.
OUI_EXPORT void uiSetSize(int item, int w, int h); OUI_EXPORT void uiSetSize(int item, int w, int h);
@@ -1181,6 +1191,21 @@ int uiInsert(int item, int child) {
return child; return child;
} }


int uiInsertFront(int item, int child) {
return uiInsert(item, child);
}

int uiInsertBack(int item, int child) {
assert(child > 0);
UIitem *pparent = uiItemPtr(item);
UIitem *pchild = uiItemPtr(child);
assert(!(pchild->flags & UI_ITEM_INSERTED));
pchild->nextitem = pparent->firstkid;
pparent->firstkid = child;
pchild->flags |= UI_ITEM_INSERTED;
return child;
}

void uiSetFrozen(int item, int enable) { void uiSetFrozen(int item, int enable) {
UIitem *pitem = uiItemPtr(item); UIitem *pitem = uiItemPtr(item);
if (enable) if (enable)


Loading…
Cancel
Save