More GTK+ control stubbing.
This commit is contained in:
parent
5ae4afd0d5
commit
da520af372
|
@ -4,6 +4,9 @@
|
|||
struct checkbox {
|
||||
uiCheckbox c;
|
||||
GtkWidget *widget;
|
||||
GtkButton *button;
|
||||
GtkToggleButton *toggleButton;
|
||||
GtkCheckButton *checkButton;
|
||||
void (*onToggled)(uiCheckbox *, void *);
|
||||
void *onToggledData;
|
||||
};
|
||||
|
@ -66,7 +69,11 @@ uiCheckbox *uiNewCheckbox(const char *text)
|
|||
|
||||
c = (struct checkbox *) uiNewControl(uiTypeCheckbox());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
c->widget = gtk_check_button_new_with_label(text);
|
||||
c->button = GTK_BUTTON(c->widget);
|
||||
c->toggleButton = GTK_TOGGLE_BUTTON(c->widget);
|
||||
c->checkButton = GTK_CHECK_BUTTON(c->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(c), c->widget);
|
||||
|
||||
c->onToggled = defaultOnToggled;
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
struct entry {
|
||||
uiEntry e;
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
GtkEditable *editable;
|
||||
void (*onChanged)(uiEntry *, void *);
|
||||
void *onChangedData;
|
||||
};
|
||||
|
@ -65,7 +67,10 @@ uiEntry *uiNewEntry(void)
|
|||
|
||||
e = (struct entry *) uiNewControl(uiTypeEntry());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
e->widget = gtk_entry_new();
|
||||
e->entry = GTK_ENTRY(e->widget);
|
||||
e->editable = GTK_EDITABLE(e->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(e), e->widget);
|
||||
|
||||
e->onChanged = defaultOnChanged;
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
struct label {
|
||||
uiLabel l;
|
||||
GtkWidget *widget;
|
||||
GtkMisc *misc;
|
||||
GtkLabel *label;
|
||||
};
|
||||
|
||||
uiDefineControlType(uiLabel, uiTypeLabel, struct label)
|
||||
|
@ -37,7 +39,12 @@ uiLabel *uiNewLabel(const char *text)
|
|||
|
||||
l = (struct label *) uiNewControl(uiTypeLabel());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
l->widget = gtk_label_new(text);
|
||||
l->misc = GTK_MISC(l->widget);
|
||||
l->label = GTK_LABEL(l->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(l), l->widget);
|
||||
|
||||
gtk_misc_set_alignment(l->misc, 0, 0);
|
||||
|
||||
uiControl(l)->Handle = labelHandle;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
struct progressbar {
|
||||
uiProgressBar p;
|
||||
GtkWidget *widget;
|
||||
GtkProgressBar *pbar;
|
||||
};
|
||||
|
||||
uiDefineControlType(uiProgressBar, uiTypeProgressBar, struct progressbar)
|
||||
|
@ -30,7 +31,9 @@ uiProgressBar *uiNewProgressBar(void)
|
|||
|
||||
p = (struct progressbar *) uiNewControl(uiTypeProgressBar());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
p->widget = gtk_progress_bar_new();
|
||||
p->pbar = GTK_PROGRESS_BAR(p->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(p), p->widget);
|
||||
|
||||
uiControl(p)->Handle = progressbarHandle;
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
struct slider {
|
||||
uiSlider s;
|
||||
GtkWidget *widget;
|
||||
GtkRange *range;
|
||||
GtkScale *scale;
|
||||
void (*onChanged)(uiSlider *, void *);
|
||||
void *onChangedData;
|
||||
};
|
||||
|
@ -50,7 +52,13 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
|
|||
|
||||
s = (struct slider *) uiNewControl(uiTypeSlider());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
s->widget = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, min, max, 1);
|
||||
s->range = GTK_RANGE(s->widget);
|
||||
s->scale = GTK_SCALE(s->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(s), s->widget);
|
||||
|
||||
// TODO needed?
|
||||
gtk_scale_set_digits(s->scale, 0);
|
||||
|
||||
s->onChanged = defaultOnChanged;
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
struct spinbox {
|
||||
uiSpinbox s;
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
GtkSpinButton *spinButton;
|
||||
void (*onChanged)(uiSpinbox *, void *);
|
||||
void *onChangedData;
|
||||
};
|
||||
|
@ -52,7 +55,13 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
|
|||
|
||||
s = (struct spinbox *) uiNewControl(uiTypeSpinbox());
|
||||
|
||||
PUT_CODE_HERE;
|
||||
s->widget = gtk_spin_button_new_with_range(min, max, 1);
|
||||
s->entry = GTK_ENTRY(s->widget);
|
||||
s->spinButton = GTK_SPIN_BUTTON(s->widget);
|
||||
uiUnixMakeSingleWidgetControl(uiControl(s), s->widget);
|
||||
|
||||
// TODO needed?
|
||||
gtk_spin_button_set_digits(s->spinButton, 0);
|
||||
|
||||
s->onChanged = defaultOnChanged;
|
||||
|
||||
|
|
|
@ -80,16 +80,6 @@ uiCheckbox *uiNewCheckbox(const char *text)
|
|||
|
||||
c = uiNew(struct checkbox);
|
||||
|
||||
uiUnixMakeControl(uiControl(c), GTK_TYPE_CHECK_BUTTON,
|
||||
FALSE, FALSE, onDestroy, c,
|
||||
"label", text,
|
||||
NULL);
|
||||
|
||||
c->widget = GTK_WIDGET(uiControlHandle(uiControl(c)));
|
||||
c->button = GTK_BUTTON(c->widget);
|
||||
c->toggleButton = GTK_TOGGLE_BUTTON(c->widget);
|
||||
c->checkButton = GTK_CHECK_BUTTON(c->widget);
|
||||
|
||||
c->onToggledSignal = g_signal_connect(c->widget, "toggled", G_CALLBACK(onToggled), c);
|
||||
c->onToggled = defaultOnToggled;
|
||||
|
||||
|
|
|
@ -79,14 +79,6 @@ uiEntry *uiNewEntry(void)
|
|||
|
||||
e = uiNew(struct entry);
|
||||
|
||||
uiUnixMakeControl(uiControl(e), GTK_TYPE_ENTRY,
|
||||
FALSE, FALSE, onDestroy, e,
|
||||
NULL);
|
||||
|
||||
e->widget = GTK_WIDGET(uiControlHandle(uiControl(e)));
|
||||
e->entry = GTK_ENTRY(e->widget);
|
||||
e->editable = GTK_EDITABLE(e->widget);
|
||||
|
||||
e->onChangedSignal = g_signal_connect(e->widget, "changed", G_CALLBACK(onChanged), e);
|
||||
e->onChanged = defaultOnChanged;
|
||||
|
||||
|
|
|
@ -34,13 +34,6 @@ uiLabel *uiNewLabel(const char *text)
|
|||
|
||||
l = uiNew(struct label);
|
||||
|
||||
uiUnixMakeControl(uiControl(l), GTK_TYPE_LABEL,
|
||||
FALSE, FALSE, onDestroy, l,
|
||||
"label", text,
|
||||
"xalign", 0.0, // note: must be a float constant, otherwise the ... will turn it into an int and we get segfaults on some platforms (thanks ebassi in irc.gimp.net/#gtk+)
|
||||
"yalign", 0.0,
|
||||
NULL);
|
||||
|
||||
l->widget = GTK_WIDGET(uiControlHandle(uiControl(l)));
|
||||
l->label = GTK_LABEL(l->widget);
|
||||
|
||||
|
|
Loading…
Reference in New Issue