2015-04-08 22:28:47 -05:00
|
|
|
// 8 april 2015
|
|
|
|
#include "uipriv_unix.h"
|
|
|
|
|
|
|
|
struct entry {
|
2015-04-15 21:17:02 -05:00
|
|
|
uiEntry e;
|
2015-04-16 21:21:02 -05:00
|
|
|
GtkWidget *widget;
|
|
|
|
GtkEntry *entry;
|
2015-04-08 22:28:47 -05:00
|
|
|
};
|
|
|
|
|
2015-04-18 16:14:19 -05:00
|
|
|
static void onDestroy(void *data)
|
2015-04-08 22:28:47 -05:00
|
|
|
{
|
2015-04-18 16:14:19 -05:00
|
|
|
struct entry *e = (struct entry *) data;
|
2015-04-08 22:28:47 -05:00
|
|
|
|
|
|
|
uiFree(e);
|
|
|
|
}
|
|
|
|
|
2015-04-16 21:21:02 -05:00
|
|
|
static char *entryText(uiEntry *ee)
|
2015-04-15 21:17:02 -05:00
|
|
|
{
|
2015-04-16 21:21:02 -05:00
|
|
|
struct entry *e = (struct entry *) ee;
|
|
|
|
|
|
|
|
return g_strdup(gtk_entry_get_text(e->entry));
|
2015-04-15 21:17:02 -05:00
|
|
|
}
|
|
|
|
|
2015-04-16 21:21:02 -05:00
|
|
|
static void entrySetText(uiEntry *ee, const char *text)
|
2015-04-15 21:17:02 -05:00
|
|
|
{
|
2015-04-16 21:21:02 -05:00
|
|
|
struct entry *e = (struct entry *) ee;
|
|
|
|
|
|
|
|
gtk_entry_set_text(e->entry, text);
|
2015-04-15 21:17:02 -05:00
|
|
|
}
|
|
|
|
|
2015-04-15 22:07:43 -05:00
|
|
|
uiEntry *uiNewEntry(void)
|
2015-04-08 22:28:47 -05:00
|
|
|
{
|
|
|
|
struct entry *e;
|
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
e = uiNew(struct entry);
|
|
|
|
|
|
|
|
uiUnixNewControl(uiControl(e), GTK_TYPE_ENTRY,
|
2015-04-18 16:14:19 -05:00
|
|
|
FALSE, FALSE, onDestroy, e,
|
2015-04-08 22:28:47 -05:00
|
|
|
NULL);
|
|
|
|
|
2015-04-29 09:36:31 -05:00
|
|
|
e->widget = GTK_WIDGET(uiControlHandle(uiControl(e)));
|
2015-04-16 21:21:02 -05:00
|
|
|
e->entry = GTK_ENTRY(e->widget);
|
|
|
|
|
|
|
|
uiEntry(e)->Text = entryText;
|
|
|
|
uiEntry(e)->SetText = entrySetText;
|
2015-04-09 01:56:51 -05:00
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
return uiEntry(e);
|
2015-04-09 01:56:51 -05:00
|
|
|
}
|