Fixed the other build errors. Now to fix runtime errors.
This commit is contained in:
parent
0128e9f85e
commit
7d1b97fb28
|
@ -19,6 +19,7 @@ osMFILES = \
|
||||||
darwin/separator.m \
|
darwin/separator.m \
|
||||||
darwin/slider.m \
|
darwin/slider.m \
|
||||||
darwin/spinbox.m \
|
darwin/spinbox.m \
|
||||||
|
darwin/stddialogs.m \
|
||||||
darwin/tab.m \
|
darwin/tab.m \
|
||||||
darwin/text.m \
|
darwin/text.m \
|
||||||
darwin/util.m \
|
darwin/util.m \
|
||||||
|
|
|
@ -29,7 +29,7 @@ uiControl *newBin(void)
|
||||||
|
|
||||||
// a simple NSView will do fine
|
// a simple NSView will do fine
|
||||||
b->view = [[NSView alloc] initWithFrame:NSZeroRect];
|
b->view = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||||
uiDarwinMakeSingleWidgetControl(uiControl(b), b->view, NO);
|
uiDarwinMakeSingleViewControl(uiControl(b), b->view, NO);
|
||||||
|
|
||||||
uiControl(b)->Handle = binHandle;
|
uiControl(b)->Handle = binHandle;
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,6 @@
|
||||||
self->c = cc;
|
self->c = cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are based on measurements from Interface Builder.
|
|
||||||
// These seem to be based on Auto Layout constants, but I don't see an API that exposes these...
|
|
||||||
// This one is 8 for most pairs of controls that I've tried; the only difference is between two pushbuttons, where it's 12...
|
|
||||||
#define macXPadding 8
|
|
||||||
// Likewise, this one appears to be 12 for pairs of push buttons...
|
|
||||||
#define macYPadding 8
|
|
||||||
|
|
||||||
- (void)containerUpdate
|
- (void)containerUpdate
|
||||||
{
|
{
|
||||||
uiSizing *d;
|
uiSizing *d;
|
||||||
|
@ -48,7 +41,7 @@ uintptr_t uiMakeContainer(uiControl *c)
|
||||||
containerView *view;
|
containerView *view;
|
||||||
|
|
||||||
view = [[containerView alloc] initWithFrame:NSZeroRect];
|
view = [[containerView alloc] initWithFrame:NSZeroRect];
|
||||||
uiDarwinMakeSingleWidgetControl(c, view, NO);
|
uiDarwinMakeSingleViewControl(c, view, NO);
|
||||||
[view setContainer:c];
|
[view setContainer:c];
|
||||||
return (uintptr_t) widget;
|
return (uintptr_t) view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
|
|
||||||
struct radiobuttons {
|
struct radiobuttons {
|
||||||
uiRadioButtons r;
|
uiRadioButtons r;
|
||||||
|
NSTextField *dummy;
|
||||||
};
|
};
|
||||||
|
|
||||||
uiDefineControlType(uiRadioButtons, uiTypeRadioButtons, struct radiobuttons)
|
uiDefineControlType(uiRadioButtons, uiTypeRadioButtons, struct radiobuttons)
|
||||||
|
|
||||||
static uintptr_t radiobuttonsHandle(uiControl *c)
|
static uintptr_t radiobuttonsHandle(uiControl *c)
|
||||||
{
|
{
|
||||||
return 0;
|
struct radiobuttons *r = (struct radiobuttons *) c;
|
||||||
|
|
||||||
|
return (uintptr_t) (r->dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radiobuttonsAppend(uiRadioButtons *rr, const char *text)
|
static void radiobuttonsAppend(uiRadioButtons *rr, const char *text)
|
||||||
|
@ -24,9 +27,11 @@ uiRadioButtons *uiNewRadioButtons(void)
|
||||||
{
|
{
|
||||||
struct radiobuttons *r;
|
struct radiobuttons *r;
|
||||||
|
|
||||||
r = (struct radiobuttons *) MAKE_CONTROL_INSTANCE(uiTypeRadioButtons());
|
r = (struct radiobuttons *) uiNewControl(uiTypeRadioButtons());
|
||||||
|
|
||||||
PUT_CODE_HERE;
|
r->dummy = [[NSTextField alloc] initWithFrame:NSZeroRect];
|
||||||
|
[r->dummy setStringValue:@"TODO uiRadioButtons not implemented"];
|
||||||
|
uiDarwinMakeSingleViewControl(uiControl(r), r->dummy, YES);
|
||||||
|
|
||||||
uiControl(r)->Handle = radiobuttonsHandle;
|
uiControl(r)->Handle = radiobuttonsHandle;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// 26 june 2015
|
||||||
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
|
char *uiOpenFile(void)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *uiSaveFile(void)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiMsgBox(const char *title, const char *description)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiMsgBoxError(const char *title, const char *description)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
|
@ -56,11 +56,10 @@ static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
*height = (intmax_t) (s.height);
|
*height = (intmax_t) (s.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabContainerUpdate(uiControl *c)
|
static void tabContainerUpdateState(uiControl *c)
|
||||||
{
|
{
|
||||||
struct tab *t = (struct tab *) c;
|
struct tab *t = (struct tab *) c;
|
||||||
|
|
||||||
(*(t->baseEnable))(uiControl(t));
|
|
||||||
// TODO enumerate over page CONTROLS instead
|
// TODO enumerate over page CONTROLS instead
|
||||||
[t->pages enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
|
[t->pages enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
|
||||||
NSValue *v = (NSValue *) obj;
|
NSValue *v = (NSValue *) obj;
|
||||||
|
@ -68,7 +67,7 @@ static void tabContainerUpdate(uiControl *c)
|
||||||
|
|
||||||
bin = (uiControl *) [v pointerValue];
|
bin = (uiControl *) [v pointerValue];
|
||||||
// TODO get the right function
|
// TODO get the right function
|
||||||
uiContainerUpdate(uiControl(bin));
|
uiControlUpdateState(uiControl(bin));
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ static void tabDelete(uiTab *tt, uintmax_t n)
|
||||||
NSTabViewItem *i;
|
NSTabViewItem *i;
|
||||||
|
|
||||||
v = (NSValue *) [t->pages objectAtIndex:n];
|
v = (NSValue *) [t->pages objectAtIndex:n];
|
||||||
page = (uiBin *) [v pointerValue];
|
page = (uiControl *) [v pointerValue];
|
||||||
[t->pages removeObjectAtIndex:n];
|
[t->pages removeObjectAtIndex:n];
|
||||||
[t->margined removeObjectAtIndex:n];
|
[t->margined removeObjectAtIndex:n];
|
||||||
|
|
||||||
|
@ -123,7 +122,7 @@ static void tabDelete(uiTab *tt, uintmax_t n)
|
||||||
binSetChild(page, NULL);
|
binSetChild(page, NULL);
|
||||||
|
|
||||||
// remove the bin from the tab view
|
// remove the bin from the tab view
|
||||||
// this serves the purpose of uiBinRemoveOSParent()
|
// this serves the purpose of uiControlSetOSParent(bin, NULL)
|
||||||
i = [t->tabview tabViewItemAtIndex:n];
|
i = [t->tabview tabViewItemAtIndex:n];
|
||||||
[t->tabview removeTabViewItem:i];
|
[t->tabview removeTabViewItem:i];
|
||||||
|
|
||||||
|
@ -163,12 +162,12 @@ static void tabSetMargined(uiTab *tt, uintmax_t n, int margined)
|
||||||
struct tab *t = (struct tab *) tt;
|
struct tab *t = (struct tab *) tt;
|
||||||
NSNumber *v;
|
NSNumber *v;
|
||||||
NSValue *pagev;
|
NSValue *pagev;
|
||||||
uiBin *page;
|
uiControl *page;
|
||||||
|
|
||||||
v = [NSNumber numberWithInt:margined];
|
v = [NSNumber numberWithInt:margined];
|
||||||
[t->margined replaceObjectAtIndex:n withObject:v];
|
[t->margined replaceObjectAtIndex:n withObject:v];
|
||||||
pagev = (NSValue *) [t->pages objectAtIndex:n];
|
pagev = (NSValue *) [t->pages objectAtIndex:n];
|
||||||
page = (uiBin *) [pagev pointerValue];
|
page = (uiControl *) [pagev pointerValue];
|
||||||
/* TODO
|
/* TODO
|
||||||
if ([v intValue])
|
if ([v intValue])
|
||||||
uiBinSetMargins(page, tabLeftMargin, tabTopMargin, tabRightMargin, tabBottomMargin);
|
uiBinSetMargins(page, tabLeftMargin, tabTopMargin, tabRightMargin, tabBottomMargin);
|
||||||
|
@ -181,7 +180,7 @@ uiTab *uiNewTab(void)
|
||||||
{
|
{
|
||||||
struct tab *t;
|
struct tab *t;
|
||||||
|
|
||||||
t = (struct tab *) MAKE_CONTROL_INSTANCE(uiTypeTab());
|
t = (struct tab *) uiNewControl(uiTypeTab());
|
||||||
|
|
||||||
t->tabview = [[NSTabView alloc] initWithFrame:NSZeroRect];
|
t->tabview = [[NSTabView alloc] initWithFrame:NSZeroRect];
|
||||||
// also good for NSTabView (same selector and everything)
|
// also good for NSTabView (same selector and everything)
|
||||||
|
@ -194,7 +193,7 @@ uiTab *uiNewTab(void)
|
||||||
uiControl(t)->PreferredSize = tabPreferredSize;
|
uiControl(t)->PreferredSize = tabPreferredSize;
|
||||||
t->baseCommitDestroy = uiControl(t)->CommitDestroy;
|
t->baseCommitDestroy = uiControl(t)->CommitDestroy;
|
||||||
uiControl(t)->CommitDestroy = tabCommitDestroy;
|
uiControl(t)->CommitDestroy = tabCommitDestroy;
|
||||||
uiControl(t)->ContainerUpdate = tabContainerUpdate;
|
uiControl(t)->ContainerUpdateState = tabContainerUpdateState;
|
||||||
|
|
||||||
uiTab(t)->Append = tabAppend;
|
uiTab(t)->Append = tabAppend;
|
||||||
uiTab(t)->InsertAt = tabInsertAt;
|
uiTab(t)->InsertAt = tabInsertAt;
|
||||||
|
|
|
@ -30,3 +30,27 @@ void complain(const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These are based on measurements from Interface Builder.
|
||||||
|
// These seem to be based on Auto Layout constants, but I don't see an API that exposes these...
|
||||||
|
// This one is 8 for most pairs of controls that I've tried; the only difference is between two pushbuttons, where it's 12...
|
||||||
|
#define macXPadding 8
|
||||||
|
// Likewise, this one appears to be 12 for pairs of push buttons...
|
||||||
|
#define macYPadding 8
|
||||||
|
|
||||||
|
uiSizing *uiDarwinNewSizing(void)
|
||||||
|
{
|
||||||
|
uiSizing *d;
|
||||||
|
|
||||||
|
d = uiNew(uiSizing);
|
||||||
|
d->XPadding = macXPadding;
|
||||||
|
d->YPadding = macYPadding;
|
||||||
|
d->Sys = uiNew(uiSizingSys);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiFreeSizing(uiSizing *d)
|
||||||
|
{
|
||||||
|
uiFree(d->Sys);
|
||||||
|
uiFree(d);
|
||||||
|
}
|
||||||
|
|
|
@ -43,14 +43,17 @@ struct window {
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
windowDelegate *delegate;
|
windowDelegate *delegate;
|
||||||
uiControl *bin;
|
uiControl *bin;
|
||||||
|
uiControl *child;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uiDefineControlType(uiWindow, uiTypeWindow, struct window)
|
||||||
|
|
||||||
static int defaultOnClosing(uiWindow *w, void *data)
|
static int defaultOnClosing(uiWindow *w, void *data)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowDestroy(uiControl *c)
|
static void windowCommitDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
struct window *w = (struct window *) c;
|
struct window *w = (struct window *) c;
|
||||||
|
|
||||||
|
@ -141,7 +144,6 @@ static void windowSetMargined(uiWindow *ww, int margined)
|
||||||
struct window *w = (struct window *) ww;
|
struct window *w = (struct window *) ww;
|
||||||
|
|
||||||
binSetMargined(w->bin, margined);
|
binSetMargined(w->bin, margined);
|
||||||
uiContainerUpdate(uiContainer(w->bin));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowResizeChild(uiWindow *ww)
|
static void windowResizeChild(uiWindow *ww)
|
||||||
|
@ -165,7 +167,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
[w->window setTitle:toNSString(title)];
|
[w->window setTitle:toNSString(title)];
|
||||||
|
|
||||||
// a NSWindow is not a NSView, but nothing we're doing in this function is view-specific
|
// a NSWindow is not a NSView, but nothing we're doing in this function is view-specific
|
||||||
uiDarwinMakeSingleViewControl(uiControl(w), (NSView *) (w->window));
|
uiDarwinMakeSingleViewControl(uiControl(w), (NSView *) (w->window), NO);
|
||||||
|
|
||||||
// explicitly release when closed
|
// explicitly release when closed
|
||||||
// the only thing that closes the window is us anyway
|
// the only thing that closes the window is us anyway
|
||||||
|
|
|
@ -48,7 +48,7 @@ static uintptr_t tabHandle(uiControl *c)
|
||||||
return (uintptr_t) (t->widget);
|
return (uintptr_t) (t->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO tabContainerUpdate()?
|
// TODO tabContainerUpdateState()?
|
||||||
|
|
||||||
static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue