Browse Source

renamed the RelTo* functions to something more descriptive

pull/1/head
Leonard Ritter 10 years ago
parent
commit
3132f241bd
2 changed files with 26 additions and 26 deletions
  1. +6
    -6
      example.cpp
  2. +20
    -20
      oui.h

+ 6
- 6
example.cpp View File

@@ -381,7 +381,7 @@ void columnhandler(int parent, UIevent event) {
int item = uiLastChild(parent); int item = uiLastChild(parent);
int last = uiPrevSibling(item); int last = uiPrevSibling(item);
// mark the new item as positioned under the previous item // mark the new item as positioned under the previous item
uiSetRelToTop(item, last);
uiSetBelow(item, last);
// fill parent horizontally, anchor to previous item vertically // fill parent horizontally, anchor to previous item vertically
uiSetLayout(item, UI_HFILL|UI_TOP); uiSetLayout(item, UI_HFILL|UI_TOP);
// if not the first item, add a margin of 1 // if not the first item, add a margin of 1
@@ -406,7 +406,7 @@ void vgrouphandler(int parent, UIevent event) {
int item = uiLastChild(parent); int item = uiLastChild(parent);
int last = uiPrevSibling(item); int last = uiPrevSibling(item);
// mark the new item as positioned under the previous item // mark the new item as positioned under the previous item
uiSetRelToTop(item, last);
uiSetBelow(item, last);
// fill parent horizontally, anchor to previous item vertically // fill parent horizontally, anchor to previous item vertically
uiSetLayout(item, UI_HFILL|UI_TOP); uiSetLayout(item, UI_HFILL|UI_TOP);
// if not the first item, add a margin // if not the first item, add a margin
@@ -425,9 +425,9 @@ int vgroup(int parent) {
void hgrouphandler(int parent, UIevent event) { void hgrouphandler(int parent, UIevent event) {
int item = uiLastChild(parent); int item = uiLastChild(parent);
int last = uiPrevSibling(item); int last = uiPrevSibling(item);
uiSetRelToLeft(item, last);
uiSetRightTo(item, last);
if (last > 0) if (last > 0)
uiSetRelToRight(last, item);
uiSetLeftTo(last, item);
uiSetLayout(item, UI_LEFT|UI_RIGHT); uiSetLayout(item, UI_LEFT|UI_RIGHT);
uiSetMargins(item, (last < 0)?0:-1, 0, 0, 0); uiSetMargins(item, (last < 0)?0:-1, 0, 0, 0);
} }
@@ -444,9 +444,9 @@ int hgroup(int parent) {
void rowhandler(int parent, UIevent event) { void rowhandler(int parent, UIevent event) {
int item = uiLastChild(parent); int item = uiLastChild(parent);
int last = uiPrevSibling(item); int last = uiPrevSibling(item);
uiSetRelToLeft(item, last);
uiSetRightTo(item, last);
if (last > 0) if (last > 0)
uiSetRelToRight(last, item);
uiSetLeftTo(last, item);
uiSetLayout(item, UI_LEFT|UI_RIGHT); uiSetLayout(item, UI_LEFT|UI_RIGHT);
uiSetMargins(item, (last < 0)?0:8, 0, 0, 0); uiSetMargins(item, (last < 0)?0:8, 0, 0, 0);
} }


+ 20
- 20
oui.h View File

@@ -450,16 +450,16 @@ OUI_EXPORT void uiSetMargins(int item, int l, int t, int r, int b);


// anchor the item to another sibling within the same container, so that the // anchor the item to another sibling within the same container, so that the
// sibling is left to this item. // sibling is left to this item.
OUI_EXPORT void uiSetRelToLeft(int item, int other);
OUI_EXPORT void uiSetRightTo(int item, int other);
// anchor the item to another sibling within the same container, so that the // anchor the item to another sibling within the same container, so that the
// sibling is above this item. // sibling is above this item.
OUI_EXPORT void uiSetRelToTop(int item, int other);
OUI_EXPORT void uiSetBelow(int item, int other);
// anchor the item to another sibling within the same container, so that the // anchor the item to another sibling within the same container, so that the
// sibling is right to this item. // sibling is right to this item.
OUI_EXPORT void uiSetRelToRight(int item, int other);
OUI_EXPORT void uiSetLeftTo(int item, int other);
// anchor the item to another sibling within the same container, so that the // anchor the item to another sibling within the same container, so that the
// sibling is below this item. // sibling is below this item.
OUI_EXPORT void uiSetRelToDown(int item, int other);
OUI_EXPORT void uiSetAbove(int item, int other);


// set item as recipient of all keyboard events; the item must have a handle // set item as recipient of all keyboard events; the item must have a handle
// assigned; if item is -1, no item will be focused. // assigned; if item is -1, no item will be focused.
@@ -575,18 +575,18 @@ OUI_EXPORT int uiGetMarginRight(int item);
// return the bottom margin of the item as set with uiSetMargins() // return the bottom margin of the item as set with uiSetMargins()
OUI_EXPORT int uiGetMarginDown(int item); OUI_EXPORT int uiGetMarginDown(int item);


// return the items anchored sibling as assigned with uiSetRelToLeft()
// return the items anchored sibling as assigned with uiSetRightTo()
// or -1 if not set. // or -1 if not set.
OUI_EXPORT int uiGetRelToLeft(int item);
// return the items anchored sibling as assigned with uiSetRelToTop()
OUI_EXPORT int uiGetRightTo(int item);
// return the items anchored sibling as assigned with uiSetBelow()
// or -1 if not set. // or -1 if not set.
OUI_EXPORT int uiGetRelToTop(int item);
// return the items anchored sibling as assigned with uiSetRelToRight()
OUI_EXPORT int uiGetBelow(int item);
// return the items anchored sibling as assigned with uiSetLeftTo()
// or -1 if not set. // or -1 if not set.
OUI_EXPORT int uiGetRelToRight(int item);
// return the items anchored sibling as assigned with uiSetRelToBottom()
OUI_EXPORT int uiGetLeftTo(int item);
// return the items anchored sibling as assigned with uiSetAbove()
// or -1 if not set. // or -1 if not set.
OUI_EXPORT int uiGetRelToDown(int item);
OUI_EXPORT int uiGetAbove(int item);


// request from_item to expand its content into parent // request from_item to expand its content into parent
OUI_EXPORT void uiExtend(int parent, int from_item); OUI_EXPORT void uiExtend(int parent, int from_item);
@@ -1056,36 +1056,36 @@ int uiGetMarginDown(int item) {
} }




void uiSetRelToLeft(int item, int other) {
void uiSetRightTo(int item, int other) {
assert((other < 0) || (uiParent(other) == uiParent(item))); assert((other < 0) || (uiParent(other) == uiParent(item)));
uiItemPtr(item)->relto[0] = other; uiItemPtr(item)->relto[0] = other;
} }


int uiGetRelToLeft(int item) {
int uiGetRightTo(int item) {
return uiItemPtr(item)->relto[0]; return uiItemPtr(item)->relto[0];
} }


void uiSetRelToTop(int item, int other) {
void uiSetBelow(int item, int other) {
assert((other < 0) || (uiParent(other) == uiParent(item))); assert((other < 0) || (uiParent(other) == uiParent(item)));
uiItemPtr(item)->relto[1] = other; uiItemPtr(item)->relto[1] = other;
} }
int uiGetRelToTop(int item) {
int uiGetBelow(int item) {
return uiItemPtr(item)->relto[1]; return uiItemPtr(item)->relto[1];
} }


void uiSetRelToRight(int item, int other) {
void uiSetLeftTo(int item, int other) {
assert((other < 0) || (uiParent(other) == uiParent(item))); assert((other < 0) || (uiParent(other) == uiParent(item)));
uiItemPtr(item)->relto[2] = other; uiItemPtr(item)->relto[2] = other;
} }
int uiGetRelToRight(int item) {
int uiGetLeftTo(int item) {
return uiItemPtr(item)->relto[2]; return uiItemPtr(item)->relto[2];
} }


void uiSetRelToDown(int item, int other) {
void uiSetAbove(int item, int other) {
assert((other < 0) || (uiParent(other) == uiParent(item))); assert((other < 0) || (uiParent(other) == uiParent(item)));
uiItemPtr(item)->relto[3] = other; uiItemPtr(item)->relto[3] = other;
} }
int uiGetRelToDown(int item) {
int uiGetAbove(int item) {
return uiItemPtr(item)->relto[3]; return uiItemPtr(item)->relto[3];
} }




Loading…
Cancel
Save