blob: ec6e5da024e6f98d6af98affcb4b4a829727c6a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// 11 april 2015
#include "uipriv_unix.h"
struct label {
};
static void onDestroy(GtkWidget *widget, gpointer data)
{
struct label *l = (struct label *) data;
uiFree(l);
}
uiControl *uiNewLabel(const char *text)
{
uiControl *c;
struct label *l;
GtkWidget *widget;
c = uiUnixNewControl(GTK_TYPE_LABEL,
FALSE, FALSE,
"label", text,
"xalign", 0,
// TODO yalign 0?
NULL);
widget = GTK_WIDGET(uiControlHandle(c));
l = uiNew(struct label);
g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), l);
c->data = l;
return c;
}
char *uiLabelText(uiControl *c)
{
// TODO change g_strdup() to a wrapper function for export in ui_unix.h
return g_strdup(gtk_label_get_text(GTK_LABEL(uiControlHandle(c))));
}
void uiLabelSetText(uiControl *c, const char *text)
{
gtk_label_set_text(GTK_LABEL(uiControlHandle(c)), text);
}
|