Instituted a new system: the parent control is responsible for extra space at the edges of controls, not the controls themselves. Let's hope this works better.
This commit is contained in:
parent
8fb8b0eeba
commit
73eed9289c
|
@ -11,6 +11,21 @@ void uiDarwinControlSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||||
(*(c->SetSuperview))(c, superview);
|
(*(c->SetSuperview))(c, superview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL uiDarwinControlHugsTrailingEdge(uiDarwinControl *c)
|
||||||
|
{
|
||||||
|
return (*(c->HugsTrailingEdge))(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL uiDarwinControlHugsBottom(uiDarwinControl *c)
|
||||||
|
{
|
||||||
|
return (*(c->HugsBottom))(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiDarwinControlChildEdgeHuggingChanged(uiDarwinControl *c)
|
||||||
|
{
|
||||||
|
(*(c->ChildEdgeHuggingChanged))(c);
|
||||||
|
}
|
||||||
|
|
||||||
void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
|
void uiDarwinSetControlFont(NSControl *c, NSControlSize size)
|
||||||
{
|
{
|
||||||
[c setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
|
[c setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
|
||||||
|
|
29
ui_darwin.h
29
ui_darwin.h
|
@ -19,11 +19,17 @@ struct uiDarwinControl {
|
||||||
BOOL visible;
|
BOOL visible;
|
||||||
void (*SyncEnableState)(uiDarwinControl *, int);
|
void (*SyncEnableState)(uiDarwinControl *, int);
|
||||||
void (*SetSuperview)(uiDarwinControl *, NSView *);
|
void (*SetSuperview)(uiDarwinControl *, NSView *);
|
||||||
|
BOOL (*HugsTrailingEdge)(uiDarwinControl *);
|
||||||
|
BOOL (*HugsBottom)(uiDarwinControl *);
|
||||||
|
void (*ChildEdgeHuggingChanged)(uiDarwinControl *);
|
||||||
};
|
};
|
||||||
#define uiDarwinControl(this) ((uiDarwinControl *) (this))
|
#define uiDarwinControl(this) ((uiDarwinControl *) (this))
|
||||||
// TODO document
|
// TODO document
|
||||||
_UI_EXTERN void uiDarwinControlSyncEnableState(uiDarwinControl *, int);
|
_UI_EXTERN void uiDarwinControlSyncEnableState(uiDarwinControl *, int);
|
||||||
_UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
_UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
|
_UI_EXTERN BOOL uiDarwinControlHugsTrailingEdge(uiDarwinControl *);
|
||||||
|
_UI_EXTERN BOOL uiDarwinControlHugsBottom(uiDarwinControl *);
|
||||||
|
_UI_EXTERN void uiDarwinControlChildEdgeHuggingChanged(uiDarwinControl *);
|
||||||
|
|
||||||
#define uiDarwinControlDefaultDestroy(type, handlefield) \
|
#define uiDarwinControlDefaultDestroy(type, handlefield) \
|
||||||
static void type ## Destroy(uiControl *c) \
|
static void type ## Destroy(uiControl *c) \
|
||||||
|
@ -104,6 +110,21 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
else \
|
else \
|
||||||
[superview addSubview:type(c)->handlefield]; \
|
[superview addSubview:type(c)->handlefield]; \
|
||||||
}
|
}
|
||||||
|
#define uiDarwinControlDefaultHugsTrailingEdge(type, handlefield) \
|
||||||
|
static BOOL type ## HugsTrailingEdge(uiDarwinControl *c) \
|
||||||
|
{ \
|
||||||
|
return YES; /* always hug by default */ \
|
||||||
|
}
|
||||||
|
#define uiDarwinControlDefaultHugsBottom(type, handlefield) \
|
||||||
|
static BOOL type ## HugsBottom(uiDarwinControl *c) \
|
||||||
|
{ \
|
||||||
|
return YES; /* always hug by default */ \
|
||||||
|
}
|
||||||
|
#define uiDarwinControlDefaultChildEdgeHuggingChanged(type, handlefield) \
|
||||||
|
static void type ## ChildEdgeHuggingChanged(uiDarwinControl *c) \
|
||||||
|
{ \
|
||||||
|
/* do nothing */ \
|
||||||
|
}
|
||||||
|
|
||||||
#define uiDarwinControlAllDefaultsExceptDestroy(type, handlefield) \
|
#define uiDarwinControlAllDefaultsExceptDestroy(type, handlefield) \
|
||||||
uiDarwinControlDefaultHandle(type, handlefield) \
|
uiDarwinControlDefaultHandle(type, handlefield) \
|
||||||
|
@ -117,7 +138,10 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
uiDarwinControlDefaultEnable(type, handlefield) \
|
uiDarwinControlDefaultEnable(type, handlefield) \
|
||||||
uiDarwinControlDefaultDisable(type, handlefield) \
|
uiDarwinControlDefaultDisable(type, handlefield) \
|
||||||
uiDarwinControlDefaultSyncEnableState(type, handlefield) \
|
uiDarwinControlDefaultSyncEnableState(type, handlefield) \
|
||||||
uiDarwinControlDefaultSetSuperview(type, handlefield)
|
uiDarwinControlDefaultSetSuperview(type, handlefield) \
|
||||||
|
uiDarwinControlDefaultHugsTrailingEdge(type, handlefield) \
|
||||||
|
uiDarwinControlDefaultHugsBottom(type, handlefield) \
|
||||||
|
uiDarwinControlDefaultChildEdgeHuggingChanged(type, handlefield)
|
||||||
|
|
||||||
#define uiDarwinControlAllDefaults(type, handlefield) \
|
#define uiDarwinControlAllDefaults(type, handlefield) \
|
||||||
uiDarwinControlDefaultDestroy(type, handlefield) \
|
uiDarwinControlDefaultDestroy(type, handlefield) \
|
||||||
|
@ -139,6 +163,9 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||||
uiControl(var)->Disable = type ## Disable; \
|
uiControl(var)->Disable = type ## Disable; \
|
||||||
uiDarwinControl(var)->SyncEnableState = type ## SyncEnableState; \
|
uiDarwinControl(var)->SyncEnableState = type ## SyncEnableState; \
|
||||||
uiDarwinControl(var)->SetSuperview = type ## SetSuperview; \
|
uiDarwinControl(var)->SetSuperview = type ## SetSuperview; \
|
||||||
|
uiDarwinControl(var)->HugsTrailingEdge = type ## HugsTrailingEdge; \
|
||||||
|
uiDarwinControl(var)->HugsBottom = type ## HugsBottom; \
|
||||||
|
uiDarwinControl(var)->ChildEdgeHuggingChanged = type ## ChildEdgeHuggingChanged; \
|
||||||
uiDarwinControl(var)->visible = YES; \
|
uiDarwinControl(var)->visible = YES; \
|
||||||
uiDarwinControl(var)->enabled = YES;
|
uiDarwinControl(var)->enabled = YES;
|
||||||
// TODO document
|
// TODO document
|
||||||
|
|
Loading…
Reference in New Issue