Reimplemented GTK+ uiLabel.

This commit is contained in:
Pietro Gagliardi 2015-06-30 22:10:52 -04:00
parent a79368e26b
commit 8e89f60330
2 changed files with 2 additions and 46 deletions

View File

@ -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));
}

View File

@ -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);
}