application/main.c

changeset 969
7385c26d998d
parent 967
ff4a8d10307b
child 979
471ca81a72f5
equal deleted inserted replaced
968:128a0de73cc8 969:7385c26d998d
124 void application_startup(UiEvent *event, void *data) { 124 void application_startup(UiEvent *event, void *data) {
125 UiObject *obj = ui_window("Test", NULL); 125 UiObject *obj = ui_window("Test", NULL);
126 126
127 ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10) { 127 ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10) {
128 ui_hbox(obj, .colspan = 2, .spacing = 10) { 128 ui_hbox(obj, .colspan = 2, .spacing = 10) {
129 ui_combobox(obj, .varname = "doclist", .getvalue = doclist_getvalue, .onactivate = action_document_selected); 129 ui_dropdown(obj, .varname = "doclist", .getvalue = doclist_getvalue, .onactivate = action_document_selected);
130 ui_textfield(obj, .varname = "name"); 130 ui_textfield(obj, .varname = "name");
131 ui_button(obj, .colspan = 4, .label = "Test Groups", .groups = UI_GROUPS(STATE_DOC, STATE_SUB)); 131 ui_button(obj, .colspan = 4, .label = "Test Groups", .groups = UI_GROUPS(STATE_DOC, STATE_SUB));
132 } 132 }
133 ui_newline(obj); 133 ui_newline(obj);
134 134
145 UIWIDGET textarea = ui_textarea(obj, .varname = "text", .hfill =TRUE); 145 UIWIDGET textarea = ui_textarea(obj, .varname = "text", .hfill =TRUE);
146 ui_widget_set_size(textarea, 300, 300); 146 ui_widget_set_size(textarea, 300, 300);
147 ui_newline(obj); 147 ui_newline(obj);
148 148
149 ui_rlabel(obj, .label = "List 1", .vfill = TRUE); 149 ui_rlabel(obj, .label = "List 1", .vfill = TRUE);
150 ui_combobox(obj, .varname = "list1"); 150 ui_dropdown(obj, .varname = "list1");
151 } 151 }
152 152
153 ToplevelDoc *doc = create_toplevel(); 153 ToplevelDoc *doc = create_toplevel();
154 ui_attach_document(obj->ctx, doc); 154 ui_attach_document(obj->ctx, doc);
155 155
684 ui_set(doc->path, "/test/path/longdirectoryname/123"); 684 ui_set(doc->path, "/test/path/longdirectoryname/123");
685 ui_newline(obj); 685 ui_newline(obj);
686 686
687 //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", -1); 687 //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", -1);
688 //model->getvalue = list_getvalue; 688 //model->getvalue = list_getvalue;
689 ui_combobox(obj, .hexpand = true, .vexpand = false, .colspan = 2, .varname = "list", .getvalue = list_getvalue); 689 ui_dropdown(obj, .hexpand = true, .vexpand = false, .colspan = 2, .varname = "list", .getvalue = list_getvalue);
690 ui_newline(obj); 690 ui_newline(obj);
691 char *dropdown[] = { 691 char *dropdown[] = {
692 "Sun", 692 "Sun",
693 "Apple", 693 "Apple",
694 "IBM", 694 "IBM",
695 "SGI", 695 "SGI",
696 "HP" 696 "HP"
697 }; 697 };
698 ui_combobox(obj, .hexpand = true, .vexpand = false, .colspan = 2, .static_elements = dropdown, .static_nelm = 5, .onactivate = action_static_dropdown); 698 ui_dropdown(obj, .hexpand = true, .vexpand = false, .colspan = 2, .static_elements = dropdown, .static_nelm = 5, .onactivate = action_static_dropdown);
699 ui_newline(obj); 699 ui_newline(obj);
700 700
701 ui_hbox0(obj) { 701 ui_hbox0(obj) {
702 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); 702 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio");
703 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); 703 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio");
1254 1254
1255 ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .fill = TRUE) { 1255 ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10, .fill = TRUE) {
1256 //UiModel *model = ui_model(obj->ctx, UI_STRING, "Name", UI_STRING, "Email", -1); 1256 //UiModel *model = ui_model(obj->ctx, UI_STRING, "Name", UI_STRING, "Email", -1);
1257 //ui_table(obj, .fill = TRUE, .varname = "persons", .model = model, .getvalue = person_getvalue, .onselection = list_onselection); 1257 //ui_table(obj, .fill = TRUE, .varname = "persons", .model = model, .getvalue = person_getvalue, .onselection = list_onselection);
1258 //ui_model_free(obj->ctx, model); 1258 //ui_model_free(obj->ctx, model);
1259 ui_combobox(obj, .varname = "persons", .getvalue = person_getvalue, .onactivate = list_onselection, .hexpand = TRUE, .hfill = TRUE); 1259 ui_dropdown(obj, .varname = "persons", .getvalue = person_getvalue, .onactivate = list_onselection, .hexpand = TRUE, .hfill = TRUE);
1260 1260
1261 ui_button(obj, .label = "Test 1"); 1261 ui_button(obj, .label = "Test 1");
1262 ui_newline(obj); 1262 ui_newline(obj);
1263 1263
1264 ui_button(obj, .label = "Button 1", .hfill = TRUE); 1264 ui_button(obj, .label = "Button 1", .hfill = TRUE);

mercurial