Sun, 24 Jan 2016 11:59:58 +0100
radio buttons bind to UiInteger now
3 | 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 | #include <stdio.h> | |
30 | #include <stdlib.h> | |
31 | #include <string.h> | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
32 | #include <stdarg.h> |
3 | 33 | |
34 | #include "toolbar.h" | |
35 | #include "button.h" | |
36 | #include "stock.h" | |
87
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
37 | #include "list.h" |
3 | 38 | #include "../../ucx/mempool.h" |
39 | #include "../common/context.h" | |
40 | ||
41 | static UcxMap *toolbar_items; | |
42 | static UcxList *defaults; | |
43 | ||
44 | void ui_toolbar_init() { | |
45 | toolbar_items = ucx_map_new(16); | |
46 | } | |
47 | ||
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
48 | void ui_toolitem(char *name, char *label, ui_callback f, void *userdata) { |
3 | 49 | UiToolItem *item = malloc(sizeof(UiToolItem)); |
50 | item->item.add_to = (ui_toolbar_add_f)add_toolitem_widget; | |
51 | item->label = label; | |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
52 | item->image = NULL; |
3 | 53 | item->callback = f; |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
54 | item->userdata = userdata; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
55 | item->groups = NULL; |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
56 | item->isimportant = FALSE; |
3 | 57 | |
58 | ucx_map_cstr_put(toolbar_items, name, item); | |
59 | } | |
60 | ||
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
61 | void ui_toolitem_st(char *name, char *stockid, ui_callback f, void *userdata) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
62 | ui_toolitem_stgr(name, stockid, f, userdata, -1); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
63 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
64 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
65 | void ui_toolitem_stgr(char *name, char *stockid, ui_callback f, void *userdata, ...) { |
3 | 66 | UiStToolItem *item = malloc(sizeof(UiStToolItem)); |
67 | item->item.add_to = (ui_toolbar_add_f)add_toolitem_st_widget; | |
68 | item->stockid = stockid; | |
69 | item->callback = f; | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
70 | item->userdata = userdata; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
71 | item->groups = NULL; |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
72 | item->isimportant = FALSE; |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
73 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
74 | // add groups |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
75 | va_list ap; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
76 | va_start(ap, userdata); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
77 | int group; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
78 | while((group = va_arg(ap, int)) != -1) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
79 | item->groups = ucx_list_append(item->groups, (void*)(intptr_t)group); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
80 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
81 | va_end(ap); |
3 | 82 | |
83 | ucx_map_cstr_put(toolbar_items, name, item); | |
84 | } | |
85 | ||
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
86 | void ui_toolitem_img(char *name, char *label, char *img, ui_callback f, void *udata) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
87 | // TODO |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
88 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
89 | UiToolItem *item = malloc(sizeof(UiToolItem)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
90 | item->item.add_to = (ui_toolbar_add_f)add_toolitem_widget; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
91 | item->label = label; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
92 | item->image = img; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
93 | item->callback = f; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
94 | item->userdata = udata; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
95 | item->groups = NULL; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
96 | item->isimportant = FALSE; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
97 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
98 | ucx_map_cstr_put(toolbar_items, name, item); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
99 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
100 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
101 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
102 | void ui_toolitem_toggle_stgr(char *name, char *stockid, ui_callback f, void *udata, ...) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
103 | // TODO |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
104 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
105 | UiStToolItem *item = malloc(sizeof(UiStToolItem)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
106 | item->item.add_to = (ui_toolbar_add_f)add_toolitem_st_toggle_widget; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
107 | item->stockid = stockid; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
108 | item->callback = f; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
109 | item->userdata = udata; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
110 | item->groups = NULL; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
111 | item->isimportant = FALSE; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
112 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
113 | // add groups |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
114 | va_list ap; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
115 | va_start(ap, udata); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
116 | int group; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
117 | while((group = va_arg(ap, int)) != -1) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
118 | item->groups = ucx_list_append(item->groups, (void*)(intptr_t)group); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
119 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
120 | va_end(ap); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
121 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
122 | ucx_map_cstr_put(toolbar_items, name, item); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
123 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
124 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
125 | void ui_toolitem_toggle_imggr(char *name, char *label, char *img, ui_callback f, void *udata, ...) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
126 | // TODO |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
127 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
128 | UiToolItem *item = malloc(sizeof(UiToolItem)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
129 | item->item.add_to = (ui_toolbar_add_f)add_toolitem_toggle_widget; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
130 | item->label = label; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
131 | item->image = img; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
132 | item->callback = f; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
133 | item->userdata = udata; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
134 | item->groups = NULL; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
135 | item->isimportant = FALSE; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
136 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
137 | // add groups |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
138 | va_list ap; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
139 | va_start(ap, udata); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
140 | int group; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
141 | while((group = va_arg(ap, int)) != -1) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
142 | item->groups = ucx_list_append(item->groups, (void*)(intptr_t)group); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
143 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
144 | va_end(ap); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
145 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
146 | ucx_map_cstr_put(toolbar_items, name, item); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
147 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
148 | |
87
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
149 | void ui_toolbar_combobox( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
150 | char *name, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
151 | UiList *list, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
152 | ui_model_getvalue_f getvalue, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
153 | ui_callback f, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
154 | void *udata) |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
155 | { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
156 | UiToolbarComboBox *cb = malloc(sizeof(UiToolbarComboBox)); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
157 | cb->item.add_to = (ui_toolbar_add_f)add_toolbar_combobox; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
158 | cb->list = list; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
159 | cb->getvalue = getvalue; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
160 | cb->callback = f; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
161 | cb->userdata = udata; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
162 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
163 | ucx_map_cstr_put(toolbar_items, name, cb); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
164 | } |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
165 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
166 | void ui_toolbar_combobox_str( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
167 | char *name, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
168 | UiList *list, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
169 | ui_callback f, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
170 | void *udata) |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
171 | { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
172 | ui_toolbar_combobox(name, list, ui_strmodel_getvalue, f, udata); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
173 | } |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
174 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
175 | void ui_toolbar_combobox_nv( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
176 | char *name, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
177 | char *listname, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
178 | ui_model_getvalue_f getvalue, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
179 | ui_callback f, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
180 | void *udata) |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
181 | { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
182 | UiToolbarComboBoxNV *cb = malloc(sizeof(UiToolbarComboBoxNV)); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
183 | cb->item.add_to = (ui_toolbar_add_f)add_toolbar_combobox; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
184 | cb->listname = listname; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
185 | cb->getvalue = getvalue; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
186 | cb->callback = f; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
187 | cb->userdata = udata; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
188 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
189 | ucx_map_cstr_put(toolbar_items, name, cb); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
190 | } |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
191 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
192 | |
3 | 193 | void ui_toolbar_add_default(char *name) { |
194 | char *s = strdup(name); | |
195 | defaults = ucx_list_append(defaults, s); | |
196 | } | |
197 | ||
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
198 | Widget ui_create_toolbar(UiObject *obj, Widget parent) { |
3 | 199 | if(!defaults) { |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
200 | return NULL; |
3 | 201 | } |
202 | ||
203 | Arg args[8]; | |
204 | XtSetArg(args[0], XmNshadowType, XmSHADOW_ETCHED_OUT); | |
205 | XtSetArg(args[1], XmNshadowThickness, 1); | |
206 | XtSetArg(args[2], XmNtopAttachment, XmATTACH_FORM); | |
207 | XtSetArg(args[3], XmNleftAttachment, XmATTACH_FORM); | |
208 | XtSetArg(args[4], XmNrightAttachment, XmATTACH_FORM); | |
209 | Widget frame = XmCreateFrame(parent, "toolbar_frame", args, 5); | |
210 | ||
211 | XtSetArg(args[0], XmNorientation, XmHORIZONTAL); | |
212 | XtSetArg(args[1], XmNpacking, XmPACK_TIGHT); | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
213 | XtSetArg(args[2], XmNspacing, 1); |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
214 | Widget toolbar = XmCreateRowColumn (frame, "toolbar", args, 3); |
3 | 215 | |
216 | UCX_FOREACH(elm, defaults) { | |
217 | UiToolItemI *item = ucx_map_cstr_get(toolbar_items, elm->data); | |
218 | if(item) { | |
219 | item->add_to(toolbar, item, obj); | |
220 | } else if(!strcmp(elm->data, "@separator")) { | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
221 | // TODO |
3 | 222 | } else { |
223 | fprintf(stderr, "UI Error: Unknown toolbar item: %s\n", elm->data); | |
224 | } | |
225 | } | |
226 | ||
227 | XtManageChild(toolbar); | |
228 | XtManageChild(frame); | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
229 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
230 | return frame; |
3 | 231 | } |
232 | ||
233 | void add_toolitem_widget(Widget parent, UiToolItem *item, UiObject *obj) { | |
234 | Arg args[4]; | |
235 | ||
236 | XmString label = XmStringCreateLocalized(item->label); | |
237 | XtSetArg(args[0], XmNlabelString, label); | |
238 | XtSetArg(args[1], XmNshadowThickness, 1); | |
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
239 | XtSetArg(args[2], XmNtraversalOn, FALSE); |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
240 | Widget button = XmCreatePushButton(parent, "toolbar_button", args, 3); |
3 | 241 | |
242 | XmStringFree(label); | |
243 | ||
244 | if(item->callback) { | |
245 | UiEventData *event = ucx_mempool_malloc( | |
246 | obj->ctx->mempool, | |
247 | sizeof(UiEventData)); | |
248 | event->obj = obj; | |
98
efaae97bd95b
added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
249 | event->userdata = item->userdata; |
3 | 250 | event->callback = item->callback; |
251 | XtAddCallback( | |
252 | button, | |
253 | XmNactivateCallback, | |
254 | (XtCallbackProc)ui_push_button_callback, | |
255 | event); | |
256 | } | |
257 | ||
258 | XtManageChild(button); | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
259 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
260 | if(item->groups) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
261 | uic_add_group_widget(obj->ctx, button, item->groups); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
262 | } |
3 | 263 | } |
264 | ||
265 | void add_toolitem_st_widget(Widget parent, UiStToolItem *item, UiObject *obj) { | |
39
4e66271541e8
added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
266 | Arg args[8]; |
3 | 267 | |
268 | UiStockItem *stock_item = ui_get_stock_item(item->stockid); | |
39
4e66271541e8
added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
269 | |
3 | 270 | XmString label = XmStringCreateLocalized(stock_item->label); |
271 | XtSetArg(args[0], XmNlabelString, label); | |
272 | XtSetArg(args[1], XmNshadowThickness, 1); | |
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
273 | XtSetArg(args[2], XmNtraversalOn, FALSE); |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
274 | Widget button = XmCreatePushButton(parent, "toolbar_button", args, 3); |
39
4e66271541e8
added table view (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
275 | |
3 | 276 | XmStringFree(label); |
277 | ||
278 | if(item->callback) { | |
279 | UiEventData *event = ucx_mempool_malloc( | |
280 | obj->ctx->mempool, | |
281 | sizeof(UiEventData)); | |
282 | event->obj = obj; | |
98
efaae97bd95b
added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
283 | event->userdata = item->userdata; |
3 | 284 | event->callback = item->callback; |
285 | XtAddCallback( | |
286 | button, | |
287 | XmNactivateCallback, | |
288 | (XtCallbackProc)ui_push_button_callback, | |
289 | event); | |
290 | } | |
291 | ||
292 | XtManageChild(button); | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
293 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
294 | if(item->groups) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
295 | uic_add_group_widget(obj->ctx, button, item->groups); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
296 | } |
3 | 297 | } |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
298 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
299 | void add_toolitem_toggle_widget(Widget parent, UiToolItem *item, UiObject *obj) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
300 | Arg args[8]; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
301 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
302 | XmString label = XmStringCreateLocalized(item->label); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
303 | XtSetArg(args[0], XmNlabelString, label); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
304 | XtSetArg(args[1], XmNshadowThickness, 1); |
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
305 | XtSetArg(args[2], XmNtraversalOn, FALSE); |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
306 | XtSetArg(args[3], XmNindicatorOn, XmINDICATOR_NONE); |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
307 | Widget button = XmCreateToggleButton(parent, "toolbar_toggle_button", args, 4); |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
308 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
309 | XmStringFree(label); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
310 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
311 | if(item->callback) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
312 | UiEventData *event = ucx_mempool_malloc( |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
313 | obj->ctx->mempool, |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
314 | sizeof(UiEventData)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
315 | event->obj = obj; |
98
efaae97bd95b
added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
316 | event->userdata = item->userdata; |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
317 | event->callback = item->callback; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
318 | XtAddCallback( |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
319 | button, |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
320 | XmNvalueChangedCallback, |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
321 | (XtCallbackProc)ui_toggle_button_callback, |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
322 | event); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
323 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
324 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
325 | XtManageChild(button); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
326 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
327 | if(item->groups) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
328 | uic_add_group_widget(obj->ctx, button, item->groups); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
329 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
330 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
331 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
332 | void add_toolitem_st_toggle_widget(Widget parent, UiStToolItem *item, UiObject *obj) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
333 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
334 | } |
87
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
335 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
336 | void add_toolbar_combobox(Widget tb, UiToolbarComboBox *item, UiObject *obj) { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
337 | UiListPtr *listptr = ucx_mempool_malloc( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
338 | obj->ctx->mempool, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
339 | sizeof(UiListPtr)); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
340 | UiListView *listview = ucx_mempool_malloc( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
341 | obj->ctx->mempool, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
342 | sizeof(UiListView)); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
343 | listptr->list = item->list; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
344 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
345 | Arg args[8]; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
346 | XtSetArg(args[0], XmNshadowThickness, 1); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
347 | XtSetArg(args[1], XmNindicatorOn, XmINDICATOR_NONE); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
348 | XtSetArg(args[2], XmNtraversalOn, FALSE); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
349 | XtSetArg(args[3], XmNwidth, 120); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
350 | Widget combobox = XmCreateDropDownList(tb, "toolbar_combobox", args, 4); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
351 | XtManageChild(combobox); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
352 | listview->widget = combobox; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
353 | listview->list = listptr; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
354 | listview->getvalue = item->getvalue; |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
355 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
356 | ui_listview_update(NULL, listview); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
357 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
358 | listptr->list->observers = ui_add_observer( |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
359 | listptr->list->observers, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
360 | (ui_callback)ui_listview_update, |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
361 | listview); |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
362 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
363 | if(item->callback) { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
364 | // TODO: |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
365 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
366 | } |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
367 | } |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
368 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
369 | void add_toolbar_combobox_nv(Widget tb, UiToolbarComboBoxNV *item, UiObject *obj) { |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
370 | |
e624b6fa4c78
added toolbar combobox (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
39
diff
changeset
|
371 | } |