More compile fixes.
This commit is contained in:
parent
fa659395c8
commit
4b0d81c144
|
@ -30,6 +30,11 @@ void uiControlDestroy(uiControl *c)
|
||||||
uiFree(c);
|
uiFree(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uintptr_t uiControlHandle(uiControl *c)
|
||||||
|
{
|
||||||
|
return (*(c->Handle))(c);
|
||||||
|
}
|
||||||
|
|
||||||
static void controlUpdateState(uiControl *);
|
static void controlUpdateState(uiControl *);
|
||||||
|
|
||||||
void uiControlSetParent(uiControl *c, uiControl *parent)
|
void uiControlSetParent(uiControl *c, uiControl *parent)
|
||||||
|
|
|
@ -28,19 +28,18 @@ uiDarwinDefineControlWithOnDestroy(
|
||||||
static uiControl *childAt(uiBox *b, uintmax_t n)
|
static uiControl *childAt(uiBox *b, uintmax_t n)
|
||||||
{
|
{
|
||||||
NSValue *v;
|
NSValue *v;
|
||||||
uiControl *c;
|
|
||||||
|
|
||||||
v = (NSValue *) [b->children objectAtIndex:n];
|
v = (NSValue *) [b->children objectAtIndex:n];
|
||||||
return (uiControl *) [v pointerValue];
|
return (uiControl *) [v pointerValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onDestroy(uiTab *t)
|
static void onDestroy(uiBox *b)
|
||||||
{
|
{
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
NSView *childView;
|
NSView *childView;
|
||||||
|
|
||||||
for (i = 0; i < [t->children count]; i++) {
|
for (i = 0; i < [b->children count]; i++) {
|
||||||
child = childAt(b, i);
|
child = childAt(b, i);
|
||||||
childView = (NSView *) uiControlHandle(child);
|
childView = (NSView *) uiControlHandle(child);
|
||||||
[childView removeFromSuperview];
|
[childView removeFromSuperview];
|
||||||
|
@ -164,7 +163,7 @@ static void relayout(uiBox *b)
|
||||||
// don't space between the last control and the no-stretchy view
|
// don't space between the last control and the no-stretchy view
|
||||||
[constraint appendString:@"[noStretchyView]"];
|
[constraint appendString:@"[noStretchyView]"];
|
||||||
[constraint appendString:@"|"];
|
[constraint appendString:@"|"];
|
||||||
addConstraints(b->view, constraint, metrics, views);
|
addConstraint(b->view, constraint, metrics, views);
|
||||||
[constraint release];
|
[constraint release];
|
||||||
|
|
||||||
// next: assemble the views in the secondary direction
|
// next: assemble the views in the secondary direction
|
||||||
|
@ -205,9 +204,9 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
||||||
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->primaryOrientation);
|
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->primaryOrientation);
|
||||||
else
|
else
|
||||||
// TODO will default high work?
|
// TODO will default high work?
|
||||||
setHuggingPri(childView NSLayoutPriorityRequired, b->primaryOrientation);
|
setHuggingPri(childView, NSLayoutPriorityRequired, b->primaryOrientation);
|
||||||
// make sure controls don't hug their secondary direction so they fill the width of the view
|
// make sure controls don't hug their secondary direction so they fill the width of the view
|
||||||
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->secondaryOrientation)
|
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->secondaryOrientation);
|
||||||
|
|
||||||
uiControlSetParent(c, uiControl(b));
|
uiControlSetParent(c, uiControl(b));
|
||||||
relayout(b);
|
relayout(b);
|
||||||
|
@ -231,7 +230,7 @@ int uiBoxPadded(uiBox *b)
|
||||||
return b->padded;
|
return b->padded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiBoxSetPadded(uiBox *ss, int padded)
|
void uiBoxSetPadded(uiBox *b, int padded)
|
||||||
{
|
{
|
||||||
b->padded = padded;
|
b->padded = padded;
|
||||||
relayout(b);
|
relayout(b);
|
||||||
|
@ -250,21 +249,21 @@ static uiBox *finishNewBox(BOOL vertical)
|
||||||
|
|
||||||
b->vertical = vertical;
|
b->vertical = vertical;
|
||||||
if (b->vertical) {
|
if (b->vertical) {
|
||||||
b->primaryDirString = @"V:";
|
b->primaryDirPrefix = @"V:";
|
||||||
b->secondaryDirString = @"H:";
|
b->secondaryDirPrefix = @"H:";
|
||||||
b->primaryOrientation = NSLayoutConstraintOrientationVertical;
|
b->primaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||||
b->secondaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
b->secondaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||||
} else {
|
} else {
|
||||||
b->primaryDirString = @"H:";
|
b->primaryDirPrefix = @"H:";
|
||||||
b->secondaryDirString = @"V:";
|
b->secondaryDirPrefix = @"V:";
|
||||||
b->primaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
b->primaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||||
b->secondaryOrientation = NSLayoutConstraintOrientationVertical;
|
b->secondaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
b->noStretchyView = [[NSView alloc] initWithFrame:NSZeroRect];
|
b->noStretchyView = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||||
[b->noStretchyView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
[b->noStretchyView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||||
setHorzHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow);
|
setHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationHorizontal);
|
||||||
setVertHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow);
|
setHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationVertical);
|
||||||
|
|
||||||
uiDarwinFinishNewControl(b, uiBox);
|
uiDarwinFinishNewControl(b, uiBox);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
// 16 august 2015
|
// 16 august 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
|
static uintmax_t type_uiDarwinControl = 0;
|
||||||
|
|
||||||
|
uintmax_t uiTypeMenu(void)
|
||||||
|
{
|
||||||
|
if (type_uiDarwinControl == 0)
|
||||||
|
type_uiDarwinControl = uiRegisterType("uiDarwinControl", uiControlType(), sizeof (uiDarwinControl));
|
||||||
|
return type_uiDarwinControl;
|
||||||
|
}
|
||||||
|
|
||||||
void osCommitShow(uiControl *c)
|
void osCommitShow(uiControl *c)
|
||||||
{
|
{
|
||||||
NSView *view;
|
NSView *view;
|
||||||
|
|
|
@ -58,6 +58,7 @@ struct uiControl {
|
||||||
_UI_EXTERN uintmax_t uiControlType(void);
|
_UI_EXTERN uintmax_t uiControlType(void);
|
||||||
#define uiControl(this) ((uiControl *) uiIsA((this), uiControlType(), 1))
|
#define uiControl(this) ((uiControl *) uiIsA((this), uiControlType(), 1))
|
||||||
_UI_EXTERN void uiControlDestroy(uiControl *);
|
_UI_EXTERN void uiControlDestroy(uiControl *);
|
||||||
|
_UI_EXTERN uintptr_t uiControlHandle(uiControl *);
|
||||||
_UI_EXTERN void uiControlSetParent(uiControl *, uiControl *);
|
_UI_EXTERN void uiControlSetParent(uiControl *, uiControl *);
|
||||||
_UI_EXTERN void uiControlShow(uiControl *);
|
_UI_EXTERN void uiControlShow(uiControl *);
|
||||||
_UI_EXTERN void uiControlHide(uiControl *);
|
_UI_EXTERN void uiControlHide(uiControl *);
|
||||||
|
|
|
@ -7,6 +7,12 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
|
||||||
#ifndef __LIBUI_UI_DARWIN_H__
|
#ifndef __LIBUI_UI_DARWIN_H__
|
||||||
#define __LIBUI_UI_DARWIN_H__
|
#define __LIBUI_UI_DARWIN_H__
|
||||||
|
|
||||||
|
typedef struct uiDarwinControl uiDarwinControl;
|
||||||
|
struct uiDarwinControl {
|
||||||
|
uiControl c;
|
||||||
|
};
|
||||||
|
_UI_EXTERN uintmax_t uiDarwinControlType(void);
|
||||||
|
|
||||||
// TODO document
|
// TODO document
|
||||||
#define uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, onDestroy) \
|
#define uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, onDestroy) \
|
||||||
static uintmax_t _ ## type ## Type = 0; \
|
static uintmax_t _ ## type ## Type = 0; \
|
||||||
|
@ -24,7 +30,7 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
|
||||||
} \
|
} \
|
||||||
static uintptr_t _ ## type ## Handle(uiControl *c) \
|
static uintptr_t _ ## type ## Handle(uiControl *c) \
|
||||||
{ \
|
{ \
|
||||||
return type(c)->handlefield; \
|
return (uintptr_t) (type(c)->handlefield); \
|
||||||
} \
|
} \
|
||||||
static void _ ## type ## ContainerUpdateState(uiControl *c) \
|
static void _ ## type ## ContainerUpdateState(uiControl *c) \
|
||||||
{ \
|
{ \
|
||||||
|
|
Loading…
Reference in New Issue