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-08 22:28:47 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
static void onDestroy(GtkWidget *widget, gpointer data)
|
|
|
|
{
|
|
|
|
struct entry *e = (struct entry *) data;
|
|
|
|
|
|
|
|
uiFree(e);
|
|
|
|
}
|
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
#define ENTRY(e) GTK_ENTRY(uiControlHandle(uiControl(e)))
|
|
|
|
|
|
|
|
static char *getText(uiEntry *e)
|
|
|
|
{
|
|
|
|
return g_strdup(gtk_entry_get_text(ENTRY(e)));
|
|
|
|
}
|
|
|
|
|
2015-04-15 22:07:43 -05:00
|
|
|
static void setText(uiEntry *e, const char *text)
|
2015-04-15 21:17:02 -05:00
|
|
|
{
|
|
|
|
gtk_entry_set_text(ENTRY(e), text);
|
|
|
|
}
|
|
|
|
|
2015-04-15 22:07:43 -05:00
|
|
|
uiEntry *uiNewEntry(void)
|
2015-04-08 22:28:47 -05:00
|
|
|
{
|
|
|
|
struct entry *e;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
e = uiNew(struct entry);
|
|
|
|
|
|
|
|
uiUnixNewControl(uiControl(e), GTK_TYPE_ENTRY,
|
2015-04-09 17:17:04 -05:00
|
|
|
FALSE, FALSE,
|
2015-04-08 22:28:47 -05:00
|
|
|
NULL);
|
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
widget = GTK_WIDGET(ENTRY(e));
|
2015-04-08 22:28:47 -05:00
|
|
|
g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), e);
|
2015-04-09 01:56:51 -05:00
|
|
|
|
2015-04-15 21:17:02 -05:00
|
|
|
uiEntry(e)->Text = getText;
|
|
|
|
uiEntry(e)->SetText = setText;
|
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
|
|
|
}
|