summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-07 13:22:46 -0400
committerPietro Gagliardi <[email protected]>2015-04-07 13:22:46 -0400
commit5b929084f8b80409ee39d21ef80f562042807e0b (patch)
tree513a6bbf595a0b43dc6fcc4ec9fa620f1116cdb1
parent587da1f40fd7aa64119657c30017da4a63eb1a68 (diff)
Tied everything together. Now to fix build issues.
-rw-r--r--new/container_unix.c6
-rw-r--r--new/main_unix.c6
-rw-r--r--new/uipriv_unix.h4
-rw-r--r--new/window_unix.c9
4 files changed, 23 insertions, 2 deletions
diff --git a/new/container_unix.c b/new/container_unix.c
index f008878..ab0298f 100644
--- a/new/container_unix.c
+++ b/new/container_unix.c
@@ -34,8 +34,12 @@ static void uiContainer_remove(GtkContainer *container, GtkWidget *widget)
static void uiContainer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
+ uiControl *c;
+ uiSizing d;
+
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 {
diff --git a/new/main_unix.c b/new/main_unix.c
index 90374c7..aae049b 100644
--- a/new/main_unix.c
+++ b/new/main_unix.c
@@ -12,3 +12,9 @@ void uiQuit(void)
{
gtk_main_quit();
}
+
+// TODO move somewhere else
+uintptr_t uiControlHandle(uiControl *c)
+{
+ return (*(c->handle))(c);
+}
diff --git a/new/uipriv_unix.h b/new/uipriv_unix.h
index 5cf2bff..95b2468 100644
--- a/new/uipriv_unix.h
+++ b/new/uipriv_unix.h
@@ -18,7 +18,9 @@ typedef struct uiContainer uiContainer;
typedef struct uiContainerClass uiContainerClass;
struct uiContainer {
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()
};
struct uiContainerClass {
diff --git a/new/window_unix.c b/new/window_unix.c
index 3a145ac..ecc520c 100644
--- a/new/window_unix.c
+++ b/new/window_unix.c
@@ -3,6 +3,7 @@
struct uiWindow {
GtkWidget *widget;
+ GtkWidget *container;
int (*onClosing)(uiWindow *, void *);
void *onClosingData;
};
@@ -15,6 +16,8 @@ uiWindow *uiNewWindow(char *title, int width, int height)
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(w->widget), title);
gtk_window_resize(GTK_WINDOW(w->widget), width, height);
+ w->container = newContainer();
+ gtk_container_add(GTK_CONTAINER(w->widget), w->container);
return w;
}
@@ -58,3 +61,9 @@ void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
w->onClosingData = data;
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));
+}