andlabs-ui/new/entry_unix.c

42 lines
707 B
C
Raw Normal View History

2015-04-08 22:28:47 -05:00
// 8 april 2015
#include "uipriv_unix.h"
struct entry {
};
static void onDestroy(GtkWidget *widget, gpointer data)
{
struct entry *e = (struct entry *) data;
uiFree(e);
}
uiControl *uiNewEntry(void)
{
uiControl *c;
2015-04-08 22:28:47 -05:00
struct entry *e;
GtkWidget *widget;
c = uiUnixNewControl(GTK_TYPE_ENTRY,
FALSE, FALSE,
2015-04-08 22:28:47 -05:00
NULL);
widget = GTK_WIDGET(uiControlHandle(c));
e = uiNew(struct entry);
2015-04-08 22:28:47 -05:00
g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), e);
c->data = e;
2015-04-08 22:28:47 -05:00
return c;
2015-04-08 22:28:47 -05:00
}
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);
}