Reimplemented GTK+ uiLabel.
This commit is contained in:
parent
a79368e26b
commit
8e89f60330
|
@ -21,14 +21,14 @@ static char *labelText(uiLabel *ll)
|
|||
{
|
||||
struct label *l = (struct label *) ll;
|
||||
|
||||
return PUT_CODE_HERE;
|
||||
return uiUnixStrdupText(gtk_label_get_text(l->label));
|
||||
}
|
||||
|
||||
static void labelSetText(uiLabel *ll, const char *text)
|
||||
{
|
||||
struct label *l = (struct label *) ll;
|
||||
|
||||
PUT_CODE_HERE;
|
||||
gtk_label_set_text(l->label, text);
|
||||
// changing the text might necessitate a change in the label's size
|
||||
uiControlQueueResize(uiControl(l));
|
||||
}
|
||||
|
|
44
unix/label.c
44
unix/label.c
|
@ -1,44 +0,0 @@
|
|||
// 11 april 2015
|
||||
#include "uipriv_unix.h"
|
||||
|
||||
struct label {
|
||||
uiLabel l;
|
||||
GtkWidget *widget;
|
||||
GtkLabel *label;
|
||||
};
|
||||
|
||||
static void onDestroy(void *data)
|
||||
{
|
||||
struct label *l = (struct label *) data;
|
||||
|
||||
uiFree(l);
|
||||
}
|
||||
|
||||
static char *labelText(uiLabel *ll)
|
||||
{
|
||||
struct label *l = (struct label *) ll;
|
||||
|
||||
return uiUnixStrdupText(gtk_label_get_text(l->label));
|
||||
}
|
||||
|
||||
static void labelSetText(uiLabel *ll, const char *text)
|
||||
{
|
||||
struct label *l = (struct label *) ll;
|
||||
|
||||
gtk_label_set_text(l->label, text);
|
||||
}
|
||||
|
||||
uiLabel *uiNewLabel(const char *text)
|
||||
{
|
||||
struct label *l;
|
||||
|
||||
l = uiNew(struct label);
|
||||
|
||||
l->widget = GTK_WIDGET(uiControlHandle(uiControl(l)));
|
||||
l->label = GTK_LABEL(l->widget);
|
||||
|
||||
uiLabel(l)->Text = labelText;
|
||||
uiLabel(l)->SetText = labelSetText;
|
||||
|
||||
return uiLabel(l);
|
||||
}
|
Loading…
Reference in New Issue