Settled uiWindow show/hide differences.

This commit is contained in:
Pietro Gagliardi 2015-08-25 20:31:43 -04:00
parent 283ae5329e
commit a390aac089
5 changed files with 10 additions and 13 deletions

View File

@ -134,9 +134,9 @@ void uiControlDisable(uiControl *c)
void controlUpdateState(uiControl *c)
{
if (controlContainerVisible(c))
osCommitShow(c);
(*(c->CommitShow))(c);
else
osCommitHide(c);
(*(c->CommitHide))(c);
if (controlContainerEnabled(c))
osCommitEnable(c);
else

View File

@ -21,20 +21,15 @@ void uiDarwinControlTriggerRelayout(uiDarwinControl *c)
(*(c->Relayout))(uiDarwinControl(c));
}
void osCommitShow(uiControl *c)
static void defaultCommitShow(uiControl *c)
{
NSView *view;
view = (NSView *) uiControlHandle(c);
// TODO
if ([view isKindOfClass:[NSWindow class]]) {
[view makeKeyAndOrderFront:view];
return;
}
[view setHidden:NO];
}
void osCommitHide(uiControl *c)
static void defaultCommitHide(uiControl *c)
{
NSView *view;
@ -69,6 +64,8 @@ void uiDarwinFinishControl(uiControl *c)
// TODO omit this for uiWindow properly
if ([view respondsToSelector:@selector(setTranslatesAutoresizingMaskIntoConstraints:)])
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
c->CommitShow = defaultCommitShow;
c->CommitHide = defaultCommitHide;
}
void uiDarwinSetControlFont(NSControl *c, NSControlSize size)

View File

@ -216,8 +216,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
uiWindowOnClosing(w, defaultOnClosing, NULL);
uiDarwinFinishNewControl(w, uiWindow);
//TODO uiControl(w)->CommitShow = windowCommitShow;
//TODO uiControl(w)->CommitHide = windowCommitHide;
uiControl(w)->CommitShow = windowCommitShow;
uiControl(w)->CommitHide = windowCommitHide;
uiControl(w)->ContainerUpdateState = windowContainerUpdateState;
uiDarwinControl(w)->Relayout = windowRelayout;

View File

@ -55,6 +55,8 @@ struct uiControl {
void *Internal; // for use by libui only
void (*CommitDestroy)(uiControl *);
uintptr_t (*Handle)(uiControl *);
void (*CommitShow)(uiControl *);
void (*CommitHide)(uiControl *);
void (*ContainerUpdateState)(uiControl *);
};
_UI_EXTERN uintmax_t uiControlType(void);

View File

@ -19,8 +19,6 @@ extern int isToplevel(uiControl *);
extern uiControl *toplevelOwning(uiControl *);
extern void controlUpdateState(uiControl *);
extern void osCommitShow(uiControl *);
extern void osCommitHide(uiControl *);
extern void osCommitEnable(uiControl *);
extern void osCommitDisable(uiControl *);