2015-06-11 18:07:06 -05:00
|
|
|
// 11 june 2015
|
|
|
|
#include "uipriv_unix.h"
|
|
|
|
|
2015-06-27 18:57:10 -05:00
|
|
|
// on GTK+ a uiRadioButtons is a GtkBox with each of the GtkRadioButtons as children
|
|
|
|
|
2015-08-28 09:30:42 -05:00
|
|
|
struct uiRadioButtons {
|
2015-08-27 22:00:34 -05:00
|
|
|
uiUnixControl c;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkContainer *container;
|
2015-06-27 18:57:10 -05:00
|
|
|
GtkBox *box;
|
2015-07-01 11:39:05 -05:00
|
|
|
GPtrArray *buttons;
|
2015-06-11 18:07:06 -05:00
|
|
|
};
|
|
|
|
|
2016-04-25 19:00:25 -05:00
|
|
|
uiUnixControlAllDefaultsExceptDestroy(uiRadioButtons)
|
2015-06-11 18:07:06 -05:00
|
|
|
|
2016-04-25 19:00:25 -05:00
|
|
|
static void uiRadioButtonsDestroy(uiControl *c)
|
2015-06-11 18:07:06 -05:00
|
|
|
{
|
2015-08-27 22:00:34 -05:00
|
|
|
// TODO
|
2015-06-11 18:07:06 -05:00
|
|
|
}
|
|
|
|
|
2015-08-28 09:30:42 -05:00
|
|
|
void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
|
2015-06-11 18:07:06 -05:00
|
|
|
{
|
2015-07-01 11:39:05 -05:00
|
|
|
GtkWidget *rb;
|
|
|
|
GtkRadioButton *previous;
|
|
|
|
|
|
|
|
previous = NULL;
|
|
|
|
if (r->buttons->len > 0)
|
|
|
|
previous = GTK_RADIO_BUTTON(g_ptr_array_index(r->buttons, 0));
|
|
|
|
rb = gtk_radio_button_new_with_label_from_widget(previous, text);
|
2015-08-27 22:00:34 -05:00
|
|
|
gtk_container_add(r->container, rb);
|
2015-07-01 11:39:05 -05:00
|
|
|
g_ptr_array_add(r->buttons, rb);
|
|
|
|
gtk_widget_show(rb);
|
2015-06-11 18:07:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uiRadioButtons *uiNewRadioButtons(void)
|
|
|
|
{
|
2015-08-27 22:00:34 -05:00
|
|
|
uiRadioButtons *r;
|
2015-06-11 18:07:06 -05:00
|
|
|
|
2016-04-25 19:00:25 -05:00
|
|
|
uiUnixNewControl(uiRadioButtons, r);
|
2015-06-11 18:07:06 -05:00
|
|
|
|
2015-08-27 22:00:34 -05:00
|
|
|
r->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
r->container = GTK_CONTAINER(r->widget);
|
|
|
|
r->box = GTK_BOX(r->widget);
|
2015-06-11 18:07:06 -05:00
|
|
|
|
2015-07-01 11:39:05 -05:00
|
|
|
r->buttons = g_ptr_array_new();
|
|
|
|
|
2015-08-27 22:00:34 -05:00
|
|
|
return r;
|
2015-06-11 18:07:06 -05:00
|
|
|
}
|