application/main.c

changeset 468
1f251c462f74
parent 465
00735562b25b
child 475
8e06a446d552
equal deleted inserted replaced
467:08e0a66d3bd6 468:1f251c462f74
32 32
33 #include <ui/ui.h> 33 #include <ui/ui.h>
34 #include <cx/buffer.h> 34 #include <cx/buffer.h>
35 #include <cx/utils.h> 35 #include <cx/utils.h>
36 36
37 #include "cx/string.h"
38
37 #if !defined(UI_COCOA) && !defined(UI_MOTIF) 39 #if !defined(UI_COCOA) && !defined(UI_MOTIF)
38 40
39 typedef struct { 41 typedef struct {
40 UiString *str1; 42 UiString *str1;
41 UiString *str2; 43 UiString *str2;
49 UiInteger *tabview; 51 UiInteger *tabview;
50 UiGeneric *image; 52 UiGeneric *image;
51 UiList *srclist1; 53 UiList *srclist1;
52 UiList *srclist2; 54 UiList *srclist2;
53 UiList *items; 55 UiList *items;
56 UiGeneric *web;
54 } MyDocument; 57 } MyDocument;
55 58
56 MyDocument *doc1; 59 MyDocument *doc1;
57 MyDocument *doc2; 60 MyDocument *doc2;
58 61
182 185
183 doc->items = ui_list_new(docctx, "items"); 186 doc->items = ui_list_new(docctx, "items");
184 ui_list_append(doc->items, "Item 1"); 187 ui_list_append(doc->items, "Item 1");
185 ui_list_append(doc->items, "Item 2"); 188 ui_list_append(doc->items, "Item 2");
186 ui_list_append(doc->items, "Item 3"); 189 ui_list_append(doc->items, "Item 3");
190
191 doc->web = ui_generic_new(docctx, NULL);
187 192
188 //doc->text = ui_text_new(docctx, "text"); 193 //doc->text = ui_text_new(docctx, "text");
189 return doc; 194 return doc;
190 } 195 }
191 196
478 ui_button(obj, .label = "Button 2"); 483 ui_button(obj, .label = "Button 2");
479 } 484 }
480 } 485 }
481 ui_tab(obj, "Tab 9") { 486 ui_tab(obj, "Tab 9") {
482 #ifdef UI_WEBVIEW 487 #ifdef UI_WEBVIEW
483 ui_webview(obj, .fill = UI_ON); 488 ui_webview(obj, .fill = UI_ON, .value = doc->web);
489 cxstring html = CX_STR("<html><body><h1>Hello Toolkit</h1><p>Toolkit WebView</p></body></html>");
490 ui_webview_load_content(doc->web, "mypage", html.ptr, html.length, NULL, NULL);
484 #else 491 #else
485 ui_label(obj, "Webview is not supported"); 492 ui_label(obj, "Webview is not supported");
486 #endif 493 #endif
487 } 494 }
488 ui_tab(obj, "Tab 10") { 495 ui_tab(obj, "Tab 10") {

mercurial