Sat, 24 Jan 2015 19:14:29 +0100
added initial WPF code
0 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2014 Olaf Wintermann. All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #ifndef UI_TOOLKIT_H | |
30 | #define UI_TOOLKIT_H | |
31 | ||
32 | #ifdef UI_COCOA | |
33 | ||
34 | #ifdef __OBJC__ | |
35 | #import <Cocoa/Cocoa.h> | |
36 | #define UIWIDGET NSView* | |
37 | #else | |
38 | typedef void* UIWIDGET; | |
39 | #endif | |
40 | ||
41 | #elif UI_GTK2 || UI_GTK3 | |
42 | ||
43 | #include <gtk/gtk.h> | |
44 | #define UIWIDGET GtkWidget* | |
18
06be29a56f8b
added menu accelerators
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
16
diff
changeset
|
45 | #define UI_GTK |
0 | 46 | |
47 | #elif UI_MOTIF | |
48 | ||
49 | #include <Xm/XmAll.h> | |
50 | #define UIWIDGET Widget | |
51 | ||
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
52 | #elif defined(UI_QT4) || defined(UI_QT5) |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
53 | #ifdef __cplusplus |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
54 | #include <QApplication> |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
55 | #include <QWidget> |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
56 | #define UIWIDGET QWidget* |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
57 | #else /* __cplusplus */ |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
58 | #define UIWIDGET void* |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
59 | #endif |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
60 | |
78
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
61 | #elif UI_WPF |
135920fe441b
added initial WPF code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
62 | #define UIWIDGET void* |
0 | 63 | #endif |
64 | ||
66
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
65 | #ifndef TRUE |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
66 | #define TRUE 1 |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
67 | #endif |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
68 | #ifndef FALSE |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
69 | #define FALSE 0 |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
70 | #endif |
8d490d97aab8
added button and box container (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
71 | |
0 | 72 | #ifdef __cplusplus |
73 | extern "C" { | |
74 | #endif | |
75 | ||
22
bcf880b29bc3
textarea automatically sets selection group (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
76 | #define UI_GROUP_SELECTION 20000 |
bcf880b29bc3
textarea automatically sets selection group (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
77 | |
0 | 78 | /* public types */ |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
79 | typedef int UiBool; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
80 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
81 | typedef struct UiObject UiObject; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
82 | typedef struct UiEvent UiEvent; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
83 | typedef struct UiObserver UiObserver; |
0 | 84 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
85 | typedef struct UiInteger UiInteger; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
86 | typedef struct UiString UiString; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
87 | typedef struct UiText UiText; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
88 | typedef struct UiList UiList; |
0 | 89 | |
90 | /* private types */ | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
91 | typedef struct UiContext UiContext; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
92 | typedef struct UiContainer UiContainer; |
0 | 93 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
94 | typedef struct UiTabbedPane UiTabbedPane; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
95 | |
0 | 96 | #define ui_getval(val) (val).get(&(val)) |
97 | #define ui_setval(val, v) (val).set(&(val), v) | |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
98 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
99 | #define ui_getsubstr(text, begin, end) (text).getsubstr(&(text), begin, end) |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
100 | #define ui_insert(text, begin, str) (text).insert(&(text), begin, str) |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
101 | #define ui_length(text) (text).length(&(text)) |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
102 | #define ui_selection(text, begin, end) (text).selection(&(text), begin, end) |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
103 | #define ui_position(text) (text).position(&(text)) |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
104 | #define ui_remove(text, begin, end) (text).remove(&(text), begin, end) |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
105 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
106 | typedef void(*ui_callback)(UiEvent*, void*); /* event, user data */ |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
107 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
108 | typedef void*(*ui_model_getvalue_f)(void*, int); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
109 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
110 | typedef int(*ui_threadfunc)(void*); |
0 | 111 | |
112 | struct UiObject { | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
113 | /* |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
114 | * native widget |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
115 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
116 | UIWIDGET widget; |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
117 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
118 | /* |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
119 | * user window data |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
120 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
121 | void *window; |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
122 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
123 | /* |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
124 | * window context (private) |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
125 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
126 | UiContext *ctx; |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
127 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
128 | /* |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
129 | * container interface (private) |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
130 | */ |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
131 | UiContainer *container; |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
132 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
133 | /* |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
134 | * next container object |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
135 | */ |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
136 | UiObject *next; |
0 | 137 | }; |
138 | ||
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
139 | struct UiTabbedPane { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
140 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
141 | * native widget |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
142 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
143 | UIWIDGET widget; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
144 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
145 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
146 | * current document |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
147 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
148 | void *document; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
149 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
150 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
151 | * parent context |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
152 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
153 | UiContext *ctx; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
154 | }; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
155 | |
0 | 156 | struct UiEvent { |
157 | UiObject *obj; | |
158 | void *document; | |
159 | void *window; | |
16
a499c8a72c15
added menu item lists (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
160 | void *eventdata; |
0 | 161 | int intval; |
162 | }; | |
163 | ||
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
164 | struct UiObserver { |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
165 | ui_callback callback; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
166 | void *data; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
167 | UiObserver *next; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
168 | }; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
169 | |
0 | 170 | struct UiInteger { |
171 | int (*get)(UiInteger*); | |
172 | void (*set)(UiInteger*, int); | |
173 | int value; | |
174 | void *obj; | |
175 | }; | |
176 | ||
177 | struct UiString { | |
178 | char* (*get)(UiString*); | |
179 | void (*set)(UiString*, char*); | |
180 | char* value; | |
181 | void *obj; | |
182 | }; | |
183 | ||
5 | 184 | struct UiText { |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
185 | void (*set)(UiText*, char*); |
5 | 186 | char* (*get)(UiText*); |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
187 | char* (*getsubstr)(UiText*, int, int); // text, begin, end |
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
188 | void (*insert)(UiText*, int, char*); |
26
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
189 | int (*position)(UiText*); |
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
190 | void (*selection)(UiText*, int*, int*); // text, begin, end |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
191 | int (*length)(UiText*); |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
192 | void (*remove)(UiText*, int, int); // text, begin, end |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
193 | char *value; |
5 | 194 | void *obj; |
6
05a18c56d9ca
added undo for text
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
195 | void *undomgr; |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
196 | // TODO: replace, ... |
5 | 197 | }; |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
198 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
199 | /* |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
200 | * abstract list |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
201 | */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
202 | struct UiList { |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
203 | /* get the first element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
204 | void*(*first)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
205 | /* get the next element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
206 | void*(*next)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
207 | /* get the nth element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
208 | void*(*get)(UiList *list, int i); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
209 | /* get the number of elements */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
210 | int(*count)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
211 | /* list of observers */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
212 | UiObserver *observers; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
213 | /* iterator changes after first() next() and get() */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
214 | void *iter; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
215 | /* private - implementation dependent */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
216 | void *data; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
217 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
218 | }; |
5 | 219 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
220 | |
0 | 221 | void ui_init(char *appname, int argc, char **argv); |
24
06bceda81a03
added application properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
22
diff
changeset
|
222 | char* ui_appname(); |
0 | 223 | |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
224 | void ui_exitfunc(ui_callback f, void *userdata); |
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
225 | void ui_openfilefunc(ui_callback f, void *userdata); |
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
226 | |
0 | 227 | void ui_main(); |
228 | void ui_show(UiObject *obj); | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
229 | void ui_close(UiObject *obj); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
230 | |
35 | 231 | void ui_job(UiObject *obj, ui_threadfunc tf, void *td, ui_callback f, void *fd); |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
232 | |
21
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
20
diff
changeset
|
233 | void ui_set_enabled(UIWIDGET widget, int enabled); |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
234 | void ui_set_show_all(UIWIDGET widget, int value); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
235 | void ui_set_visible(UIWIDGET widget, int visible); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
236 | |
61
7ee124a58fe3
improved box (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
237 | UIWIDGET ui_vbox(UiObject *obj); |
7ee124a58fe3
improved box (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
238 | UIWIDGET ui_hbox(UiObject *obj); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
239 | UIWIDGET ui_grid(UiObject *obj); |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
240 | UIWIDGET ui_sidebar(UiObject *obj); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
241 | void ui_end(UiObject *obj); |
0 | 242 | |
64
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
243 | UIWIDGET ui_tabview(UiObject *obj); |
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
244 | void ui_tab(UiObject *obj, char *title); |
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
245 | void ui_select_tab(UIWIDGET tabview, int tab); |
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
246 | |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
247 | void ui_layout_fill(UiObject *obj, UiBool fill); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
248 | void ui_newline(UiObject *obj); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
249 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
250 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
251 | UiTabbedPane* ui_tabbed_document_view(UiObject *obj); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
252 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
253 | UiObject* ui_document_tab(UiTabbedPane *view); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
254 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
255 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
256 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
257 | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
258 | void ui_set_document(UiObject *obj, void *document); |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
259 | void ui_detach_document(UiObject *obj, void *document); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
260 | void* ui_get_document(UiObject *obj); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
261 | void ui_set_subdocument(void *document, void *sub); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
262 | void ui_detach_subdocument(void *document, void *sub); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
263 | void* ui_get_subdocument(void *document); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
264 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
265 | void* ui_document_new(size_t size); |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
266 | void ui_document_destroy(void *doc); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
267 | |
37
56016468753d
refactored value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
35
diff
changeset
|
268 | UiContext* ui_document_context(void *doc); |
56016468753d
refactored value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
35
diff
changeset
|
269 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
270 | // TODO: remove |
0 | 271 | void* ui_document_malloc(void *doc, size_t size); |
272 | void* ui_document_calloc(void *doc, size_t nelem, size_t elsize); | |
273 | void ui_document_free(void *doc, void *ptr); | |
274 | void* ui_document_realloc(void *doc, void *ptr, size_t size); | |
275 | ||
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
276 | // TODO: remove (or not) |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
277 | void ui_document_addint(void *doc, char *name); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
278 | void ui_document_regint(void *doc, char *name, UiInteger *i); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
279 | void ui_document_setint(void *doc, char *name, int val); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
280 | int ui_document_getint(void *doc, char *name); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
281 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
282 | void ui_document_regtext(void *doc, char *name, UiText *text); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
283 | void ui_document_reglist(void *doc, char *name, UiList *list); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
284 | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
285 | // new: |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
286 | int ui_getint(UiObject *obj, char *name); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
287 | char *ui_getstr(UiObject *obj, char *name); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
288 | char* ui_gettext(UiObject *obj, char *name); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
289 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
290 | |
20
2dda1ad6dc7a
added groups for menu items (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
18
diff
changeset
|
291 | void ui_set_group(UiContext *ctx, int group); |
2dda1ad6dc7a
added groups for menu items (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
18
diff
changeset
|
292 | void ui_unset_group(UiContext *ctx, int group); |
2dda1ad6dc7a
added groups for menu items (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
18
diff
changeset
|
293 | int* ui_active_groups(UiContext *ctx, int *ngroups); |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
294 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
295 | void* ui_malloc(UiContext *ctx, size_t size); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
296 | void* ui_calloc(UiContext *ctx, size_t nelem, size_t elsize); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
297 | void ui_free(UiContext *ctx, void *ptr); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
298 | void* ui_realloc(UiContext *ctx, void *ptr, size_t size); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
299 | |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
300 | // types |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
301 | UiObserver* ui_observer_new(ui_callback f, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
302 | UiObserver* ui_obsvlist_add(UiObserver *list, UiObserver *observer); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
303 | UiObserver* ui_add_observer(UiObserver *list, ui_callback f, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
304 | void ui_notify(UiObserver *observer, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
305 | void ui_notify_except(UiObserver *observer, UiObserver *exc, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
306 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
307 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
308 | UiList* ui_list_new(); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
309 | void* ui_list_first(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
310 | void* ui_list_next(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
311 | void* ui_list_get(UiList *list, int i); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
312 | int ui_list_count(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
313 | void ui_list_append(UiList *list, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
314 | void ui_list_prepend(UiList *list, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
315 | void ui_list_addobsv(UiList *list, ui_callback f, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
316 | void ui_list_notify(UiList *list); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
317 | |
26
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
318 | void ui_clipboard_set(char *str); |
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
319 | char* ui_clipboard_get(); |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
320 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
321 | void ui_add_image(char *imgname, char *filename); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
322 | |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
323 | |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
324 | |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
325 | UIWIDGET ui_label(UiObject *obj, char *label); |
63
46a42f0c4f93
added textfield and some container fixes (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
326 | UIWIDGET ui_space(UiObject *obj); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
327 | |
0 | 328 | #ifdef __cplusplus |
329 | } | |
330 | #endif | |
331 | ||
332 | #endif /* UI_TOOLKIT_H */ | |
333 |