Remove useless whitespaces.
This commit is contained in:
parent
c29f0c525c
commit
65818a08da
9 changed files with 50 additions and 50 deletions
|
@ -19,7 +19,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
//==================================================================================================================================
|
||||
// OGApplication.m
|
||||
//==================================================================================================================================
|
||||
|
@ -89,7 +89,7 @@ void win32_init(int *argc, char ***argv)
|
|||
wcx.lpszMenuName = NULL;
|
||||
wcx.lpszClassName = clsName;
|
||||
wcx.hIconSm = NULL;
|
||||
|
||||
|
||||
RegisterClassEx(&wcx);
|
||||
//TODO: although this doesn't ever really fail, we should probably Throw an Exception here...
|
||||
//if(!RegisterClassEx(&wcx)) @throw ...;
|
||||
|
@ -113,7 +113,7 @@ void win32_main()
|
|||
LRESULT CALLBACK win32_OGWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
void *ptr = (void *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
return [(id)ptr MessageReceived : hwnd : msg : wparam : lparam];
|
||||
}
|
||||
//==================================================================================================================================
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
//==================================================================================================================================
|
||||
// OGBox.m
|
||||
//==================================================================================================================================
|
||||
|
@ -81,7 +81,7 @@
|
|||
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
|
||||
{
|
||||
HWND parent;
|
||||
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
//==================================================================================================================================
|
||||
// OGButton.m
|
||||
//==================================================================================================================================
|
||||
|
@ -54,7 +54,7 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
- init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
//we're specifying a different class name...
|
||||
//so we'll have to discard the default OGWidget HWND...
|
||||
DestroyWindow(widget);
|
||||
|
@ -63,7 +63,7 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
|
||||
widget = CreateWindow("button", "", BS_PUSHBUTTON,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, NULL, hInst, NULL);
|
||||
NULL, NULL, hInst, NULL);
|
||||
SetWindowLong(widget, GWL_STYLE, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
|
||||
//crazy workaround since we don't have control of our WNDPROC for default "button"s
|
||||
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
|
||||
|
@ -82,7 +82,7 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
int tlen = GetWindowTextLength(widget);
|
||||
char *buff = (char *)malloc(tlen + 1);
|
||||
GetWindowText(widget, buff, tlen+1);
|
||||
|
||||
|
||||
OFString *ret = [OFString stringWithUTF8String : buff];
|
||||
free(buff);
|
||||
return ret;
|
||||
|
|
|
@ -61,13 +61,13 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
|
||||
widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT,
|
||||
0, 0, 32, 32,
|
||||
NULL, NULL, hInst, NULL);
|
||||
NULL, NULL, hInst, NULL);
|
||||
SetWindowLong(widget, GWL_STYLE, LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
|
||||
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
|
||||
chd->funct = CH_Command;
|
||||
chd->object = self;
|
||||
SetProp(widget, "CommandHandlerData", chd);
|
||||
|
||||
|
||||
[self retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
|
||||
widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
|
||||
0, 0, 32, 32,
|
||||
parent->widget, NULL, hInst, NULL);
|
||||
parent->widget, NULL, hInst, NULL);
|
||||
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
|
||||
chd->funct = CH_Command;
|
||||
chd->object = self;
|
||||
SetProp(widget, "CommandHandlerData", chd);
|
||||
|
||||
|
||||
[self retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static void CH_Command(id object, WPARAM wparam)
|
|||
{
|
||||
OGComboBoxItem *item = itemAtIndex(dataSource,
|
||||
@selector(comboBox:itemAtIndex:), self, i);
|
||||
|
||||
|
||||
SendMessage(widget, LB_ADDSTRING, 0, (WPARAM)[item.label UTF8String]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
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;
|
||||
|
@ -53,7 +53,7 @@
|
|||
newChild->originalSize = (rc.right - rc.left);
|
||||
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
|
||||
newChild->next = NULL;
|
||||
|
||||
|
||||
if(firstBorn == NULL)
|
||||
firstBorn = newChild;
|
||||
else
|
||||
|
@ -62,7 +62,7 @@
|
|||
while(curr->next != NULL) curr = curr->next;
|
||||
curr->next = newChild;
|
||||
}
|
||||
|
||||
|
||||
[self OG_resizeChildren];
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -74,7 +74,7 @@
|
|||
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;
|
||||
|
@ -83,9 +83,9 @@
|
|||
newChild->originalSize = (rc.right - rc.left);
|
||||
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
|
||||
newChild->next = firstBorn;
|
||||
|
||||
|
||||
firstBorn = newChild;
|
||||
|
||||
|
||||
[self OG_resizeChildren];
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -93,12 +93,12 @@
|
|||
{
|
||||
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' widths
|
||||
int childOriginal = 0;
|
||||
curr = firstBorn;
|
||||
|
@ -107,11 +107,11 @@
|
|||
childOriginal += (curr->originalSize + (curr->padding << 1));
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
|
||||
//how to divide our extra space
|
||||
int extra = width - childOriginal;
|
||||
float evenShare = 0.0f;
|
||||
|
||||
|
||||
if(extra <= 0)
|
||||
{
|
||||
curr = firstBorn;
|
||||
|
@ -151,7 +151,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//assign new positions/heights
|
||||
float x = 0.0f;
|
||||
curr = firstBorn;
|
||||
|
@ -174,7 +174,7 @@
|
|||
[self OG_resizeChildren];
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
break;
|
||||
|
||||
|
||||
case WM_SIZING:
|
||||
[self OG_resizeChildren];
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
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;
|
||||
|
@ -53,7 +53,7 @@
|
|||
newChild->originalSize = (rc.bottom - rc.top);
|
||||
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
|
||||
newChild->next = NULL;
|
||||
|
||||
|
||||
if(firstBorn == NULL)
|
||||
firstBorn = newChild;
|
||||
else
|
||||
|
@ -62,7 +62,7 @@
|
|||
while(curr->next != NULL) curr = curr->next;
|
||||
curr->next = newChild;
|
||||
}
|
||||
|
||||
|
||||
[self OG_resizeChildren];
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -74,7 +74,7 @@
|
|||
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;
|
||||
|
@ -83,9 +83,9 @@
|
|||
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];
|
||||
}
|
||||
|
@ -94,12 +94,12 @@
|
|||
{
|
||||
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;
|
||||
|
@ -108,11 +108,11 @@
|
|||
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;
|
||||
|
@ -152,7 +152,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//assign new positions/heights
|
||||
float y = 0;
|
||||
curr = firstBorn;
|
||||
|
@ -175,7 +175,7 @@
|
|||
[self OG_resizeChildren];
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
break;
|
||||
|
||||
|
||||
case WM_SIZING:
|
||||
[self OG_resizeChildren];
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
|
|
|
@ -38,13 +38,13 @@ void og_destroy(HWND widget, OGWidget *object)
|
|||
- init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
widget = NULL;
|
||||
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
|
||||
widget = CreateWindowEx(WS_EX_LEFT, "OGWidgetClass", "OGWidget", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 1, 1, NULL, NULL, hInst, NULL);
|
||||
SetWindowLong(widget, GWL_USERDATA, (int)self);
|
||||
|
||||
|
||||
@try {
|
||||
if (isa == [OGWidget class])
|
||||
@throw [OFNotImplementedException
|
||||
|
|
|
@ -44,7 +44,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
|
|||
//so make sure child.parent == use
|
||||
HWND parent = (HWND)lparam;
|
||||
if(GetParent(child) != parent) return 1;
|
||||
|
||||
|
||||
RECT rc;
|
||||
GetClientRect(parent, &rc);
|
||||
SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom,
|
||||
|
@ -67,7 +67,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
|
|||
|
||||
SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW);
|
||||
//"event connections" are handled in MessageReceived
|
||||
|
||||
|
||||
[self retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
|
|||
int tlen = GetWindowTextLength(widget);
|
||||
char *buff = (char *)malloc(tlen + 1);
|
||||
GetWindowText(widget, buff, tlen+1);
|
||||
|
||||
|
||||
OFString *ret = [OFString stringWithUTF8String : buff];
|
||||
free(buff);
|
||||
return ret;
|
||||
|
@ -138,7 +138,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
|
|||
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
|
||||
{
|
||||
HWND ctrlHwnd;
|
||||
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
|
@ -150,18 +150,18 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
|
|||
chd->funct(chd->object, wparam);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
|
||||
case WM_CLOSE:
|
||||
if([self OG_willClose] == YES)
|
||||
og_destroy(hwnd, self);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
|
||||
case WM_SIZE:
|
||||
//act like GTK; expand our child(ren) to fit
|
||||
EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
|
||||
break;
|
||||
|
||||
|
||||
case WM_SIZING:
|
||||
//act like GTK; expand our child(ren) to fit
|
||||
EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
- init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
items = (OGComboBoxItem **)malloc(sizeof(OGComboBoxItem *) << 2);
|
||||
items[0] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 0"];
|
||||
items[1] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 1"];
|
||||
items[2] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 2"];
|
||||
items[3] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 3"];
|
||||
|
||||
|
||||
[self retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ OG_APPLICATION_DELEGATE(Test)
|
|||
expand: YES
|
||||
fill: YES
|
||||
padding: 0];
|
||||
|
||||
|
||||
OGComboBox *cb = [[OGComboBox alloc] initWithParent : hboxPre];
|
||||
cb.dataSource = [[TestSource alloc] init];
|
||||
cb.delegate = self;
|
||||
|
|
Reference in a new issue