More compile fixes.
This commit is contained in:
parent
fa659395c8
commit
4b0d81c144
|
@ -30,6 +30,11 @@ void uiControlDestroy(uiControl *c)
|
|||
uiFree(c);
|
||||
}
|
||||
|
||||
uintptr_t uiControlHandle(uiControl *c)
|
||||
{
|
||||
return (*(c->Handle))(c);
|
||||
}
|
||||
|
||||
static void controlUpdateState(uiControl *);
|
||||
|
||||
void uiControlSetParent(uiControl *c, uiControl *parent)
|
||||
|
|
|
@ -28,19 +28,18 @@ uiDarwinDefineControlWithOnDestroy(
|
|||
static uiControl *childAt(uiBox *b, uintmax_t n)
|
||||
{
|
||||
NSValue *v;
|
||||
uiControl *c;
|
||||
|
||||
v = (NSValue *) [b->children objectAtIndex:n];
|
||||
return (uiControl *) [v pointerValue];
|
||||
}
|
||||
|
||||
static void onDestroy(uiTab *t)
|
||||
static void onDestroy(uiBox *b)
|
||||
{
|
||||
uintmax_t i;
|
||||
uiControl *child;
|
||||
NSView *childView;
|
||||
|
||||
for (i = 0; i < [t->children count]; i++) {
|
||||
for (i = 0; i < [b->children count]; i++) {
|
||||
child = childAt(b, i);
|
||||
childView = (NSView *) uiControlHandle(child);
|
||||
[childView removeFromSuperview];
|
||||
|
@ -164,7 +163,7 @@ static void relayout(uiBox *b)
|
|||
// don't space between the last control and the no-stretchy view
|
||||
[constraint appendString:@"[noStretchyView]"];
|
||||
[constraint appendString:@"|"];
|
||||
addConstraints(b->view, constraint, metrics, views);
|
||||
addConstraint(b->view, constraint, metrics, views);
|
||||
[constraint release];
|
||||
|
||||
// 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);
|
||||
else
|
||||
// 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
|
||||
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->secondaryOrientation)
|
||||
setHuggingPri(childView, NSLayoutPriorityDefaultLow, b->secondaryOrientation);
|
||||
|
||||
uiControlSetParent(c, uiControl(b));
|
||||
relayout(b);
|
||||
|
@ -231,7 +230,7 @@ int uiBoxPadded(uiBox *b)
|
|||
return b->padded;
|
||||
}
|
||||
|
||||
void uiBoxSetPadded(uiBox *ss, int padded)
|
||||
void uiBoxSetPadded(uiBox *b, int padded)
|
||||
{
|
||||
b->padded = padded;
|
||||
relayout(b);
|
||||
|
@ -250,21 +249,21 @@ static uiBox *finishNewBox(BOOL vertical)
|
|||
|
||||
b->vertical = vertical;
|
||||
if (b->vertical) {
|
||||
b->primaryDirString = @"V:";
|
||||
b->secondaryDirString = @"H:";
|
||||
b->primaryDirPrefix = @"V:";
|
||||
b->secondaryDirPrefix = @"H:";
|
||||
b->primaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||
b->secondaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||
} else {
|
||||
b->primaryDirString = @"H:";
|
||||
b->secondaryDirString = @"V:";
|
||||
b->primaryDirPrefix = @"H:";
|
||||
b->secondaryDirPrefix = @"V:";
|
||||
b->primaryOrientation = NSLayoutConstraintOrientationHorizontal;
|
||||
b->secondaryOrientation = NSLayoutConstraintOrientationVertical;
|
||||
}
|
||||
|
||||
b->noStretchyView = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||
[b->noStretchyView setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
setHorzHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow);
|
||||
setVertHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow);
|
||||
setHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationHorizontal);
|
||||
setHuggingPri(b->noStretchyView, NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationVertical);
|
||||
|
||||
uiDarwinFinishNewControl(b, uiBox);
|
||||
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
// 16 august 2015
|
||||
#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)
|
||||
{
|
||||
NSView *view;
|
||||
|
|
|
@ -58,6 +58,7 @@ struct uiControl {
|
|||
_UI_EXTERN uintmax_t uiControlType(void);
|
||||
#define uiControl(this) ((uiControl *) uiIsA((this), uiControlType(), 1))
|
||||
_UI_EXTERN void uiControlDestroy(uiControl *);
|
||||
_UI_EXTERN uintptr_t uiControlHandle(uiControl *);
|
||||
_UI_EXTERN void uiControlSetParent(uiControl *, uiControl *);
|
||||
_UI_EXTERN void uiControlShow(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__
|
||||
#define __LIBUI_UI_DARWIN_H__
|
||||
|
||||
typedef struct uiDarwinControl uiDarwinControl;
|
||||
struct uiDarwinControl {
|
||||
uiControl c;
|
||||
};
|
||||
_UI_EXTERN uintmax_t uiDarwinControlType(void);
|
||||
|
||||
// TODO document
|
||||
#define uiDarwinDefineControlWithOnDestroy(type, typefn, handlefield, onDestroy) \
|
||||
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) \
|
||||
{ \
|
||||
return type(c)->handlefield; \
|
||||
return (uintptr_t) (type(c)->handlefield); \
|
||||
} \
|
||||
static void _ ## type ## ContainerUpdateState(uiControl *c) \
|
||||
{ \
|
||||
|
|
Loading…
Reference in New Issue