@@ -42,29 +42,29 @@ padding: (float)padding { RECT rc; SetParent(child->widget, widget); GetWindowRect(child->widget, &rc); - + og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); newChild->hwnd = child->widget; newChild->expand = expand; newChild->fill = fill; newChild->padding = (int)padding; newChild->originalSize = (rc.bottom - rc.top); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->next = NULL; - + if(firstBorn == NULL) firstBorn = newChild; else { og_box_child_t *curr = firstBorn; while(curr->next != NULL) curr = curr->next; curr->next = newChild; } - + [self OG_resizeChildren]; } //---------------------------------------------------------------------------------------------------------------------------------- - (void)prependChild: (OGWidget*)child expand: (BOOL)expand @@ -72,49 +72,49 @@ padding: (float)padding { RECT rc; SetParent(child->widget, widget); GetWindowRect(child->widget, &rc); - + og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); newChild->hwnd = child->widget; newChild->expand = expand; newChild->fill = fill; newChild->padding = (int)padding; newChild->originalSize = (rc.bottom - rc.top); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->next = firstBorn; - + firstBorn = newChild; - + SetParent(child->widget, widget); [self OG_resizeChildren]; } //---------------------------------------------------------------------------------------------------------------------------------- - (void)OG_resizeChildren { RECT rc; og_box_child_t *curr; - + //get our available size GetClientRect(widget, &rc); int width = rc.right; int height = rc.bottom; - + //get total of childrens' heights int childOriginal = 0; curr = firstBorn; while(curr != NULL) { childOriginal += (curr->originalSize + (curr->padding << 1)); curr = curr->next; } - + //how to divide our extra space int extra = height - childOriginal; float evenShare = 0.0f; - + if(extra <= 0) { curr = firstBorn; while(curr != NULL) { @@ -150,11 +150,11 @@ curr->currentSize = (float)curr->originalSize + evenShare; curr = curr->next; } } } - + //assign new positions/heights float y = 0; curr = firstBorn; while(curr != NULL) { @@ -173,11 +173,11 @@ { case WM_SIZE: [self OG_resizeChildren]; return DefWindowProc(hwnd, msg, wparam, lparam); break; - + case WM_SIZING: [self OG_resizeChildren]; return DefWindowProc(hwnd, msg, wparam, lparam); break; }