More work with changing things for OS X. Still not fully sure about things...
This commit is contained in:
parent
e643dc3693
commit
31dee85b5e
|
@ -22,11 +22,6 @@ void uiControlSetParent(uiControl *c, uiControl *parent)
|
|||
(*(c->SetParent))(c, parent);
|
||||
}
|
||||
|
||||
void uiControlUpdateChildren(uiControl *c)
|
||||
{
|
||||
(*(c->UpdateChildren))(c);
|
||||
}
|
||||
|
||||
int uiControlToplevel(uiControl *c)
|
||||
{
|
||||
return (*(c->Toplevel))(c);
|
||||
|
@ -62,6 +57,11 @@ void uiControlDisable(uiControl *c)
|
|||
(*(c->Disable))(c);
|
||||
}
|
||||
|
||||
void uiControlSyncEnableState(uiControl *c, int state)
|
||||
{
|
||||
(*(c->SyncEnableState))(c, state);
|
||||
}
|
||||
|
||||
#define uiControlSignature 0x7569436F
|
||||
|
||||
uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
|
||||
|
|
5
ui.h
5
ui.h
|
@ -51,7 +51,6 @@ struct uiControl {
|
|||
uintptr_t (*Handle)(uiControl *);
|
||||
uiControl *(*Parent)(uiControl *);
|
||||
void (*SetParent)(uiControl *, uiControl *);
|
||||
void (*UpdateChildren)(uiControl *);
|
||||
int (*Toplevel)(uiControl *);
|
||||
int (*Visible)(uiControl *);
|
||||
void (*Show)(uiControl *);
|
||||
|
@ -59,13 +58,14 @@ struct uiControl {
|
|||
int (*Enabled)(uiControl *);
|
||||
void (*Enable)(uiControl *);
|
||||
void (*Disable)(uiControl *);
|
||||
void (*SyncEnableState)(uiControl *, int);
|
||||
};
|
||||
// TOOD add argument names to all arguments
|
||||
#define uiControl(this) ((uiControl *) (this))
|
||||
_UI_EXTERN void uiControlDestroy(uiControl *);
|
||||
_UI_EXTERN uintptr_t uiControlHandle(uiControl *);
|
||||
_UI_EXTERN uiControl *uiControlParent(uiControl *);
|
||||
_UI_EXTERN void uiControlSetParent(uiControl *, uiControl *);
|
||||
_UI_EXTERN void uiControlUpdateChildren(uiControl *);
|
||||
_UI_EXTERN int uiControlToplevel(uiControl *);
|
||||
_UI_EXTERN int uiControlVisible(uiControl *);
|
||||
_UI_EXTERN void uiControlShow(uiControl *);
|
||||
|
@ -73,6 +73,7 @@ _UI_EXTERN void uiControlHide(uiControl *);
|
|||
_UI_EXTERN int uiControlEnabled(uiControl *);
|
||||
_UI_EXTERN void uiControlEnable(uiControl *);
|
||||
_UI_EXTERN void uiControlDisable(uiControl *);
|
||||
_UI_EXTERN void uiControlSyncEnableState(uiControl *, int);
|
||||
|
||||
_UI_EXTERN uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
|
||||
_UI_EXTERN void uiFreeControl(uiControl *);
|
||||
|
|
31
ui_darwin.h
31
ui_darwin.h
|
@ -17,10 +17,12 @@ struct uiDarwinControl {
|
|||
uiControl *parent;
|
||||
BOOL enabled;
|
||||
BOOL visible;
|
||||
void (*AddSubview)(uiDarwinControl *, NSView *);
|
||||
void (*Relayout)(uiDarwinControl *);
|
||||
};
|
||||
#define uiDarwinControl(this) ((uiDarwinControl *) (this))
|
||||
// TODO document
|
||||
_UI_EXTERN void uiDarwinControlAddSubview(uiDarwinControl *, NSView *);
|
||||
_UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *);
|
||||
|
||||
#define uiDarwinControlDefaultDestroy(type, handlefield) \
|
||||
|
@ -46,11 +48,25 @@ _UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *);
|
|||
uiDarwinControl(c)->parent = parent; \
|
||||
if (uiDarwinControl(c)->parent == NULL) \
|
||||
[type(c)->handlefield removeFromSuperview]; \
|
||||
else { \
|
||||
else \
|
||||
uiDarwinControlAddSubview(uiDarwinControl(uiDarwinControl(c)->parent), type(c)->handlefield); \
|
||||
}
|
||||
#define uiDarwinControlDefaultToplevel(type) \
|
||||
static int type ## Toplevel(uiControl *c) \
|
||||
{ \
|
||||
return 0; \
|
||||
}
|
||||
#define uiDarwinControlDefaultVisible(type) \
|
||||
static int type ## Visible(uiDarwinControl *c) \
|
||||
{ \
|
||||
/* TODO */ \
|
||||
if ([type(c)->handlefield respondsToSelector:@selector(setEnabled:)]) \
|
||||
[type(c)->handlefield setEnabled:uiControlEnabledToUser(c)]; \
|
||||
} \
|
||||
return uiDarwinControl(c)->visible; \
|
||||
}
|
||||
// TODO others here
|
||||
#define uiDarwinControlDefaultAddSubview(type) \
|
||||
static void type ## AddSubview(uiDarwinControl *c, NSView *subview) \
|
||||
{ \
|
||||
/* TODO do nothing or log? one of the two */ \
|
||||
}
|
||||
#define uiDarwinControlDefaultRelayout(type) \
|
||||
static void type ## Relayout(uiDarwinControl *c) \
|
||||
|
@ -62,11 +78,16 @@ _UI_EXTERN void uiDarwinControlTriggerRelayout(uiDarwinControl *);
|
|||
uiDarwinControlDefaultDestroy(type, handlefield) \
|
||||
uiDarwinControlDefaultHandle(type, handlefield) \
|
||||
uiDarwinControlDefaultParent(type) \
|
||||
uiDarwinControlDefaultSetParent(type, handlefield) \
|
||||
uiDarwinControlDefaultToplevel(type) \
|
||||
xxxxx \
|
||||
uiDarwinControlDefaultAddSubview(type) \
|
||||
uiDarwinControlDefaultRelayout(type)
|
||||
|
||||
// TODO document
|
||||
#define uiDarwinNewControl(type) type(uiDarwinNewControl(sizeof (type), type ## Signature, #type))
|
||||
#define uiDarwinNewControl(var, type) \
|
||||
var = type(uiDarwinNewControl(sizeof (type), type ## Signature, #type)) \
|
||||
TODO
|
||||
_UI_EXTERN uiDarwinControl *uiDarwinAllocControl(size_t n, uint32_t typesig, const char *typenamestr);
|
||||
|
||||
#define uiDarwinFinishNewControl(variable, type) \
|
||||
|
|
Loading…
Reference in New Issue