Tied everything together. Now to fix build issues.
This commit is contained in:
parent
587da1f40f
commit
5b929084f8
|
@ -34,8 +34,12 @@ static void uiContainer_remove(GtkContainer *container, GtkWidget *widget)
|
||||||
|
|
||||||
static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
|
static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
|
uiControl *c;
|
||||||
|
uiSizing d;
|
||||||
|
|
||||||
gtk_widget_set_allocation(widget, allocation);
|
gtk_widget_set_allocation(widget, allocation);
|
||||||
// TODO resize child
|
c = uiContainer(widget)->child;
|
||||||
|
(*(c->resize))(widget, allocation.x, allocation.y, allocation.width, allocation.height, &d);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct forall {
|
struct forall {
|
||||||
|
|
|
@ -12,3 +12,9 @@ void uiQuit(void)
|
||||||
{
|
{
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO move somewhere else
|
||||||
|
uintptr_t uiControlHandle(uiControl *c)
|
||||||
|
{
|
||||||
|
return (*(c->handle))(c);
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ typedef struct uiContainer uiContainer;
|
||||||
typedef struct uiContainerClass uiContainerClass;
|
typedef struct uiContainerClass uiContainerClass;
|
||||||
struct uiContainer {
|
struct uiContainer {
|
||||||
GtkContainer parent_instance;
|
GtkContainer parent_instance;
|
||||||
// TODO
|
// this is what triggers the resizing of all the children
|
||||||
|
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()
|
||||||
};
|
};
|
||||||
struct uiContainerClass {
|
struct uiContainerClass {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
struct uiWindow {
|
struct uiWindow {
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
GtkWidget *container;
|
||||||
int (*onClosing)(uiWindow *, void *);
|
int (*onClosing)(uiWindow *, void *);
|
||||||
void *onClosingData;
|
void *onClosingData;
|
||||||
};
|
};
|
||||||
|
@ -15,6 +16,8 @@ uiWindow *uiNewWindow(char *title, int width, int height)
|
||||||
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_title(GTK_WINDOW(w->widget), title);
|
gtk_window_set_title(GTK_WINDOW(w->widget), title);
|
||||||
gtk_window_resize(GTK_WINDOW(w->widget), width, height);
|
gtk_window_resize(GTK_WINDOW(w->widget), width, height);
|
||||||
|
w->container = newContainer();
|
||||||
|
gtk_container_add(GTK_CONTAINER(w->widget), w->container);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,3 +61,9 @@ void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
|
||||||
w->onClosingData = data;
|
w->onClosingData = data;
|
||||||
g_signal_connect(w->widget, "delete-event", G_CALLBACK(onClosing), w);
|
g_signal_connect(w->widget, "delete-event", G_CALLBACK(onClosing), w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiWindowSetChild(uiWindow *w, uiControl *c)
|
||||||
|
{
|
||||||
|
uiContainer(w->container)->child = c;
|
||||||
|
(*(c->setParent))(c, (uintptr_t) (w->container));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue