Implemented the text routines on the GTK+ backend. They work!

This commit is contained in:
Pietro Gagliardi 2015-04-09 02:56:51 -04:00
parent a0073727c8
commit 723f2af8c6
4 changed files with 35 additions and 2 deletions

View File

@ -47,7 +47,15 @@ uiControl *uiNewButton(const char *text)
return b->c;
}
// TODO text
char *uiButtonText(uiControl *c)
{
return g_strdup(gtk_button_get_label(GTK_BUTTON(uiControlHandle(c))));
}
void uiButtonSetText(uiControl *c, const char *text)
{
gtk_button_set_label(GTK_BUTTON(uiControlHandle(c)), text);
}
void uiButtonOnClicked(uiControl *c, void (*f)(uiControl *, void *), void *data)
{

View File

@ -30,3 +30,13 @@ uiControl *uiNewEntry(void)
return e->c;
}
char *uiEntryText(uiControl *c)
{
return g_strdup(gtk_entry_get_text(GTK_ENTRY(uiControlHandle(c))));
}
void uiEntrySetText(uiControl *c, const char *text)
{
gtk_entry_set_text(GTK_ENTRY(uiControlHandle(c)), text);
}

7
new/util_unix.c Normal file
View File

@ -0,0 +1,7 @@
// 9 april 2015
#include "uipriv_unix.h"
void uiFreeText(char *t)
{
g_free(t);
}

View File

@ -39,7 +39,15 @@ uintptr_t uiWindowHandle(uiWindow *w)
return (uintptr_t) (w->widget);
}
// TODO titles
char *uiWindowTitle(uiWindow *w)
{
return g_strdup(gtk_window_get_title(GTK_WINDOW(w->widget)));
}
void uiWindowSetTitle(uiWindow *w, const char *title)
{
gtk_window_set_title(GTK_WINDOW(w->widget), title);
}
void uiWindowShow(uiWindow *w)
{