Finished the conversions. Let's hope it works!
This commit is contained in:
parent
289ca0ed78
commit
3f16e28d1b
20
unix/tab.c
20
unix/tab.c
|
@ -11,15 +11,11 @@ struct uiTab {
|
||||||
GArray *pages; // []*struct child
|
GArray *pages; // []*struct child
|
||||||
};
|
};
|
||||||
|
|
||||||
static void onDestroy(uiTab *);
|
uiUnixControlAllDefaultsExceptDestroy(uiTab)
|
||||||
|
|
||||||
uiUnixDefineControlWithOnDestroy(
|
static void uiTabDestroy(uiControl *c)
|
||||||
uiTab, // type name
|
|
||||||
onDestroy(this); // on destroy
|
|
||||||
)
|
|
||||||
|
|
||||||
static void onDestroy(uiTab *t)
|
|
||||||
{
|
{
|
||||||
|
uiTab *t = uiTab(c);
|
||||||
guint i;
|
guint i;
|
||||||
struct child *page;
|
struct child *page;
|
||||||
|
|
||||||
|
@ -28,10 +24,11 @@ static void onDestroy(uiTab *t)
|
||||||
childDestroy(page);
|
childDestroy(page);
|
||||||
}
|
}
|
||||||
g_array_free(t->pages, TRUE);
|
g_array_free(t->pages, TRUE);
|
||||||
|
// and free ourselves
|
||||||
|
g_object_unref(t->widget);
|
||||||
|
uiControlFree(uiControl(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO tabContainerUpdateState()
|
|
||||||
|
|
||||||
void uiTabAppend(uiTab *t, const char *name, uiControl *child)
|
void uiTabAppend(uiTab *t, const char *name, uiControl *child)
|
||||||
{
|
{
|
||||||
uiTabInsertAt(t, name, t->pages->len, child);
|
uiTabInsertAt(t, name, t->pages->len, child);
|
||||||
|
@ -86,7 +83,7 @@ uiTab *uiNewTab(void)
|
||||||
{
|
{
|
||||||
uiTab *t;
|
uiTab *t;
|
||||||
|
|
||||||
t = (uiTab *) uiNewControl(uiTab);
|
uiUnixNewControl(uiTab, t);
|
||||||
|
|
||||||
t->widget = gtk_notebook_new();
|
t->widget = gtk_notebook_new();
|
||||||
t->container = GTK_CONTAINER(t->widget);
|
t->container = GTK_CONTAINER(t->widget);
|
||||||
|
@ -96,8 +93,5 @@ uiTab *uiNewTab(void)
|
||||||
|
|
||||||
t->pages = g_array_new(FALSE, TRUE, sizeof (struct child *));
|
t->pages = g_array_new(FALSE, TRUE, sizeof (struct child *));
|
||||||
|
|
||||||
uiUnixFinishNewControl(t, uiTab);
|
|
||||||
//TODO uiControl(t)->ContainerUpdateState = tabContainerUpdateState;
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,6 @@ struct uiWindow {
|
||||||
void *onClosingData;
|
void *onClosingData;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void onDestroy(uiWindow *);
|
|
||||||
|
|
||||||
uiUnixDefineControlWithOnDestroy(
|
|
||||||
uiWindow, // type name
|
|
||||||
onDestroy(this); // on destroy
|
|
||||||
)
|
|
||||||
|
|
||||||
static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
|
static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
|
||||||
{
|
{
|
||||||
uiWindow *w = uiWindow(data);
|
uiWindow *w = uiWindow(data);
|
||||||
|
@ -44,8 +37,10 @@ static int defaultOnClosing(uiWindow *w, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onDestroy(uiWindow *w)
|
static void uiWindowDestroy(uiControl *c)
|
||||||
{
|
{
|
||||||
|
uiWindow *w = uiWindow(c);
|
||||||
|
|
||||||
// first hide ourselves
|
// first hide ourselves
|
||||||
gtk_widget_hide(w->widget);
|
gtk_widget_hide(w->widget);
|
||||||
// now destroy the child
|
// now destroy the child
|
||||||
|
@ -55,9 +50,25 @@ static void onDestroy(uiWindow *w)
|
||||||
if (w->menubar != NULL)
|
if (w->menubar != NULL)
|
||||||
freeMenubar(w->menubar);
|
freeMenubar(w->menubar);
|
||||||
gtk_widget_destroy(w->vboxWidget);
|
gtk_widget_destroy(w->vboxWidget);
|
||||||
|
// and finally free ourselves
|
||||||
|
g_object_unref(w->widget);
|
||||||
|
uiFreeControl(uiControl(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowCommitShow(uiControl *c)
|
uiUnixControlDefaultHandle(uiWindow)
|
||||||
|
// TODO?
|
||||||
|
uiUnixControlDefaultParent(uiWindow)
|
||||||
|
uiUnixControlDefaultSetParent(uiWindow)
|
||||||
|
// end TODO
|
||||||
|
|
||||||
|
static int uiWindowToplevel(uiControl *c)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiUnixControlDefaultVisible(uiWindow)
|
||||||
|
|
||||||
|
static void uiWindowShow(uiControl *c)
|
||||||
{
|
{
|
||||||
uiWindow *w = uiWindow(c);
|
uiWindow *w = uiWindow(c);
|
||||||
|
|
||||||
|
@ -67,13 +78,12 @@ static void windowCommitShow(uiControl *c)
|
||||||
gtk_window_present(w->window);
|
gtk_window_present(w->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void windowContainerUpdateState(uiControl *c)
|
uiUnixControlDefaultHide(uiWindow)
|
||||||
{
|
uiUnixControlDefaultEnabled(uiWindow)
|
||||||
uiWindow *w = uiWindow(c);
|
uiUnixControlDefaultEnable(uiWindow)
|
||||||
|
uiUnixControlDefaultDisable(uiWindow)
|
||||||
if (w->child != NULL)
|
// TODO?
|
||||||
childUpdateState(w->child);
|
uiUnixControlDefaultSetContainer(uiWindow)
|
||||||
}
|
|
||||||
|
|
||||||
char *uiWindowTitle(uiWindow *w)
|
char *uiWindowTitle(uiWindow *w)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +93,6 @@ char *uiWindowTitle(uiWindow *w)
|
||||||
void uiWindowSetTitle(uiWindow *w, const char *title)
|
void uiWindowSetTitle(uiWindow *w, const char *title)
|
||||||
{
|
{
|
||||||
gtk_window_set_title(w->window, title);
|
gtk_window_set_title(w->window, title);
|
||||||
// don't queue resize; the caption isn't part of what affects layout and sizing of the client area (it'll be ellipsized if too long)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
|
void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
|
||||||
|
@ -121,7 +130,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
{
|
{
|
||||||
uiWindow *w;
|
uiWindow *w;
|
||||||
|
|
||||||
w = (uiWindow *) uiNewControl(uiWindow);
|
uiUnixNewControl(uiWindow, w);
|
||||||
|
|
||||||
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
w->container = GTK_CONTAINER(w->widget);
|
w->container = GTK_CONTAINER(w->widget);
|
||||||
|
@ -149,9 +158,5 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
g_signal_connect(w->widget, "delete-event", G_CALLBACK(onClosing), w);
|
g_signal_connect(w->widget, "delete-event", G_CALLBACK(onClosing), w);
|
||||||
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
uiWindowOnClosing(w, defaultOnClosing, NULL);
|
||||||
|
|
||||||
uiUnixFinishNewControl(w, uiWindow);
|
|
||||||
uiControl(w)->CommitShow = windowCommitShow;
|
|
||||||
uiControl(w)->ContainerUpdateState = windowContainerUpdateState;
|
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue