2015-08-16 22:08:00 -05:00
|
|
|
// 16 august 2015
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
2016-04-25 16:52:16 -05:00
|
|
|
void uiDarwinControlSyncEnableState(uiDarwinControl *c, int state)
|
|
|
|
{
|
|
|
|
(*(c->SyncEnableState))(c, state);
|
|
|
|
}
|
|
|
|
|
2016-04-25 12:38:17 -05:00
|
|
|
void uiDarwinControlSetSuperview(uiDarwinControl *c, NSView *superview)
|
2015-08-17 18:11:35 -05:00
|
|
|
{
|
2016-04-25 11:55:51 -05:00
|
|
|
(*(c->SetSuperview))(c, superview);
|
2015-08-16 22:08:00 -05:00
|
|
|
}
|
|
|
|
|
2016-05-11 16:00:01 -05:00
|
|
|
BOOL uiDarwinControlHugsTrailingEdge(uiDarwinControl *c)
|
|
|
|
{
|
|
|
|
return (*(c->HugsTrailingEdge))(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL uiDarwinControlHugsBottom(uiDarwinControl *c)
|
|
|
|
{
|
|
|
|
return (*(c->HugsBottom))(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiDarwinControlChildEdgeHuggingChanged(uiDarwinControl *c)
|
|
|
|
{
|
|
|
|
(*(c->ChildEdgeHuggingChanged))(c);
|
|
|
|
}
|
|
|
|
|
2016-05-12 11:26:43 -05:00
|
|
|
NSLayoutPriority uiDarwinControlHuggingPriority(uiDarwinControl *c, NSLayoutConstraintOrientation orientation)
|
|
|
|
{
|
|
|
|
return (*(c->HuggingPriority))(c, orientation);
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiDarwinControlSetHuggingPriority(uiDarwinControl *c, NSLayoutPriority priority, NSLayoutConstraintOrientation orientation)
|
|
|
|
{
|
|
|
|
(*(c->SetHuggingPriority))(c, priority, orientation);
|
|
|
|
}
|
|
|
|
|
2015-08-16 22:08:00 -05:00
|
|
|
void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
|
|
|
|
{
|
|
|
|
[c setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
|
|
|
|
}
|
2016-04-24 14:46:29 -05:00
|
|
|
|
|
|
|
#define uiDarwinControlSignature 0x44617277
|
|
|
|
|
2016-04-25 12:38:17 -05:00
|
|
|
uiDarwinControl *uiDarwinAllocControl(size_t n, uint32_t typesig, const char *typenamestr)
|
2016-04-24 14:46:29 -05:00
|
|
|
{
|
2016-04-24 18:22:21 -05:00
|
|
|
return uiDarwinControl(uiAllocControl(n, uiDarwinControlSignature, typesig, typenamestr));
|
2016-04-24 14:46:29 -05:00
|
|
|
}
|
2016-04-25 17:07:29 -05:00
|
|
|
|
|
|
|
BOOL uiDarwinShouldStopSyncEnableState(uiDarwinControl *c, BOOL enabled)
|
|
|
|
{
|
|
|
|
int ce;
|
|
|
|
|
|
|
|
ce = uiControlEnabled(uiControl(c));
|
|
|
|
// only stop if we're going from disabled back to enabled; don't stop under any other condition
|
|
|
|
// (if we stop when going from enabled to disabled then enabled children of a disabled control won't get disabled at the OS level)
|
|
|
|
if (!ce && enabled)
|
|
|
|
return YES;
|
|
|
|
return NO;
|
|
|
|
}
|
2016-05-12 11:26:43 -05:00
|
|
|
|
|
|
|
void uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl *c)
|
|
|
|
{
|
|
|
|
uiControl *parent;
|
|
|
|
|
|
|
|
parent = uiControlParent(uiControl(c));
|
|
|
|
if (parent != NULL)
|
|
|
|
uiDarwinControlChildEdgeHuggingChanged(uiDarwinControl(parent));
|
|
|
|
}
|