@@ -1,7 +1,8 @@ /* * Copyright (c) 2011, 2012, Dillon Aumiller + * Copyright (c) 2012, Jonathan Schleifer * * https://webkeks.org/hg/objgui/ * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -42,11 +43,11 @@ { RECT rc; SetParent(child->widget, widget); GetWindowRect(child->widget, &rc); - OGBoxChild *newChild = (OGBoxChild *)malloc(sizeof(OGBoxChild)); + 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); @@ -55,16 +56,16 @@ if(firstBorn == NULL) firstBorn = newChild; else { - OGBoxChild *curr = firstBorn; + og_box_child_t *curr = firstBorn; while(curr->next != NULL) curr = curr->next; curr->next = newChild; } - [self resizeChildren]; + [self OG_resizeChildren]; } //---------------------------------------------------------------------------------------------------------------------------------- - (void)prependChild: (OGWidget*)child expand: (BOOL)expand fill: (BOOL)fill @@ -72,11 +73,11 @@ { RECT rc; SetParent(child->widget, widget); GetWindowRect(child->widget, &rc); - OGBoxChild *newChild = (OGBoxChild *)malloc(sizeof(OGBoxChild)); + 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); @@ -84,17 +85,17 @@ newChild->next = firstBorn; firstBorn = newChild; SetParent(child->widget, widget); - [self resizeChildren]; + [self OG_resizeChildren]; } //---------------------------------------------------------------------------------------------------------------------------------- -- (void)resizeChildren +- (void)OG_resizeChildren { RECT rc; - OGBoxChild *curr; + og_box_child_t *curr; //get our available size GetClientRect(widget, &rc); int width = rc.right; int height = rc.bottom; @@ -120,11 +121,11 @@ curr->currentSize = curr->originalSize; curr = curr->next; } if(extra < 0) { - //this will generate a WM_SIZE message, and we'll come back to resizeChildren + //this will generate a WM_SIZE message, and we'll come back to OG_resizeChildren SetWindowPos(widget, NULL, 0, 0, width, childOriginal, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE); return; } } else @@ -169,19 +170,19 @@ - (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam { switch(msg) { case WM_SIZE: - [self resizeChildren]; + [self OG_resizeChildren]; return DefWindowProc(hwnd, msg, wparam, lparam); break; case WM_SIZING: - [self resizeChildren]; + [self OG_resizeChildren]; return DefWindowProc(hwnd, msg, wparam, lparam); break; } return [(id)super MessageReceived : hwnd : msg : wparam : lparam]; } //---------------------------------------------------------------------------------------------------------------------------------- @end //==================================================================================================================================