Line |
Branch |
Exec |
Source |
1 |
|
|
/* GATE PROJECT LICENSE: |
2 |
|
|
+----------------------------------------------------------------------------+ |
3 |
|
|
| Copyright(c) 2018-2025, Stefan Meislinger <sm@opengate.at> | |
4 |
|
|
| All rights reserved. | |
5 |
|
|
| | |
6 |
|
|
| Redistribution and use in source and binary forms, with or without | |
7 |
|
|
| modification, are permitted provided that the following conditions are met:| |
8 |
|
|
| | |
9 |
|
|
| 1. Redistributions of source code must retain the above copyright notice, | |
10 |
|
|
| this list of conditions and the following disclaimer. | |
11 |
|
|
| 2. Redistributions in binary form must reproduce the above copyright | |
12 |
|
|
| notice, this list of conditions and the following disclaimer in the | |
13 |
|
|
| documentation and/or other materials provided with the distribution. | |
14 |
|
|
| | |
15 |
|
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| |
16 |
|
|
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 |
|
|
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 |
|
|
| ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
19 |
|
|
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 |
|
|
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 |
|
|
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 |
|
|
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 |
|
|
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 |
|
|
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
25 |
|
|
| THE POSSIBILITY OF SUCH DAMAGE. | |
26 |
|
|
+----------------------------------------------------------------------------+ |
27 |
|
|
*/ |
28 |
|
|
|
29 |
|
|
#include "gate/ui/timers.h" |
30 |
|
|
#include "gate/results.h" |
31 |
|
|
|
32 |
|
|
#if defined(GATE_UI_WINAPI) |
33 |
|
|
|
34 |
|
|
#include "gate/platforms.h" |
35 |
|
|
#include "gate/ui/gateui_winapi.h" |
36 |
|
|
|
37 |
|
|
|
38 |
|
|
static gate_bool_t gate_ui_timer_events(void* hwnd, gate_ui_ctrl_t* ctrl, gate_uint32_t msg, gate_uintptr_t wParam, gate_intptr_t lParam, gate_intptr_t* lresult) |
39 |
|
|
{ |
40 |
|
|
HWND hwndCtrl; |
41 |
|
|
gate_ui_timer_t* timer; |
42 |
|
|
|
43 |
|
|
if (ctrl != NULL) |
44 |
|
|
{ |
45 |
|
|
hwndCtrl = GATE_UI_WINAPI_GET_HWND(ctrl); |
46 |
|
|
if (hwnd == hwndCtrl) |
47 |
|
|
{ |
48 |
|
|
timer = (gate_ui_timer_t*)ctrl; |
49 |
|
|
switch (msg) |
50 |
|
|
{ |
51 |
|
|
case WM_TIMER: |
52 |
|
|
{ |
53 |
|
|
if (timer->on_interval != NULL) |
54 |
|
|
{ |
55 |
|
|
timer->on_interval(ctrl); |
56 |
|
|
} |
57 |
|
|
*lresult = 0; |
58 |
|
|
return true; |
59 |
|
|
break; |
60 |
|
|
} |
61 |
|
|
} |
62 |
|
|
} |
63 |
|
|
} |
64 |
|
|
return false; |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
gate_result_t gate_ui_timer_create(gate_ui_timer_t* timer, gate_ui_host_t* host, void* userparam) |
69 |
|
|
{ |
70 |
|
|
gate_result_t ret; |
71 |
|
|
gate_uint32_t styles, exstyles; |
72 |
|
|
gate_ui_position_t position; |
73 |
|
|
|
74 |
|
|
position.pos.x = 0; |
75 |
|
|
position.pos.y = 0; |
76 |
|
|
position.size.width = 1; |
77 |
|
|
position.size.height = 1; |
78 |
|
|
|
79 |
|
|
gate_mem_clear(timer, sizeof(gate_ui_timer_t)); |
80 |
|
|
|
81 |
|
|
exstyles = 0; |
82 |
|
|
styles = WS_DISABLED; |
83 |
|
|
/*styles |= WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;*/ |
84 |
|
|
|
85 |
|
|
#if !defined(GATE_SYS_WINCE) |
86 |
|
|
/*styles |= (WS_OVERLAPPED | WS_CAPTION);*/ |
87 |
|
|
#endif |
88 |
|
|
|
89 |
|
|
ret = gate_ui_winapi_create(&timer->ctrl, host, NULL, NULL, &position, styles, exstyles, NULL, userparam, false); |
90 |
|
|
if (GATE_SUCCEEDED(ret)) |
91 |
|
|
{ |
92 |
|
|
gate_ui_winapi_register_event(host, GATE_UI_WINAPI_GET_HWND(&timer->ctrl), WM_TIMER, &gate_ui_timer_events, &timer->ctrl); |
93 |
|
|
} |
94 |
|
|
return ret; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
#ifndef USER_TIMER_MINIMUM |
98 |
|
|
#define USER_TIMER_MINIMUM 0x0a |
99 |
|
|
#endif |
100 |
|
|
#ifndef USER_TIMER_MAXIMUM |
101 |
|
|
#define USER_TIMER_MAXIMUM 0x7FFFFFFF |
102 |
|
|
#endif |
103 |
|
|
|
104 |
|
|
gate_result_t gate_ui_timer_start(gate_ui_timer_t* timer, gate_uint32_t interval) |
105 |
|
|
{ |
106 |
|
|
HWND hwnd = GATE_UI_WINAPI_GET_HWND(&timer->ctrl); |
107 |
|
|
if (interval < USER_TIMER_MINIMUM) interval = USER_TIMER_MINIMUM; |
108 |
|
|
if (interval > USER_TIMER_MAXIMUM) interval = USER_TIMER_MAXIMUM; |
109 |
|
|
EnableWindow(hwnd, TRUE); |
110 |
|
|
if (0 != SetTimer(hwnd, 1, interval, NULL)) |
111 |
|
|
{ |
112 |
|
|
return GATE_RESULT_OK; |
113 |
|
|
} |
114 |
|
|
else |
115 |
|
|
{ |
116 |
|
|
EnableWindow(hwnd, FALSE); |
117 |
|
|
return GATE_RESULT_FAILED; |
118 |
|
|
} |
119 |
|
|
} |
120 |
|
|
|
121 |
|
|
gate_bool_t gate_ui_timer_is_started(gate_ui_timer_t* timer) |
122 |
|
|
{ |
123 |
|
|
HWND hwnd = GATE_UI_WINAPI_GET_HWND(&timer->ctrl); |
124 |
|
|
return IsWindowEnabled(hwnd) == FALSE ? false : true; |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
gate_result_t gate_ui_timer_stop(gate_ui_timer_t* timer) |
129 |
|
|
{ |
130 |
|
|
HWND hwnd = GATE_UI_WINAPI_GET_HWND(&timer->ctrl); |
131 |
|
|
if (KillTimer(hwnd, 1)) |
132 |
|
|
{ |
133 |
|
|
EnableWindow(hwnd, FALSE); |
134 |
|
|
return GATE_RESULT_OK; |
135 |
|
|
} |
136 |
|
|
else |
137 |
|
|
{ |
138 |
|
|
return GATE_RESULT_FAILED; |
139 |
|
|
} |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
#endif /* GATE_UI_WINAPI */ |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
#if defined(GATE_UI_GTK) |
146 |
|
|
|
147 |
|
|
#include "gate/ui/gateui_gtk.h" |
148 |
|
|
|
149 |
|
|
typedef struct gate_ui_gtk_timer_param |
150 |
|
|
{ |
151 |
|
|
gate_ui_timer_t* timer; |
152 |
|
|
gate_bool_t started; |
153 |
|
|
} gate_ui_gtk_timer_param_t; |
154 |
|
|
|
155 |
|
|
static gboolean gate_ui_gtk_timer_callback(gpointer user_data) |
156 |
|
|
{ |
157 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)user_data; |
158 |
|
|
if (!param) |
159 |
|
|
{ |
160 |
|
|
return FALSE; |
161 |
|
|
} |
162 |
|
|
if (param->started) |
163 |
|
|
{ |
164 |
|
|
if (NULL != param->timer) |
165 |
|
|
{ |
166 |
|
|
if (NULL != param->timer->on_interval) |
167 |
|
|
{ |
168 |
|
|
param->timer->on_interval(¶m->timer->ctrl); |
169 |
|
|
} |
170 |
|
|
} |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
if (!param->started) |
174 |
|
|
{ |
175 |
|
|
return FALSE; |
176 |
|
|
} |
177 |
|
|
else |
178 |
|
|
{ |
179 |
|
|
return TRUE; |
180 |
|
|
} |
181 |
|
|
} |
182 |
|
|
|
183 |
|
|
static gate_uint32_t gate_ui_gtk_timer_get_text_length(gate_ui_ctrl_t* ctrl) |
184 |
|
|
{ |
185 |
|
|
return GATE_RESULT_NOTIMPLEMENTED; |
186 |
|
|
} |
187 |
|
|
static gate_result_t gate_ui_gtk_timer_get_text(gate_ui_ctrl_t* ctrl, gate_string_t* text) |
188 |
|
|
{ |
189 |
|
|
return GATE_RESULT_NOTIMPLEMENTED; |
190 |
|
|
} |
191 |
|
|
static gate_result_t gate_ui_gtk_timer_set_text(gate_ui_ctrl_t* ctrl, gate_string_t const* text) |
192 |
|
|
{ |
193 |
|
|
return GATE_RESULT_NOTIMPLEMENTED; |
194 |
|
|
} |
195 |
|
|
static gate_result_t gate_ui_gtk_timer_get_state(gate_ui_ctrl_t* ctrl, gate_int32_t* value) |
196 |
|
|
{ |
197 |
|
|
gate_result_t ret = GATE_RESULT_FAILED; |
198 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)GATE_UI_GTK_GET_CTRL_PRIVATE_ARG(ctrl); |
199 |
|
|
if (param == NULL) |
200 |
|
|
{ |
201 |
|
|
ret = GATE_RESULT_INVALIDSTATE; |
202 |
|
|
} |
203 |
|
|
else |
204 |
|
|
{ |
205 |
|
|
if (value) |
206 |
|
|
{ |
207 |
|
|
*value = param->started ? 1 : 0; |
208 |
|
|
} |
209 |
|
|
ret = GATE_RESULT_OK; |
210 |
|
|
} |
211 |
|
|
return ret; |
212 |
|
|
} |
213 |
|
|
static gate_result_t gate_ui_gtk_timer_set_state(gate_ui_ctrl_t* ctrl, gate_int32_t value) |
214 |
|
|
{ |
215 |
|
|
return GATE_RESULT_NOTIMPLEMENTED; |
216 |
|
|
} |
217 |
|
|
static gate_result_t gate_ui_gtk_timer_refresh(gate_ui_ctrl_t* ctrl) |
218 |
|
|
{ |
219 |
|
|
return GATE_RESULT_OK; |
220 |
|
|
} |
221 |
|
|
static gate_result_t gate_ui_gtk_timer_destroy(gate_ui_ctrl_t* ctrl) |
222 |
|
|
{ |
223 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)GATE_UI_GTK_GET_CTRL_PRIVATE_ARG(ctrl); |
224 |
|
|
if (param) |
225 |
|
|
{ |
226 |
|
|
gate_mem_dealloc(param); |
227 |
|
|
GATE_UI_GTK_SET_CTRL_PRIVATE_ARG(ctrl, NULL); |
228 |
|
|
} |
229 |
|
|
return GATE_RESULT_OK; |
230 |
|
|
} |
231 |
|
|
|
232 |
|
|
static gate_ui_gtk_dispatcher_t gate_ui_gtk_timer_dispatcher = |
233 |
|
|
{ |
234 |
|
|
&gate_ui_gtk_timer_get_text_length, |
235 |
|
|
&gate_ui_gtk_timer_get_text, |
236 |
|
|
&gate_ui_gtk_timer_set_text, |
237 |
|
|
&gate_ui_gtk_timer_get_state, |
238 |
|
|
&gate_ui_gtk_timer_set_state, |
239 |
|
|
&gate_ui_gtk_timer_refresh, |
240 |
|
|
&gate_ui_gtk_timer_destroy |
241 |
|
|
}; |
242 |
|
|
|
243 |
|
|
|
244 |
|
|
gate_result_t gate_ui_timer_create( |
245 |
|
|
gate_ui_timer_t* timer, gate_ui_host_t* host, |
246 |
|
|
void* userparam |
247 |
|
|
) |
248 |
|
|
{ |
249 |
|
|
gate_result_t ret = GATE_RESULT_FAILED; |
250 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)gate_mem_alloc(sizeof(gate_ui_gtk_timer_param_t)); |
251 |
|
|
|
252 |
|
|
do |
253 |
|
|
{ |
254 |
|
|
if (param == NULL) |
255 |
|
|
{ |
256 |
|
|
ret = GATE_RESULT_OUTOFMEMORY; |
257 |
|
|
break; |
258 |
|
|
} |
259 |
|
|
param->timer = timer; |
260 |
|
|
param->started = false; |
261 |
|
|
|
262 |
|
|
gate_mem_clear(timer, sizeof(gate_ui_timer_t)); |
263 |
|
|
|
264 |
|
|
GATE_UI_GTK_SET_CTRL_WIDGET_DIRECT(&timer->ctrl, GATE_UI_GTK_NO_WIDGET); |
265 |
|
|
GATE_UI_GTK_SET_CTRL_HOST(&timer->ctrl, host); |
266 |
|
|
GATE_UI_GTK_SET_CTRL_DISP(&timer->ctrl, &gate_ui_gtk_timer_dispatcher); |
267 |
|
|
GATE_UI_GTK_SET_CTRL_USER_PARAM(&timer->ctrl, userparam); |
268 |
|
|
GATE_UI_GTK_SET_CTRL_CONTAINER(&timer->ctrl, NULL); |
269 |
|
|
GATE_UI_GTK_SET_CTRL_PARENT(&timer->ctrl, NULL); |
270 |
|
|
GATE_UI_GTK_SET_CTRL_PRIVATE_ARG(&timer->ctrl, param); |
271 |
|
|
ret = GATE_RESULT_OK; |
272 |
|
|
|
273 |
|
|
} while (0); |
274 |
|
|
|
275 |
|
|
return ret; |
276 |
|
|
} |
277 |
|
|
|
278 |
|
|
gate_result_t gate_ui_timer_start(gate_ui_timer_t* timer, gate_uint32_t interval) |
279 |
|
|
{ |
280 |
|
|
gate_result_t ret; |
281 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)GATE_UI_GTK_GET_CTRL_PRIVATE_ARG(&timer->ctrl); |
282 |
|
|
if (param == NULL) |
283 |
|
|
{ |
284 |
|
|
ret = GATE_RESULT_INVALIDSTATE; |
285 |
|
|
} |
286 |
|
|
else |
287 |
|
|
{ |
288 |
|
|
param->started = true; |
289 |
|
|
g_timeout_add(interval, &gate_ui_gtk_timer_callback, param); |
290 |
|
|
ret = GATE_RESULT_OK; |
291 |
|
|
} |
292 |
|
|
return ret; |
293 |
|
|
} |
294 |
|
|
|
295 |
|
|
gate_result_t gate_ui_timer_stop(gate_ui_timer_t* timer) |
296 |
|
|
{ |
297 |
|
|
gate_result_t ret; |
298 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)GATE_UI_GTK_GET_CTRL_PRIVATE_ARG(&timer->ctrl); |
299 |
|
|
if (param == NULL) |
300 |
|
|
{ |
301 |
|
|
ret = GATE_RESULT_INVALIDSTATE; |
302 |
|
|
} |
303 |
|
|
else |
304 |
|
|
{ |
305 |
|
|
param->started = false; |
306 |
|
|
GATE_UI_GTK_SET_CTRL_PRIVATE_ARG(&timer->ctrl, NULL); |
307 |
|
|
ret = GATE_RESULT_OK; |
308 |
|
|
} |
309 |
|
|
return ret; |
310 |
|
|
} |
311 |
|
|
|
312 |
|
|
gate_bool_t gate_ui_timer_is_started(gate_ui_timer_t* timer) |
313 |
|
|
{ |
314 |
|
|
gate_ui_gtk_timer_param_t* param = (gate_ui_gtk_timer_param_t*)GATE_UI_GTK_GET_CTRL_PRIVATE_ARG(&timer->ctrl); |
315 |
|
|
if (param == NULL) |
316 |
|
|
{ |
317 |
|
|
return false; |
318 |
|
|
} |
319 |
|
|
else |
320 |
|
|
{ |
321 |
|
|
return param->started; |
322 |
|
|
} |
323 |
|
|
} |
324 |
|
|
|
325 |
|
|
#endif /* GATE_UI_GTK */ |
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
#if defined(GATE_UI_MOTIF) |
330 |
|
|
|
331 |
|
|
#include "gate/ui/gateui_motif.h" |
332 |
|
|
|
333 |
|
✗ |
gate_result_t gate_ui_timer_create(gate_ui_timer_t* timer, gate_ui_host_t* host, void* userparam) |
334 |
|
|
{ |
335 |
|
✗ |
Widget w = (Widget)(gate_intptr_t)-1; |
336 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_HOST(&timer->ctrl, host); |
337 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_WIDGET(&timer->ctrl, w); |
338 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_CONTAINER(&timer->ctrl, NULL); |
339 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_USER_PARAM(&timer->ctrl, userparam); |
340 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_PARENT(&timer->ctrl, NULL); |
341 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_DISP(&timer->ctrl, NULL); |
342 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_PRIVATE_ARG(&timer->ctrl, NULL); |
343 |
|
✗ |
return GATE_RESULT_OK; |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
typedef struct gate_ui_motif_timer_info_class |
347 |
|
|
{ |
348 |
|
|
gate_ui_timer_t* ctrl; |
349 |
|
|
XtIntervalId id; |
350 |
|
|
gate_uint32_t interval; |
351 |
|
|
} gate_ui_motif_timer_info_t; |
352 |
|
|
|
353 |
|
✗ |
static void gate_ui_timer_callback(XtPointer client_arg, XtIntervalId* id) |
354 |
|
|
{ |
355 |
|
✗ |
gate_ui_motif_timer_info_t* ptr_timerinfo = (gate_ui_motif_timer_info_t*)client_arg; |
356 |
|
✗ |
gate_ui_timer_t* ptr_timer = NULL; |
357 |
|
✗ |
unsigned long next_interval = 0; |
358 |
|
|
XtIntervalId next_id; |
359 |
|
|
gate_ui_host_t* ptr_host; |
360 |
|
|
XtAppContext app_context; |
361 |
|
|
|
362 |
|
✗ |
if (!ptr_timerinfo) |
363 |
|
|
{ |
364 |
|
✗ |
return; |
365 |
|
|
} |
366 |
|
|
|
367 |
|
✗ |
ptr_timer = ptr_timerinfo->ctrl; |
368 |
|
✗ |
next_interval = (unsigned long)ptr_timerinfo->interval; |
369 |
|
|
|
370 |
|
✗ |
if (!ptr_timer) |
371 |
|
|
{ |
372 |
|
✗ |
gate_mem_dealloc(ptr_timerinfo); |
373 |
|
✗ |
return; |
374 |
|
|
} |
375 |
|
|
|
376 |
|
✗ |
ptr_host = GATE_UI_MOTIF_GET_CTRL_HOST(&ptr_timer->ctrl); |
377 |
|
✗ |
if (!ptr_host) |
378 |
|
|
{ |
379 |
|
✗ |
gate_mem_dealloc(ptr_timerinfo); |
380 |
|
✗ |
return; |
381 |
|
|
} |
382 |
|
✗ |
app_context = (XtAppContext)GATE_UI_MOTIF_GET_HOST_APPHANDLE(ptr_host); |
383 |
|
✗ |
ptr_timer->on_interval(&ptr_timer->ctrl); |
384 |
|
✗ |
next_id = XtAppAddTimeOut(app_context, next_interval, &gate_ui_timer_callback, (XtPointer)ptr_timerinfo); |
385 |
|
✗ |
ptr_timerinfo->id = next_id; |
386 |
|
|
} |
387 |
|
|
|
388 |
|
✗ |
gate_result_t gate_ui_timer_start(gate_ui_timer_t* timer, gate_uint32_t interval) |
389 |
|
|
{ |
390 |
|
✗ |
gate_result_t ret = GATE_RESULT_FAILED; |
391 |
|
|
gate_ui_host_t* ptr_host; |
392 |
|
|
XtAppContext app_context; |
393 |
|
|
XtIntervalId id; |
394 |
|
✗ |
gate_ui_motif_timer_info_t* ptr_timerinfo = NULL; |
395 |
|
|
|
396 |
|
|
do |
397 |
|
|
{ |
398 |
|
✗ |
ptr_host = GATE_UI_MOTIF_GET_CTRL_HOST(&timer->ctrl); |
399 |
|
✗ |
app_context = (XtAppContext)GATE_UI_MOTIF_GET_HOST_APPHANDLE(ptr_host); |
400 |
|
✗ |
ptr_timerinfo = gate_mem_alloc(sizeof(gate_ui_motif_timer_info_t)); |
401 |
|
✗ |
if (NULL == ptr_timerinfo) |
402 |
|
|
{ |
403 |
|
✗ |
ret = GATE_RESULT_OUTOFMEMORY; |
404 |
|
✗ |
break; |
405 |
|
|
} |
406 |
|
✗ |
ptr_timerinfo->ctrl = timer; |
407 |
|
✗ |
ptr_timerinfo->interval = interval; |
408 |
|
✗ |
id = XtAppAddTimeOut(app_context, interval, &gate_ui_timer_callback, (XtPointer)ptr_timerinfo); |
409 |
|
✗ |
ptr_timerinfo->id = id; |
410 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_PRIVATE_ARG(&timer->ctrl, ptr_timerinfo); |
411 |
|
✗ |
ret = GATE_RESULT_OK; |
412 |
|
|
} while (0); |
413 |
|
|
|
414 |
|
✗ |
return ret; |
415 |
|
|
} |
416 |
|
|
|
417 |
|
✗ |
gate_result_t gate_ui_timer_stop(gate_ui_timer_t* timer) |
418 |
|
|
{ |
419 |
|
✗ |
gate_ui_motif_timer_info_t* ptr_timerinfo = (gate_ui_motif_timer_info_t*)GATE_UI_MOTIF_GET_CTRL_PRIVATE_ARG(&timer->ctrl); |
420 |
|
✗ |
XtIntervalId id = (XtIntervalId)(void*)GATE_UI_MOTIF_GET_CTRL_WIDGET(&timer->ctrl); |
421 |
|
✗ |
if (ptr_timerinfo) |
422 |
|
|
{ |
423 |
|
✗ |
GATE_UI_MOTIF_SET_CTRL_PRIVATE_ARG(&timer->ctrl, NULL); |
424 |
|
✗ |
XtRemoveTimeOut(ptr_timerinfo->id); |
425 |
|
✗ |
gate_mem_dealloc(ptr_timerinfo); |
426 |
|
✗ |
return GATE_RESULT_OK; |
427 |
|
|
} |
428 |
|
✗ |
return GATE_RESULT_INVALIDSTATE; |
429 |
|
|
} |
430 |
|
|
|
431 |
|
✗ |
gate_bool_t gate_ui_timer_is_started(gate_ui_timer_t* timer) |
432 |
|
|
{ |
433 |
|
✗ |
gate_ui_motif_timer_info_t* ptr_timerinfo = (gate_ui_motif_timer_info_t*)GATE_UI_MOTIF_GET_CTRL_PRIVATE_ARG(&timer->ctrl); |
434 |
|
✗ |
if (ptr_timerinfo) |
435 |
|
|
{ |
436 |
|
✗ |
return true; |
437 |
|
|
} |
438 |
|
✗ |
return false; |
439 |
|
|
} |
440 |
|
|
|
441 |
|
|
#endif /* GATE_UI_MOTIF */ |
442 |
|
|
|