application/main.c

Sun, 01 Feb 2015 10:35:07 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 01 Feb 2015 10:35:07 +0100
changeset 84
a56c2baa9429
parent 83
a38aec91bd66
child 85
91f45354d1e2
permissions
-rw-r--r--

added vbox,hbox function (WPF)

0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2012 Olaf Wintermann. All rights reserved.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include <ui/ui.h>
28
794a5c91c479 added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 27
diff changeset
33 #include <ucx/buffer.h>
794a5c91c479 added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 27
diff changeset
34 #include <ucx/utils.h>
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
36 /*
39
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
37 typedef struct Person {
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
38 char *name;
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
39 char *mail;
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
40 } Person;
5
19d37cb9c96c added textarea
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 4
diff changeset
41
52
25e5390cce41 added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 51
diff changeset
42 typedef struct Document {
25e5390cce41 added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 51
diff changeset
43 UiText text;
25e5390cce41 added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 51
diff changeset
44 } Document;
25e5390cce41 added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 51
diff changeset
45
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 void action_close(UiEvent *event, void *data) {
55
9076eb40454d added toolbar (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 54
diff changeset
47 ui_close(event->obj);
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 }
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49
39
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
50 char* person_getvalue(Person *p, int column) {
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
51 switch(column) {
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
52 case 0: return p->name;
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
53 case 1: return p->mail;
2
eeb50c534497 added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
54 }
39
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
55 return NULL;
14
e2fd132ab781 added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 12
diff changeset
56 }
e2fd132ab781 added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 12
diff changeset
57
64
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
58 UiString name;
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
59 UiString mail;
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
60
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
61 UIWIDGET tabview = NULL;
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
62
42
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
63 void action_activate(UiEvent *event, void *data) {
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
64 UiListSelection *selection = event->eventdata;
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
65 printf("activate: %d\n", event->intval);
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
66 }
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
67
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
68 void action_select(UiEvent *event, void *data) {
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
69 UiListSelection *selection = event->eventdata;
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
70 printf("selection[%d]: ", selection->count);
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
71 for(int i=0;i<selection->count;i++) {
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
72 printf("%d ", selection->rows[i]);
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
73 }
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
74 printf("\n");
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
75 }
29b2821d1262 added table view events (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 39
diff changeset
76
49
a80ba8741be6 added toolbar toggle button (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 46
diff changeset
77 void action_button(UiEvent *event, void *data) {
a80ba8741be6 added toolbar toggle button (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 46
diff changeset
78 printf("button: %d\n", event->intval);
70
3d801e8dda3a added label and textfield (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 69
diff changeset
79 //char *s = ui_gettext(event->obj, "text");
3d801e8dda3a added label and textfield (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 69
diff changeset
80 char *s = ui_getval(name);
64
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
81 printf("{%s}\n", s);
66
8d490d97aab8 added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 64
diff changeset
82 //printf("name: {%s}\n", ui_getval(name));
8d490d97aab8 added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 64
diff changeset
83 //printf("mail: {%s}\n", ui_getval(mail));
69
419c8c3209e8 improved table (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 68
diff changeset
84 //ui_select_tab(tabview, 1);
64
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
85 }
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
86
71
3e021c5f18a0 added check item for menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 70
diff changeset
87 void action_check(UiEvent *event, void *data) {
3e021c5f18a0 added check item for menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 70
diff changeset
88 printf("check: %d\n", event->intval);
3e021c5f18a0 added check item for menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 70
diff changeset
89 }
3e021c5f18a0 added check item for menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 70
diff changeset
90
64
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
91 void action_test(UiEvent *event, void *data) {
69
419c8c3209e8 improved table (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 68
diff changeset
92 //ui_select_tab(tabview, 0);
49
a80ba8741be6 added toolbar toggle button (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 46
diff changeset
93 }
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
94 */
82
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
95
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
96 void action_menu(UiEvent *event, void *data) {
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
97 printf("action_menu test: {%s}\n", data);
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
98 fflush(stdout);
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
99 }
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
100
83
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
101 void action_button(UiEvent *event, void *data) {
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
102 printf("button clicked\n");
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
103 fflush(stdout);
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
104 }
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
105
29
c96169444d88 added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 28
diff changeset
106 int main(int argc, char** argv) {
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 ui_init("app1", argc, argv);
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
108
81
5eb765a7a793 added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
109 ui_menu("File");
82
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
110 ui_menuitem("Hello", action_menu, "hello");
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
111 ui_submenu("Submenu1");
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
112 ui_submenu("Submenu2");
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
113 ui_menuitem("item2", NULL, NULL);
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
114 ui_submenu_end();
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
115 ui_menuitem("item3", NULL, NULL);
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
116 ui_submenu_end();
0cdb8089a29f added event handler for menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 81
diff changeset
117 ui_menuitem("item4", NULL, NULL);
81
5eb765a7a793 added menus (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 78
diff changeset
118
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
119 UiObject *obj = ui_window("Test", NULL);
84
a56c2baa9429 added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 83
diff changeset
120 ui_hbox(obj);
a56c2baa9429 added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 83
diff changeset
121 ui_button(obj, "HELLO", NULL, NULL);
a56c2baa9429 added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 83
diff changeset
122 ui_button(obj, "WORLD", NULL, NULL);
a56c2baa9429 added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 83
diff changeset
123 ui_end(obj);
83
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
124 ui_button(obj, "Test1", action_button, NULL);
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
125 ui_button(obj, "Test2", action_button, NULL);
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
126 ui_button(obj, "Test3", action_button, NULL);
a38aec91bd66 added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 82
diff changeset
127 ui_button(obj, "Test4", action_button, NULL);
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
128 ui_show(obj);
84
a56c2baa9429 added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 83
diff changeset
129 fflush(stdout);
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
130 ui_main();
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
131 /*
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
132 ui_locales_dir("/opt/app1/locales");
30
34513f76d5a8 added locale support (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 29
diff changeset
133 ui_load_lang_def(NULL, "en_EN");
33
458831c574f4 added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 30
diff changeset
134 //ui_openfilefunc(action_new, NULL);
29
c96169444d88 added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 28
diff changeset
135
22
bcf880b29bc3 textarea automatically sets selection group (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 21
diff changeset
136
7
431dde3c5fbe added Cocoa implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
137
39
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
138 ui_menu("File");
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
139 ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL);
71
3e021c5f18a0 added check item for menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 70
diff changeset
140 ui_checkitem("Test", action_check, NULL);
66
8d490d97aab8 added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 64
diff changeset
141 //ui_checkitem("Check", action_button, NULL);
49
a80ba8741be6 added toolbar toggle button (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 46
diff changeset
142
59
eb6611be50c7 added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 58
diff changeset
143 ui_toolitem_st("button", UI_STOCK_GO_BACK, action_button, NULL);
55
9076eb40454d added toolbar (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 54
diff changeset
144 ui_toolbar_add_default("button");
3
c1a75454b444 added toolbar
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
145
7
431dde3c5fbe added Cocoa implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
146 printf("create window\n");
39
4e66271541e8 added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
147 UiObject *window = ui_window("Mod0", NULL);
1
eb5269000bc8 added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 0
diff changeset
148
72
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
149 UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1);
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
150 model->getvalue = (ui_model_getvalue_f)person_getvalue;
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
151 model->activate = action_activate;
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
152 model->selection = action_select;
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
153 UiList *list = ui_list_new();
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
154 Person *p1 = ui_malloc(window->ctx, sizeof(Person));
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
155 Person *p2 = ui_malloc(window->ctx, sizeof(Person));
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
156 Person *p3 = ui_malloc(window->ctx, sizeof(Person));
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
157 Person *p4 = ui_malloc(window->ctx, sizeof(Person));
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
158 p1->name = "Some Näme";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
159 p1->mail = "mail@host.com";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
160 p2->name = "押井守";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
161 p2->mail = "other.person@provider.com";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
162 p3->name = "My Self";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
163 p3->mail = "my@self.org";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
164 p4->name = "Gregory House";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
165 p4->mail = "greg@pp";
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
166 ui_list_append(list, p1);
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
167 ui_list_append(list, p2);
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
168 ui_list_append(list, p3);
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
169 ui_list_append(list, p4);
68
bd9fb6476b80 added tabview (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 67
diff changeset
170
74
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
171 ui_layout_fill(window, FALSE);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
172 ui_grid(window);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
173 ui_button(window, "Test", NULL, NULL);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
174 ui_button(window, "Test", NULL, NULL);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
175 ui_button(window, "Test", NULL, NULL);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
176 ui_newline(window);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
177 ui_textfield(window, NULL);
55718d4ed227 fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 73
diff changeset
178 ui_end(window);
72
a00b46d92c54 added list view (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 71
diff changeset
179 ui_listview(window, list, (ui_model_getvalue_f)person_getvalue, action_activate, NULL);
75
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
180 ui_contextmenu(window);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
181 ui_widget_menuitem(window, "OK", action_test, NULL);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
182 ui_widget_menuitem(window, "1", action_test, NULL);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
183 ui_widget_menuitem(window, "2", action_test, NULL);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
184 ui_widget_menuitem(window, "3", action_test, NULL);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
185 ui_widget_menuitem(window, "4", action_test, NULL);
efe2f65bea17 added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 74
diff changeset
186 ui_widget_menuitem_st(window, UI_STOCK_CLOSE, action_test, NULL);
73
473acef47ddd added context menus (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 72
diff changeset
187
64
6ef2c7f73a30 added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 63
diff changeset
188
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 ui_show(window);
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 ui_main();
78
135920fe441b added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 75
diff changeset
191 */
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 return (EXIT_SUCCESS);
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 }

mercurial