2020-11-17 11:16:16 +00:00
|
|
|
#include "entry.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
void entry_set_string(ui::Entry entry, const char *string)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
gtk_entry_set_text(entry, string);
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void entry_set_int(ui::Entry entry, int i)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
char buf[32];
|
|
|
|
sprintf(buf, "%d", i);
|
|
|
|
entry_set_string(entry, buf);
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void entry_set_float(ui::Entry entry, float f)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
char buf[32];
|
|
|
|
sprintf(buf, "%g", f);
|
|
|
|
entry_set_string(entry, buf);
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *entry_get_string(ui::Entry entry)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
return gtk_entry_get_text(entry);
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int entry_get_int(ui::Entry entry)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
return atoi(entry_get_string(entry));
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double entry_get_float(ui::Entry entry)
|
|
|
|
{
|
2021-08-04 20:23:18 +00:00
|
|
|
return atof(entry_get_string(entry));
|
2020-11-17 11:16:16 +00:00
|
|
|
}
|