Adjusted the Unix uiParent to conform to the newest set of changes.
This commit is contained in:
parent
9f0729de1c
commit
04ae252e27
|
@ -13,9 +13,7 @@ typedef struct uipParentClass uipParentClass;
|
||||||
|
|
||||||
struct uipParent {
|
struct uipParent {
|
||||||
GtkContainer parent_instance;
|
GtkContainer parent_instance;
|
||||||
// this is what triggers the resizing of all the children
|
uiControl *mainControl;
|
||||||
uiControl *child;
|
|
||||||
// these are the actual children widgets of the container as far as GTK+ is concerned
|
|
||||||
GPtrArray *children; // for forall()
|
GPtrArray *children; // for forall()
|
||||||
intmax_t marginLeft;
|
intmax_t marginLeft;
|
||||||
intmax_t marginTop;
|
intmax_t marginTop;
|
||||||
|
@ -47,9 +45,9 @@ static void uipParent_dispose(GObject *obj)
|
||||||
g_ptr_array_unref(p->children);
|
g_ptr_array_unref(p->children);
|
||||||
p->children = NULL;
|
p->children = NULL;
|
||||||
}
|
}
|
||||||
if (p->child != NULL) {
|
if (p->mainControl != NULL) {
|
||||||
uiControlDestroy(p->child);
|
uiControlDestroy(p->mainControl);
|
||||||
p->child = NULL;
|
p->mainControl = NULL;
|
||||||
}
|
}
|
||||||
G_OBJECT_CLASS(uipParent_parent_class)->dispose(obj);
|
G_OBJECT_CLASS(uipParent_parent_class)->dispose(obj);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +87,7 @@ static void uipParent_size_allocate(GtkWidget *widget, GtkAllocation *allocation
|
||||||
intmax_t x, y, width, height;
|
intmax_t x, y, width, height;
|
||||||
|
|
||||||
gtk_widget_set_allocation(GTK_WIDGET(p), allocation);
|
gtk_widget_set_allocation(GTK_WIDGET(p), allocation);
|
||||||
if (p->child == NULL)
|
if (p->mainControl == NULL)
|
||||||
return;
|
return;
|
||||||
x = allocation->x + p->marginLeft;
|
x = allocation->x + p->marginLeft;
|
||||||
y = allocation->y + p->marginTop;
|
y = allocation->y + p->marginTop;
|
||||||
|
@ -97,7 +95,7 @@ static void uipParent_size_allocate(GtkWidget *widget, GtkAllocation *allocation
|
||||||
height = allocation->height - (p->marginTop + p->marginBottom);
|
height = allocation->height - (p->marginTop + p->marginBottom);
|
||||||
d.xPadding = gtkXPadding;
|
d.xPadding = gtkXPadding;
|
||||||
d.yPadding = gtkYPadding;
|
d.yPadding = gtkYPadding;
|
||||||
uiControlResize(p->child, x, y, width, height, &d);
|
uiControlResize(p->mainControl, x, y, width, height, &d);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct forall {
|
struct forall {
|
||||||
|
@ -140,13 +138,15 @@ static uintptr_t parentHandle(uiParent *p)
|
||||||
return (uintptr_t) pp;
|
return (uintptr_t) pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parentSetChild(uiParent *p, uiControl *child)
|
static void parentSetMainControl(uiParent *pp, uiControl *mainControl)
|
||||||
{
|
{
|
||||||
uipParent *pp = uipParent(p->Internal);
|
uipParent *p = uipParent(pp->Internal);
|
||||||
|
|
||||||
pp->child = child;
|
if (p->mainControl != NULL)
|
||||||
if (pp->child != NULL)
|
uiControlSetParent(p->mainControl, NULL);
|
||||||
uiControlSetParent(child, p);
|
p->mainControl = mainControl;
|
||||||
|
if (p->mainControl != NULL)
|
||||||
|
uiControlSetParent(p->mainControl, pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parentSetMargins(uiParent *p, intmax_t left, intmax_t top, intmax_t right, intmax_t bottom)
|
static void parentSetMargins(uiParent *p, intmax_t left, intmax_t top, intmax_t right, intmax_t bottom)
|
||||||
|
@ -173,7 +173,7 @@ uiParent *uiNewParent(uintptr_t osParent)
|
||||||
p = uiNew(uiParent);
|
p = uiNew(uiParent);
|
||||||
p->Internal = g_object_new(uipParentType, NULL);
|
p->Internal = g_object_new(uipParentType, NULL);
|
||||||
p->Handle = parentHandle;
|
p->Handle = parentHandle;
|
||||||
p->SetChild = parentSetChild;
|
p->SetMainControl = parentSetMainControl;
|
||||||
p->SetMargins = parentSetMargins;
|
p->SetMargins = parentSetMargins;
|
||||||
p->Update = parentUpdate;
|
p->Update = parentUpdate;
|
||||||
gtk_container_add(GTK_CONTAINER(osParent), GTK_WIDGET(p->Internal));
|
gtk_container_add(GTK_CONTAINER(osParent), GTK_WIDGET(p->Internal));
|
||||||
|
|
Loading…
Reference in New Issue