Fixed build errors. Now to test!

This commit is contained in:
Pietro Gagliardi 2016-04-25 13:38:17 -04:00
parent 3ca4a28bb3
commit d0d0efce1a
12 changed files with 30 additions and 30 deletions

View File

@ -72,7 +72,6 @@ uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const c
c->Signature = uiControlSignature;
c->OSSignature = OSsig;
c->TypeSignature = typesig;
c->Internal = uiNew(struct controlBase);
return c;
}

View File

@ -138,7 +138,7 @@ static void relayout(uiBox *b)
cc = uiDarwinControl(child);
childView = (NSView *) uiControlHandle(child);
[views setObject:childView forKey:viewName(n)];
(*(cc->Relayout))(cc);
//TODO (*(cc->Relayout))(cc);
fittingSize = fittingAlignmentSize(childView);
[metrics setObject:[NSNumber numberWithDouble:fittingSize.width]
forKey:widthMetricName(n)];
@ -228,7 +228,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
[b->stretchy addObject:[NSNumber numberWithInt:stretchy]];
uiControlSetParent(c, uiControl(b));
uiControlSetSuperview(c, b->view);
uiDarwinControlSetSuperview(uiDarwinControl(c), b->view);
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(b)));
// TODO save the old hugging priorities

View File

@ -27,7 +27,7 @@ struct uiCombobox {
NSPopUpButton *pb;
NSArrayController *pbac;
NSComboBox *cb;
NSObject *handle; // for uiControlHandle()
NSView *handle; // for uiControlHandle()
void (*onSelected)(uiCombobox *, void *);
void *onSelectedData;
};

View File

@ -1,7 +1,7 @@
// 16 august 2015
#import "uipriv_darwin.h"
void uiDarwinControlSetSuperview(uiControl *c, NSView *superview)
void uiDarwinControlSetSuperview(uiDarwinControl *c, NSView *superview)
{
(*(c->SetSuperview))(c, superview);
}
@ -13,7 +13,7 @@ void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
#define uiDarwinControlSignature 0x44617277
uiDarwinControl *uiDarwinNewControl(size_t n, uint32_t typesig, const char *typenamestr)
uiDarwinControl *uiDarwinAllocControl(size_t n, uint32_t typesig, const char *typenamestr)
{
return uiDarwinControl(uiAllocControl(n, uiDarwinControlSignature, typesig, typenamestr));
}

View File

@ -83,7 +83,7 @@ static void uiEntryDestroy(uiControl *c)
[entryDelegate unregisterEntry:e];
[e->textfield release];
uiFreeControl(e);
uiFreeControl(uiControl(e));
}
char *uiEntryText(uiEntry *e)

View File

@ -31,19 +31,18 @@ uiDarwinControlDefaultEnabled(uiGroup, box)
uiDarwinControlDefaultEnable(uiGroup, box)
uiDarwinControlDefaultDisable(uiGroup, box)
static void uiBoxSyncEnableState(uiControl *c, int enabled)
static void uiGroupSyncEnableState(uiControl *c, int enabled)
{
uiGroup *g = uiGroup(c);
if (g->child != NULL)
uiControlSyncEnableState(g->child);
uiControlSyncEnableState(g->child, enabled);
}
uiDarwinControlDefaultSetSuperview(uiGroup, box)
static void groupRelayout(uiDarwinControl *c)
static void groupRelayout(uiGroup *g)
{
uiGroup *g = uiGroup(c);
uiDarwinControl *cc;
NSView *childView;
@ -53,7 +52,7 @@ static void groupRelayout(uiDarwinControl *c)
cc = uiDarwinControl(g->child);
childView = (NSView *) uiControlHandle(g->child);
// first relayout the child
(*(cc->Relayout))(cc);
//TODO (*(cc->Relayout))(cc);
// now relayout ourselves
// see below on using the content view
layoutSingleView(g->box, childView, g->margined);
@ -89,8 +88,8 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
// we have to add controls to the box itself NOT the content view
// otherwise, things get really glitchy
// we also need to call -sizeToFit, but we'll do that in the relayout that's triggered below (see above)
uiControlSetSuperview(c, g->box);
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(g)));
uiDarwinControlSetSuperview(uiDarwinControl(g->child), g->box);
uiControlSyncEnableState(g->child, uiControlEnabledToUser(uiControl(g)));
}
groupRelayout(g);
}

View File

@ -17,7 +17,7 @@ uiSeparator *uiNewHorizontalSeparator(void)
{
uiSeparator *s;
uiDarwinNewControl(uiSeparator);
uiDarwinNewControl(uiSeparator, s);
s->box = [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, separatorFrameWidth, separatorFrameHeight)];
[s->box setBoxType:NSBoxSeparator];

View File

