comparison gtk4/dw.c @ 2304:ae6f678cb1a9

GTK4: Implement thread safety system based on the new MacOS thread code. First part is most of the MacOS function that require thread safety... A second part filling in the gaps will be coming soon.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 09 Feb 2021 23:14:26 +0000
parents cdd8459add40
children 047ad6a5cc1d
comparison
equal deleted inserted replaced
2303:cdd8459add40 2304:ae6f678cb1a9
42 # else 42 # else
43 # define __func__ "<unknown>" 43 # define __func__ "<unknown>"
44 # endif 44 # endif
45 #endif 45 #endif
46 46
47 /* Macros to encapsulate running functions on the main thread
48 * #define _DW_SINGLE_THREADED to disable thread safety encapulation.
49 * Parameters converted to a pointer array:
50 * [0] Pointer to the thread's event semaphore
51 * [1] Pointer to the funtion's return value
52 * [2] Pointer to function parameter 1
53 * ...
54 */
55 #ifndef _DW_SINGLE_THREADED
56 #define DW_FUNCTION_DEFINITION(func, rettype, ...) gboolean _##func(void **_args); \
57 rettype API func(__VA_ARGS__) {
58 #define DW_FUNCTION_ADD_PARAM1(param1) void **_args = alloca(sizeof(void *)*3); \
59 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
60 _args[1] = (void *)NULL; \
61 _args[2] = (void *)&param1;
62 #define DW_FUNCTION_ADD_PARAM2(param1, param2) void **_args = alloca(sizeof(void *)*4); \
63 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
64 _args[1] = (void *)NULL; \
65 _args[2] = (void *)&param1; \
66 _args[3] = (void *)&param2;
67 #define DW_FUNCTION_ADD_PARAM3(param1, param2, param3) void **_args = alloca(sizeof(void *)*5); \
68 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
69 _args[1] = (void *)NULL; \
70 _args[2] = (void *)&param1; \
71 _args[3] = (void *)&param2; \
72 _args[4] = (void *)&param3;
73 #define DW_FUNCTION_ADD_PARAM4(param1, param2, param3, param4) void **_args = alloca(sizeof(void *)*6); \
74 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
75 _args[1] = (void *)NULL; \
76 _args[2] = (void *)&param1; \
77 _args[3] = (void *)&param2; \
78 _args[4] = (void *)&param3; \
79 _args[5] = (void *)&param4;
80 #define DW_FUNCTION_ADD_PARAM5(param1, param2, param3, param4, param5) void **_args = alloca(sizeof(void *)*7); \
81 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
82 _args[1] = (void *)NULL; \
83 _args[2] = (void *)&param1; \
84 _args[3] = (void *)&param2; \
85 _args[4] = (void *)&param3; \
86 _args[5] = (void *)&param4; \
87 _args[6] = (void *)&param5;
88 #define DW_FUNCTION_ADD_PARAM6(param1, param2, param3, param4, param5, param6) \
89 void **_args = alloca(sizeof(void *)*8); \
90 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
91 _args[1] = (void *)NULL; \
92 _args[2] = (void *)&param1; \
93 _args[3] = (void *)&param2; \
94 _args[4] = (void *)&param3; \
95 _args[5] = (void *)&param4; \
96 _args[6] = (void *)&param5; \
97 _args[7] = (void *)&param6;
98 #define DW_FUNCTION_ADD_PARAM7(param1, param2, param3, param4, param5, param6, param7) \
99 void **_args = alloca(sizeof(void *)*9); \
100 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
101 _args[1] = (void *)NULL; \
102 _args[2] = (void *)&param1; \
103 _args[3] = (void *)&param2; \
104 _args[4] = (void *)&param3; \
105 _args[5] = (void *)&param4; \
106 _args[6] = (void *)&param5; \
107 _args[7] = (void *)&param6; \
108 _args[8] = (void *)&param7;
109 #define DW_FUNCTION_ADD_PARAM8(param1, param2, param3, param4, param5, param6, param7, param8) \
110 void **_args = alloca(sizeof(void *)*10); \
111 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
112 _args[1] = (void *)NULL; \
113 _args[2] = (void *)&param1; \
114 _args[3] = (void *)&param2; \
115 _args[4] = (void *)&param3; \
116 _args[5] = (void *)&param4; \
117 _args[6] = (void *)&param5; \
118 _args[7] = (void *)&param6; \
119 _args[8] = (void *)&param7; \
120 _args[9] = (void *)&param8;
121 #define DW_FUNCTION_ADD_PARAM9(param1, param2, param3, param4, param5, param6, param7, param8, param9) \
122 void **_args = alloca(sizeof(void *)*11); \
123 _args[0] = (void *)pthread_getspecific(_dw_event_key); \
124 _args[1] = (void *)NULL; \
125 _args[2] = (void *)&param1; \
126 _args[3] = (void *)&param2; \
127 _args[4] = (void *)&param3; \
128 _args[5] = (void *)&param4; \
129 _args[6] = (void *)&param5; \
130 _args[7] = (void *)&param6; \
131 _args[8] = (void *)&param7; \
132 _args[9] = (void *)&param8; \
133 _args[10] = (void *)&param9;
134 #define DW_FUNCTION_RESTORE_PARAM1(param1, vartype1) \
135 vartype1 param1 = *((vartype1 *)_args[2]);
136 #define DW_FUNCTION_RESTORE_PARAM2(param1, vartype1, param2, vartype2) \
137 vartype1 param1 = *((vartype1 *)_args[2]); \
138 vartype2 param2 = *((vartype2 *)_args[3]);
139 #define DW_FUNCTION_RESTORE_PARAM3(param1, vartype1, param2, vartype2, param3, vartype3) \
140 vartype1 param1 = *((vartype1 *)_args[2]); \
141 vartype2 param2 = *((vartype2 *)_args[3]); \
142 vartype3 param3 = *((vartype3 *)_args[4]);
143 #define DW_FUNCTION_RESTORE_PARAM4(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4) \
144 vartype1 param1 = *((vartype1 *)_args[2]); \
145 vartype2 param2 = *((vartype2 *)_args[3]); \
146 vartype3 param3 = *((vartype3 *)_args[4]); \
147 vartype4 param4 = *((vartype4 *)_args[5]);
148 #define DW_FUNCTION_RESTORE_PARAM5(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5) \
149 vartype1 param1 = *((vartype1 *)_args[2]); \
150 vartype2 param2 = *((vartype2 *)_args[3]); \
151 vartype3 param3 = *((vartype3 *)_args[4]); \
152 vartype4 param4 = *((vartype4 *)_args[5]); \
153 vartype5 param5 = *((vartype5 *)_args[6]);
154 #define DW_FUNCTION_RESTORE_PARAM6(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6) \
155 vartype1 param1 = *((vartype1 *)_args[2]); \
156 vartype2 param2 = *((vartype2 *)_args[3]); \
157 vartype3 param3 = *((vartype3 *)_args[4]); \
158 vartype4 param4 = *((vartype4 *)_args[5]); \
159 vartype5 param5 = *((vartype5 *)_args[6]); \
160 vartype6 param6 = *((vartype6 *)_args[7]);
161 #define DW_FUNCTION_RESTORE_PARAM7(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7) \
162 vartype1 param1 = *((vartype1 *)_args[2]); \
163 vartype2 param2 = *((vartype2 *)_args[3]); \
164 vartype3 param3 = *((vartype3 *)_args[4]); \
165 vartype4 param4 = *((vartype4 *)_args[5]); \
166 vartype5 param5 = *((vartype5 *)_args[6]); \
167 vartype6 param6 = *((vartype6 *)_args[7]); \
168 vartype7 param7 = *((vartype7 *)_args[8]);
169 #define DW_FUNCTION_RESTORE_PARAM8(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8) \
170 vartype1 param1 = *((vartype1 *)_args[2]); \
171 vartype2 param2 = *((vartype2 *)_args[3]); \
172 vartype3 param3 = *((vartype3 *)_args[4]); \
173 vartype4 param4 = *((vartype4 *)_args[5]); \
174 vartype5 param5 = *((vartype5 *)_args[6]); \
175 vartype6 param6 = *((vartype6 *)_args[7]); \
176 vartype7 param7 = *((vartype7 *)_args[8]); \
177 vartype8 param8 = *((vartype8 *)_args[9]);
178 #define DW_FUNCTION_RESTORE_PARAM9(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8, param9, vartype9) \
179 vartype1 param1 = *((vartype1 *)_args[2]); \
180 vartype2 param2 = *((vartype2 *)_args[3]); \
181 vartype3 param3 = *((vartype3 *)_args[4]); \
182 vartype4 param4 = *((vartype4 *)_args[5]); \
183 vartype5 param5 = *((vartype5 *)_args[6]); \
184 vartype6 param6 = *((vartype6 *)_args[7]); \
185 vartype7 param7 = *((vartype7 *)_args[8]); \
186 vartype8 param8 = *((vartype8 *)_args[9]); \
187 vartype9 param9 = *((vartype9 *)_args[10]);
188 #define DW_FUNCTION_END }
189 #define DW_FUNCTION_NO_RETURN(func) dw_event_reset((HEV)_args[0]); \
190 if(_dw_thread == (pthread_t)-1 || pthread_self() == _dw_thread) \
191 _##func(_args); \
192 else { \
193 g_idle_add_full(G_PRIORITY_HIGH_IDLE, G_SOURCE_FUNC(_##func), (gpointer)_args, NULL); \
194 dw_event_wait((HEV)_args[0], DW_TIMEOUT_INFINITE); } \
195 }\
196 gboolean _##func(void **_args) {
197 #define DW_FUNCTION_RETURN(func, rettype) dw_event_reset((HEV)_args[0]); \
198 if(_dw_thread == (pthread_t)-1 || pthread_self() == _dw_thread) \
199 _##func(_args); \
200 else { \
201 g_idle_add_full(G_PRIORITY_HIGH_IDLE, G_SOURCE_FUNC(_##func), (gpointer)_args, NULL); \
202 dw_event_wait((HEV)_args[0], DW_TIMEOUT_INFINITE); } { \
203 void *tmp = _args[1]; \
204 rettype myreturn = *((rettype *)tmp); \
205 free(tmp); \
206 return myreturn; } \
207 } \
208 gboolean _##func(void **_args) {
209 #define DW_FUNCTION_RETURN_THIS(_retvar) { void *_myreturn = malloc(sizeof(_retvar)); \
210 memcpy(_myreturn, (void *)&_retvar, sizeof(_retvar)); \
211 _args[1] = _myreturn; } \
212 dw_event_post((HEV)_args[0]); \
213 return FALSE; }
214 #define DW_FUNCTION_RETURN_NOTHING dw_event_post((HEV)_args[0]); \
215 return FALSE; }
216 #else
217 #define DW_FUNCTION_DEFINITION(func, rettype, ...) rettype API func(__VA_ARGS__)
218 #define DW_FUNCTION_ADD_PARAM1(param1)
219 #define DW_FUNCTION_ADD_PARAM2(param1, param2)
220 #define DW_FUNCTION_ADD_PARAM3(param1, param2, param3)
221 #define DW_FUNCTION_ADD_PARAM4(param1, param2, param3, param4)
222 #define DW_FUNCTION_ADD_PARAM5(param1, param2, param3, param4, param5)
223 #define DW_FUNCTION_ADD_PARAM6(param1, param2, param3, param4, param5, param6)
224 #define DW_FUNCTION_ADD_PARAM7(param1, param2, param3, param4, param5, param6, param7)
225 #define DW_FUNCTION_ADD_PARAM8(param1, param2, param3, param4, param5, param6, param7, param8)
226 #define DW_FUNCTION_ADD_PARAM9(param1, param2, param3, param4, param5, param6, param7, param8, param9)
227 #define DW_FUNCTION_RESTORE_PARAM1(param1, vartype1)
228 #define DW_FUNCTION_RESTORE_PARAM2(param1, vartype1, param2, vartype2)
229 #define DW_FUNCTION_RESTORE_PARAM3(param1, vartype1, param2, vartype2, param3, vartype3)
230 #define DW_FUNCTION_RESTORE_PARAM4(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4)
231 #define DW_FUNCTION_RESTORE_PARAM5(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5)
232 #define DW_FUNCTION_RESTORE_PARAM6(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6)
233 #define DW_FUNCTION_RESTORE_PARAM7(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7)
234 #define DW_FUNCTION_RESTORE_PARAM8(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8)
235 #define DW_FUNCTION_RESTORE_PARAM9(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8, param9, vartype9)
236 #define DW_FUNCTION_END
237 #define DW_FUNCTION_NO_RETURN(func)
238 #define DW_FUNCTION_RETURN(func, rettype)
239 #define DW_FUNCTION_RETURN_THIS(retvar) return retvar;
240 #define DW_FUNCTION_RETURN_NOTHING
241 #endif
242
47 /* ff = 255 = 1.0000 243 /* ff = 255 = 1.0000
48 * ee = 238 = 0.9333 244 * ee = 238 = 0.9333
49 * cc = 204 = 0.8000 245 * cc = 204 = 0.8000
50 * bb = 187 = 0.7333 246 * bb = 187 = 0.7333
51 * aa = 170 = 0.6667 247 * aa = 170 = 0.6667
97 # define min(a,b) (((a) < (b)) ? (a) : (b)) 293 # define min(a,b) (((a) < (b)) ? (a) : (b))
98 #endif 294 #endif
99 295
100 pthread_key_t _dw_fg_color_key; 296 pthread_key_t _dw_fg_color_key;
101 pthread_key_t _dw_bg_color_key; 297 pthread_key_t _dw_bg_color_key;
298 pthread_key_t _dw_event_key;
102 299
103 GtkWidget *last_window = NULL, *popup = NULL; 300 GtkWidget *last_window = NULL, *popup = NULL;
104 301
105 static int _dw_ignore_expand = 0; 302 static int _dw_ignore_expand = 0;
106 static pthread_t _dw_thread = (pthread_t)-1; 303 static pthread_t _dw_thread = (pthread_t)-1;
1095 _DWMainLoop = g_main_loop_new(NULL, FALSE); 1292 _DWMainLoop = g_main_loop_new(NULL, FALSE);
1096 g_main_loop_ref(_DWMainLoop); 1293 g_main_loop_ref(_DWMainLoop);
1097 1294
1098 pthread_key_create(&_dw_fg_color_key, NULL); 1295 pthread_key_create(&_dw_fg_color_key, NULL);
1099 pthread_key_create(&_dw_bg_color_key, NULL); 1296 pthread_key_create(&_dw_bg_color_key, NULL);
1297 pthread_key_create(&_dw_event_key, NULL);
1100 1298
1101 _dw_init_thread(); 1299 _dw_init_thread();
1102 1300
1103 /* Create a global object for glib activities */ 1301 /* Create a global object for glib activities */
1104 _DWObject = g_object_new(G_TYPE_OBJECT, NULL); 1302 _DWObject = g_object_new(G_TYPE_OBJECT, NULL);
1368 * Parameters: 1566 * Parameters:
1369 * handle: The window handle to minimize. 1567 * handle: The window handle to minimize.
1370 */ 1568 */
1371 int dw_window_minimize(HWND handle) 1569 int dw_window_minimize(HWND handle)
1372 { 1570 {
1373 if(!handle) 1571 if(handle && GTK_IS_WINDOW(handle))
1374 return 0; 1572 gtk_window_minimize(GTK_WINDOW(handle));
1375 1573 return DW_ERROR_NONE;
1376 gtk_window_minimize(GTK_WINDOW(handle));
1377 return 0;
1378 } 1574 }
1379 1575
1380 /* 1576 /*
1381 * Makes the window topmost. 1577 * Makes the window topmost.
1382 * Parameters: 1578 * Parameters:
2017 * Create a new Box to be packed. 2213 * Create a new Box to be packed.
2018 * Parameters: 2214 * Parameters:
2019 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). 2215 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
2020 * pad: Number of pixels to pad around the box. 2216 * pad: Number of pixels to pad around the box.
2021 */ 2217 */
2022 HWND dw_box_new(int type, int pad) 2218 DW_FUNCTION_DEFINITION(dw_box_new, HWND, int type, int pad)
2023 { 2219 DW_FUNCTION_ADD_PARAM2(type, pad)
2024 GtkWidget *tmp; 2220 DW_FUNCTION_RETURN(dw_box_new, HWND)
2025 2221 DW_FUNCTION_RESTORE_PARAM2(type, int, pad, int)
2026 tmp = gtk_grid_new(); 2222 {
2223 GtkWidget *tmp = gtk_grid_new();
2027 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type)); 2224 g_object_set_data(G_OBJECT(tmp), "_dw_boxtype", GINT_TO_POINTER(type));
2028 _dw_widget_set_pad(tmp, pad); 2225 _dw_widget_set_pad(tmp, pad);
2029 gtk_widget_show(tmp); 2226 gtk_widget_show(tmp);
2030 return tmp; 2227 DW_FUNCTION_RETURN_THIS(tmp);
2031 } 2228 }
2032 2229
2033 /* 2230 /*
2034 * Create a new scrollable Box to be packed. 2231 * Create a new scrollable Box to be packed.
2035 * Parameters: 2232 * Parameters:
2664 * Create a container object to be packed. 2861 * Create a container object to be packed.
2665 * Parameters: 2862 * Parameters:
2666 * id: An ID to be used for getting the resource from the 2863 * id: An ID to be used for getting the resource from the
2667 * resource file. 2864 * resource file.
2668 */ 2865 */
2669 HWND dw_container_new(unsigned long id, int multi) 2866 DW_FUNCTION_DEFINITION(dw_container_new, HWND, ULONG cid, int multi)
2867 DW_FUNCTION_ADD_PARAM2(cid, multi)
2868 DW_FUNCTION_RETURN(dw_container_new, HWND)
2869 DW_FUNCTION_RESTORE_PARAM2(cid, ULONG, multi, int)
2670 { 2870 {
2671 GtkWidget *tmp; 2871 GtkWidget *tmp;
2672 2872
2673 if(!(tmp = _dw_tree_create(id))) 2873 if((tmp = _dw_tree_create(cid)))
2674 return 0; 2874 {
2675 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)); 2875 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER));
2676 g_object_set_data(G_OBJECT(tmp), "_dw_multi_sel", GINT_TO_POINTER(multi)); 2876 g_object_set_data(G_OBJECT(tmp), "_dw_multi_sel", GINT_TO_POINTER(multi));
2677 return tmp; 2877 }
2878 DW_FUNCTION_RETURN_THIS(tmp);
2678 } 2879 }
2679 2880
2680 /* 2881 /*
2681 * Create a tree object to be packed. 2882 * Create a tree object to be packed.
2682 * Parameters: 2883 * Parameters:
2683 * id: An ID to be used for getting the resource from the 2884 * id: An ID to be used for getting the resource from the
2684 * resource file. 2885 * resource file.
2685 */ 2886 */
2686 HWND dw_tree_new(ULONG id) 2887 DW_FUNCTION_DEFINITION(dw_tree_new, HWND, ULONG cid)
2888 DW_FUNCTION_ADD_PARAM1(cid)
2889 DW_FUNCTION_RETURN(dw_tree_new, HWND)
2890 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG)
2687 { 2891 {
2688 GtkWidget *tmp, *tree; 2892 GtkWidget *tmp, *tree;
2689 GtkTreeStore *store; 2893 GtkTreeStore *store;
2690 GtkTreeViewColumn *col; 2894 GtkTreeViewColumn *col;
2691 GtkCellRenderer *rend; 2895 GtkCellRenderer *rend;
2692 GtkTreeSelection *sel; 2896 GtkTreeSelection *sel;
2693 2897
2694 if(!(tmp = _dw_tree_create(id))) 2898 if((tmp = _dw_tree_create(cid)))
2695 return 0; 2899 {
2696 store = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_POINTER); 2900 store = gtk_tree_store_new(4, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_POINTER);
2697 tree = _dw_tree_view_setup(tmp, GTK_TREE_MODEL(store)); 2901 tree = _dw_tree_view_setup(tmp, GTK_TREE_MODEL(store));
2698 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE)); 2902 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE));
2699 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE)); 2903 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_TREE));
2700 col = gtk_tree_view_column_new(); 2904 col = gtk_tree_view_column_new();
2701 2905
2702 rend = gtk_cell_renderer_pixbuf_new(); 2906 rend = gtk_cell_renderer_pixbuf_new();
2703 gtk_tree_view_column_pack_start(col, rend, FALSE); 2907 gtk_tree_view_column_pack_start(col, rend, FALSE);
2704 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1); 2908 gtk_tree_view_column_add_attribute(col, rend, "pixbuf", 1);
2705 rend = gtk_cell_renderer_text_new(); 2909 rend = gtk_cell_renderer_text_new();
2706 gtk_tree_view_column_pack_start(col, rend, TRUE); 2910 gtk_tree_view_column_pack_start(col, rend, TRUE);
2707 gtk_tree_view_column_add_attribute(col, rend, "text", 0); 2911 gtk_tree_view_column_add_attribute(col, rend, "text", 0);
2708 2912
2709 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); 2913 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col);
2710 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); 2914 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col);
2711 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); 2915 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
2712 2916
2713 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); 2917 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
2714 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); 2918 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
2715 gtk_widget_show(tree); 2919 gtk_widget_show(tree);
2716 2920
2717 if(_DWDefaultFont) 2921 if(_DWDefaultFont)
2718 dw_window_set_font(tmp, _DWDefaultFont); 2922 dw_window_set_font(tmp, _DWDefaultFont);
2719 return tmp; 2923 }
2924 DW_FUNCTION_RETURN_THIS(tmp);
2720 } 2925 }
2721 2926
2722 2927
2723 /* 2928 /*
2724 * Create a new static text window (widget) to be packed. 2929 * Create a new static text window (widget) to be packed.
2841 * Create a new Combobox window (widget) to be packed. 3046 * Create a new Combobox window (widget) to be packed.
2842 * Parameters: 3047 * Parameters:
2843 * text: The default text to be in the combpbox widget. 3048 * text: The default text to be in the combpbox widget.
2844 * id: An ID to be used with dw_window_from_id() or 0L. 3049 * id: An ID to be used with dw_window_from_id() or 0L.
2845 */ 3050 */
2846 HWND dw_combobox_new(const char *text, unsigned long id) 3051 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, const char *text, ULONG cid)
3052 DW_FUNCTION_ADD_PARAM2(text, cid)
3053 DW_FUNCTION_RETURN(dw_combobox_new, HWND)
3054 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG)
2847 { 3055 {
2848 GtkWidget *tmp; 3056 GtkWidget *tmp;
2849 GtkEntryBuffer *buffer; 3057 GtkEntryBuffer *buffer;
2850 GtkListStore *store; 3058 GtkListStore *store;
2851 3059
2855 buffer = gtk_entry_get_buffer(GTK_ENTRY(gtk_combo_box_get_child(GTK_COMBO_BOX(tmp)))); 3063 buffer = gtk_entry_get_buffer(GTK_ENTRY(gtk_combo_box_get_child(GTK_COMBO_BOX(tmp))));
2856 gtk_entry_buffer_set_max_length(buffer, 0); 3064 gtk_entry_buffer_set_max_length(buffer, 0);
2857 gtk_entry_buffer_set_text(buffer, text, -1); 3065 gtk_entry_buffer_set_text(buffer, text, -1);
2858 gtk_widget_show(tmp); 3066 gtk_widget_show(tmp);
2859 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_COMBOBOX)); 3067 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_COMBOBOX));
2860 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); 3068 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(cid));
2861 if(_DWDefaultFont) 3069 if(_DWDefaultFont)
2862 dw_window_set_font(tmp, _DWDefaultFont); 3070 dw_window_set_font(tmp, _DWDefaultFont);
2863 return tmp; 3071 DW_FUNCTION_RETURN_THIS(tmp);
2864 } 3072 }
2865 3073
2866 /* 3074 /*
2867 * Create a new button window (widget) to be packed. 3075 * Create a new button window (widget) to be packed.
2868 * Parameters: 3076 * Parameters:
3093 * Create a new listbox window (widget) to be packed. 3301 * Create a new listbox window (widget) to be packed.
3094 * Parameters: 3302 * Parameters:
3095 * id: An ID to be used with dw_window_from_id() or 0L. 3303 * id: An ID to be used with dw_window_from_id() or 0L.
3096 * multi: Multiple select TRUE or FALSE. 3304 * multi: Multiple select TRUE or FALSE.
3097 */ 3305 */
3098 HWND dw_listbox_new(unsigned long id, int multi) 3306 DW_FUNCTION_DEFINITION(dw_listbox_new, HWND, ULONG cid, int multi)
3307 DW_FUNCTION_ADD_PARAM2(cid, multi)
3308 DW_FUNCTION_RETURN(dw_listbox_new, HWND)
3309 DW_FUNCTION_RESTORE_PARAM2(cid, ULONG, multi, int)
3099 { 3310 {
3100 GtkWidget *tmp, *tree; 3311 GtkWidget *tmp, *tree;
3101 GtkListStore *store; 3312 GtkListStore *store;
3102 GtkTreeViewColumn *col; 3313 GtkTreeViewColumn *col;
3103 GtkCellRenderer *rend; 3314 GtkCellRenderer *rend;
3104 GtkTreeSelection *sel; 3315 GtkTreeSelection *sel;
3105 3316
3106 if(!(tmp = _dw_tree_create(id))) 3317 if((tmp = _dw_tree_create(cid)))
3107 return 0; 3318 {
3108 store = gtk_list_store_new(1, G_TYPE_STRING); 3319 store = gtk_list_store_new(1, G_TYPE_STRING);
3109 tree = _dw_tree_view_setup(tmp, GTK_TREE_MODEL(store)); 3320 tree = _dw_tree_view_setup(tmp, GTK_TREE_MODEL(store));
3110 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); 3321 g_object_set_data(G_OBJECT(tmp), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX));
3111 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)); 3322 g_object_set_data(G_OBJECT(tree), "_dw_tree_type", GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX));
3112 3323
3113 col = gtk_tree_view_column_new(); 3324 col = gtk_tree_view_column_new();
3114 rend = gtk_cell_renderer_text_new(); 3325 rend = gtk_cell_renderer_text_new();
3115 gtk_tree_view_column_pack_start(col, rend, TRUE); 3326 gtk_tree_view_column_pack_start(col, rend, TRUE);
3116 gtk_tree_view_column_add_attribute(col, rend, "text", 0); 3327 gtk_tree_view_column_add_attribute(col, rend, "text", 0);
3117 3328
3118 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); 3329 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col);
3119 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); 3330 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col);
3120 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); 3331 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
3121 3332
3122 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); 3333 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
3123 if(multi) 3334 if(multi)
3124 { 3335 {
3125 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); 3336 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
3126 } 3337 }
3127 else 3338 else
3128 { 3339 {
3129 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); 3340 gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
3130 } 3341 }
3131 gtk_widget_show(tree); 3342 gtk_widget_show(tree);
3132 if(_DWDefaultFont) 3343 if(_DWDefaultFont)
3133 dw_window_set_font(tmp, _DWDefaultFont); 3344 dw_window_set_font(tmp, _DWDefaultFont);
3134 return tmp; 3345 }
3346 DW_FUNCTION_RETURN_THIS(tmp);
3135 } 3347 }
3136 3348
3137 /* 3349 /*
3138 * Sets the icon used for a given window. 3350 * Sets the icon used for a given window.
3139 * Parameters: 3351 * Parameters:
3416 * Parameters: 3628 * Parameters:
3417 * handle: Handle to the MLE to be queried. 3629 * handle: Handle to the MLE to be queried.
3418 * buffer: Text buffer to be imported. 3630 * buffer: Text buffer to be imported.
3419 * startpoint: Point to start entering text. 3631 * startpoint: Point to start entering text.
3420 */ 3632 */
3421 unsigned int dw_mle_import(HWND handle, const char *buffer, int startpoint) 3633 DW_FUNCTION_DEFINITION(dw_mle_import, unsigned int, HWND handle, const char *buffer, int startpoint)
3634 DW_FUNCTION_ADD_PARAM3(handle, buffer, startpoint)
3635 DW_FUNCTION_RETURN(dw_mle_import, unsigned int)
3636 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, buffer, const char *, startpoint, int)
3422 { 3637 {
3423 unsigned int tmppoint = startpoint; 3638 unsigned int tmppoint = startpoint;
3424 3639
3425 if(GTK_IS_SCROLLED_WINDOW(handle)) 3640 if(GTK_IS_SCROLLED_WINDOW(handle))
3426 { 3641 {
3436 gtk_text_buffer_place_cursor(tbuffer, &iter); 3651 gtk_text_buffer_place_cursor(tbuffer, &iter);
3437 gtk_text_buffer_insert_at_cursor(tbuffer, buffer, -1); 3652 gtk_text_buffer_insert_at_cursor(tbuffer, buffer, -1);
3438 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(buffer); 3653 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(buffer);
3439 } 3654 }
3440 } 3655 }
3441 return tmppoint; 3656 DW_FUNCTION_RETURN_THIS(tmppoint);
3442 } 3657 }
3443 3658
3444 /* 3659 /*
3445 * Grabs text from an MLE box. 3660 * Grabs text from an MLE box.
3446 * Parameters: 3661 * Parameters:
3447 * handle: Handle to the MLE to be queried. 3662 * handle: Handle to the MLE to be queried.
3448 * buffer: Text buffer to be exported. MUST allow for trailing nul character. 3663 * buffer: Text buffer to be exported. MUST allow for trailing nul character.
3449 * startpoint: Point to start grabbing text. 3664 * startpoint: Point to start grabbing text.
3450 * length: Amount of text to be grabbed. 3665 * length: Amount of text to be grabbed.
3451 */ 3666 */
3452 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) 3667 DW_FUNCTION_DEFINITION(dw_mle_export, void, HWND handle, char *buffer, int startpoint, int length)
3668 DW_FUNCTION_ADD_PARAM4(handle, buffer, startpoint, length)
3669 DW_FUNCTION_NO_RETURN(dw_mle_export)
3670 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, buffer, char *, startpoint, int, length, int)
3453 { 3671 {
3454 gchar *text; 3672 gchar *text;
3455 3673
3456 /* force the return value to nul in case the following tests fail */ 3674 /* force the return value to nul in case the following tests fail */
3457 if(buffer) 3675 if(buffer)
3474 if(buffer) 3692 if(buffer)
3475 strcpy(buffer, text); 3693 strcpy(buffer, text);
3476 } 3694 }
3477 } 3695 }
3478 } 3696 }
3697 DW_FUNCTION_RETURN_NOTHING;
3479 } 3698 }
3480 3699
3481 /* 3700 /*
3482 * Obtains information about an MLE box. 3701 * Obtains information about an MLE box.
3483 * Parameters: 3702 * Parameters:
3484 * handle: Handle to the MLE to be queried. 3703 * handle: Handle to the MLE to be queried.
3485 * bytes: A pointer to a variable to return the total bytes. 3704 * bytes: A pointer to a variable to return the total bytes.
3486 * lines: A pointer to a variable to return the number of lines. 3705 * lines: A pointer to a variable to return the number of lines.
3487 */ 3706 */
3488 void dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) 3707 DW_FUNCTION_DEFINITION(dw_mle_get_size, void, HWND handle, unsigned long *bytes, unsigned long *lines)
3708 DW_FUNCTION_ADD_PARAM3(handle, bytes, lines)
3709 DW_FUNCTION_NO_RETURN(dw_mle_get_size)
3710 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, bytes, unsigned long *, lines, unsigned long *)
3489 { 3711 {
3490 if(bytes) 3712 if(bytes)
3491 *bytes = 0; 3713 *bytes = 0;
3492 if(lines) 3714 if(lines)
3493 *lines = 0; 3715 *lines = 0;
3504 *bytes = gtk_text_buffer_get_char_count(buffer); 3726 *bytes = gtk_text_buffer_get_char_count(buffer);
3505 if(lines) 3727 if(lines)
3506 *lines = gtk_text_buffer_get_line_count(buffer); 3728 *lines = gtk_text_buffer_get_line_count(buffer);
3507 } 3729 }
3508 } 3730 }
3731 DW_FUNCTION_RETURN_NOTHING;
3509 } 3732 }
3510 3733
3511 /* 3734 /*
3512 * Deletes text from an MLE box. 3735 * Deletes text from an MLE box.
3513 * Parameters: 3736 * Parameters:
3514 * handle: Handle to the MLE to be deleted from. 3737 * handle: Handle to the MLE to be deleted from.
3515 * startpoint: Point to start deleting text. 3738 * startpoint: Point to start deleting text.
3516 * length: Amount of text to be deleted. 3739 * length: Amount of text to be deleted.
3517 */ 3740 */
3518 void dw_mle_delete(HWND handle, int startpoint, int length) 3741 DW_FUNCTION_DEFINITION(dw_mle_delete, void, HWND handle, int startpoint, int length)
3742 DW_FUNCTION_ADD_PARAM3(handle, startpoint, length)
3743 DW_FUNCTION_NO_RETURN(dw_mle_delete)
3744 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, startpoint, int, length, int)
3519 { 3745 {
3520 if(GTK_IS_SCROLLED_WINDOW(handle)) 3746 if(GTK_IS_SCROLLED_WINDOW(handle))
3521 { 3747 {
3522 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 3748 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
3523 3749
3530 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint); 3756 gtk_text_buffer_get_iter_at_offset(tbuffer, &start, startpoint);
3531 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); 3757 gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length);
3532 gtk_text_buffer_delete(tbuffer, &start, &end); 3758 gtk_text_buffer_delete(tbuffer, &start, &end);
3533 } 3759 }
3534 } 3760 }
3761 DW_FUNCTION_RETURN_NOTHING;
3535 } 3762 }
3536 3763
3537 /* 3764 /*
3538 * Clears all text from an MLE box. 3765 * Clears all text from an MLE box.
3539 * Parameters: 3766 * Parameters:
3540 * handle: Handle to the MLE to be cleared. 3767 * handle: Handle to the MLE to be cleared.
3541 */ 3768 */
3542 void dw_mle_clear(HWND handle) 3769 DW_FUNCTION_DEFINITION(dw_mle_clear, void, HWND handle)
3770 DW_FUNCTION_ADD_PARAM1(handle)
3771 DW_FUNCTION_NO_RETURN(dw_mle_clear)
3772 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
3543 { 3773 {
3544 int length; 3774 int length;
3545 3775
3546 if(GTK_IS_SCROLLED_WINDOW(handle)) 3776 if(GTK_IS_SCROLLED_WINDOW(handle))
3547 { 3777 {
3553 3783
3554 length = -1; 3784 length = -1;
3555 gtk_text_buffer_set_text(buffer, "", length); 3785 gtk_text_buffer_set_text(buffer, "", length);
3556 } 3786 }
3557 } 3787 }
3788 DW_FUNCTION_RETURN_NOTHING;
3558 } 3789 }
3559 3790
3560 /* 3791 /*
3561 * Sets the visible line of an MLE box. 3792 * Sets the visible line of an MLE box.
3562 * Parameters: 3793 * Parameters:
3563 * handle: Handle to the MLE. 3794 * handle: Handle to the MLE.
3564 * line: Line to be visible. 3795 * line: Line to be visible.
3565 */ 3796 */
3566 void dw_mle_set_visible(HWND handle, int line) 3797 DW_FUNCTION_DEFINITION(dw_mle_set_visible, void, HWND handle, int line)
3798 DW_FUNCTION_ADD_PARAM2(handle, line)
3799 DW_FUNCTION_NO_RETURN(dw_mle_set_visible)
3800 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, line, int)
3567 { 3801 {
3568 if(GTK_IS_SCROLLED_WINDOW(handle)) 3802 if(GTK_IS_SCROLLED_WINDOW(handle))
3569 { 3803 {
3570 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 3804 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
3571 3805
3587 gtk_text_buffer_move_mark(tbuffer, mark, &iter); 3821 gtk_text_buffer_move_mark(tbuffer, mark, &iter);
3588 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, 3822 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark,
3589 0, FALSE, 0, 0); 3823 0, FALSE, 0, 0);
3590 } 3824 }
3591 } 3825 }
3826 DW_FUNCTION_RETURN_NOTHING;
3592 } 3827 }
3593 3828
3594 /* 3829 /*
3595 * Sets the editablity of an MLE box. 3830 * Sets the editablity of an MLE box.
3596 * Parameters: 3831 * Parameters:
3639 * Sets the current cursor position of an MLE box. 3874 * Sets the current cursor position of an MLE box.
3640 * Parameters: 3875 * Parameters:
3641 * handle: Handle to the MLE to be positioned. 3876 * handle: Handle to the MLE to be positioned.
3642 * point: Point to position cursor. 3877 * point: Point to position cursor.
3643 */ 3878 */
3644 void dw_mle_set_cursor(HWND handle, int point) 3879 DW_FUNCTION_DEFINITION(dw_mle_set_cursor, void, HWND handle, int point)
3880 DW_FUNCTION_ADD_PARAM2(handle, point)
3881 DW_FUNCTION_NO_RETURN(dw_mle_set_cursor)
3882 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, point, int)
3645 { 3883 {
3646 if(GTK_IS_SCROLLED_WINDOW(handle)) 3884 if(GTK_IS_SCROLLED_WINDOW(handle))
3647 { 3885 {
3648 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 3886 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
3649 3887
3665 gtk_text_buffer_place_cursor(tbuffer, &iter); 3903 gtk_text_buffer_place_cursor(tbuffer, &iter);
3666 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark, 3904 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tmp), mark,
3667 0, FALSE, 0, 0); 3905 0, FALSE, 0, 0);
3668 } 3906 }
3669 } 3907 }
3908 DW_FUNCTION_RETURN_NOTHING;
3670 } 3909 }
3671 3910
3672 /* 3911 /*
3673 * Finds text in an MLE box. 3912 * Finds text in an MLE box.
3674 * Parameters: 3913 * Parameters:
3675 * handle: Handle to the MLE to be cleared. 3914 * handle: Handle to the MLE to be cleared.
3676 * text: Text to search for. 3915 * text: Text to search for.
3677 * point: Start point of search. 3916 * point: Start point of search.
3678 * flags: Search specific flags. 3917 * flags: Search specific flags.
3679 */ 3918 */
3680 int dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) 3919 DW_FUNCTION_DEFINITION(dw_mle_search, int, HWND handle, const char *text, int point, DW_UNUSED(unsigned long flags))
3920 DW_FUNCTION_ADD_PARAM4(handle, text, point, flags)
3921 DW_FUNCTION_RETURN(dw_mle_search, int)
3922 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, text, const char *, point, int, DW_UNUSED(flags), unsigned long)
3681 { 3923 {
3682 int retval = 0; 3924 int retval = 0;
3683 3925
3684 if(GTK_IS_SCROLLED_WINDOW(handle)) 3926 if(GTK_IS_SCROLLED_WINDOW(handle))
3685 { 3927 {
3694 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point); 3936 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, point);
3695 gtk_text_iter_forward_search(&iter, text, GTK_TEXT_SEARCH_TEXT_ONLY, &found, NULL, NULL); 3937 gtk_text_iter_forward_search(&iter, text, GTK_TEXT_SEARCH_TEXT_ONLY, &found, NULL, NULL);
3696 retval = gtk_text_iter_get_offset(&found); 3938 retval = gtk_text_iter_get_offset(&found);
3697 } 3939 }
3698 } 3940 }
3699 return retval; 3941 DW_FUNCTION_RETURN_THIS(retval);
3700 } 3942 }
3701 3943
3702 /* 3944 /*
3703 * Stops redrawing of an MLE box. 3945 * Stops redrawing of an MLE box.
3704 * Parameters: 3946 * Parameters:
3734 * Sets the percent bar position. 3976 * Sets the percent bar position.
3735 * Parameters: 3977 * Parameters:
3736 * handle: Handle to the percent bar to be set. 3978 * handle: Handle to the percent bar to be set.
3737 * position: Position of the percent bar withing the range. 3979 * position: Position of the percent bar withing the range.
3738 */ 3980 */
3739 void dw_percent_set_pos(HWND handle, unsigned int position) 3981 DW_FUNCTION_DEFINITION(dw_percent_set_pos, void, HWND handle, unsigned int position)
3982 DW_FUNCTION_ADD_PARAM2(handle, position)
3983 DW_FUNCTION_NO_RETURN(dw_percent_set_pos)
3984 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, position, unsigned int)
3740 { 3985 {
3741 if(position == DW_PERCENT_INDETERMINATE) 3986 if(position == DW_PERCENT_INDETERMINATE)
3742 { 3987 {
3743 /* Check if we are indeterminate already */ 3988 /* Check if we are indeterminate already */
3744 if(!g_object_get_data(G_OBJECT(handle), "_dw_alive")) 3989 if(!g_object_get_data(G_OBJECT(handle), "_dw_alive"))
3754 /* Cancel the existing timer if one is there */ 3999 /* Cancel the existing timer if one is there */
3755 g_object_set_data(G_OBJECT(handle), "_dw_alive", NULL); 4000 g_object_set_data(G_OBJECT(handle), "_dw_alive", NULL);
3756 /* Set the position like normal */ 4001 /* Set the position like normal */
3757 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100); 4002 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100);
3758 } 4003 }
4004 DW_FUNCTION_RETURN_NOTHING;
3759 } 4005 }
3760 4006
3761 /* 4007 /*
3762 * Returns the position of the slider. 4008 * Returns the position of the slider.
3763 * Parameters: 4009 * Parameters:
3962 * title: The text title of the entry. 4208 * title: The text title of the entry.
3963 * icon: Handle to coresponding icon. 4209 * icon: Handle to coresponding icon.
3964 * parent: Parent handle or 0 if root. 4210 * parent: Parent handle or 0 if root.
3965 * itemdata: Item specific data. 4211 * itemdata: Item specific data.
3966 */ 4212 */
3967 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) 4213 DW_FUNCTION_DEFINITION(dw_tree_insert_after, HTREEITEM, HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
4214 DW_FUNCTION_ADD_PARAM6(handle, item, title, icon, parent, itemdata)
4215 DW_FUNCTION_RETURN(dw_tree_insert_after, HTREEITEM)
4216 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, item, HTREEITEM, title, char *, icon, HICN, parent, HTREEITEM, itemdata, void *)
3968 { 4217 {
3969 GtkWidget *tree; 4218 GtkWidget *tree;
3970 GtkTreeIter *iter; 4219 GtkTreeIter *iter;
3971 GtkTreeStore *store; 4220 GtkTreeStore *store;
3972 GdkPixbuf *pixbuf; 4221 GdkPixbuf *pixbuf;
3973 HTREEITEM retval = 0; 4222 HTREEITEM retval = 0;
3974 4223
3975 if(!handle) 4224 if(handle)
3976 return NULL; 4225 {
3977 4226 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
3978 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4227 && GTK_IS_TREE_VIEW(tree) &&
3979 && GTK_IS_TREE_VIEW(tree) && 4228 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
3980 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4229 {
3981 { 4230 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter));
3982 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); 4231
3983 4232 pixbuf = _dw_find_pixbuf(icon, NULL, NULL);
3984 pixbuf = _dw_find_pixbuf(icon, NULL, NULL); 4233
3985 4234 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item);
3986 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); 4235 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1);
3987 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); 4236 retval = (HTREEITEM)iter;
3988 retval = (HTREEITEM)iter; 4237 }
3989 } 4238 }
3990 return retval; 4239 DW_FUNCTION_RETURN_THIS(retval);
3991 } 4240 }
3992 4241
3993 /* 4242 /*
3994 * Inserts an item into a tree window (widget). 4243 * Inserts an item into a tree window (widget).
3995 * Parameters: 4244 * Parameters:
3997 * title: The text title of the entry. 4246 * title: The text title of the entry.
3998 * icon: Handle to coresponding icon. 4247 * icon: Handle to coresponding icon.
3999 * parent: Parent handle or 0 if root. 4248 * parent: Parent handle or 0 if root.
4000 * itemdata: Item specific data. 4249 * itemdata: Item specific data.
4001 */ 4250 */
4002 HTREEITEM dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) 4251 DW_FUNCTION_DEFINITION(dw_tree_insert, HTREEITEM, HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
4252 DW_FUNCTION_ADD_PARAM5(handle, title, icon, parent, itemdata)
4253 DW_FUNCTION_RETURN(dw_tree_insert, HTREEITEM)
4254 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, title, char *, icon, HICN, parent, HTREEITEM, itemdata, void *)
4003 { 4255 {
4004 GtkWidget *tree; 4256 GtkWidget *tree;
4005 GtkTreeIter *iter; 4257 GtkTreeIter *iter;
4006 GtkTreeStore *store; 4258 GtkTreeStore *store;
4007 GdkPixbuf *pixbuf; 4259 GdkPixbuf *pixbuf;
4008 HTREEITEM retval = 0; 4260 HTREEITEM retval = 0;
4009 4261
4010 if(!handle) 4262 if(handle)
4011 return NULL; 4263 {
4012 4264 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4013 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4265 && GTK_IS_TREE_VIEW(tree) &&
4014 && GTK_IS_TREE_VIEW(tree) && 4266 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4015 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4267 {
4016 { 4268 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter));
4017 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); 4269
4018 4270 pixbuf = _dw_find_pixbuf(icon, NULL, NULL);
4019 pixbuf = _dw_find_pixbuf(icon, NULL, NULL); 4271
4020 4272 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent);
4021 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); 4273 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1);
4022 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); 4274 retval = (HTREEITEM)iter;
4023 retval = (HTREEITEM)iter; 4275 }
4024 } 4276 }
4025 return retval; 4277 DW_FUNCTION_RETURN_THIS(retval);
4026 } 4278 }
4027 4279
4028 /* 4280 /*
4029 * Sets the text and icon of an item in a tree window (widget). 4281 * Sets the text and icon of an item in a tree window (widget).
4030 * Parameters: 4282 * Parameters:
4031 * handle: Handle to the tree containing the item. 4283 * handle: Handle to the tree containing the item.
4032 * item: Handle of the item to be modified. 4284 * item: Handle of the item to be modified.
4033 * title: The text title of the entry. 4285 * title: The text title of the entry.
4034 * icon: Handle to coresponding icon. 4286 * icon: Handle to coresponding icon.
4035 */ 4287 */
4036 void dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) 4288 DW_FUNCTION_DEFINITION(dw_tree_item_change, void, HWND handle, HTREEITEM item, const char *title, HICN icon)
4289 DW_FUNCTION_ADD_PARAM4(handle, item, title, icon)
4290 DW_FUNCTION_NO_RETURN(dw_tree_item_change)
4291 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, item, HTREEITEM, title, char *, icon, HICN)
4037 { 4292 {
4038 GtkWidget *tree; 4293 GtkWidget *tree;
4039 GtkTreeStore *store; 4294 GtkTreeStore *store;
4040 GdkPixbuf *pixbuf; 4295 GdkPixbuf *pixbuf;
4041 4296
4042 if(!handle) 4297 if(handle)
4043 return; 4298 {
4044 4299 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4045 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4300 && GTK_IS_TREE_VIEW(tree) &&
4046 && GTK_IS_TREE_VIEW(tree) && 4301 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4047 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4302 {
4048 { 4303 pixbuf = _dw_find_pixbuf(icon, NULL, NULL);
4049 pixbuf = _dw_find_pixbuf(icon, NULL, NULL); 4304
4050 4305 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1);
4051 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); 4306 }
4052 } 4307 }
4308 DW_FUNCTION_RETURN_NOTHING;
4053 } 4309 }
4054 4310
4055 /* 4311 /*
4056 * Sets the item data of a tree item. 4312 * Sets the item data of a tree item.
4057 * Parameters: 4313 * Parameters:
4058 * handle: Handle to the tree containing the item. 4314 * handle: Handle to the tree containing the item.
4059 * item: Handle of the item to be modified. 4315 * item: Handle of the item to be modified.
4060 * itemdata: User defined data to be associated with item. 4316 * itemdata: User defined data to be associated with item.
4061 */ 4317 */
4062 void dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) 4318 DW_FUNCTION_DEFINITION(dw_tree_item_set_data, void, HWND handle, HTREEITEM item, void *itemdata)
4319 DW_FUNCTION_ADD_PARAM3(handle, item, itemdata)
4320 DW_FUNCTION_NO_RETURN(dw_tree_item_set_data)
4321 DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(handle), HWND, item, HTREEITEM, itemdata, void *)
4063 { 4322 {
4064 GtkWidget *tree; 4323 GtkWidget *tree;
4065 GtkTreeStore *store; 4324 GtkTreeStore *store;
4066 4325
4067 if(!handle || !item) 4326 if(handle && item)
4068 return; 4327 {
4069 4328 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4070 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4329 && GTK_IS_TREE_VIEW(tree) &&
4071 && GTK_IS_TREE_VIEW(tree) && 4330 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4072 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4331 gtk_tree_store_set(store, (GtkTreeIter *)item, 2, itemdata, -1);
4073 gtk_tree_store_set(store, (GtkTreeIter *)item, 2, itemdata, -1); 4332 }
4333 DW_FUNCTION_RETURN_NOTHING;
4074 } 4334 }
4075 4335
4076 /* 4336 /*
4077 * Gets the text an item in a tree window (widget). 4337 * Gets the text an item in a tree window (widget).
4078 * Parameters: 4338 * Parameters:
4079 * handle: Handle to the tree containing the item. 4339 * handle: Handle to the tree containing the item.
4080 * item: Handle of the item to be modified. 4340 * item: Handle of the item to be modified.
4081 */ 4341 */
4082 char * API dw_tree_get_title(HWND handle, HTREEITEM item) 4342 DW_FUNCTION_DEFINITION(dw_tree_get_title, char *, HWND handle, HTREEITEM item)
4343 DW_FUNCTION_ADD_PARAM2(handle, item)
4344 DW_FUNCTION_RETURN(dw_tree_get_title, char *)
4345 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(handle), HWND, item, HTREEITEM)
4083 { 4346 {
4084 char *text = NULL; 4347 char *text = NULL;
4085 GtkWidget *tree; 4348 GtkWidget *tree;
4086 GtkTreeModel *store; 4349 GtkTreeModel *store;
4087 4350
4088 if(!handle || !item) 4351 if(handle && item)
4089 return text; 4352 {
4090 4353 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
4091 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 4354
4092 4355 if(tree && GTK_IS_TREE_VIEW(tree) &&
4093 if(tree && GTK_IS_TREE_VIEW(tree) && 4356 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4094 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4357 gtk_tree_model_get(store, (GtkTreeIter *)item, _DW_DATA_TYPE_STRING, &text, -1);
4095 gtk_tree_model_get(store, (GtkTreeIter *)item, _DW_DATA_TYPE_STRING, &text, -1); 4358 if(text)
4096 if(text) 4359 {
4097 { 4360 char *temp = text;
4098 char *temp = text; 4361 text = strdup(temp);
4099 text = strdup(temp); 4362 g_free(temp);
4100 g_free(temp); 4363 }
4101 } 4364 }
4102 return text; 4365 DW_FUNCTION_RETURN_THIS(text);
4103 } 4366 }
4104 4367
4105 /* 4368 /*
4106 * Gets the text an item in a tree window (widget). 4369 * Gets the text an item in a tree window (widget).
4107 * Parameters: 4370 * Parameters:
4108 * handle: Handle to the tree containing the item. 4371 * handle: Handle to the tree containing the item.
4109 * item: Handle of the item to be modified. 4372 * item: Handle of the item to be modified.
4110 */ 4373 */
4111 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) 4374 DW_FUNCTION_DEFINITION(dw_tree_get_parent, HTREEITEM, HWND handle, HTREEITEM item)
4375 DW_FUNCTION_ADD_PARAM2(handle, item)
4376 DW_FUNCTION_RETURN(dw_tree_get_parent, HTREEITEM)
4377 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM)
4112 { 4378 {
4113 HTREEITEM parent = (HTREEITEM)0; 4379 HTREEITEM parent = (HTREEITEM)0;
4114 GtkWidget *tree; 4380 GtkWidget *tree;
4115 GtkTreeModel *store; 4381 GtkTreeModel *store;
4116 4382
4117 if(!handle || !item) 4383 if(handle && item)
4118 return parent; 4384 {
4119 4385 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
4120 tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 4386
4121 4387 if(tree && GTK_IS_TREE_VIEW(tree) &&
4122 if(tree && GTK_IS_TREE_VIEW(tree) && 4388 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4123 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4389 {
4124 { 4390 GtkTreeIter iter;
4125 GtkTreeIter iter; 4391
4126 4392 if(gtk_tree_model_iter_parent(store, &iter, (GtkTreeIter *)item))
4127 if(gtk_tree_model_iter_parent(store, &iter, (GtkTreeIter *)item)) 4393 gtk_tree_model_get(store, &iter, 3, &parent, -1);
4128 gtk_tree_model_get(store, &iter, 3, &parent, -1); 4394 }
4129 } 4395 }
4130 return parent; 4396 DW_FUNCTION_RETURN_THIS(parent);
4131 } 4397 }
4132 4398
4133 /* 4399 /*
4134 * Gets the item data of a tree item. 4400 * Gets the item data of a tree item.
4135 * Parameters: 4401 * Parameters:
4136 * handle: Handle to the tree containing the item. 4402 * handle: Handle to the tree containing the item.
4137 * item: Handle of the item to be modified. 4403 * item: Handle of the item to be modified.
4138 */ 4404 */
4139 void *dw_tree_item_get_data(HWND handle, HTREEITEM item) 4405 DW_FUNCTION_DEFINITION(dw_tree_item_get_data, void *, HWND handle, HTREEITEM item)
4406 DW_FUNCTION_ADD_PARAM2(handle, item)
4407 DW_FUNCTION_RETURN(dw_tree_item_get_data, void *)
4408 DW_FUNCTION_RESTORE_PARAM2(DW_UNUSED(handle), HWND, item, HTREEITEM)
4140 { 4409 {
4141 void *ret = NULL; 4410 void *ret = NULL;
4142 GtkWidget *tree; 4411 GtkWidget *tree;
4143 GtkTreeModel *store; 4412 GtkTreeModel *store;
4144 4413
4145 if(!handle || !item) 4414 if(handle && item)
4146 return NULL; 4415 {
4147 4416 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4148 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4417 && GTK_IS_TREE_VIEW(tree) &&
4149 && GTK_IS_TREE_VIEW(tree) && 4418 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4150 (store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4419 gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1);
4151 gtk_tree_model_get(store, (GtkTreeIter *)item, 2, &ret, -1); 4420 }
4152 return ret; 4421 DW_FUNCTION_RETURN_THIS(ret);
4153 } 4422 }
4154 4423
4155 /* 4424 /*
4156 * Sets this item as the active selection. 4425 * Sets this item as the active selection.
4157 * Parameters: 4426 * Parameters:
4158 * handle: Handle to the tree window (widget) to be selected. 4427 * handle: Handle to the tree window (widget) to be selected.
4159 * item: Handle to the item to be selected. 4428 * item: Handle to the item to be selected.
4160 */ 4429 */
4161 void dw_tree_item_select(HWND handle, HTREEITEM item) 4430 DW_FUNCTION_DEFINITION(dw_tree_item_select, void, HWND handle, HTREEITEM item)
4431 DW_FUNCTION_ADD_PARAM2(handle, item)
4432 DW_FUNCTION_NO_RETURN(dw_tree_item_select)
4433 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM)
4162 { 4434 {
4163 GtkWidget *tree; 4435 GtkWidget *tree;
4164 GtkTreeStore *store; 4436 GtkTreeStore *store;
4165 4437
4166 if(!handle || !item) 4438 if(handle && item)
4167 return; 4439 {
4168 4440 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4169 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4441 && GTK_IS_TREE_VIEW(tree) &&
4170 && GTK_IS_TREE_VIEW(tree) && 4442 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4171 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4443 {
4172 { 4444 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item);
4173 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); 4445 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
4174 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); 4446
4175 4447 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE);
4176 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE); 4448 gtk_tree_selection_select_iter(sel, (GtkTreeIter *)item);
4177 gtk_tree_selection_select_iter(sel, (GtkTreeIter *)item); 4449 gtk_tree_path_free(path);
4178 gtk_tree_path_free(path); 4450 }
4179 } 4451 }
4452 DW_FUNCTION_RETURN_NOTHING;
4180 } 4453 }
4181 4454
4182 static void _dw_recursive_free(GtkTreeModel *store, GtkTreeIter parent) 4455 static void _dw_recursive_free(GtkTreeModel *store, GtkTreeIter parent)
4183 { 4456 {
4184 void *data; 4457 void *data;
4200 /* 4473 /*
4201 * Removes all nodes from a tree. 4474 * Removes all nodes from a tree.
4202 * Parameters: 4475 * Parameters:
4203 * handle: Handle to the window (widget) to be cleared. 4476 * handle: Handle to the window (widget) to be cleared.
4204 */ 4477 */
4205 void dw_tree_clear(HWND handle) 4478 DW_FUNCTION_DEFINITION(dw_tree_clear, void, HWND handle)
4479 DW_FUNCTION_ADD_PARAM1(handle)
4480 DW_FUNCTION_NO_RETURN(dw_tree_clear)
4481 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
4206 { 4482 {
4207 GtkWidget *tree; 4483 GtkWidget *tree;
4208 GtkTreeStore *store; 4484 GtkTreeStore *store;
4209 4485
4210 if(!handle) 4486 if(handle)
4211 return; 4487 {
4212 4488 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4213 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4489 && GTK_IS_TREE_VIEW(tree) &&
4214 && GTK_IS_TREE_VIEW(tree) && 4490 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4215 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4216 {
4217 GtkTreeIter iter;
4218
4219 if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
4220 { 4491 {
4221 do { 4492 GtkTreeIter iter;
4222 _dw_recursive_free(GTK_TREE_MODEL(store), iter); 4493
4223 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); 4494 if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
4495 {
4496 do {
4497 _dw_recursive_free(GTK_TREE_MODEL(store), iter);
4498 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
4499 }
4500 gtk_tree_store_clear(store);
4224 } 4501 }
4225 gtk_tree_store_clear(store); 4502 }
4226 } 4503 DW_FUNCTION_RETURN_NOTHING;
4227 } 4504 }
4228 4505
4229 /* 4506 /*
4230 * Expands a node on a tree. 4507 * Expands a node on a tree.
4231 * Parameters: 4508 * Parameters:
4232 * handle: Handle to the tree window (widget). 4509 * handle: Handle to the tree window (widget).
4233 * item: Handle to node to be expanded. 4510 * item: Handle to node to be expanded.
4234 */ 4511 */
4235 void dw_tree_item_expand(HWND handle, HTREEITEM item) 4512 DW_FUNCTION_DEFINITION(dw_tree_item_expand, void, HWND handle, HTREEITEM item)
4513 DW_FUNCTION_ADD_PARAM2(handle, item)
4514 DW_FUNCTION_NO_RETURN(dw_tree_item_expand)
4515 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM)
4236 { 4516 {
4237 GtkWidget *tree; 4517 GtkWidget *tree;
4238 GtkTreeStore *store; 4518 GtkTreeStore *store;
4239 4519
4240 if(!handle) 4520 if(handle)
4241 return; 4521 {
4242 4522 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4243 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4523 && GTK_IS_TREE_VIEW(tree) &&
4244 && GTK_IS_TREE_VIEW(tree) && 4524 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4245 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4525 {
4246 { 4526 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item);
4247 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); 4527 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE);
4248 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE); 4528 gtk_tree_path_free(path);
4249 gtk_tree_path_free(path); 4529 }
4250 } 4530 }
4531 DW_FUNCTION_RETURN_NOTHING;
4251 } 4532 }
4252 4533
4253 /* 4534 /*
4254 * Collapses a node on a tree. 4535 * Collapses a node on a tree.
4255 * Parameters: 4536 * Parameters:
4256 * handle: Handle to the tree window (widget). 4537 * handle: Handle to the tree window (widget).
4257 * item: Handle to node to be collapsed. 4538 * item: Handle to node to be collapsed.
4258 */ 4539 */
4259 void dw_tree_item_collapse(HWND handle, HTREEITEM item) 4540 DW_FUNCTION_DEFINITION(dw_tree_item_collapse, void, HWND handle, HTREEITEM item)
4541 DW_FUNCTION_ADD_PARAM2(handle, item)
4542 DW_FUNCTION_NO_RETURN(dw_tree_item_collapse)
4543 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM)
4260 { 4544 {
4261 GtkWidget *tree; 4545 GtkWidget *tree;
4262 GtkTreeStore *store; 4546 GtkTreeStore *store;
4263 4547
4264 if(!handle) 4548 if(handle)
4265 return; 4549 {
4266 4550 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4267 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4551 && GTK_IS_TREE_VIEW(tree) &&
4268 && GTK_IS_TREE_VIEW(tree) && 4552 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4269 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4553 {
4270 { 4554 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item);
4271 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), (GtkTreeIter *)item); 4555 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path);
4272 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path); 4556 gtk_tree_path_free(path);
4273 gtk_tree_path_free(path); 4557 }
4274 } 4558 }
4559 DW_FUNCTION_RETURN_NOTHING;
4275 } 4560 }
4276 4561
4277 /* 4562 /*
4278 * Removes a node from a tree. 4563 * Removes a node from a tree.
4279 * Parameters: 4564 * Parameters:
4280 * handle: Handle to the window (widget) to be cleared. 4565 * handle: Handle to the window (widget) to be cleared.
4281 * item: Handle to node to be deleted. 4566 * item: Handle to node to be deleted.
4282 */ 4567 */
4283 void dw_tree_item_delete(HWND handle, HTREEITEM item) 4568 DW_FUNCTION_DEFINITION(dw_tree_item_delete, void, HWND handle, HTREEITEM item)
4569 DW_FUNCTION_ADD_PARAM2(handle, item)
4570 DW_FUNCTION_NO_RETURN(dw_tree_item_delete)
4571 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, item, HTREEITEM)
4284 { 4572 {
4285 GtkWidget *tree; 4573 GtkWidget *tree;
4286 GtkTreeStore *store; 4574 GtkTreeStore *store;
4287 4575
4288 if(!handle) 4576 if(handle)
4289 return; 4577 {
4290 4578 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"))
4291 if((tree = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")) 4579 && GTK_IS_TREE_VIEW(tree) &&
4292 && GTK_IS_TREE_VIEW(tree) && 4580 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree))))
4293 (store = (GtkTreeStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(tree)))) 4581 {
4294 { 4582 gtk_tree_store_remove(store, (GtkTreeIter *)item);
4295 gtk_tree_store_remove(store, (GtkTreeIter *)item); 4583 free(item);
4296 free(item); 4584 }
4297 } 4585 }
4586 DW_FUNCTION_RETURN_NOTHING;
4298 } 4587 }
4299 4588
4300 #define _DW_CONTAINER_STORE_EXTRA 2 4589 #define _DW_CONTAINER_STORE_EXTRA 2
4301 4590
4302 static int _dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator, int extra) 4591 static int _dw_container_setup_int(HWND handle, unsigned long *flags, char **titles, int count, int separator, int extra)
4303 { 4592 {
4304 int z; 4593 int z;
4305 char numbuf[25] = {0}; 4594 char numbuf[25] = {0};
4306 GtkWidget *tree; 4595 GtkWidget *tree;
4307 GtkListStore *store; 4596 GtkListStore *store;
4450 * titles: An array of strings with column text titles. 4739 * titles: An array of strings with column text titles.
4451 * count: The number of columns (this should match the arrays). 4740 * count: The number of columns (this should match the arrays).
4452 * separator: The column number that contains the main separator. 4741 * separator: The column number that contains the main separator.
4453 * (this item may only be used in OS/2) 4742 * (this item may only be used in OS/2)
4454 */ 4743 */
4455 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) 4744 DW_FUNCTION_DEFINITION(dw_container_setup, int, HWND handle, unsigned long *flags, char **titles, int count, int separator)
4456 { 4745 DW_FUNCTION_ADD_PARAM5(handle, flags, titles, count, separator)
4457 return _dw_container_setup(handle, flags, titles, count, separator, 0); 4746 DW_FUNCTION_RETURN(dw_container_setup, int)
4747 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, flags, unsigned long *, titles, char **, count, int, DW_UNUSED(separator), int)
4748 {
4749 int retval = _dw_container_setup_int(handle, flags, titles, count, separator, 0);
4750 DW_FUNCTION_RETURN_THIS(retval);
4458 } 4751 }
4459 4752
4460 /* 4753 /*
4461 * Configures the main filesystem columnn title for localization. 4754 * Configures the main filesystem columnn title for localization.
4462 * Parameters: 4755 * Parameters:
4488 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; 4781 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
4489 4782
4490 memcpy(&newtitles[1], titles, sizeof(char *) * count); 4783 memcpy(&newtitles[1], titles, sizeof(char *) * count);
4491 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); 4784 memcpy(&newflags[1], flags, sizeof(unsigned long) * count);
4492 4785
4493 _dw_container_setup(handle, newflags, newtitles, count + 1, 1, 1); 4786 _dw_container_setup_int(handle, newflags, newtitles, count + 1, 1, 1);
4494 4787
4495 if(coltitle) 4788 if(coltitle)
4496 { 4789 {
4497 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", NULL); 4790 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", NULL);
4498 free(coltitle); 4791 free(coltitle);
4621 * Allocates memory used to populate a container. 4914 * Allocates memory used to populate a container.
4622 * Parameters: 4915 * Parameters:
4623 * handle: Handle to the container window (widget). 4916 * handle: Handle to the container window (widget).
4624 * rowcount: The number of items to be populated. 4917 * rowcount: The number of items to be populated.
4625 */ 4918 */
4626 void *dw_container_alloc(HWND handle, int rowcount) 4919 DW_FUNCTION_DEFINITION(dw_container_alloc, void *, HWND handle, int rowcount)
4920 DW_FUNCTION_ADD_PARAM2(handle, rowcount)
4921 DW_FUNCTION_RETURN(dw_container_alloc, void *)
4922 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, rowcount, int)
4627 { 4923 {
4628 int z, prevrowcount = 0; 4924 int z, prevrowcount = 0;
4629 GtkWidget *cont; 4925 GtkWidget *cont;
4630 GtkListStore *store = NULL; 4926 GtkListStore *store = NULL;
4631 4927
4646 gtk_list_store_append(store, &iter); 4942 gtk_list_store_append(store, &iter);
4647 } 4943 }
4648 g_object_set_data(G_OBJECT(cont), "_dw_insertpos", GINT_TO_POINTER(prevrowcount)); 4944 g_object_set_data(G_OBJECT(cont), "_dw_insertpos", GINT_TO_POINTER(prevrowcount));
4649 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rowcount + prevrowcount)); 4945 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rowcount + prevrowcount));
4650 } 4946 }
4651 return (void *)cont; 4947 DW_FUNCTION_RETURN_THIS(cont);
4652 } 4948 }
4653 4949
4654 /* 4950 /*
4655 * Internal representation of dw_container_set_item() extracted so we can pass 4951 * Internal representation of dw_container_set_item() extracted so we can pass
4656 * two data pointers; icon and text for dw_filesystem_set_item(). 4952 * two data pointers; icon and text for dw_filesystem_set_item().
4657 */ 4953 */
4658 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) 4954 void _dw_container_set_item_int(HWND handle, void *pointer, int column, int row, void *data)
4659 { 4955 {
4660 char numbuf[25] = {0}, textbuffer[101] = {0}; 4956 char numbuf[25] = {0}, textbuffer[101] = {0};
4661 int flag = 0; 4957 int flag = 0;
4662 GtkWidget *cont; 4958 GtkWidget *cont;
4663 GtkListStore *store = NULL; 4959 GtkListStore *store = NULL;
4752 * pointer: Pointer to the allocated memory in dw_container_alloc(). 5048 * pointer: Pointer to the allocated memory in dw_container_alloc().
4753 * column: Zero based column of data being set. 5049 * column: Zero based column of data being set.
4754 * row: Zero based row of data being set. 5050 * row: Zero based row of data being set.
4755 * data: Pointer to the data to be added. 5051 * data: Pointer to the data to be added.
4756 */ 5052 */
4757 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) 5053 DW_FUNCTION_DEFINITION(dw_container_set_item, void, HWND handle, void *pointer, int column, int row, void *data)
4758 { 5054 DW_FUNCTION_ADD_PARAM5(handle, pointer, column, row, data)
4759 _dw_container_set_item(handle, pointer, column, row, data); 5055 DW_FUNCTION_NO_RETURN(dw_container_set_item)
5056 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, column, int, row, int, data, void *)
5057 {
5058 _dw_container_set_item_int(handle, pointer, column, row, data);
5059 DW_FUNCTION_RETURN_NOTHING;
4760 } 5060 }
4761 5061
4762 /* 5062 /*
4763 * Changes an existing item in specified row and column to the given data. 5063 * Changes an existing item in specified row and column to the given data.
4764 * Parameters: 5064 * Parameters:
4765 * handle: Handle to the container window (widget). 5065 * handle: Handle to the container window (widget).
4766 * column: Zero based column of data being set. 5066 * column: Zero based column of data being set.
4767 * row: Zero based row of data being set. 5067 * row: Zero based row of data being set.
4768 * data: Pointer to the data to be added. 5068 * data: Pointer to the data to be added.
4769 */ 5069 */
4770 void dw_container_change_item(HWND handle, int column, int row, void *data) 5070 DW_FUNCTION_DEFINITION(dw_container_change_item, void, HWND handle, int column, int row, void *data)
4771 { 5071 DW_FUNCTION_ADD_PARAM4(handle, column, row, data)
4772 _dw_container_set_item(handle, NULL, column, row, data); 5072 DW_FUNCTION_NO_RETURN(dw_container_change_item)
5073 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, column, int, row, int, data, void *)
5074 {
5075 _dw_container_set_item_int(handle, NULL, column, row, data);
5076 DW_FUNCTION_RETURN_NOTHING;
4773 } 5077 }
4774 5078
4775 /* 5079 /*
4776 * Changes an existing item in specified row and column to the given data. 5080 * Changes an existing item in specified row and column to the given data.
4777 * Parameters: 5081 * Parameters:
4806 * pointer: Pointer to the allocated memory in dw_container_alloc(). 5110 * pointer: Pointer to the allocated memory in dw_container_alloc().
4807 * column: Zero based column of data being set. 5111 * column: Zero based column of data being set.
4808 * row: Zero based row of data being set. 5112 * row: Zero based row of data being set.
4809 * data: Pointer to the data to be added. 5113 * data: Pointer to the data to be added.
4810 */ 5114 */
4811 void dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) 5115 DW_FUNCTION_DEFINITION(dw_filesystem_set_file, void, HWND handle, void *pointer, int row, const char *filename, HICN icon)
5116 DW_FUNCTION_ADD_PARAM5(handle, pointer, row, filename, icon)
5117 DW_FUNCTION_NO_RETURN(dw_filesystem_set_file)
5118 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, row, int, filename, char *, icon, HICN)
4812 { 5119 {
4813 void *data[2] = { (void *)&icon, (void *)filename }; 5120 void *data[2] = { (void *)&icon, (void *)filename };
4814 5121
4815 _dw_container_set_item(handle, pointer, 0, row, (void *)data); 5122 _dw_container_set_item_int(handle, pointer, 0, row, (void *)data);
5123 DW_FUNCTION_RETURN_NOTHING;
4816 } 5124 }
4817 5125
4818 /* 5126 /*
4819 * Sets an item in specified row and column to the given data. 5127 * Sets an item in specified row and column to the given data.
4820 * Parameters: 5128 * Parameters:
4822 * pointer: Pointer to the allocated memory in dw_container_alloc(). 5130 * pointer: Pointer to the allocated memory in dw_container_alloc().
4823 * column: Zero based column of data being set. 5131 * column: Zero based column of data being set.
4824 * row: Zero based row of data being set. 5132 * row: Zero based row of data being set.
4825 * data: Pointer to the data to be added. 5133 * data: Pointer to the data to be added.
4826 */ 5134 */
4827 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) 5135 DW_FUNCTION_DEFINITION(dw_filesystem_set_item, void, HWND handle, void *pointer, int column, int row, void *data)
4828 { 5136 DW_FUNCTION_ADD_PARAM5(handle, pointer, column, row, data)
4829 _dw_container_set_item(handle, pointer, column + 1, row, data); 5137 DW_FUNCTION_NO_RETURN(dw_filesystem_set_item)
5138 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, column, int, row, int, data, void *)
5139 {
5140 _dw_container_set_item_int(handle, pointer, column + 1, row, data);
5141 DW_FUNCTION_RETURN_NOTHING;
4830 } 5142 }
4831 5143
4832 /* 5144 /*
4833 * Gets column type for a container column 5145 * Gets column type for a container column
4834 * Parameters: 5146 * Parameters:
4835 * handle: Handle to the container window (widget). 5147 * handle: Handle to the container window (widget).
4836 * column: Zero based column. 5148 * column: Zero based column.
4837 */ 5149 */
4838 int dw_container_get_column_type(HWND handle, int column) 5150 DW_FUNCTION_DEFINITION(dw_container_get_column_type, int, HWND handle, int column)
4839 { 5151 DW_FUNCTION_ADD_PARAM2(handle, column)
4840 char numbuf[25] = {0}; 5152 DW_FUNCTION_RETURN(dw_container_get_column_type, int)
5153 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, column, int)
5154 {
4841 int flag, rc = 0; 5155 int flag, rc = 0;
4842 GtkWidget *cont = handle; 5156 GtkWidget *cont = handle;
4843 5157
4844 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 5158 if((cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user")))
4845 if(!cont) 5159 {
4846 return 0; 5160 char numbuf[25] = {0};
4847 5161
4848 snprintf(numbuf, 24, "_dw_cont_col%d", column); 5162 snprintf(numbuf, 24, "_dw_cont_col%d", column);
4849 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf)); 5163 flag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cont), numbuf));
4850 5164
4851 if(flag & DW_CFA_BITMAPORICON) 5165 if(flag & DW_CFA_BITMAPORICON)
4852 rc = DW_CFA_BITMAPORICON; 5166 rc = DW_CFA_BITMAPORICON;
4853 else if(flag & DW_CFA_STRING) 5167 else if(flag & DW_CFA_STRING)
4854 rc = DW_CFA_STRING; 5168 rc = DW_CFA_STRING;
4855 else if(flag & DW_CFA_ULONG) 5169 else if(flag & DW_CFA_ULONG)
4856 rc = DW_CFA_ULONG; 5170 rc = DW_CFA_ULONG;
4857 else if(flag & DW_CFA_DATE) 5171 else if(flag & DW_CFA_DATE)
4858 rc = DW_CFA_DATE; 5172 rc = DW_CFA_DATE;
4859 else if(flag & DW_CFA_TIME) 5173 else if(flag & DW_CFA_TIME)
4860 rc = DW_CFA_TIME; 5174 rc = DW_CFA_TIME;
4861 else 5175 else
4862 rc = 0; 5176 rc = 0;
4863 return rc; 5177 }
5178 DW_FUNCTION_RETURN_THIS(rc);
4864 } 5179 }
4865 5180
4866 /* 5181 /*
4867 * Gets column type for a filesystem container column 5182 * Gets column type for a filesystem container column
4868 * Parameters: 5183 * Parameters:
4892 * Parameters: 5207 * Parameters:
4893 * handle: Handle to window (widget) of container. 5208 * handle: Handle to window (widget) of container.
4894 * column: Zero based column of width being set. 5209 * column: Zero based column of width being set.
4895 * width: Width of column in pixels. 5210 * width: Width of column in pixels.
4896 */ 5211 */
4897 void dw_container_set_column_width(HWND handle, int column, int width) 5212 DW_FUNCTION_DEFINITION(dw_container_set_column_width, void, HWND handle, int column, int width)
5213 DW_FUNCTION_ADD_PARAM3(handle, column, width)
5214 DW_FUNCTION_NO_RETURN(dw_container_set_column_width)
5215 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, column, int, width, int)
4898 { 5216 {
4899 GtkWidget *cont; 5217 GtkWidget *cont;
4900 5218
4901 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 5219 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
4902 5220
4908 if(col && GTK_IS_TREE_VIEW_COLUMN(col)) 5226 if(col && GTK_IS_TREE_VIEW_COLUMN(col))
4909 { 5227 {
4910 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(col), width); 5228 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(col), width);
4911 } 5229 }
4912 } 5230 }
5231 DW_FUNCTION_RETURN_NOTHING;
4913 } 5232 }
4914 5233
4915 /* Internal version for both */ 5234 /* Internal version for both */
4916 void _dw_container_set_row_data(HWND handle, void *pointer, int row, int type, void *data) 5235 void _dw_container_set_row_data_int(HWND handle, void *pointer, int row, int type, void *data)
4917 { 5236 {
4918 GtkWidget *cont = handle; 5237 GtkWidget *cont = handle;
4919 GtkListStore *store = NULL; 5238 GtkListStore *store = NULL;
4920 5239
4921 /* Make sure it is the correct tree type */ 5240 /* Make sure it is the correct tree type */
4945 * row: Zero based row of data being set. 5264 * row: Zero based row of data being set.
4946 * title: String title of the item. 5265 * title: String title of the item.
4947 */ 5266 */
4948 void dw_container_set_row_title(void *pointer, int row, const char *title) 5267 void dw_container_set_row_title(void *pointer, int row, const char *title)
4949 { 5268 {
4950 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, (void *)title); 5269 _dw_container_set_row_data_int(pointer, pointer, row, _DW_DATA_TYPE_STRING, (void *)title);
4951 } 5270 }
4952 5271
4953 /* 5272 /*
4954 * Changes the title of a row already inserted in the container. 5273 * Changes the title of a row already inserted in the container.
4955 * Parameters: 5274 * Parameters:
4957 * row: Zero based row of data being set. 5276 * row: Zero based row of data being set.
4958 * title: String title of the item. 5277 * title: String title of the item.
4959 */ 5278 */
4960 void dw_container_change_row_title(HWND handle, int row, const char *title) 5279 void dw_container_change_row_title(HWND handle, int row, const char *title)
4961 { 5280 {
4962 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, (void *)title); 5281 _dw_container_set_row_data_int(handle, NULL, row, _DW_DATA_TYPE_STRING, (void *)title);
4963 } 5282 }
4964 5283
4965 /* 5284 /*
4966 * Sets the data of a row in the container. 5285 * Sets the data of a row in the container.
4967 * Parameters: 5286 * Parameters:
4969 * row: Zero based row of data being set. 5288 * row: Zero based row of data being set.
4970 * data: Data pointer. 5289 * data: Data pointer.
4971 */ 5290 */
4972 void dw_container_set_row_data(void *pointer, int row, void *data) 5291 void dw_container_set_row_data(void *pointer, int row, void *data)
4973 { 5292 {
4974 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_POINTER, data); 5293 _dw_container_set_row_data_int(pointer, pointer, row, _DW_DATA_TYPE_POINTER, data);
4975 } 5294 }
4976 5295
4977 /* 5296 /*
4978 * Changes the data of a row already inserted in the container. 5297 * Changes the data of a row already inserted in the container.
4979 * Parameters: 5298 * Parameters:
4981 * row: Zero based row of data being set. 5300 * row: Zero based row of data being set.
4982 * data: Data pointer. 5301 * data: Data pointer.
4983 */ 5302 */
4984 void dw_container_change_row_data(HWND handle, int row, void *data) 5303 void dw_container_change_row_data(HWND handle, int row, void *data)
4985 { 5304 {
4986 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_POINTER, data); 5305 _dw_container_set_row_data_int(handle, NULL, row, _DW_DATA_TYPE_POINTER, data);
4987 } 5306 }
4988 5307
4989 /* 5308 /*
4990 * Sets the title of a row in the container. 5309 * Sets the title of a row in the container.
4991 * Parameters: 5310 * Parameters:
5578 * handle: Handle to the window. 5897 * handle: Handle to the window.
5579 * pixmap: Handle to the pixmap. (choose only one of these) 5898 * pixmap: Handle to the pixmap. (choose only one of these)
5580 * x: X coordinate. 5899 * x: X coordinate.
5581 * y: Y coordinate. 5900 * y: Y coordinate.
5582 */ 5901 */
5583 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) 5902 DW_FUNCTION_DEFINITION(dw_draw_point, void, HWND handle, HPIXMAP pixmap, int x, int y)
5903 DW_FUNCTION_ADD_PARAM4(handle, pixmap, x, y)
5904 DW_FUNCTION_NO_RETURN(dw_draw_point)
5905 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, pixmap, HPIXMAP, x, int, y, int)
5584 { 5906 {
5585 cairo_t *cr = NULL; 5907 cairo_t *cr = NULL;
5586 GdkDrawContext *dc = NULL; 5908 GdkDrawContext *dc = NULL;
5587 int cached = FALSE; 5909 int cached = FALSE;
5588 5910
5600 cairo_region_t *region = cairo_region_create(); 5922 cairo_region_t *region = cairo_region_create();
5601 gdk_draw_context_begin_frame(dc, region); 5923 gdk_draw_context_begin_frame(dc, region);
5602 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 5924 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
5603 cairo_region_destroy(region); 5925 cairo_region_destroy(region);
5604 } 5926 }
5605 else
5606 return;
5607 } 5927 }
5608 } 5928 }
5609 else if(pixmap) 5929 else if(pixmap)
5610 cr = cairo_create(pixmap->image); 5930 cr = cairo_create(pixmap->image);
5611 if(cr) 5931 if(cr)
5622 if(dc) 5942 if(dc)
5623 gdk_draw_context_end_frame(dc); 5943 gdk_draw_context_end_frame(dc);
5624 else if(!cached) 5944 else if(!cached)
5625 cairo_destroy(cr); 5945 cairo_destroy(cr);
5626 } 5946 }
5947 DW_FUNCTION_RETURN_NOTHING;
5627 } 5948 }
5628 5949
5629 /* Draw a line on a window (preferably a render window). 5950 /* Draw a line on a window (preferably a render window).
5630 * Parameters: 5951 * Parameters:
5631 * handle: Handle to the window. 5952 * handle: Handle to the window.
5633 * x1: First X coordinate. 5954 * x1: First X coordinate.
5634 * y1: First Y coordinate. 5955 * y1: First Y coordinate.
5635 * x2: Second X coordinate. 5956 * x2: Second X coordinate.
5636 * y2: Second Y coordinate. 5957 * y2: Second Y coordinate.
5637 */ 5958 */
5638 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) 5959 DW_FUNCTION_DEFINITION(dw_draw_line, void, HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
5960 DW_FUNCTION_ADD_PARAM6(handle, pixmap, x1, y1, x2, y2)
5961 DW_FUNCTION_NO_RETURN(dw_draw_line)
5962 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, pixmap, HPIXMAP, x1, int, y1, int, x2, int, y2, int)
5639 { 5963 {
5640 cairo_t *cr = NULL; 5964 cairo_t *cr = NULL;
5641 GdkDrawContext *dc = NULL; 5965 GdkDrawContext *dc = NULL;
5642 int cached = FALSE; 5966 int cached = FALSE;
5643 5967
5655 cairo_region_t *region = cairo_region_create(); 5979 cairo_region_t *region = cairo_region_create();
5656 gdk_draw_context_begin_frame(dc, region); 5980 gdk_draw_context_begin_frame(dc, region);
5657 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 5981 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
5658 cairo_region_destroy(region); 5982 cairo_region_destroy(region);
5659 } 5983 }
5660 else
5661 return;
5662 } 5984 }
5663 } 5985 }
5664 else if(pixmap) 5986 else if(pixmap)
5665 cr = cairo_create(pixmap->image); 5987 cr = cairo_create(pixmap->image);
5666 if(cr) 5988 if(cr)
5678 if(dc) 6000 if(dc)
5679 gdk_draw_context_end_frame(dc); 6001 gdk_draw_context_end_frame(dc);
5680 else if(!cached) 6002 else if(!cached)
5681 cairo_destroy(cr); 6003 cairo_destroy(cr);
5682 } 6004 }
6005 DW_FUNCTION_RETURN_NOTHING;
5683 } 6006 }
5684 6007
5685 /* Draw a closed polygon on a window (preferably a render window). 6008 /* Draw a closed polygon on a window (preferably a render window).
5686 * Parameters: 6009 * Parameters:
5687 * handle: Handle to the window. 6010 * handle: Handle to the window.
5689 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). 6012 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0).
5690 * number of points 6013 * number of points
5691 * x[]: X coordinates. 6014 * x[]: X coordinates.
5692 * y[]: Y coordinates. 6015 * y[]: Y coordinates.
5693 */ 6016 */
5694 void dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) 6017 DW_FUNCTION_DEFINITION(dw_draw_polygon, void, HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y)
6018 DW_FUNCTION_ADD_PARAM6(handle, pixmap, flags, npoints, x, y)
6019 DW_FUNCTION_NO_RETURN(dw_draw_polygon)
6020 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, pixmap, HPIXMAP, flags, int, npoints, int, x, int *, y, int *)
5695 { 6021 {
5696 cairo_t *cr = NULL; 6022 cairo_t *cr = NULL;
5697 int z; 6023 int z;
5698 GdkDrawContext *dc = NULL; 6024 GdkDrawContext *dc = NULL;
5699 int cached = FALSE; 6025 int cached = FALSE;
5712 cairo_region_t *region = cairo_region_create(); 6038 cairo_region_t *region = cairo_region_create();
5713 gdk_draw_context_begin_frame(dc, region); 6039 gdk_draw_context_begin_frame(dc, region);
5714 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 6040 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
5715 cairo_region_destroy(region); 6041 cairo_region_destroy(region);
5716 } 6042 }
5717 else
5718 return;
5719 } 6043 }
5720 } 6044 }
5721 else if(pixmap) 6045 else if(pixmap)
5722 cr = cairo_create(pixmap->image); 6046 cr = cairo_create(pixmap->image);
5723 if(cr) 6047 if(cr)
5743 if(dc) 6067 if(dc)
5744 gdk_draw_context_end_frame(dc); 6068 gdk_draw_context_end_frame(dc);
5745 else if(!cached) 6069 else if(!cached)
5746 cairo_destroy(cr); 6070 cairo_destroy(cr);
5747 } 6071 }
6072 DW_FUNCTION_RETURN_NOTHING;
5748 } 6073 }
5749 6074
5750 /* Draw a rectangle on a window (preferably a render window). 6075 /* Draw a rectangle on a window (preferably a render window).
5751 * Parameters: 6076 * Parameters:
5752 * handle: Handle to the window. 6077 * handle: Handle to the window.
5755 * x: X coordinate. 6080 * x: X coordinate.
5756 * y: Y coordinate. 6081 * y: Y coordinate.
5757 * width: Width of rectangle. 6082 * width: Width of rectangle.
5758 * height: Height of rectangle. 6083 * height: Height of rectangle.
5759 */ 6084 */
5760 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) 6085 DW_FUNCTION_DEFINITION(dw_draw_rect, void, HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height)
6086 DW_FUNCTION_ADD_PARAM7(handle, pixmap, flags, x, y, width, height)
6087 DW_FUNCTION_NO_RETURN(dw_draw_rect)
6088 DW_FUNCTION_RESTORE_PARAM7(handle, HWND, pixmap, HPIXMAP, flags, int, x, int, y, int, width, int, height, int)
5761 { 6089 {
5762 cairo_t *cr = NULL; 6090 cairo_t *cr = NULL;
5763 GdkDrawContext *dc = NULL; 6091 GdkDrawContext *dc = NULL;
5764 int cached = FALSE; 6092 int cached = FALSE;
5765 6093
5777 cairo_region_t *region = cairo_region_create(); 6105 cairo_region_t *region = cairo_region_create();
5778 gdk_draw_context_begin_frame(dc, region); 6106 gdk_draw_context_begin_frame(dc, region);
5779 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 6107 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
5780 cairo_region_destroy(region); 6108 cairo_region_destroy(region);
5781 } 6109 }
5782 else
5783 return;
5784 } 6110 }
5785 } 6111 }
5786 else if(pixmap) 6112 else if(pixmap)
5787 cr = cairo_create(pixmap->image); 6113 cr = cairo_create(pixmap->image);
5788 if(cr) 6114 if(cr)
5807 if(dc) 6133 if(dc)
5808 gdk_draw_context_end_frame(dc); 6134 gdk_draw_context_end_frame(dc);
5809 else if(!cached) 6135 else if(!cached)
5810 cairo_destroy(cr); 6136 cairo_destroy(cr);
5811 } 6137 }
6138 DW_FUNCTION_RETURN_NOTHING;
5812 } 6139 }
5813 6140
5814 /* Draw an arc on a window (preferably a render window). 6141 /* Draw an arc on a window (preferably a render window).
5815 * Parameters: 6142 * Parameters:
5816 * handle: Handle to the window. 6143 * handle: Handle to the window.
5822 * x1: X coordinate of first segment of arc. 6149 * x1: X coordinate of first segment of arc.
5823 * y1: Y coordinate of first segment of arc. 6150 * y1: Y coordinate of first segment of arc.
5824 * x2: X coordinate of second segment of arc. 6151 * x2: X coordinate of second segment of arc.
5825 * y2: Y coordinate of second segment of arc. 6152 * y2: Y coordinate of second segment of arc.
5826 */ 6153 */
5827 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) 6154 DW_FUNCTION_DEFINITION(dw_draw_arc, void, HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2)
6155 DW_FUNCTION_ADD_PARAM9(handle, pixmap, flags, xorigin, yorigin, x1, y1, x2, y2)
6156 DW_FUNCTION_NO_RETURN(dw_draw_arc)
6157 DW_FUNCTION_RESTORE_PARAM9(handle, HWND, pixmap, HPIXMAP, flags, int, xorigin, int, yorigin, int, x1, int, y1, int, x2, int, y2, int)
5828 { 6158 {
5829 cairo_t *cr = NULL; 6159 cairo_t *cr = NULL;
5830 GdkDrawContext *dc = NULL; 6160 GdkDrawContext *dc = NULL;
5831 int cached = FALSE; 6161 int cached = FALSE;
5832 6162
5844 cairo_region_t *region = cairo_region_create(); 6174 cairo_region_t *region = cairo_region_create();
5845 gdk_draw_context_begin_frame(dc, region); 6175 gdk_draw_context_begin_frame(dc, region);
5846 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 6176 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
5847 cairo_region_destroy(region); 6177 cairo_region_destroy(region);
5848 } 6178 }
5849 else
5850 return;
5851 } 6179 }
5852 } 6180 }
5853 else if(pixmap) 6181 else if(pixmap)
5854 cr = cairo_create(pixmap->image); 6182 cr = cairo_create(pixmap->image);
5855 if(cr) 6183 if(cr)
5886 if(dc) 6214 if(dc)
5887 gdk_draw_context_end_frame(dc); 6215 gdk_draw_context_end_frame(dc);
5888 else if(!cached) 6216 else if(!cached)
5889 cairo_destroy(cr); 6217 cairo_destroy(cr);
5890 } 6218 }
6219 DW_FUNCTION_RETURN_NOTHING;
5891 } 6220 }
5892 6221
5893 /* Draw text on a window (preferably a render window). 6222 /* Draw text on a window (preferably a render window).
5894 * Parameters: 6223 * Parameters:
5895 * handle: Handle to the window. 6224 * handle: Handle to the window.
5896 * pixmap: Handle to the pixmap. (choose only one of these) 6225 * pixmap: Handle to the pixmap. (choose only one of these)
5897 * x: X coordinate. 6226 * x: X coordinate.
5898 * y: Y coordinate. 6227 * y: Y coordinate.
5899 * text: Text to be displayed. 6228 * text: Text to be displayed.
5900 */ 6229 */
5901 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) 6230 DW_FUNCTION_DEFINITION(dw_draw_text, void, HWND handle, HPIXMAP pixmap, int x, int y, const char *text)
5902 { 6231 DW_FUNCTION_ADD_PARAM5(handle, pixmap, x, y, text)
5903 cairo_t *cr = NULL; 6232 DW_FUNCTION_NO_RETURN(dw_draw_text)
5904 PangoFontDescription *font; 6233 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pixmap, HPIXMAP, x, int, y, int, text, const char *)
5905 char *tmpname, *fontname = "monospace 10"; 6234 {
5906 GdkDrawContext *dc = NULL; 6235 if(text)
5907 int cached = FALSE; 6236 {
5908 6237 cairo_t *cr = NULL;
5909 if(!text) 6238 PangoFontDescription *font;
5910 return; 6239 char *tmpname, *fontname = "monospace 10";
5911 6240 GdkDrawContext *dc = NULL;
5912 if(handle) 6241 int cached = FALSE;
5913 { 6242
5914 if((cr = g_object_get_data(G_OBJECT(handle), "_dw_cr"))) 6243 if(handle)
5915 cached = TRUE; 6244 {
5916 else 6245 if((cr = g_object_get_data(G_OBJECT(handle), "_dw_cr")))
5917 { 6246 cached = TRUE;
5918 GtkNative *native = gtk_widget_get_native(handle); 6247 else
5919 GdkSurface *surface = gtk_native_get_surface(native);
5920
5921 if((dc = GDK_DRAW_CONTEXT(gdk_surface_create_cairo_context(surface))))
5922 { 6248 {
5923 cairo_region_t *region = cairo_region_create(); 6249 GtkNative *native = gtk_widget_get_native(handle);
5924 gdk_draw_context_begin_frame(dc, region); 6250 GdkSurface *surface = gtk_native_get_surface(native);
5925 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc)); 6251
5926 cairo_region_destroy(region); 6252 if((dc = GDK_DRAW_CONTEXT(gdk_surface_create_cairo_context(surface))))
6253 {
6254 cairo_region_t *region = cairo_region_create();
6255 gdk_draw_context_begin_frame(dc, region);
6256 cr = gdk_cairo_context_cairo_create(GDK_CAIRO_CONTEXT(dc));
6257 cairo_region_destroy(region);
6258 }
5927 } 6259 }
5928 else 6260 if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname")))
5929 return; 6261 fontname = tmpname;
5930 } 6262 }
5931 if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"))) 6263 else if(pixmap)
5932 fontname = tmpname; 6264 {
5933 } 6265 if(pixmap->font)
5934 else if(pixmap) 6266 fontname = pixmap->font;
5935 { 6267 else if(pixmap->handle && (tmpname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname")))
5936 if(pixmap->font) 6268 fontname = tmpname;
5937 fontname = pixmap->font; 6269 cr = cairo_create(pixmap->image);
5938 else if(pixmap->handle && (tmpname = (char *)g_object_get_data(G_OBJECT(pixmap->handle), "_dw_fontname"))) 6270 }
5939 fontname = tmpname; 6271 if(cr)
5940 cr = cairo_create(pixmap->image); 6272 {
5941 } 6273 font = pango_font_description_from_string(fontname);
5942 if(cr) 6274 if(font)
5943 {
5944 font = pango_font_description_from_string(fontname);
5945 if(font)
5946 {
5947 PangoContext *context = pango_cairo_create_context(cr);
5948
5949 if(context)
5950 { 6275 {
5951 PangoLayout *layout = pango_layout_new(context); 6276 PangoContext *context = pango_cairo_create_context(cr);
5952 6277
5953 if(layout) 6278 if(context)
5954 { 6279 {
5955 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key); 6280 PangoLayout *layout = pango_layout_new(context);
5956 GdkRGBA *background = pthread_getspecific(_dw_bg_color_key); 6281
5957 6282 if(layout)
5958 pango_layout_set_font_description(layout, font);
5959 pango_layout_set_text(layout, text, strlen(text));
5960
5961 gdk_cairo_set_source_rgba(cr, foreground);
5962 /* Create a background color attribute if required */
5963 if(background)
5964 { 6283 {
5965 PangoAttrList *list = pango_layout_get_attributes(layout); 6284 GdkRGBA *foreground = pthread_getspecific(_dw_fg_color_key);
5966 PangoAttribute *attr = pango_attr_background_new((guint16)(background->red * 65535), 6285 GdkRGBA *background = pthread_getspecific(_dw_bg_color_key);
5967 (guint16)(background->green * 65535), 6286
5968 (guint16)(background->blue* 65535)); 6287 pango_layout_set_font_description(layout, font);
5969 if(!list) 6288 pango_layout_set_text(layout, text, strlen(text));
6289
6290 gdk_cairo_set_source_rgba(cr, foreground);
6291 /* Create a background color attribute if required */
6292 if(background)
5970 { 6293 {
5971 list = pango_attr_list_new(); 6294 PangoAttrList *list = pango_layout_get_attributes(layout);
6295 PangoAttribute *attr = pango_attr_background_new((guint16)(background->red * 65535),
6296 (guint16)(background->green * 65535),
6297 (guint16)(background->blue* 65535));
6298 if(!list)
6299 {
6300 list = pango_attr_list_new();
6301 }
6302 pango_attr_list_change(list, attr);
6303 pango_layout_set_attributes(layout, list);
5972 } 6304 }
5973 pango_attr_list_change(list, attr); 6305 /* Do the drawing */
5974 pango_layout_set_attributes(layout, list); 6306 cairo_move_to(cr, x, y);
6307 pango_cairo_show_layout (cr, layout);
6308
6309 g_object_unref(layout);
5975 } 6310 }
5976 /* Do the drawing */ 6311 g_object_unref(context);
5977 cairo_move_to(cr, x, y);
5978 pango_cairo_show_layout (cr, layout);
5979
5980 g_object_unref(layout);
5981 } 6312 }
5982 g_object_unref(context); 6313 pango_font_description_free(font);
5983 } 6314 }
5984 pango_font_description_free(font); 6315 /* If we are using a drawing context...
5985 } 6316 * we don't own the cairo context so don't destroy it.
5986 /* If we are using a drawing context... 6317 */
5987 * we don't own the cairo context so don't destroy it. 6318 if(dc)
5988 */ 6319 gdk_draw_context_end_frame(dc);
5989 if(dc) 6320 else if(!cached)
5990 gdk_draw_context_end_frame(dc); 6321 cairo_destroy(cr);
5991 else if(!cached) 6322 }
5992 cairo_destroy(cr); 6323 }
5993 } 6324 DW_FUNCTION_RETURN_NOTHING;
5994 } 6325 }
5995 6326
5996 /* Query the width and height of a text string. 6327 /* Query the width and height of a text string.
5997 * Parameters: 6328 * Parameters:
5998 * handle: Handle to the window. 6329 * handle: Handle to the window.
6987 * they create threads that require access to Dynamic Windows. 7318 * they create threads that require access to Dynamic Windows.
6988 */ 7319 */
6989 void API _dw_init_thread(void) 7320 void API _dw_init_thread(void)
6990 { 7321 {
6991 GdkRGBA *foreground = malloc(sizeof(GdkRGBA)); 7322 GdkRGBA *foreground = malloc(sizeof(GdkRGBA));
7323 HEV event = dw_event_new();
6992 7324
6993 foreground->alpha = foreground->red = foreground->green = foreground->blue = 0.0; 7325 foreground->alpha = foreground->red = foreground->green = foreground->blue = 0.0;
6994 pthread_setspecific(_dw_fg_color_key, foreground); 7326 pthread_setspecific(_dw_fg_color_key, foreground);
6995 pthread_setspecific(_dw_bg_color_key, NULL); 7327 pthread_setspecific(_dw_bg_color_key, NULL);
7328 pthread_setspecific(_dw_event_key, event);
6996 } 7329 }
6997 7330
6998 /* 7331 /*
6999 * Generally an internal function called from a terminating 7332 * Generally an internal function called from a terminating
7000 * thread to cleanup the Dynamic Windows environment for the thread. 7333 * thread to cleanup the Dynamic Windows environment for the thread.
7002 * they exit threads that require access to Dynamic Windows. 7335 * they exit threads that require access to Dynamic Windows.
7003 */ 7336 */
7004 void API _dw_deinit_thread(void) 7337 void API _dw_deinit_thread(void)
7005 { 7338 {
7006 GdkRGBA *foreground, *background; 7339 GdkRGBA *foreground, *background;
7340 HEV event;
7007 7341
7008 if((foreground = pthread_getspecific(_dw_fg_color_key))) 7342 if((foreground = pthread_getspecific(_dw_fg_color_key)))
7009 free(foreground); 7343 free(foreground);
7010 if((background = pthread_getspecific(_dw_bg_color_key))) 7344 if((background = pthread_getspecific(_dw_bg_color_key)))
7011 free(background); 7345 free(background);
7346 if((event = pthread_getspecific(_dw_event_key)))
7347 dw_event_close(&event);
7012 } 7348 }
7013 7349
7014 /* 7350 /*
7015 * Setup thread independent color sets. 7351 * Setup thread independent color sets.
7016 */ 7352 */
7442 * Parameters: 7778 * Parameters:
7443 * handle: Window handle of the packed item to be removed. 7779 * handle: Window handle of the packed item to be removed.
7444 * Returns: 7780 * Returns:
7445 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. 7781 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
7446 */ 7782 */
7447 int API dw_box_unpack(HWND handle) 7783 DW_FUNCTION_DEFINITION(dw_box_unpack, int, HWND handle)
7784 DW_FUNCTION_ADD_PARAM1(handle)
7785 DW_FUNCTION_RETURN(dw_box_unpack, int)
7786 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
7448 { 7787 {
7449 int retcode = DW_ERROR_GENERAL; 7788 int retcode = DW_ERROR_GENERAL;
7450 7789
7451 if(GTK_IS_WIDGET(handle)) 7790 if(GTK_IS_WIDGET(handle))
7452 { 7791 {
7505 } 7844 }
7506 } 7845 }
7507 retcode = DW_ERROR_NONE; 7846 retcode = DW_ERROR_NONE;
7508 } 7847 }
7509 } 7848 }
7510 return retcode; 7849 DW_FUNCTION_RETURN_THIS(retcode);
7511 } 7850 }
7512 7851
7513 /* 7852 /*
7514 * Remove windows (widgets) from a box at an arbitrary location. 7853 * Remove windows (widgets) from a box at an arbitrary location.
7515 * Parameters: 7854 * Parameters:
7516 * box: Window handle of the box to be removed from. 7855 * box: Window handle of the box to be removed from.
7517 * index: 0 based index of packed items. 7856 * index: 0 based index of packed items.
7518 * Returns: 7857 * Returns:
7519 * Handle to the removed item on success, 0 on failure or padding. 7858 * Handle to the removed item on success, 0 on failure or padding.
7520 */ 7859 */
7521 HWND API dw_box_unpack_at_index(HWND box, int index) 7860 DW_FUNCTION_DEFINITION(dw_box_unpack_at_index, HWND, HWND box, int index)
7861 DW_FUNCTION_ADD_PARAM2(box, index)
7862 DW_FUNCTION_RETURN(dw_box_unpack_at_index, HWND)
7863 DW_FUNCTION_RESTORE_PARAM2(box, HWND, index, int)
7522 { 7864 {
7523 HWND retval = 0; 7865 HWND retval = 0;
7524 7866
7525 /* Check if we are removing a widget from a box */ 7867 /* Check if we are removing a widget from a box */
7526 if(GTK_IS_GRID(box)) 7868 if(GTK_IS_GRID(box))
7553 else 7895 else
7554 gtk_grid_remove_column(GTK_GRID(box), index); 7896 gtk_grid_remove_column(GTK_GRID(box), index);
7555 retval = item; 7897 retval = item;
7556 } 7898 }
7557 } 7899 }
7558 return retval; 7900 DW_FUNCTION_RETURN_THIS(retval);
7559 } 7901 }
7560 7902
7561 /* 7903 /*
7562 * Pack windows (widgets) into a box at an arbitrary location. 7904 * Pack windows (widgets) into a box at an arbitrary location.
7563 * Parameters: 7905 * Parameters:
7615 * Parameters: 7957 * Parameters:
7616 * handle: Window (widget) handle. 7958 * handle: Window (widget) handle.
7617 * width: New width in pixels. 7959 * width: New width in pixels.
7618 * height: New height in pixels. 7960 * height: New height in pixels.
7619 */ 7961 */
7620 void dw_window_set_size(HWND handle, unsigned long width, unsigned long height) 7962 DW_FUNCTION_DEFINITION(dw_window_set_size, void, HWND handle, ULONG width, ULONG height)
7621 { 7963 DW_FUNCTION_ADD_PARAM3(handle, width, height)
7622 if(!handle) 7964 DW_FUNCTION_NO_RETURN(dw_window_set_size)
7623 return; 7965 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, width, ULONG, height, ULONG)
7624 7966 {
7625 if(GTK_IS_WINDOW(handle)) 7967 if(handle)
7626 gtk_window_set_default_size(GTK_WINDOW(handle), width, height); 7968 {
7627 else 7969 if(GTK_IS_WINDOW(handle))
7628 gtk_widget_set_size_request(GTK_WIDGET(handle), width, height); 7970 gtk_window_set_default_size(GTK_WINDOW(handle), width, height);
7971 else if(GTK_IS_WIDGET(handle))
7972 gtk_widget_set_size_request(GTK_WIDGET(handle), width, height);
7973 }
7974 DW_FUNCTION_RETURN_NOTHING;
7629 } 7975 }
7630 7976
7631 /* 7977 /*
7632 * Gets the size the system thinks the widget should be. 7978 * Gets the size the system thinks the widget should be.
7633 * Parameters: 7979 * Parameters:
8093 * Parameters: 8439 * Parameters:
8094 * handle: Handle to the listbox to be appended to. 8440 * handle: Handle to the listbox to be appended to.
8095 * text: Text to insert into listbox. 8441 * text: Text to insert into listbox.
8096 * pos: 0-based index into listbox. -1 will append 8442 * pos: 0-based index into listbox. -1 will append
8097 */ 8443 */
8098 void dw_listbox_insert(HWND handle, const char *text, int pos) 8444 DW_FUNCTION_DEFINITION(dw_listbox_insert, void, HWND handle, const char *text, int pos)
8445 DW_FUNCTION_ADD_PARAM3(handle, text, pos)
8446 DW_FUNCTION_NO_RETURN(dw_listbox_insert)
8447 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, const char *, pos, int)
8099 { 8448 {
8100 GtkWidget *handle2 = handle; 8449 GtkWidget *handle2 = handle;
8101 GtkListStore *store = NULL; 8450 GtkListStore *store = NULL;
8102 8451
8103 /* Get the inner handle for scrolled controls */ 8452 /* Get the inner handle for scrolled controls */
8115 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) 8464 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX))
8116 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); 8465 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2));
8117 else if(GTK_IS_COMBO_BOX(handle2)) 8466 else if(GTK_IS_COMBO_BOX(handle2))
8118 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); 8467 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2));
8119 8468
8120 if(!store) 8469 if(store)
8121 return; 8470 {
8122 8471 if(pos < 0)
8123 if(pos < 0) 8472 {
8124 { 8473 /* Insert an entry at the end */
8125 /* Insert an entry at the end */ 8474 gtk_list_store_append(store, &iter);
8126 gtk_list_store_append(store, &iter); 8475 }
8127 } 8476 else
8128 else 8477 {
8129 { 8478 /* Insert at position */
8130 /* Insert at position */ 8479 gtk_list_store_insert(store, &iter, pos);
8131 gtk_list_store_insert(store, &iter, pos); 8480 }
8132 } 8481 gtk_list_store_set (store, &iter, 0, text, -1);
8133 gtk_list_store_set (store, &iter, 0, text, -1); 8482 }
8134 } 8483 }
8484 DW_FUNCTION_RETURN_NOTHING;
8135 } 8485 }
8136 8486
8137 /* 8487 /*
8138 * Appends the specified text items to the listbox's (or combobox) entry list. 8488 * Appends the specified text items to the listbox's (or combobox) entry list.
8139 * Parameters: 8489 * Parameters:
8140 * handle: Handle to the listbox to be appended to. 8490 * handle: Handle to the listbox to be appended to.
8141 * text: Text strings to append into listbox. 8491 * text: Text strings to append into listbox.
8142 * count: Number of text strings to append 8492 * count: Number of text strings to append
8143 */ 8493 */
8144 void dw_listbox_list_append(HWND handle, char **text, int count) 8494 DW_FUNCTION_DEFINITION(dw_listbox_list_append, void, HWND handle, char **text, int count)
8495 DW_FUNCTION_ADD_PARAM3(handle, text, count)
8496 DW_FUNCTION_NO_RETURN(dw_listbox_list_append)
8497 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, char **, count, int)
8145 { 8498 {
8146 GtkWidget *handle2 = handle; 8499 GtkWidget *handle2 = handle;
8147 GtkListStore *store = NULL; 8500 GtkListStore *store = NULL;
8148 8501
8149 /* Get the inner handle for scrolled controls */ 8502 /* Get the inner handle for scrolled controls */
8162 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) 8515 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX))
8163 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); 8516 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2));
8164 else if(GTK_IS_COMBO_BOX(handle2)) 8517 else if(GTK_IS_COMBO_BOX(handle2))
8165 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); 8518 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2));
8166 8519
8167 if(!store) 8520 if(store)
8168 return; 8521 {
8169 8522 /* Insert entries at the end */
8170 /* Insert entries at the end */ 8523 for(z=0;z<count;z++)
8171 for(z=0;z<count;z++) 8524 {
8172 { 8525 gtk_list_store_append(store, &iter);
8173 gtk_list_store_append(store, &iter); 8526 gtk_list_store_set (store, &iter, 0, text[z], -1);
8174 gtk_list_store_set (store, &iter, 0, text[z], -1); 8527 }
8175 } 8528 }
8176 } 8529 }
8530 DW_FUNCTION_RETURN_NOTHING;
8177 } 8531 }
8178 8532
8179 /* 8533 /*
8180 * Clears the listbox's (or combobox) list of all entries. 8534 * Clears the listbox's (or combobox) list of all entries.
8181 * Parameters: 8535 * Parameters:
8182 * handle: Handle to the listbox to be cleared. 8536 * handle: Handle to the listbox to be cleared.
8183 */ 8537 */
8184 void dw_listbox_clear(HWND handle) 8538 DW_FUNCTION_DEFINITION(dw_listbox_clear, void, HWND handle)
8539 DW_FUNCTION_ADD_PARAM1(handle)
8540 DW_FUNCTION_NO_RETURN(dw_listbox_clear)
8541 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
8542
8185 { 8543 {
8186 GtkWidget *handle2 = handle; 8544 GtkWidget *handle2 = handle;
8187 GtkListStore *store = NULL; 8545 GtkListStore *store = NULL;
8188 8546
8189 /* Get the inner handle for scrolled controls */ 8547 /* Get the inner handle for scrolled controls */
8199 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX)) 8557 if(GTK_IS_TREE_VIEW(handle2) && g_object_get_data(G_OBJECT(handle2), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_LISTBOX))
8200 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2)); 8558 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(handle2));
8201 else if(GTK_IS_COMBO_BOX(handle2)) 8559 else if(GTK_IS_COMBO_BOX(handle2))
8202 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2)); 8560 store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(handle2));
8203 8561
8204 if(!store) 8562 if(store)
8205 return; 8563 {
8206 /* Clear the list */ 8564 /* Clear the list */
8207 gtk_list_store_clear(store); 8565 gtk_list_store_clear(store);
8208 } 8566 }
8567 }
8568 DW_FUNCTION_RETURN_NOTHING;
8209 } 8569 }
8210 8570
8211 /* 8571 /*
8212 * Returns the listbox's item count. 8572 * Returns the listbox's item count.
8213 * Parameters: 8573 * Parameters:
8247 * Sets the topmost item in the viewport. 8607 * Sets the topmost item in the viewport.
8248 * Parameters: 8608 * Parameters:
8249 * handle: Handle to the listbox to be cleared. 8609 * handle: Handle to the listbox to be cleared.
8250 * top: Index to the top item. 8610 * top: Index to the top item.
8251 */ 8611 */
8252 void dw_listbox_set_top(HWND handle, int top) 8612 DW_FUNCTION_DEFINITION(dw_listbox_set_top, void, HWND handle, int top)
8613 DW_FUNCTION_ADD_PARAM2(handle, top)
8614 DW_FUNCTION_NO_RETURN(dw_listbox_set_top)
8615 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, top, int)
8616
8253 { 8617 {
8254 GtkWidget *handle2 = handle; 8618 GtkWidget *handle2 = handle;
8255 8619
8256 if(GTK_IS_SCROLLED_WINDOW(handle)) 8620 if(GTK_IS_SCROLLED_WINDOW(handle))
8257 { 8621 {
8273 gdouble upper = gtk_adjustment_get_upper(adjust) - pagesize; 8637 gdouble upper = gtk_adjustment_get_upper(adjust) - pagesize;
8274 gdouble lower = gtk_adjustment_get_lower(adjust); 8638 gdouble lower = gtk_adjustment_get_lower(adjust);
8275 gdouble change; 8639 gdouble change;
8276 8640
8277 /* Safety check */ 8641 /* Safety check */
8278 if(rowcount < 2) 8642 if(rowcount > 1)
8279 return; 8643 {
8280 8644 /* Verify the range */
8281 /* Verify the range */ 8645 rowcount--;
8282 rowcount--; 8646 if(top > rowcount)
8283 if(top > rowcount) 8647 top = rowcount;
8284 top = rowcount; 8648
8285 8649 change = ((gdouble)top/(gdouble)rowcount) * (upper - lower);
8286 change = ((gdouble)top/(gdouble)rowcount) * (upper - lower); 8650
8287 8651 gtk_adjustment_set_value(adjust, change + lower);
8288 gtk_adjustment_set_value(adjust, change + lower); 8652 }
8289 } 8653 }
8290 } 8654 }
8655 DW_FUNCTION_RETURN_NOTHING;
8291 } 8656 }
8292 8657
8293 /* 8658 /*
8294 * Copies the given index item's text into buffer. 8659 * Copies the given index item's text into buffer.
8295 * Parameters: 8660 * Parameters:
8296 * handle: Handle to the listbox to be queried. 8661 * handle: Handle to the listbox to be queried.
8297 * index: Index into the list to be queried. 8662 * index: Index into the list to be queried.
8298 * buffer: Buffer where text will be copied. 8663 * buffer: Buffer where text will be copied.
8299 * length: Length of the buffer (including NULL). 8664 * length: Length of the buffer (including NULL).
8300 */ 8665 */
8301 void dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) 8666 DW_FUNCTION_DEFINITION(dw_listbox_get_text, void, HWND handle, unsigned int index, char *buffer, unsigned int length)
8667 DW_FUNCTION_ADD_PARAM4(handle, index, buffer, length)
8668 DW_FUNCTION_NO_RETURN(dw_listbox_get_text)
8669 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, index, unsigned int, buffer, char *, length, unsigned int)
8670
8302 { 8671 {
8303 GtkWidget *handle2 = handle; 8672 GtkWidget *handle2 = handle;
8304 GtkListStore *store = NULL; 8673 GtkListStore *store = NULL;
8305 8674
8306 /* Get the inner handle for scrolled controls */ 8675 /* Get the inner handle for scrolled controls */
8331 if(text) 8700 if(text)
8332 { 8701 {
8333 strncpy(buffer, text, length); 8702 strncpy(buffer, text, length);
8334 g_free(text); 8703 g_free(text);
8335 } 8704 }
8336 return;
8337 } 8705 }
8338 } 8706 }
8339 } 8707 }
8340 buffer[0] = '\0'; 8708 buffer[0] = '\0';
8709 DW_FUNCTION_RETURN_NOTHING;
8341 } 8710 }
8342 8711
8343 /* 8712 /*
8344 * Sets the text of a given listbox entry. 8713 * Sets the text of a given listbox entry.
8345 * Parameters: 8714 * Parameters:
8346 * handle: Handle to the listbox to be queried. 8715 * handle: Handle to the listbox to be queried.
8347 * index: Index into the list to be queried. 8716 * index: Index into the list to be queried.
8348 * buffer: Buffer where text will be copied. 8717 * buffer: Buffer where text will be copied.
8349 */ 8718 */
8350 void dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) 8719 DW_FUNCTION_DEFINITION(dw_listbox_set_text, void, HWND handle, unsigned int index, const char *buffer)
8720 DW_FUNCTION_ADD_PARAM3(handle, index, buffer)
8721 DW_FUNCTION_NO_RETURN(dw_listbox_set_text)
8722 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, unsigned int, buffer, char *)
8351 { 8723 {
8352 GtkWidget *handle2 = handle; 8724 GtkWidget *handle2 = handle;
8353 GtkListStore *store = NULL; 8725 GtkListStore *store = NULL;
8354 8726
8355 /* Get the inner handle for scrolled controls */ 8727 /* Get the inner handle for scrolled controls */
8377 /* Update the text */ 8749 /* Update the text */
8378 gtk_list_store_set(store, &iter, buffer); 8750 gtk_list_store_set(store, &iter, buffer);
8379 } 8751 }
8380 } 8752 }
8381 } 8753 }
8754 DW_FUNCTION_RETURN_NOTHING;
8382 } 8755 }
8383 8756
8384 /* 8757 /*
8385 * Returns the index to the current selected item or -1 when done. 8758 * Returns the index to the current selected item or -1 when done.
8386 * Parameters: 8759 * Parameters:
8387 * handle: Handle to the listbox to be queried. 8760 * handle: Handle to the listbox to be queried.
8388 * where: Either the previous return or -1 to restart. 8761 * where: Either the previous return or -1 to restart.
8389 */ 8762 */
8390 int dw_listbox_selected_multi(HWND handle, int where) 8763 DW_FUNCTION_DEFINITION(dw_listbox_selected_multi, int, HWND handle, int where)
8764 DW_FUNCTION_ADD_PARAM2(handle, where)
8765 DW_FUNCTION_RETURN(dw_listbox_selected_multi, int)
8766 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, where, int)
8391 { 8767 {
8392 GtkWidget *handle2; 8768 GtkWidget *handle2;
8393 GtkListStore *store = NULL; 8769 GtkListStore *store = NULL;
8394 int retval = DW_LIT_NONE; 8770 int retval = DW_LIT_NONE;
8395 8771
8425 8801
8426 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); 8802 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL);
8427 g_list_free(list); 8803 g_list_free(list);
8428 } 8804 }
8429 } 8805 }
8430 return retval; 8806 DW_FUNCTION_RETURN_THIS(retval);
8431 } 8807 }
8432 8808
8433 /* 8809 /*
8434 * Returns the index to the item in the list currently selected. 8810 * Returns the index to the item in the list currently selected.
8435 * Parameters: 8811 * Parameters:
8436 * handle: Handle to the listbox to be queried. 8812 * handle: Handle to the listbox to be queried.
8437 */ 8813 */
8438 int dw_listbox_selected(HWND handle) 8814 DW_FUNCTION_DEFINITION(dw_listbox_selected, int, HWND handle)
8815 DW_FUNCTION_ADD_PARAM1(handle)
8816 DW_FUNCTION_RETURN(dw_listbox_selected, int)
8817 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
8439 { 8818 {
8440 GtkWidget *handle2 = handle; 8819 GtkWidget *handle2 = handle;
8441 GtkListStore *store = NULL; 8820 GtkListStore *store = NULL;
8442 unsigned int retval = 0; 8821 unsigned int retval = 0;
8443 8822
8496 } 8875 }
8497 } 8876 }
8498 } 8877 }
8499 } 8878 }
8500 } 8879 }
8501 return retval; 8880 DW_FUNCTION_RETURN_THIS(retval);
8502 } 8881 }
8503 8882
8504 /* 8883 /*
8505 * Sets the selection state of a given index. 8884 * Sets the selection state of a given index.
8506 * Parameters: 8885 * Parameters:
8507 * handle: Handle to the listbox to be set. 8886 * handle: Handle to the listbox to be set.
8508 * index: Item index. 8887 * index: Item index.
8509 * state: TRUE if selected FALSE if unselected. 8888 * state: TRUE if selected FALSE if unselected.
8510 */ 8889 */
8511 void dw_listbox_select(HWND handle, int index, int state) 8890 DW_FUNCTION_DEFINITION(dw_listbox_select, void, HWND handle, int index, int state)
8891 DW_FUNCTION_ADD_PARAM3(handle, index, state)
8892 DW_FUNCTION_NO_RETURN(dw_listbox_select)
8893 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, int, state, int)
8512 { 8894 {
8513 GtkWidget *handle2 = handle; 8895 GtkWidget *handle2 = handle;
8514 GtkListStore *store = NULL; 8896 GtkListStore *store = NULL;
8515 8897
8516 /* Get the inner handle for scrolled controls */ 8898 /* Get the inner handle for scrolled controls */
8554 } 8936 }
8555 } 8937 }
8556 } 8938 }
8557 } 8939 }
8558 } 8940 }
8941 DW_FUNCTION_RETURN_NOTHING;
8559 } 8942 }
8560 8943
8561 /* 8944 /*
8562 * Deletes the item with given index from the list. 8945 * Deletes the item with given index from the list.
8563 * Parameters: 8946 * Parameters:
8564 * handle: Handle to the listbox to be set. 8947 * handle: Handle to the listbox to be set.
8565 * index: Item index. 8948 * index: Item index.
8566 */ 8949 */
8567 void dw_listbox_delete(HWND handle, int index) 8950 DW_FUNCTION_DEFINITION(dw_listbox_delete, void, HWND handle, int index)
8951 DW_FUNCTION_ADD_PARAM2(handle, index)
8952 DW_FUNCTION_NO_RETURN(dw_listbox_delete)
8953 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, index, int)
8568 { 8954 {
8569 GtkWidget *handle2 = handle; 8955 GtkWidget *handle2 = handle;
8570 GtkListStore *store = NULL; 8956 GtkListStore *store = NULL;
8571 8957
8572 /* Get the inner handle for scrolled controls */ 8958 /* Get the inner handle for scrolled controls */
8593 { 8979 {
8594 gtk_list_store_remove(store, &iter); 8980 gtk_list_store_remove(store, &iter);
8595 } 8981 }
8596 } 8982 }
8597 } 8983 }
8984 DW_FUNCTION_RETURN_NOTHING;
8598 } 8985 }
8599 8986
8600 /* Function to do delayed positioning */ 8987 /* Function to do delayed positioning */
8601 gboolean _dw_splitbar_set_percent(gpointer data) 8988 gboolean _dw_splitbar_set_percent(gpointer data)
8602 { 8989 {