diff --git a/darwin/button.m b/darwin/button.m index fd73675a..3ec8a549 100644 --- a/darwin/button.m +++ b/darwin/button.m @@ -82,5 +82,5 @@ uiButton *uiNewButton(const char *text) bb.uiB = b; - return b.uiB; + return bb.uiB; } diff --git a/darwin/checkbox.m b/darwin/checkbox.m index 5ad6961b..a7ccfb33 100644 --- a/darwin/checkbox.m +++ b/darwin/checkbox.m @@ -50,7 +50,7 @@ static void checkboxOnToggled(uiCheckbox *c, void (*f)(uiCheckbox *, void *), vo { uiCheckboxNSButton *cc; - cc = (uiCheckboxNSButton *) uiControlHandle(uiCheckbox(c)); + cc = (uiCheckboxNSButton *) uiControlHandle(uiControl(c)); cc.uiOnToggled = f; cc.uiOnToggledData = data; } @@ -83,7 +83,7 @@ uiCheckbox *uiNewCheckbox(const char *text) c = uiNew(uiCheckbox); uiDarwinNewControl(uiControl(c), [uiCheckboxNSButton class], NO, NO); - cc = (uiCheckboxNSButton *) uiControlHandle(c); + cc = (uiCheckboxNSButton *) uiControlHandle(uiControl(c)); [cc setTitle:toNSString(text)]; [cc setButtonType:NSSwitchButton]; diff --git a/darwin/entry.m b/darwin/entry.m index 84835f36..71891562 100644 --- a/darwin/entry.m +++ b/darwin/entry.m @@ -59,7 +59,7 @@ uiEntry *uiNewEntry(void) e = uiNew(uiEntry); uiDarwinNewControl(uiControl(e), [uiNSTextField class], NO, NO); - t = (uiNSTextField *) uiControlHandle(c); + t = (uiNSTextField *) uiControlHandle(uiControl(e)); [t setSelectable:YES]; // otherwise the setting is masked by the editable default of YES finishNewTextField((NSTextField *) t, YES); diff --git a/darwin/label.m b/darwin/label.m index 4f20e985..56780d01 100644 --- a/darwin/label.m +++ b/darwin/label.m @@ -34,7 +34,7 @@ static void labelSetText(uiLabel *l, const char *text) [t setStringValue:toNSString(text)]; } -uiControl *uiNewLabel(const char *text) +uiLabel *uiNewLabel(const char *text) { uiLabel *l; uiLabelNSTextField *t; @@ -42,7 +42,7 @@ uiControl *uiNewLabel(const char *text) l = uiNew(uiLabel); uiDarwinNewControl(uiControl(l), [uiLabelNSTextField class], NO, NO); - t = (uiLabelNSTextField *) uiControlHandle(c); + t = (uiLabelNSTextField *) uiControlHandle(uiControl(l)); [t setStringValue:toNSString(text)]; [t setEditable:NO]; @@ -53,7 +53,7 @@ uiControl *uiNewLabel(const char *text) uiLabel(l)->Text = labelText; uiLabel(l)->SetText = labelSetText; - t.uiC = l; + t.uiL = l; - return t.uiC; + return t.uiL; } diff --git a/darwin/tab.m b/darwin/tab.m index 98dd7339..b84ee9af 100644 --- a/darwin/tab.m +++ b/darwin/tab.m @@ -15,7 +15,7 @@ { // TODO free all tabs explicitly if (uiDarwinControlFreeWhenAppropriate(uiControl(self.uiT), [self superview])) - self.uiC = NULL; + self.uiT = NULL; [super viewDidMoveToSuperview]; } @@ -55,8 +55,10 @@ uiTab *uiNewTab(void) uiTab *t; uiNSTabView *tv; + t = uiNew(uiTab); + uiDarwinNewControl(uiControl(t), [uiNSTabView class], NO, NO); - tv = (uiNSTabView *) uiControlHandle(c); + tv = (uiNSTabView *) uiControlHandle(uiControl(t)); // also good for NSTabView (same selector and everything) setStandardControlFont((NSControl *) tv); diff --git a/darwin/window.m b/darwin/window.m index af644c07..c243374a 100644 --- a/darwin/window.m +++ b/darwin/window.m @@ -19,7 +19,7 @@ uiLogObjCClassAllocations - (BOOL)windowShouldClose:(id)win { // return exact constants to be safe - if ((*(self.onClosing))(self.uiw, self.onClosingData)) + if ((*(self.onClosing))(uiWindow(self.uiw), self.onClosingData)) return YES; return NO; } @@ -153,10 +153,10 @@ uiWindow *uiNewWindow(const char *title, int width, int height) uiWindow(d.uiw)->SetTitle = windowSetTitle; uiWindow(d.uiw)->Show = windowShow; uiWindow(d.uiw)->Hide = windowHide; - uiWindow(d.uiw)->OnClosing = windowSetOnClosing; + uiWindow(d.uiw)->OnClosing = windowOnClosing; uiWindow(d.uiw)->SetChild = windowSetChild; uiWindow(d.uiw)->Margined = windowMargined; uiWindow(d.uiw)->SetMargined = windowSetMargined; - return d.uiw; + return uiWindow(d.uiw); }