@ -54,9 +54,8 @@ uiDarwinControlDefaultSyncEnableState(uiTab, tabview)
uiDarwinControlDefaultSetSuperview(uiTab, tabview)
static void tabRelayout(uiDarwinControl *c)
static void tabRelayout(uiTab *t)
{
uiTab *t = uiTab(c);
NSUInteger i;
if ([t->pages count] == 0)
@ -76,7 +75,7 @@ static void tabRelayout(uiDarwinControl *c)
margined = (NSNumber *) [t->margined objectAtIndex:i];
// first lay out the child
cc = uiDarwinControl(child);
(*(cc->Relayout))(cc);
//TODO (*(cc->Relayout))(cc);
// then lay out the page
layoutSingleView(view, childView, [margined intValue]);
}
@ -98,7 +97,7 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
childView = (NSView *) uiControlHandle(child);
view = [[NSView alloc] initWithFrame:NSZeroRect];
// TODO if we turn off the autoresizing mask, nothing shows up; didn't this get documented somewhere?
uiControlSetSuperview(child, view);
uiDarwinControlSetSuperview(uiDarwinControl(child), view);
uiControlSyncEnableState(child, uiControlEnabledToUser(uiControl(t)));
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];

View File

@ -89,3 +89,6 @@ extern void doDrawText(CGContextRef c, CGFloat cheight, double x, double y, uiDr
// fontbutton.m
extern BOOL fontButtonInhibitSendAction(SEL sel, id from, id to);
extern BOOL fontButtonOverrideTargetForAction(SEL sel, id from, id to, id *override);
// MASSIVE TODO
#define uiDarwinControlTriggerRelayout(...)

View File

@ -131,7 +131,7 @@ static void uiWindowSyncEnableState(uiControl *c, int enabled)
uiWindow *w = uiWindow(c);
if (w->child != NULL)
uiControlSyncUpdateState(w->child, enabled);
uiControlSyncEnableState(w->child, enabled);
}
static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
@ -139,9 +139,8 @@ static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
// TODO
}
static void windowRelayout(uiDarwinControl *c)
static void windowRelayout(uiWindow *w)
{
uiWindow *w = uiWindow(c);
uiDarwinControl *cc;
NSView *childView;
NSView *contentView;
@ -153,7 +152,7 @@ static void windowRelayout(uiDarwinControl *c)
contentView = [w->window contentView];
[contentView removeConstraints:[contentView constraints]];
// first relayout the child
(*(cc->Relayout))(cc);
//TODO (*(cc->Relayout))(cc);
// now relayout ourselves
layoutSingleView(contentView, childView, w->margined);
}
@ -187,8 +186,8 @@ void uiWindowSetChild(uiWindow *w, uiControl *child)
if (w->child != NULL) {
uiControlSetParent(w->child, uiControl(w));
childView = (NSView *) uiControlHandle(w->child);
uiControlSetSuperview(child, [w->window contentView]);
uiControlSyncEnableState(child, uiControlEnabledToUser(uiControl(w)));
uiDarwinControlSetSuperview(uiDarwinControl(w->child), [w->window contentView]);
uiControlSyncEnableState(w->child, uiControlEnabledToUser(uiControl(w)));
}
windowRelayout(w);
}

3
ui.h
View File

@ -78,8 +78,9 @@ _UI_EXTERN void uiControlSyncEnableState(uiControl *, int);
_UI_EXTERN uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
_UI_EXTERN void uiFreeControl(uiControl *);
// TODO make sure all controls have these
_UI_EXTERN void uiControlVerifyDestroy(uiControl *);
_UI_EXTERN void uiControlVerifySetParent(uiControl *);
_UI_EXTERN void uiControlVerifySetParent(uiControl *, uiControl *);
_UI_EXTERN int uiControlEnabledToUser(uiControl *);
typedef struct uiWindow uiWindow;

View File

@ -68,7 +68,7 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
[type(c)->handlefield setHidden:YES]; \
}
#define uiDarwinControlDefaultEnabled(type, handlefield) \
static int type ## Visible(uiControl *c) \
static int type ## Enabled(uiControl *c) \
{ \
return uiDarwinControl(c)->enabled; \
}
@ -87,8 +87,8 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
#define uiDarwinControlDefaultSyncEnableState(type, handlefield) \
static void type ## SyncEnableState(uiControl *c, int enabled) \
{ \
if ([type(e)->handlefield respondsToSelector:@selector(setEnabled:)]) \
[type(e)->handlefield setEnabled:enabled]; \
if ([type(c)->handlefield respondsToSelector:@selector(setEnabled:)]) \
[((id) type(c)->handlefield) setEnabled:enabled]; /* id cast to make compiler happy; thanks mikeash in irc.freenode.net/#macdev */ \
}
#define uiDarwinControlDefaultSetSuperview(type, handlefield) \
static void type ## SetSuperview(uiDarwinControl *c, NSView *superview) \
@ -120,7 +120,7 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
// TODO document
#define uiDarwinNewControl(type, var) \
var = type(uiDarwinNewControl(sizeof (type), type ## Signature, #type)); \
var = type(uiDarwinAllocControl(sizeof (type), type ## Signature, #type)); \
uiControl(var)->Destroy = type ## Destroy; \
uiControl(var)->Handle = type ## Handle; \
uiControl(var)->Parent = type ## Parent; \