Changed uiParentSetChild() to uiParentSetMainControl(). Backend changes incoming.

This commit is contained in:
Pietro Gagliardi 2015-04-17 13:43:01 -04:00
parent 797408fe6e
commit 9f0729de1c
8 changed files with 10 additions and 12 deletions

View File

@ -41,7 +41,7 @@ static void tabAddPage(uiTab *t, const char *name, uiControl *child)
NSTabViewItem *i; NSTabViewItem *i;
content = uiNewParent(0); content = uiNewParent(0);
uiParentSetChild(content, child); uiParentSetMainControl(content, child);
i = [[NSTabViewItem alloc] initWithIdentifier:nil]; i = [[NSTabViewItem alloc] initWithIdentifier:nil];
[i setLabel:toNSString(name)]; [i setLabel:toNSString(name)];

View File

@ -93,7 +93,7 @@ static void windowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *dat
static void windowSetChild(uiWindow *w, uiControl *c) static void windowSetChild(uiWindow *w, uiControl *c)
{ {
uiParentSetChild(D.content, c); uiParentSetMainControl(D.content, c);
} }
static int windowMargined(uiWindow *ww) static int windowMargined(uiWindow *ww)

View File

@ -14,7 +14,7 @@ i entry
w = NewWindow() w = NewWindow()
p = NewParent(w.Handle) p = NewParent(w.Handle)
w.SetChild(c) w.SetChild(c)
p.SetChild(c) p.SetMainControl(c)
c.SetParent(p) c.SetParent(p)
d.SetParent(p) d.SetParent(p)
e.SetParent(p) e.SetParent(p)
@ -34,7 +34,7 @@ g.Hide()
p.Update() p.Update()
c.Resize() c.Resize()
w.SetChild(i) w.SetChild(i)
p.SetChild(i) p.SetMainControl(i)
c.SetParent(NULL) c.SetParent(NULL)
d.SetParent(NULL) d.SetParent(NULL)
... ...
@ -43,7 +43,7 @@ w.SetChild(i)
p.Update() p.Update()
i.Resize() i.Resize()
w.SetChild(NULL) w.SetChild(NULL)
p.SetChild(NULL) p.SetMainControl(NULL)
i.SetParent(NULL) i.SetParent(NULL)
p.Update() p.Update()
w.SetChild(i) w.SetChild(i)
@ -53,5 +53,4 @@ w.Destroy()
i.Destroy() i.Destroy()
TODO TODO
- rename these methods
- p.DeferUpdate()/p.EndDeferUpdate() - p.DeferUpdate()/p.EndDeferUpdate()

3
ui.idl
View File

@ -62,8 +62,7 @@ interface Parent {
// TODO destroy // TODO destroy
// TODO object destruction debug handler // TODO object destruction debug handler
func Handle(void) uintptr_t; func Handle(void) uintptr_t;
// TODO rename and clean this up func SetMainControl(c *Control);
func SetChild(c *Control);
func SetMargins(left intmax_t, top intmax_t, right intmax_t, bottom intmax_t); func SetMargins(left intmax_t, top intmax_t, right intmax_t, bottom intmax_t);
// TODO Resize? // TODO Resize?
func Update(void); func Update(void);

View File

@ -32,7 +32,7 @@ static void tabAddPage(uiTab *tt, const char *name, uiControl *child)
} }
content = uiNewParent((uintptr_t) (t->container)); content = uiNewParent((uintptr_t) (t->container));
uiParentSetChild(content, child); uiParentSetMainControl(content, child);
uiParentUpdate(content); uiParentUpdate(content);
gtk_notebook_set_tab_label_text(t->notebook, GTK_WIDGET(uiParentHandle(content)), name); gtk_notebook_set_tab_label_text(t->notebook, GTK_WIDGET(uiParentHandle(content)), name);

View File

@ -88,7 +88,7 @@ static void windowSetChild(uiWindow *ww, uiControl *c)
{ {
struct window *w = (struct window *) ww; struct window *w = (struct window *) ww;
uiParentSetChild(w->content, c); uiParentSetMainControl(w->content, c);
uiParentUpdate(w->content); uiParentUpdate(w->content);
} }

View File

@ -131,7 +131,7 @@ void tabAddPage(uiTab *tt, const char *name, uiControl *child)
n = SendMessageW(t->hwnd, TCM_GETITEMCOUNT, 0, 0); n = SendMessageW(t->hwnd, TCM_GETITEMCOUNT, 0, 0);
parent = uiNewParent((uintptr_t) (t->hwnd)); parent = uiNewParent((uintptr_t) (t->hwnd));
uiParentSetChild(parent, child); uiParentSetMainControl(parent, child);
uiParentUpdate(parent); uiParentUpdate(parent);
if (n != 0) // if this isn't the first page, we have to hide the other controls if (n != 0) // if this isn't the first page, we have to hide the other controls
ShowWindow(uiParentHWND(parent), SW_HIDE); ShowWindow(uiParentHWND(parent), SW_HIDE);

View File

@ -144,7 +144,7 @@ static void windowSetChild(uiWindow *ww, uiControl *c)
{ {
struct window *w = (struct window *) ww; struct window *w = (struct window *) ww;
uiParentSetChild(w->content, c); uiParentSetMainControl(w->content, c);
// don't call uiParentUpdate(); instead, synthesize a resize // don't call uiParentUpdate(); instead, synthesize a resize
// otherwise, we'll have a 0x0 content area at first // otherwise, we'll have a 0x0 content area at first
SendMessageW(w->hwnd, msgUpdateChild, 0, 0); SendMessageW(w->hwnd, msgUpdateChild, 0, 0);