libui/redo/unix/radiobuttons.c

46 lines
1.1 KiB
C
Raw Normal View History

2015-06-11 18:07:06 -05:00
// 11 june 2015
#include "uipriv_unix.h"
// on GTK+ a uiRadioButtons is a GtkBox with each of the GtkRadioButtons as children
2015-06-11 18:07:06 -05:00
struct radiobuttons {
uiRadioButtons r;
GtkWidget *boxWidget;
GtkBox *box;
2015-06-11 18:07:06 -05:00
};
uiDefineControlType(uiRadioButtons, uiTypeRadioButtons, struct radiobuttons)
2015-06-29 19:41:41 -05:00
// TODO note that the handle of a uiRadioButtons is undefined (or at least highly platform-dependent and unreliable)
2015-06-11 18:07:06 -05:00
static uintptr_t radiobuttonsHandle(uiControl *c)
{
2015-06-29 19:37:55 -05:00
struct radiobuttons *r = (struct radiobuttons *) c;
return (uintptr_t) (r->boxWidget);
2015-06-11 18:07:06 -05:00
}
static void radiobuttonsAppend(uiRadioButtons *rr, const char *text)
{
struct radiobuttons *r = (struct radiobuttons *) rr;
PUT_CODE_HERE;
uiControlQueueResize(uiControl(r));
}
uiRadioButtons *uiNewRadioButtons(void)
{
struct radiobuttons *r;
r = (struct radiobuttons *) uiNewControl(uiTypeRadioButtons());
2015-06-11 18:07:06 -05:00
r->boxWidget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
r->box = GTK_BOX(r->boxWidget);
uiUnixMakeSingleWidgetControl(uiControl(r), r->boxWidget);
2015-06-11 18:07:06 -05:00
uiControl(r)->Handle = radiobuttonsHandle;
uiRadioButtons(r)->Append = radiobuttonsAppend;
return uiRadioButtons(r);
}