Made SyncEnableState() a uiDarwinControl method instead of a uiControl method since it's not needed on GTK+.
This commit is contained in:
parent
a651caac89
commit
7b0780be2a
|
@ -57,11 +57,6 @@ 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)
|
||||
|
|
|
@ -65,7 +65,7 @@ uiDarwinControlDefaultEnabled(uiBox, view)
|
|||
uiDarwinControlDefaultEnable(uiBox, view)
|
||||
uiDarwinControlDefaultDisable(uiBox, view)
|
||||
|
||||
static void uiBoxSyncEnableState(uiControl *c, int enabled)
|
||||
static void uiBoxSyncEnableState(uiDarwinControl *c, int enabled)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
NSUInteger i;
|
||||
|
@ -77,7 +77,7 @@ static void uiBoxSyncEnableState(uiControl *c, int enabled)
|
|||
v = (NSValue *) [b->children objectAtIndex:i];
|
||||
// TODO change all these other instances of casts to conversions
|
||||
child = uiControl([v pointerValue]);
|
||||
uiControlSyncEnableState(child, enabled);
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(child), enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
|||
|
||||
uiControlSetParent(c, uiControl(b));
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(c), b->view);
|
||||
uiControlSyncEnableState(c, uiControlEnabledToUser(uiControl(b)));
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(c), uiControlEnabledToUser(uiControl(b)));
|
||||
|
||||
// TODO save the old hugging priorities
|
||||
// if a control is stretchy, it should not hug in the primary direction
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// 16 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
void uiDarwinControlSyncEnableState(uiDarwinControl *c, int state)
|
||||
{
|
||||
(*(c->SyncEnableState))(c, state);
|
||||
}
|
||||
|
||||
void uiDarwinControlSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||
{
|
||||
(*(c->SetSuperview))(c, superview);
|
||||
|
|
|
@ -31,12 +31,12 @@ uiDarwinControlDefaultEnabled(uiGroup, box)
|
|||
uiDarwinControlDefaultEnable(uiGroup, box)
|
||||
uiDarwinControlDefaultDisable(uiGroup, box)
|
||||
|
||||
static void uiGroupSyncEnableState(uiControl *c, int enabled)
|
||||
static void uiGroupSyncEnableState(uiDarwinControl *c, int enabled)
|
||||
{
|
||||
uiGroup *g = uiGroup(c);
|
||||
|
||||
if (g->child != NULL)
|
||||
uiControlSyncEnableState(g->child, enabled);
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(g->child), enabled);
|
||||
}
|
||||
|
||||
uiDarwinControlDefaultSetSuperview(uiGroup, box)
|
||||
|
@ -89,7 +89,7 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
|
|||
// otherwise, things get really glitchy
|
||||
// we also need to call -sizeToFit, but we'll do that in the relayout that's triggered below (see above)
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(g->child), g->box);
|
||||
uiControlSyncEnableState(g->child, uiControlEnabledToUser(uiControl(g)));
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(g->child), uiControlEnabledToUser(uiControl(g)));
|
||||
}
|
||||
groupRelayout(g);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
|||
view = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||
// TODO if we turn off the autoresizing mask, nothing shows up; didn't this get documented somewhere?
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(child), view);
|
||||
uiControlSyncEnableState(child, uiControlEnabledToUser(uiControl(t)));
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(child), uiControlEnabledToUser(uiControl(t)));
|
||||
|
||||
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];
|
||||
[t->views insertObject:view atIndex:n];
|
||||
|
|
|
@ -126,12 +126,12 @@ uiDarwinControlDefaultEnabled(uiWindow, window)
|
|||
uiDarwinControlDefaultEnable(uiWindow, window)
|
||||
uiDarwinControlDefaultDisable(uiWindow, window)
|
||||
|
||||
static void uiWindowSyncEnableState(uiControl *c, int enabled)
|
||||
static void uiWindowSyncEnableState(uiDarwinControl *c, int enabled)
|
||||
{
|
||||
uiWindow *w = uiWindow(c);
|
||||
|
||||
if (w->child != NULL)
|
||||
uiControlSyncEnableState(w->child, enabled);
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(w->child), enabled);
|
||||
}
|
||||
|
||||
static void uiWindowSetSuperview(uiDarwinControl *c, NSView *superview)
|
||||
|
@ -187,7 +187,7 @@ void uiWindowSetChild(uiWindow *w, uiControl *child)
|
|||
uiControlSetParent(w->child, uiControl(w));
|
||||
childView = (NSView *) uiControlHandle(w->child);
|
||||
uiDarwinControlSetSuperview(uiDarwinControl(w->child), [w->window contentView]);
|
||||
uiControlSyncEnableState(w->child, uiControlEnabledToUser(uiControl(w)));
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(w->child), uiControlEnabledToUser(uiControl(w)));
|
||||
}
|
||||
windowRelayout(w);
|
||||
}
|
||||
|
|
2
ui.h
2
ui.h
|
@ -58,7 +58,6 @@ 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))
|
||||
|
@ -73,7 +72,6 @@ _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 *);
|
||||
|
|
10
ui_darwin.h
10
ui_darwin.h
|
@ -17,10 +17,12 @@ struct uiDarwinControl {
|
|||
uiControl *parent;
|
||||
BOOL enabled;
|
||||
BOOL visible;
|
||||
void (*SyncEnableState)(uiDarwinControl *, int);
|
||||
void (*SetSuperview)(uiDarwinControl *, NSView *);
|
||||
};
|
||||
#define uiDarwinControl(this) ((uiDarwinControl *) (this))
|
||||
// TODO document
|
||||
_UI_EXTERN void uiDarwinControlSyncEnableState(uiDarwinControl *, int);
|
||||
_UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
||||
|
||||
#define uiDarwinControlDefaultDestroy(type, handlefield) \
|
||||
|
@ -77,16 +79,16 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
|||
static void type ## Enable(uiControl *c) \
|
||||
{ \
|
||||
uiDarwinControl(c)->enabled = YES; \
|
||||
uiControlSyncEnableState(c, uiControlEnabledToUser(c)); \
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(c), uiControlEnabledToUser(c)); \
|
||||
}
|
||||
#define uiDarwinControlDefaultDisable(type, handlefield) \
|
||||
static void type ## Disable(uiControl *c) \
|
||||
{ \
|
||||
uiDarwinControl(c)->enabled = NO; \
|
||||
uiControlSyncEnableState(c, uiControlEnabledToUser(c)); \
|
||||
uiDarwinControlSyncEnableState(uiDarwinControl(c), uiControlEnabledToUser(c)); \
|
||||
}
|
||||
#define uiDarwinControlDefaultSyncEnableState(type, handlefield) \
|
||||
static void type ## SyncEnableState(uiControl *c, int enabled) \
|
||||
static void type ## SyncEnableState(uiDarwinControl *c, int enabled) \
|
||||
{ \
|
||||
if ([type(c)->handlefield respondsToSelector:@selector(setEnabled:)]) \
|
||||
[((id) type(c)->handlefield) setEnabled:enabled]; /* id cast to make compiler happy; thanks mikeash in irc.freenode.net/#macdev */ \
|
||||
|
@ -133,7 +135,7 @@ _UI_EXTERN void uiDarwinControlSetSuperview(uiDarwinControl *, NSView *);
|
|||
uiControl(var)->Enabled = type ## Enabled; \
|
||||
uiControl(var)->Enable = type ## Enable; \
|
||||
uiControl(var)->Disable = type ## Disable; \
|
||||
uiControl(var)->SyncEnableState = type ## SyncEnableState; \
|
||||
uiDarwinControl(var)->SyncEnableState = type ## SyncEnableState; \
|
||||
uiDarwinControl(var)->SetSuperview = type ## SetSuperview; \
|
||||
uiDarwinControl(var)->visible = YES; \
|
||||
uiDarwinControl(var)->enabled = YES;
|
||||
|
|
Loading…
Reference in New Issue