Fixed build errors. Now to test!
This commit is contained in:
parent
3ca4a28bb3
commit
d0d0efce1a
|
@ -72,7 +72,6 @@ uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const c
|
||||||
c->Signature = uiControlSignature;
|
c->Signature = uiControlSignature;
|
||||||
c->OSSignature = OSsig;
|
c->OSSignature = OSsig;
|
||||||
c->TypeSignature = typesig;
|
c->TypeSignature = typesig;
|
||||||
c->Internal = uiNew(struct controlBase);
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ static void relayout(uiBox *b)
|
||||||
cc = uiDarwinControl(child);
|
cc = uiDarwinControl(child);
|
||||||
childView = (NSView *) uiControlHandle(child);
|
childView = (NSView *) uiControlHandle(child);
|
||||||
[views setObject:childView forKey:viewName(n)];
|
[views setObject:childView forKey:viewName(n)];
|
||||||
(*(cc->Relayout))(cc);
|
//TODO (*(cc->Relayout))(cc);
|
||||||
fittingSize = fittingAlignmentSize(childView);
|
fittingSize = fittingAlignmentSize(childView);
|
||||||
[metrics setObject:[NSNumber numberWithDouble:fittingSize.width]
|
[metrics setObject:[NSNumber numberWithDouble:fittingSize.width]
|
||||||
forKey:widthMetricName(n)];
|
forKey:widthMetricName(n)];
|
||||||
|
@ -228,7 +228,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
[b->stretchy addObject:[NSNumber numberWithInt:stretchy]];
|
[b->stretchy addObject:[NSNumber numberWithInt:stretchy]];
|
||||||
|
|
||||||
uiControlSetParent(c, uiControl(b));
|
uiControlSetParent(c, uiControl(b));
|
||||||
uiControlSetSuperview(c, b->view);
|
uiDarwinControlSetSuperview(uiDarwinControl(c), b->view);
|
||||||
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(b)));
|
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(b)));
|
||||||
|
|
||||||
// TODO save the old hugging priorities
|
// TODO save the old hugging priorities
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct uiCombobox {
|
||||||
NSPopUpButton *pb;
|
NSPopUpButton *pb;
|
||||||
NSArrayController *pbac;
|
NSArrayController *pbac;
|
||||||
NSComboBox *cb;
|
NSComboBox *cb;
|
||||||
NSObject *handle; // for uiControlHandle()
|
NSView *handle; // for uiControlHandle()
|
||||||
void (*onSelected)(uiCombobox *, void *);
|
void (*onSelected)(uiCombobox *, void *);
|
||||||
void *onSelectedData;
|
void *onSelectedData;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 16 august 2015
|
// 16 august 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
void uiDarwinControlSetSuperview(uiControl *c, NSView *superview)
|
void uiDarwinControlSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||||
{
|
{
|
||||||
(*(c->SetSuperview))(c, superview);
|
(*(c->SetSuperview))(c, superview);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
|
||||||
|
|
||||||
#define uiDarwinControlSignature 0x44617277
|
#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));
|
return uiDarwinControl(uiAllocControl(n, uiDarwinControlSignature, typesig, typenamestr));
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void uiEntryDestroy(uiControl *c)
|
||||||
|
|
||||||
[entryDelegate unregisterEntry:e];
|
[entryDelegate unregisterEntry:e];
|
||||||
[e->textfield release];
|
[e->textfield release];
|
||||||
uiFreeControl(e);
|
uiFreeControl(uiControl(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *uiEntryText(uiEntry *e)
|
char *uiEntryText(uiEntry *e)
|
||||||
|
|
|
@ -31,19 +31,18 @@ uiDarwinControlDefaultEnabled(uiGroup, box)
|
||||||
uiDarwinControlDefaultEnable(uiGroup, box)
|
uiDarwinControlDefaultEnable(uiGroup, box)
|
||||||
uiDarwinControlDefaultDisable(uiGroup, box)
|
uiDarwinControlDefaultDisable(uiGroup, box)
|
||||||
|
|
||||||
static void uiBoxSyncEnableState(uiControl *c, int enabled)
|
static void uiGroupSyncEnableState(uiControl *c, int enabled)
|
||||||
{
|
{
|
||||||
uiGroup *g = uiGroup(c);
|
uiGroup *g = uiGroup(c);
|
||||||
|
|
||||||
if (g->child != NULL)
|
if (g->child != NULL)
|
||||||
uiControlSyncEnableState(g->child);
|
uiControlSyncEnableState(g->child, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiDarwinControlDefaultSetSuperview(uiGroup, box)
|
uiDarwinControlDefaultSetSuperview(uiGroup, box)
|
||||||
|
|
||||||
static void groupRelayout(uiDarwinControl *c)
|
static void groupRelayout(uiGroup *g)
|
||||||
{
|
{
|
||||||
uiGroup *g = uiGroup(c);
|
|
||||||
uiDarwinControl *cc;
|
uiDarwinControl *cc;
|
||||||
NSView *childView;
|
NSView *childView;
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ static void groupRelayout(uiDarwinControl *c)
|
||||||
cc = uiDarwinControl(g->child);
|
cc = uiDarwinControl(g->child);
|
||||||
childView = (NSView *) uiControlHandle(g->child);
|
childView = (NSView *) uiControlHandle(g->child);
|
||||||
// first relayout the child
|
// first relayout the child
|
||||||
(*(cc->Relayout))(cc);
|
//TODO (*(cc->Relayout))(cc);
|
||||||
// now relayout ourselves
|
// now relayout ourselves
|
||||||
// see below on using the content view
|
// see below on using the content view
|
||||||
layoutSingleView(g->box, childView, g->margined);
|
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
|
// we have to add controls to the box itself NOT the content view
|
||||||
// otherwise, things get really glitchy
|
// 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)
|
// we also need to call -sizeToFit, but we'll do that in the relayout that's triggered below (see above)
|
||||||
uiControlSetSuperview(c, g->box);
|
uiDarwinControlSetSuperview(uiDarwinControl(g->child), g->box);
|
||||||
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(g)));
|
uiControlSyncEnableState(g->child, uiControlEnabledToUser(uiControl(g)));
|
||||||
}
|
}
|
||||||
groupRelayout(g);
|
groupRelayout(g);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
||||||
{
|
{
|
||||||
uiSeparator *s;
|
uiSeparator *s;
|
||||||
|
|
||||||
uiDarwinNewControl(uiSeparator);
|
uiDarwinNewControl(uiSeparator, s);
|
||||||
|
|
||||||
s->box = [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, separatorFrameWidth, separatorFrameHeight)];
|
s->box = [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, separatorFrameWidth, separatorFrameHeight)];
|
||||||
[s->box setBoxType:NSBoxSeparator];
|
[s->box setBoxType:NSBoxSeparator];
|
||||||
|
|
|
@ -54,9 +54,8 @@ uiDarwinControlDefaultSyncEnableState(uiTab, tabview)
|
||||||
|
|
||||||
uiDarwinControlDefaultSetSuperview(uiTab, tabview)
|
uiDarwinControlDefaultSetSuperview(uiTab, tabview)
|
||||||
|
|
||||||
static void tabRelayout(uiDarwinControl *c)
|
static void tabRelayout(uiTab *t)
|
||||||
{
|
{
|
||||||
uiTab *t = uiTab(c);
|
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
if ([t->pages count] == 0)
|
if ([t->pages count] == 0)
|
||||||
|
@ -76,7 +75,7 @@ static void tabRelayout(uiDarwinControl *c)
|
||||||
margined = (NSNumber *) [t->margined objectAtIndex:i];
|
margined = (NSNumber *) [t->margined objectAtIndex:i];
|
||||||
// first lay out the child
|
// first lay out the child
|
||||||
cc = uiDarwinControl(child);
|
cc = uiDarwinControl(child);
|
||||||
(*(cc->Relayout))(cc);
|
//TODO (*(cc->Relayout))(cc);
|
||||||
// then lay out the page
|
// then lay out the page
|
||||||
layoutSingleView(view, childView, [margined intValue]);
|
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);
|
childView = (NSView *) uiControlHandle(child);
|
||||||
view = [[NSView alloc] initWithFrame:NSZeroRect];
|
view = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||||
// TODO if we turn off the autoresizing mask, nothing shows up; didn't this get documented somewhere?
|
// 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)));
|
uiControlSyncEnableState(child, uiControlEnabledToUser(uiControl(t)));
|
||||||
|
|
||||||
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];
|
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];
|
||||||
|
|
|
@ -89,3 +89,6 @@ extern void doDrawText(CGContextRef c, CGFloat cheight, double x, double y, uiDr
|
||||||
// fontbutton.m
|
// fontbutton.m
|
||||||
extern BOOL fontButtonInhibitSendAction(SEL sel, id from, id to);
|
extern BOOL fontButtonInhibitSendAction(SEL sel, id from, id to);
|
||||||
extern BOOL fontButtonOverrideTargetForAction(SEL sel, id from, id to, id *override);
|
extern BOOL fontButtonOverrideTargetForAction(SEL sel, id from, id to, id *override);
|
||||||
|
|
||||||
|
// MASSIVE TODO
|
||||||
|
#define uiDarwinControlTriggerRelayout(...)
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void uiWindowSyncEnableState(uiControl *c, int enabled)
|
||||||
uiWindow *w = uiWindow(c);
|
uiWindow *w = uiWindow(c);
|
||||||
|
|
||||||
if (w->child != NULL)
|
if (w->child != NULL)
|
||||||
uiControlSyncUpdateState(w->child, enabled);
|
uiControlSyncEnableState(w->child, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
|
static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||||
|
@ -139,9 +139,8 @@ static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowRelayout(uiDarwinControl *c)
|
static void windowRelayout(uiWindow *w)
|
||||||
{
|
{
|
||||||
uiWindow *w = uiWindow(c);
|
|
||||||
uiDarwinControl *cc;
|
uiDarwinControl *cc;
|
||||||
NSView *childView;
|
NSView *childView;
|
||||||
NSView *contentView;
|
NSView *contentView;
|
||||||
|
@ -153,7 +152,7 @@ static void windowRelayout(uiDarwinControl *c)
|
||||||
contentView = [w->window contentView];
|
contentView = [w->window contentView];
|
||||||
[contentView removeConstraints:[contentView constraints]];
|
[contentView removeConstraints:[contentView constraints]];
|
||||||
// first relayout the child
|
// first relayout the child
|
||||||
(*(cc->Relayout))(cc);
|
//TODO (*(cc->Relayout))(cc);
|
||||||
// now relayout ourselves
|
// now relayout ourselves
|
||||||
layoutSingleView(contentView, childView, w->margined);
|
layoutSingleView(contentView, childView, w->margined);
|
||||||
}
|
}
|
||||||
|
@ -187,8 +186,8 @@ void uiWindowSetChild(uiWindow *w, uiControl *child)
|
||||||
if (w->child != NULL) {
|
if (w->child != NULL) {
|
||||||
uiControlSetParent(w->child, uiControl(w));
|
uiControlSetParent(w->child, uiControl(w));
|
||||||
childView = (NSView *) uiControlHandle(w->child);
|
childView = (NSView *) uiControlHandle(w->child);
|
||||||
uiControlSetSuperview(child, [w->window contentView]);
|
uiDarwinControlSetSuperview(uiDarwinControl(w->child), [w->window contentView]);
|
||||||
uiControlSyncEnableState(child, uiControlEnabledToUser(uiControl(w)));
|
uiControlSyncEnableState(w->child, uiControlEnabledToUser(uiControl(w)));
|
||||||
}
|
}
|
||||||
windowRelayout(w);
|
windowRelayout(w);
|
||||||
}
|
}
|
||||||
|
|
3
ui.h
3
ui.h
|
@ -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 uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
|
||||||
_UI_EXTERN void uiFreeControl(uiControl *);
|
_UI_EXTERN void uiFreeControl(uiControl *);
|
||||||
|
|
||||||
|
// TODO make sure all controls have these
|
||||||
_UI_EXTERN void uiControlVerifyDestroy(uiControl *);
|
_UI_EXTERN void uiControlVerifyDestroy(uiControl *);
|
||||||
_UI_EXTERN void uiControlVerifySetParent(uiControl *);
|
_UI_EXTERN void uiControlVerifySetParent(uiControl *, uiControl *);
|
||||||
_UI_EXTERN int uiControlEnabledToUser(uiControl *);
|
_UI_EXTERN int uiControlEnabledToUser(uiControl *);
|
||||||
|
|
||||||
typedef struct uiWindow uiWindow;
|
typedef struct uiWindow uiWindow;
|
||||||
|
|
|
@ -68,7 +68,7 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
[type(c)->handlefield setHidden:YES]; \
|
[type(c)->handlefield setHidden:YES]; \
|
||||||
}
|
}
|
||||||
#define uiDarwinControlDefaultEnabled(type, handlefield) \
|
#define uiDarwinControlDefaultEnabled(type, handlefield) \
|
||||||
static int type ## Visible(uiControl *c) \
|
static int type ## Enabled(uiControl *c) \
|
||||||
{ \
|
{ \
|
||||||
return uiDarwinControl(c)->enabled; \
|
return uiDarwinControl(c)->enabled; \
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
#define uiDarwinControlDefaultSyncEnableState(type, handlefield) \
|
#define uiDarwinControlDefaultSyncEnableState(type, handlefield) \
|
||||||
static void type ## SyncEnableState(uiControl *c, int enabled) \
|
static void type ## SyncEnableState(uiControl *c, int enabled) \
|
||||||
{ \
|
{ \
|
||||||
if ([type(e)->handlefield respondsToSelector:@selector(setEnabled:)]) \
|
if ([type(c)->handlefield respondsToSelector:@selector(setEnabled:)]) \
|
||||||
[type(e)->handlefield setEnabled:enabled]; \
|
[((id) type(c)->handlefield) setEnabled:enabled]; /* id cast to make compiler happy; thanks mikeash in irc.freenode.net/#macdev */ \
|
||||||
}
|
}
|
||||||
#define uiDarwinControlDefaultSetSuperview(type, handlefield) \
|
#define uiDarwinControlDefaultSetSuperview(type, handlefield) \
|
||||||
static void type ## SetSuperview(uiDarwinControl *c, NSView *superview) \
|
static void type ## SetSuperview(uiDarwinControl *c, NSView *superview) \
|
||||||
|
@ -120,7 +120,7 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
|
|
||||||
// TODO document
|
// TODO document
|
||||||
#define uiDarwinNewControl(type, var) \
|
#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)->Destroy = type ## Destroy; \
|
||||||
uiControl(var)->Handle = type ## Handle; \
|
uiControl(var)->Handle = type ## Handle; \
|
||||||
uiControl(var)->Parent = type ## Parent; \
|
uiControl(var)->Parent = type ## Parent; \
|
||||||
|
|
Loading…
Reference in New Issue