More relayout parent work. More TODOs.
This commit is contained in:
parent
77a293b699
commit
bec9ba1ba7
|
@ -191,7 +191,7 @@ static void relayout(uiBox *b)
|
|||
[metrics release];
|
||||
[views release];
|
||||
|
||||
uiDarwinControlRelayoutParent(uiControl(b));
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(b));
|
||||
}
|
||||
|
||||
static void boxRelayout(uiDarwinControl *c)
|
||||
|
|
|
@ -17,7 +17,7 @@ void uiDarwinControlRelayoutParent(uiDarwinControl *c)
|
|||
p = uiControlParent(uiControl(c));
|
||||
if (p == NULL)
|
||||
return;
|
||||
(*(uiDarwinControl(p)->Relayout))(p);
|
||||
(*(uiDarwinControl(p)->Relayout))(uiDarwinControl(p));
|
||||
}
|
||||
|
||||
void osCommitShow(uiControl *c)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// 14 august 2015
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODO
|
||||
// - even with the uiDarwinControlRelayoutParent() calls, we still need to click the button twice for the ambiguity to go away
|
||||
|
||||
struct uiGroup {
|
||||
uiDarwinControl c;
|
||||
NSBox *box;
|
||||
|
@ -54,6 +57,7 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
|
|||
uiControlSetParent(g->child, uiControl(g));
|
||||
[g->box addSubview:childView];
|
||||
layoutSingleView(g->box, childView, g->margined);
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(g));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +74,7 @@ void uiGroupSetMargined(uiGroup *g, int margined)
|
|||
if (g->child != NULL) {
|
||||
childView = (NSView *) uiControlHandle(g->child);
|
||||
layoutSingleView(g->box, childView, g->margined);
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(g));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
|||
view = [[NSView alloc] initWithFrame:NSZeroRect];
|
||||
[view addSubview:childView];
|
||||
layoutSingleView(view, childView, 0);
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(t));
|
||||
|
||||
[t->pages insertObject:[NSValue valueWithPointer:child] atIndex:n];
|
||||
[t->views insertObject:view atIndex:n];
|
||||
|
@ -122,6 +123,7 @@ void uiTabSetMargined(uiTab *t, uintmax_t n, int margined)
|
|||
child = (uiControl *) [childv pointerValue];
|
||||
childView = (NSView *) uiControlHandle(child);
|
||||
layoutSingleView(view, childView, margined);
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(t));
|
||||
}
|
||||
|
||||
uiTab *uiNewTab(void)
|
||||
|
|
|
@ -10,7 +10,7 @@ This file assumes that you have imported <Cocoa/Cocoa.h> and "ui.h" beforehand.
|
|||
typedef struct uiDarwinControl uiDarwinControl;
|
||||
struct uiDarwinControl {
|
||||
uiControl c;
|
||||
void (*Relayout)(uiControl *);
|
||||
void (*Relayout)(uiDarwinControl *);
|
||||
};
|
||||
_UI_EXTERN uintmax_t uiDarwinControlType(void);
|
||||
#define uiDarwinControl(this) ((uiDarwinControl *) uiIsA((this), uiDarwinControlType(), 1))
|
||||
|
@ -40,7 +40,7 @@ _UI_EXTERN void uiDarwinControlRelayoutParent(uiDarwinControl *);
|
|||
{ \
|
||||
/* do nothing */ \
|
||||
} \
|
||||
static void _ ## type ## Relayout(uiControl *c) \
|
||||
static void _ ## type ## Relayout(uiDarwinControl *c) \
|
||||
{ \
|
||||
uiDarwinControlRelayoutParent(uiDarwinControl(c)); \
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue