application/main.c

changeset 107
9aff1dc3990d
parent 106
a4f4123ca12a
child 108
fcf6d5fac8f5
--- a/application/main.c	Sat Jan 23 20:47:07 2016 +0100
+++ b/application/main.c	Sat Jan 23 23:44:41 2016 +0100
@@ -33,6 +33,8 @@
 #include <ucx/buffer.h>
 #include <ucx/utils.h>
 
+UiRadioButtonGroup rgroup;
+
 void action_menu(UiEvent *event, void *data) {
     printf("action_menu test: {%s}\n", data);
     printf("text: {%s}\n", ui_gettext(event->obj, "text"));
@@ -45,10 +47,14 @@
 }
 
 void action_button(UiEvent *event, void *data) {
-    printf("button clicked\n");
+    printf("radio: %d\n", ui_radiobuttongroup_selection(&rgroup));
     fflush(stdout);
 }
 
+void action_button2(UiEvent *event, void *data) {
+    ui_radiobuttongroup_select(&rgroup, 3);
+}
+
 void draw(UiEvent *event, UiGraphics *g, void *data) {
     /*
     int width = g->width;
@@ -95,27 +101,47 @@
     ui_toolbar_add_default("button1");
     ui_toolbar_add_default("button2");
     
-    UiObject *obj = ui_window("Test", NULL);
+    UiObject *obj = ui_simplewindow("Test", NULL);
     //UIWIDGET w = ui_drawingarea(obj, draw, NULL);
     //ui_mouse_handler(obj, w, click, NULL);
     
 ///*
-    ui_grid_sp(obj, 8, 4, 4);
+    ui_vbox_sp(obj, 8, 8);
     
-    ui_button(obj, "OK", NULL, NULL);
-    ui_layout_hexpand(obj, TRUE);
-    ui_button(obj, "Google", NULL, NULL);
+    ui_layout_fill(obj, FALSE);
+    ui_grid_sp(obj, 0, 4, 4);
+    ui_label(obj, "Name");
     ui_textfield(obj, NULL);
     ui_newline(obj);
-    
-    ui_vbox(obj);
-    ui_button(obj, "txt", NULL, NULL);
+    ui_label(obj, "Email");
     ui_textfield(obj, NULL);
     ui_end(obj);
-    ui_layout_hexpand(obj, TRUE);
-    ui_layout_vexpand(obj, TRUE);
-    ui_textarea(obj, NULL);
-    ui_button(obj, "BTN1", NULL, NULL);
+    
+    ui_separator(obj);
+    
+    ui_layout_fill(obj, FALSE);
+    ui_grid_sp(obj, 0, 4, 4);
+    ui_checkbox(obj, "Shit", NULL);
+    ui_newline(obj);
+    ui_checkbox(obj, "Nein", NULL);
+    ui_checkbox(obj, "Nein", NULL);
+    ui_checkbox(obj, "Nein", NULL);
+    ui_end(obj);
+    
+    ui_separator(obj);
+    
+    ui_layout_fill(obj, FALSE);
+    ui_grid_sp(obj, 0, 4, 4);
+    rgroup = ui_radiobuttongroup();
+    ui_radiobutton(obj, "better", &rgroup);
+    ui_newline(obj);
+    ui_radiobutton(obj, "awesome", &rgroup);
+    ui_newline(obj);
+    ui_radiobutton(obj, "smarter", &rgroup);
+    ui_end(obj);
+    
+    ui_button(obj, "OK", action_button, NULL);
+    ui_button(obj, "Activate", action_button2, NULL);
     
     ui_end(obj);
 //*/

mercurial