application/window.c

changeset 108
77254bd6dccb
parent 106
3a64316b3672
child 109
c3dfcb8f0be7
equal deleted inserted replaced
107:b34bd1557c6c 108:77254bd6dccb
79 79
80 wdata->progress = ui_int_new(obj->ctx, "progress"); 80 wdata->progress = ui_int_new(obj->ctx, "progress");
81 81
82 // navigation bar 82 // navigation bar
83 83
84 ui_hbox(obj, .fill = UI_OFF, .margin = 8, .spacing = 8) { 84 ui_hbox(obj, .margin = 8, .spacing = 8) {
85 ui_hbox(obj, .fill = UI_OFF, .style_class="linked") { 85 ui_hbox(obj, .style_class="linked") {
86 ui_button(obj, .icon = UI_ICON_GO_BACK, .onclick = action_go_back); 86 ui_button(obj, .icon = UI_ICON_GO_BACK, .onclick = action_go_back);
87 ui_button(obj, .icon = UI_ICON_GO_FORWARD, .onclick = action_go_forward); 87 ui_button(obj, .icon = UI_ICON_GO_FORWARD, .onclick = action_go_forward);
88 } 88 }
89 89
90 ui_path_textfield(obj, .fill = UI_ON, .getpathelm = dav_get_pathelm, .onactivate = action_path_selected, .varname = "path"); 90 ui_path_textfield(obj, .fill = TRUE, .getpathelm = dav_get_pathelm, .onactivate = action_path_selected, .varname = "path");
91 ui_progressspinner(obj, .value = wdata->progress); 91 ui_progressspinner(obj, .value = wdata->progress);
92 } 92 }
93 93
94 // main content 94 // main content
95 UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Name", UI_STRING_FREE, "Flags", UI_STRING, "Type", UI_STRING_FREE, "Last Modified", UI_STRING_FREE, "Size", -1); 95 UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Name", UI_STRING_FREE, "Flags", UI_STRING, "Type", UI_STRING_FREE, "Last Modified", UI_STRING_FREE, "Size", -1);
96 model->columnsize[0] = -1; 96 model->columnsize[0] = -1;
97 model->columnsize[2] = 150; 97 model->columnsize[2] = 150;
98 model->getvalue = (ui_getvaluefunc) window_resource_table_getvalue; 98 model->getvalue = (ui_getvaluefunc) window_resource_table_getvalue;
99 ui_table(obj, 99 ui_table(obj,
100 .fill = UI_ON, 100 .fill = TRUE,
101 .model = model, 101 .model = model,
102 .onselection = action_list_selection, 102 .onselection = action_list_selection,
103 .onactivate = action_list_activate, 103 .onactivate = action_list_activate,
104 .ondragstart = action_dnd_start, 104 .ondragstart = action_dnd_start,
105 .ondragcomplete = action_dnd_end, 105 .ondragcomplete = action_dnd_end,
108 .multiselection = TRUE, 108 .multiselection = TRUE,
109 .contextmenu = contextmenu); 109 .contextmenu = contextmenu);
110 110
111 // status bar 111 // status bar
112 112
113 ui_hbox(obj, .fill = UI_OFF) { 113 ui_hbox0(obj) {
114 ui_label(obj, .label = ""); 114 ui_label(obj, .label = "");
115 } 115 }
116 116
117 return obj; 117 return obj;
118 } 118 }
197 197
198 DavResourceViewer *doc = dav_resourceviewer_create(win, browser->sn, path, type); 198 DavResourceViewer *doc = dav_resourceviewer_create(win, browser->sn, path, type);
199 ui_attach_document(win->ctx, doc); 199 ui_attach_document(win->ctx, doc);
200 ui_context_closefunc(win->ctx, resourceviewer_close, doc); 200 ui_context_closefunc(win->ctx, resourceviewer_close, doc);
201 201
202 ui_tabview(win, .tabview = UI_TABVIEW_INVISIBLE, .varname = "tabview") { 202 ui_tabview(win, .tabview = UI_TABVIEW_INVISIBLE, .varname = "tabview", .fill = TRUE) {
203 /* loading / message tab */ 203 /* loading / message tab */
204 ui_tab(win, NULL) { 204 ui_tab(win, NULL) {
205 ui_hbox(win, .margin = 16, .spacing = 10, .fill = UI_OFF) { 205 ui_hbox(win, .margin = 16, .spacing = 10, .fill = TRUE) {
206 ui_progressspinner(win, .varname = "loading"); 206 ui_progressspinner(win, .varname = "loading");
207 ui_label(win, .varname = "message"); 207 ui_label(win, .varname = "message");
208 } 208 }
209 } 209 }
210 210
211 /* preview tab */ 211 /* preview tab */
212 ui_tab(win, NULL) { 212 ui_tab(win, NULL) {
213 ui_tabview0(win) { 213 ui_tabview(win, .fill = TRUE) {
214 if(type == DAV_RESOURCE_VIEW_TEXT) { 214 if(type == DAV_RESOURCE_VIEW_TEXT) {
215 ui_tab(win, "Content") { 215 ui_tab(win, "Content") {
216 ui_textarea(win, .varname = "text", .onchange = action_resourceviewer_text_modified); 216 ui_textarea(win, .varname = "text", .onchange = action_resourceviewer_text_modified);
217 } 217 }
218 } else if(type == DAV_RESOURCE_VIEW_IMAGE) { 218 } else if(type == DAV_RESOURCE_VIEW_IMAGE) {
219 ui_tab(win, "Preview") { 219 ui_tab(win, "Preview") {
220 ui_imageviewer(win, 220 ui_imageviewer(win,
221 .varname = "image", 221 .varname = "image",
222 .scrollarea = TRUE, 222 .scrollarea = TRUE,
223 .useradjustable = TRUE); 223 .useradjustable = TRUE,
224 .fill = TRUE);
224 } 225 }
225 } 226 }
226 227
227 ui_tab(win, "Info") { 228 ui_tab(win, "Info") {
228 ui_grid(win, .margin = 16, .columnspacing = 30, .rowspacing = 6) { 229 ui_grid(win, .margin = 16, .columnspacing = 30, .rowspacing = 6, .fill = TRUE) {
229 ui_llabel(win, .label = "URL"); 230 ui_llabel(win, .label = "URL");
230 ui_llabel(win, .varname = "info_url"); 231 ui_llabel(win, .varname = "info_url");
231 ui_newline(win); 232 ui_newline(win);
232 233
233 ui_llabel(win, .label = "Name"); 234 ui_llabel(win, .label = "Name");
253 } 254 }
254 255
255 ui_tab(win, "Properties") { 256 ui_tab(win, "Properties") {
256 UiModel* model = ui_model(win->ctx, UI_STRING, "Namespace", UI_STRING, "Name", UI_STRING, "Value", -1); 257 UiModel* model = ui_model(win->ctx, UI_STRING, "Namespace", UI_STRING, "Name", UI_STRING, "Value", -1);
257 model->getvalue = (ui_getvaluefunc) resourceviewer_proplist_getvalue; 258 model->getvalue = (ui_getvaluefunc) resourceviewer_proplist_getvalue;
258 ui_table(win, .fill = UI_ON, .model = model, .varname = "properties", .onselection = action_resourceviewer_property_select, .onactivate = action_resourceviewer_property_activate); 259 ui_table(win, .fill = TRUE, .model = model, .varname = "properties", .onselection = action_resourceviewer_property_select, .onactivate = action_resourceviewer_property_activate);
259 ui_hbox(win, .fill = UI_OFF, .margin = 4, .spacing = 4) { 260 ui_hbox(win, .margin = 4, .spacing = 4) {
260 ui_button(win, .label = "Add", .onclick = action_resourceviewer_property_add); 261 ui_button(win, .label = "Add", .onclick = action_resourceviewer_property_add);
261 ui_button(win, .label = "Edit", .onclick = action_resourceviewer_property_edit, .groups = UI_GROUPS(RESOURCEVIEWER_STATE_PROP_SELECTED)); 262 ui_button(win, .label = "Edit", .onclick = action_resourceviewer_property_edit, .groups = UI_GROUPS(RESOURCEVIEWER_STATE_PROP_SELECTED));
262 ui_button(win, .label = "Remove", .onclick = action_resourceviewer_property_remove, .groups = UI_GROUPS(RESOURCEVIEWER_STATE_PROP_SELECTED)); 263 ui_button(win, .label = "Remove", .onclick = action_resourceviewer_property_remove, .groups = UI_GROUPS(RESOURCEVIEWER_STATE_PROP_SELECTED));
263 } 264 }
264 } 265 }
320 AuthDialogWindow *wdata = ui_malloc(obj->ctx, sizeof(AuthDialogWindow)); 321 AuthDialogWindow *wdata = ui_malloc(obj->ctx, sizeof(AuthDialogWindow));
321 wdata->user = ui_string_new(obj->ctx, NULL); 322 wdata->user = ui_string_new(obj->ctx, NULL);
322 wdata->password = ui_string_new(obj->ctx, NULL); 323 wdata->password = ui_string_new(obj->ctx, NULL);
323 obj->window = wdata; 324 obj->window = wdata;
324 325
325 ui_grid(obj, .margin = 20, .columnspacing = 12, .rowspacing = 12) { 326 ui_grid(obj, .margin = 20, .columnspacing = 12, .rowspacing = 12, .fill = TRUE) {
326 cxmutstr heading = cx_asprintf("Authentication required for: %s", auth->sn->base_url); 327 cxmutstr heading = cx_asprintf("Authentication required for: %s", auth->sn->base_url);
327 ui_llabel(obj, .label = heading.ptr, .colspan = 2); 328 ui_llabel(obj, .label = heading.ptr, .colspan = 2);
328 free(heading.ptr); 329 free(heading.ptr);
329 ui_newline(obj); 330 ui_newline(obj);
330 331

mercurial