Fri, 11 Dec 2020 11:46:19 +0100
add drawingarea and textarea group
0
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2017 Olaf Wintermann. All rights reserved. |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
804d8803eade
add existing toolkit source
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 |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <string.h> |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include <stdarg.h> |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include <ucx/list.h> |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include "../ui/tree.h" |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include "types.h" |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #include "context.h" |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | UiObserver* ui_observer_new(ui_callback f, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | UiObserver *observer = malloc(sizeof(UiObserver)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | observer->callback = f; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | observer->data = data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | observer->next = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | return observer; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | UiObserver* ui_obsvlist_add(UiObserver *list, UiObserver *observer) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | if(!list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | return observer; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | } else { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | UiObserver *l = list; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | while(l->next) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | l = l->next; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | l->next = observer; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | return list; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | UiObserver* ui_add_observer(UiObserver *list, ui_callback f, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | UiObserver *observer = ui_observer_new(f, data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | return ui_obsvlist_add(list, observer); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | void ui_notify(UiObserver *observer, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | ui_notify_except(observer, NULL, data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | void ui_notify_except(UiObserver *observer, UiObserver *exc, void *data) { |
2 | 70 | UiEvent evt; |
71 | evt.obj = NULL; | |
72 | evt.window = NULL; | |
73 | evt.document = NULL; | |
74 | evt.eventdata = data; | |
75 | evt.intval = 0; | |
76 | ||
0
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | while(observer) { |
2 | 78 | if(observer != exc) { |
0
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | observer->callback(&evt, observer->data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | observer = observer->next; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | void ui_notify_evt(UiObserver *observer, UiEvent *event) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | while(observer) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | observer->callback(event, observer->data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | observer = observer->next; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | /* --------------------------- UiList --------------------------- */ |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | UiList* ui_list_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | UiList *list = malloc(sizeof(UiList)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | list->first = ui_list_first; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | list->next = ui_list_next; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | list->get = ui_list_get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | list->count = ui_list_count; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | list->observers = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | list->data = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | list->iter = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | list->update = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | list->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | uic_reg_var(ctx, name, UI_VAR_LIST, list); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | return list; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | void ui_list_free(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | ucx_list_free(list->data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | free(list); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | void* ui_list_first(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | UcxList *elm = list->data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | list->iter = elm; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | return elm ? elm->data : NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | void* ui_list_next(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | UcxList *elm = list->iter; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | if(elm) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | elm = elm->next; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | if(elm) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | list->iter = elm; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | return elm->data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | return NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | void* ui_list_get(UiList *list, int i) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | UcxList *elm = ucx_list_get(list->data, i); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | if(elm) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | list->iter = elm; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | return elm->data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | } else { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | return NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | int ui_list_count(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | UcxList *elm = list->data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | return (int)ucx_list_size(elm); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | void ui_list_append(UiList *list, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | list->data = ucx_list_append(list->data, data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | void ui_list_prepend(UiList *list, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | list->data = ucx_list_prepend(list->data, data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | void ui_list_clear(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | ucx_list_free(list->data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | list->data = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | void ui_list_addobsv(UiList *list, ui_callback f, void *data) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | list->observers = ui_add_observer(list->observers, f, data); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
168 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170 | void ui_list_notify(UiList *list) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | ui_notify(list->observers, list); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
174 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | typedef struct { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | int type; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
177 | char *name; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | } UiColumn; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
180 | UiModel* ui_model(UiContext *ctx, ...) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181 | UiModel *info = ui_calloc(ctx, 1, sizeof(UiModel)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183 | va_list ap; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184 | va_start(ap, ctx); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
185 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186 | UcxList *cols = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
187 | int type; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
188 | while((type = va_arg(ap, int)) != -1) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
189 | char *name = va_arg(ap, char*); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
190 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
191 | UiColumn *column = malloc(sizeof(UiColumn)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
192 | column->type = type; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
193 | column->name = name; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
194 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
195 | cols = ucx_list_append(cols, column); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
196 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
197 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
198 | va_end(ap); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
199 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
200 | size_t len = ucx_list_size(cols); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
201 | info->columns = len; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
202 | info->types = ui_calloc(ctx, len, sizeof(UiModelType)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
203 | info->titles = ui_calloc(ctx, len, sizeof(char*)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
204 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
205 | int i = 0; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206 | UCX_FOREACH(elm, cols) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
207 | UiColumn *c = elm->data; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
208 | info->types[i] = c->type; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
209 | info->titles[i] = c->name; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
210 | free(c); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
211 | i++; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
212 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213 | ucx_list_free(cols); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215 | return info; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
217 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218 | void ui_model_free(UiContext *ctx, UiModel *mi) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
219 | ucx_mempool_free(ctx->mempool, mi->types); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
220 | ucx_mempool_free(ctx->mempool, mi->titles); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
221 | ucx_mempool_free(ctx->mempool, mi); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
222 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
223 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
224 | // types |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
225 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
226 | // public functions |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
227 | UiInteger* ui_int_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
228 | UiInteger *i = ui_malloc(ctx, sizeof(UiInteger)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
229 | memset(i, 0, sizeof(UiInteger)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231 | uic_reg_var(ctx, name, UI_VAR_INTEGER, i); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
232 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
233 | return i; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
234 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
235 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
236 | UiDouble* ui_double_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
237 | UiDouble *d = ui_malloc(ctx, sizeof(UiDouble)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238 | memset(d, 0, sizeof(UiDouble)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
239 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240 | uic_reg_var(ctx, name, UI_VAR_DOUBLE, d); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
241 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
242 | return d; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
243 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
244 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
245 | UiString* ui_string_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
246 | UiString *s = ui_malloc(ctx, sizeof(UiString)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247 | memset(s, 0, sizeof(UiString)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
248 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
249 | uic_reg_var(ctx, name, UI_VAR_STRING, s); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
250 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251 | return s; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
252 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
254 | UiText* ui_text_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
255 | UiText *t = ui_malloc(ctx, sizeof(UiText)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
256 | memset(t, 0, sizeof(UiText)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
257 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
258 | uic_reg_var(ctx, name, UI_VAR_TEXT, t); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
259 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
260 | return t; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
261 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
262 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
263 | UiRange* ui_range_new(UiContext *ctx, char *name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
264 | UiRange *r = ui_malloc(ctx, sizeof(UiRange)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
265 | memset(r, 0, sizeof(UiRange)); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
266 | if(name) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
267 | uic_reg_var(ctx, name, UI_VAR_RANGE, r); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
268 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
269 | return r; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
270 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
271 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
272 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
273 | // private functions |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274 | void uic_int_copy(UiInteger *from, UiInteger *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
275 | to->get = from->get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276 | to->set = from->set; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
277 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
278 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
279 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
280 | void uic_double_copy(UiDouble *from, UiDouble *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
281 | to->get = from->get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
282 | to->set = from->set; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
283 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
284 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
285 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
286 | void uic_string_copy(UiString *from, UiString *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
287 | to->get = from->get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
288 | to->set = from->set; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
292 | void uic_text_copy(UiText *from, UiText *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
293 | to->get = from->get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
294 | to->set = from->set; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295 | to->getsubstr = from->getsubstr; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
296 | to->insert = from->insert; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
297 | to->setposition = from->setposition; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298 | to->position = from->position; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299 | to->selection = from->selection; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300 | to->length = from->length; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301 | to->remove = from->remove; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
303 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
304 | // do not copy the undo manager |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
305 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
306 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
307 | void uic_range_copy(UiRange *from, UiRange *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
308 | to->get = from->get; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
309 | to->set = from->set; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
310 | to->setrange = from->setrange; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
311 | to->setextent = from->setextent; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
312 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
313 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
314 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
315 | void uic_list_copy(UiList *from, UiList *to) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | to->update = from->update; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317 | to->obj = from->obj; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
318 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
319 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
320 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
321 | void uic_int_save(UiInteger *i) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322 | if(!i->obj) return; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323 | i->value = i->get(i); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
325 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
326 | void uic_double_save(UiDouble *d) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
327 | if(!d->obj) return; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
328 | d->value = d->get(d); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
329 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
330 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
331 | void uic_string_save(UiString *s) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332 | if(!s->obj) return; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
333 | s->get(s); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
334 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
335 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
336 | void uic_text_save(UiText *t) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337 | if(!t->obj) return; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
338 | t->get(t); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
339 | t->position(t); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
340 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
341 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
342 | void uic_range_save(UiRange *r) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
343 | if(!r->obj) return; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
344 | r->get(r); |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
345 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
346 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
347 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
348 | void uic_int_unbind(UiInteger *i) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
349 | i->get = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
350 | i->set = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
351 | i->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
352 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
353 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
354 | void uic_double_unbind(UiDouble *d) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
355 | d->get = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
356 | d->set = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
357 | d->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
358 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
359 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
360 | void uic_string_unbind(UiString *s) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
361 | s->get = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
362 | s->set = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
363 | s->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
364 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
365 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
366 | void uic_text_unbind(UiText *t) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
367 | t->set = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
368 | t->get = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
369 | t->getsubstr = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
370 | t->insert = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
371 | t->setposition = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
372 | t->position = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
373 | t->selection = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
374 | t->length = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
375 | t->remove = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
376 | t->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
377 | t->undomgr = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
378 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
379 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
380 | void uic_range_unbind(UiRange *r) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
381 | r->get = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
382 | r->set = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
383 | r->setextent = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
384 | r->setrange = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
385 | r->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
386 | } |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
387 | |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
388 | void uic_list_unbind(UiList *l) { |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
389 | l->update = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390 | l->obj = NULL; |
804d8803eade
add existing toolkit source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
391 | } |