Sun, 24 Aug 2014 13:31:07 +0200
added Qt window and menu implementation
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 | |
0 | 61 | #endif |
62 | ||
63 | #ifdef __cplusplus | |
64 | extern "C" { | |
65 | #endif | |
66 | ||
22
bcf880b29bc3
textarea automatically sets selection group (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
67 | #define UI_GROUP_SELECTION 20000 |
bcf880b29bc3
textarea automatically sets selection group (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
68 | |
0 | 69 | /* public types */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
70 | typedef struct UiObject UiObject; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
71 | typedef struct UiEvent UiEvent; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
72 | typedef struct UiObserver UiObserver; |
0 | 73 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
74 | typedef struct UiInteger UiInteger; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
75 | typedef struct UiString UiString; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
76 | typedef struct UiText UiText; |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
77 | typedef struct UiList UiList; |
0 | 78 | |
79 | /* private types */ | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
80 | typedef struct UiContext UiContext; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
81 | typedef struct UiContainer UiContainer; |
0 | 82 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
83 | typedef struct UiTabbedPane UiTabbedPane; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
84 | |
0 | 85 | #define ui_getval(val) (val).get(&(val)) |
86 | #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
|
87 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
88 | #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
|
89 | #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
|
90 | #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
|
91 | #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
|
92 | #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
|
93 | #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
|
94 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
95 | 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
|
96 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
97 | 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
|
98 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
99 | typedef int(*ui_threadfunc)(void*); |
0 | 100 | |
101 | struct UiObject { | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
102 | /* |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
103 | * native widget |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
104 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
105 | UIWIDGET widget; |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
106 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
107 | /* |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
108 | * user window data |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
109 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
110 | void *window; |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
111 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
112 | /* |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
113 | * window context (private) |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
114 | */ |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
115 | UiContext *ctx; |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
116 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
117 | /* |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
118 | * container interface (private) |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
119 | */ |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
2
diff
changeset
|
120 | UiContainer *container; |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
121 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
122 | /* |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
123 | * next container object |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
124 | */ |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
125 | UiObject *next; |
0 | 126 | }; |
127 | ||
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
128 | struct UiTabbedPane { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
129 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
130 | * native widget |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
131 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
132 | UIWIDGET widget; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
133 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
134 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
135 | * current document |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
136 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
137 | void *document; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
138 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
139 | /* |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
140 | * parent context |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
141 | */ |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
142 | UiContext *ctx; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
143 | }; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
144 | |
0 | 145 | struct UiEvent { |
146 | UiObject *obj; | |
147 | void *document; | |
148 | void *window; | |
16
a499c8a72c15
added menu item lists (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
149 | void *eventdata; |
0 | 150 | int intval; |
151 | }; | |
152 | ||
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
153 | struct UiObserver { |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
154 | ui_callback callback; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
155 | void *data; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
156 | UiObserver *next; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
157 | }; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
158 | |
0 | 159 | struct UiInteger { |
160 | int (*get)(UiInteger*); | |
161 | void (*set)(UiInteger*, int); | |
162 | int value; | |
163 | void *obj; | |
164 | }; | |
165 | ||
166 | struct UiString { | |
167 | char* (*get)(UiString*); | |
168 | void (*set)(UiString*, char*); | |
169 | char* value; | |
170 | void *obj; | |
171 | }; | |
172 | ||
5 | 173 | struct UiText { |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
174 | void (*set)(UiText*, char*); |
5 | 175 | char* (*get)(UiText*); |
12
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
176 | char* (*getsubstr)(UiText*, int, int); // text, begin, end |
fe94e0fb9ef3
added some text functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
177 | void (*insert)(UiText*, int, char*); |
26
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
178 | int (*position)(UiText*); |
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
179 | 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
|
180 | int (*length)(UiText*); |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
181 | 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
|
182 | char *value; |
5 | 183 | void *obj; |
6
05a18c56d9ca
added undo for text
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
184 | void *undomgr; |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
185 | // TODO: replace, ... |
5 | 186 | }; |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
187 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
188 | /* |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
189 | * abstract list |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
190 | */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
191 | struct UiList { |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
192 | /* get the first element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
193 | void*(*first)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
194 | /* get the next element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
195 | void*(*next)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
196 | /* get the nth element */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
197 | void*(*get)(UiList *list, int i); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
198 | /* get the number of elements */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
199 | int(*count)(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
200 | /* list of observers */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
201 | UiObserver *observers; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
202 | /* iterator changes after first() next() and get() */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
203 | void *iter; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
204 | /* private - implementation dependent */ |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
205 | void *data; |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
206 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
207 | }; |
5 | 208 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
209 | |
0 | 210 | void ui_init(char *appname, int argc, char **argv); |
24
06bceda81a03
added application properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
22
diff
changeset
|
211 | char* ui_appname(); |
0 | 212 | |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
213 | 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
|
214 | 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
|
215 | |
0 | 216 | void ui_main(); |
217 | 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
|
218 | void ui_close(UiObject *obj); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
219 | |
35 | 220 | 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
|
221 | |
21
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
20
diff
changeset
|
222 | 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
|
223 | 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
|
224 | 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
|
225 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
226 | UIWIDGET ui_sidebar(UiObject *obj); |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
227 | void ui_end(UiObject *obj); |
0 | 228 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
229 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
230 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
231 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
232 | UiTabbedPane* ui_tabbed_document_view(UiObject *obj); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
233 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
234 | UiObject* ui_document_tab(UiTabbedPane *view); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
235 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
236 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
237 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
238 | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
239 | void ui_set_document(UiObject *obj, void *document); |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
240 | 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
|
241 | void* ui_get_document(UiObject *obj); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
242 | void ui_set_subdocument(void *document, void *sub); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
243 | void ui_detach_subdocument(void *document, void *sub); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
244 | void* ui_get_subdocument(void *document); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
245 | |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
246 | void* ui_document_new(size_t size); |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
247 | void ui_document_destroy(void *doc); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
248 | |
37
56016468753d
refactored value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
35
diff
changeset
|
249 | UiContext* ui_document_context(void *doc); |
56016468753d
refactored value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
35
diff
changeset
|
250 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
251 | // TODO: remove |
0 | 252 | void* ui_document_malloc(void *doc, size_t size); |
253 | void* ui_document_calloc(void *doc, size_t nelem, size_t elsize); | |
254 | void ui_document_free(void *doc, void *ptr); | |
255 | void* ui_document_realloc(void *doc, void *ptr, size_t size); | |
256 | ||
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
257 | // TODO: remove (or not) |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
258 | void ui_document_addint(void *doc, char *name); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
259 | 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
|
260 | 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
|
261 | int ui_document_getint(void *doc, char *name); |
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
262 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
263 | 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
|
264 | 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
|
265 | |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
266 | // new: |
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
267 | int ui_getint(UiObject *obj, char *name); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
268 | char *ui_getstr(UiObject *obj, char *name); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
38
diff
changeset
|
269 | char* ui_gettext(UiObject *obj, char *name); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
270 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
271 | |
20
2dda1ad6dc7a
added groups for menu items (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
18
diff
changeset
|
272 | 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
|
273 | 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
|
274 | 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
|
275 | |
38
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
276 | void* ui_malloc(UiContext *ctx, size_t size); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
277 | 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
|
278 | void ui_free(UiContext *ctx, void *ptr); |
8ccdde37275b
added some allocation functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
37
diff
changeset
|
279 | 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
|
280 | |
14
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
281 | // types |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | void ui_notify(UiObserver *observer, void *data); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
286 | 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
|
287 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
288 | |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
289 | UiList* ui_list_new(); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
290 | void* ui_list_first(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
291 | void* ui_list_next(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
292 | 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
|
293 | int ui_list_count(UiList *list); |
e2fd132ab781
added menu item lists (Cocoa implementation)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
12
diff
changeset
|
294 | 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
|
295 | 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
|
296 | 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
|
297 | void ui_list_notify(UiList *list); |
2
eeb50c534497
added support for replaceable documents
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
298 | |
26
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
299 | void ui_clipboard_set(char *str); |
a137277f9173
added copy & paste (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
300 | char* ui_clipboard_get(); |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
301 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
302 | 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
|
303 | |
0 | 304 | #ifdef __cplusplus |
305 | } | |
306 | #endif | |
307 | ||
308 | #endif /* UI_TOOLKIT_H */ | |
309 |