Fixed Unix backend build errors. Impressively, IT STILL WORKS! Now to fix the warnings...

This commit is contained in:
Pietro Gagliardi 2015-04-15 23:07:43 -04:00
parent e49436170a
commit 0c73a7fb80
6 changed files with 22 additions and 22 deletions

View File

@ -38,20 +38,20 @@ static void setText(uiButton *b, const char *text)
gtk_button_set_label(BUTTON(b), text); gtk_button_set_label(BUTTON(b), text);
} }
static void setOnClicked(uiButton *b, void (*f)(uiControl *, void *), void *data) static void setOnClicked(uiButton *bb, void (*f)(uiControl *, void *), void *data)
{ {
struct button *b = (struct button *) b; struct button *b = (struct button *) bb;
b->onClicked = f; b->onClicked = f;
b->onClickedData = data; b->onClickedData = data;
} }
uiControl *uiNewButton(const char *text) uiButton *uiNewButton(const char *text)
{ {
struct button *b; struct button *b;
GtkWidget *widget; GtkWidget *widget;
b = uiNew(b); b = uiNew(struct button);
uiUnixNewControl(uiControl(b), GTK_TYPE_BUTTON, uiUnixNewControl(uiControl(b), GTK_TYPE_BUTTON,
FALSE, FALSE, FALSE, FALSE,

View File

@ -3,7 +3,7 @@
struct checkbox { struct checkbox {
uiCheckbox c; uiCheckbox c;
void (*onToggled)(uiControl *, void *); void (*onToggled)(uiCheckbox *, void *);
void *onToggledData; void *onToggledData;
gulong onToggledSignal; gulong onToggledSignal;
}; };
@ -12,10 +12,10 @@ static void onToggled(GtkToggleButton *b, gpointer data)
{ {
struct checkbox *c = (struct checkbox *) data; struct checkbox *c = (struct checkbox *) data;
(*(c->onToggled))(uiControl(c), c->onToggledData); (*(c->onToggled))(uiCheckbox(c), c->onToggledData);
} }
static void defaultOnToggled(uiControl *c, void *data) static void defaultOnToggled(uiCheckbox *c, void *data)
{ {
// do nothing // do nothing
} }
@ -39,9 +39,9 @@ static void setText(uiCheckbox *c, const char *text)
gtk_button_set_label(CHECKBOX(c), text); gtk_button_set_label(CHECKBOX(c), text);
} }
static void setOnToggled(uiCheckbox *c, void (*f)(uiControl *, void *), void *data) static void setOnToggled(uiCheckbox *cc, void (*f)(uiCheckbox *, void *), void *data)
{ {
struct checkbox *c = (struct checkbox *) c; struct checkbox *c = (struct checkbox *) cc;
c->onToggled = f; c->onToggled = f;
c->onToggledData = data; c->onToggledData = data;
@ -52,9 +52,9 @@ static int getChecked(uiCheckbox *c)
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CHECKBOX(c))) != FALSE; return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CHECKBOX(c))) != FALSE;
} }
static void setChecked(uiCheckbox *c, int checked) static void setChecked(uiCheckbox *cc, int checked)
{ {
struct checkbox *cc = (struct checkbox *) c; struct checkbox *c = (struct checkbox *) cc;
GtkToggleButton *button; GtkToggleButton *button;
gboolean active; gboolean active;
@ -63,12 +63,12 @@ static void setChecked(uiCheckbox *c, int checked)
active = TRUE; active = TRUE;
// we need to inhibit sending of ::toggled because this WILL send a ::toggled otherwise // we need to inhibit sending of ::toggled because this WILL send a ::toggled otherwise
button = GTK_TOGGLE_BUTTON(CHECKBOX(c)); button = GTK_TOGGLE_BUTTON(CHECKBOX(c));
g_signal_handler_block(button, cc->onToggledSignal); g_signal_handler_block(button, c->onToggledSignal);
gtk_toggle_button_set_active(button, active); gtk_toggle_button_set_active(button, active);
g_signal_handler_unblock(button, cc->onToggledSignal); g_signal_handler_unblock(button, c->onToggledSignal);
} }
uiControl *uiNewCheckbox(const char *text) uiCheckbox *uiNewCheckbox(const char *text)
{ {
struct checkbox *c; struct checkbox *c;
GtkWidget *widget; GtkWidget *widget;

View File

@ -19,12 +19,12 @@ static char *getText(uiEntry *e)
return g_strdup(gtk_entry_get_text(ENTRY(e))); return g_strdup(gtk_entry_get_text(ENTRY(e)));
} }
static void uiEntrySetText(uiEntry *e, const char *text) static void setText(uiEntry *e, const char *text)
{ {
gtk_entry_set_text(ENTRY(e), text); gtk_entry_set_text(ENTRY(e), text);
} }
uiControl *uiNewEntry(void) uiEntry *uiNewEntry(void)
{ {
struct entry *e; struct entry *e;
GtkWidget *widget; GtkWidget *widget;

View File

@ -25,7 +25,7 @@ static void setText(uiLabel *l, const char *text)
gtk_label_set_text(LABEL(l), text); gtk_label_set_text(LABEL(l), text);
} }
uiControl *uiNewLabel(const char *text) uiLabel *uiNewLabel(const char *text)
{ {
struct label *l; struct label *l;
GtkWidget *widget; GtkWidget *widget;

View File

@ -31,7 +31,7 @@ static void addPage(uiTab *tt, const char *name, uiControl *child)
t->pages = (uiParent **) uiRealloc(t->pages, t->cap * sizeof (uiParent *), "uiParent *[]"); t->pages = (uiParent **) uiRealloc(t->pages, t->cap * sizeof (uiParent *), "uiParent *[]");
} }
notebook = GTK_WIDGET(uiControlHandle(c)); notebook = GTK_WIDGET(TAB(t));
content = uiNewParent((uintptr_t) notebook); content = uiNewParent((uintptr_t) notebook);
uiParentSetChild(content, child); uiParentSetChild(content, child);
uiParentUpdate(content); uiParentUpdate(content);
@ -41,7 +41,7 @@ static void addPage(uiTab *tt, const char *name, uiControl *child)
t->len++; t->len++;
} }
uiControl *uiNewTab(void) uiTab *uiNewTab(void)
{ {
uiControl *c; uiControl *c;
struct tab *t; struct tab *t;

View File

@ -46,7 +46,7 @@ static uintptr_t handle(uiWindow *ww)
return (uintptr_t) (w->widget); return (uintptr_t) (w->widget);
} }
static char *title(uiWindow *ww) static char *getTitle(uiWindow *ww)
{ {
struct window *w = (struct window *) ww; struct window *w = (struct window *) ww;
@ -109,7 +109,7 @@ static void setMargined(uiWindow *ww, int margined)
uiParentUpdate(w->content); uiParentUpdate(w->content);
} }
uiWindow *uiNewWindow(char *title, int width, int height) uiWindow *uiNewWindow(const char *title, int width, int height)
{ {
struct window *w; struct window *w;
@ -124,7 +124,7 @@ uiWindow *uiNewWindow(char *title, int width, int height)
uiWindow(w)->Destroy = windowDestroy; uiWindow(w)->Destroy = windowDestroy;
uiWindow(w)->Handle = handle; uiWindow(w)->Handle = handle;
uiWindow(w)->Title = title; uiWindow(w)->Title = getTitle;
uiWindow(w)->SetTitle = setTitle; uiWindow(w)->SetTitle = setTitle;
uiWindow(w)->Show = show; uiWindow(w)->Show = show;
uiWindow(w)->Hide = hide; uiWindow(w)->Hide = hide;