Mercurial > dwindows
comparison android/dw.cpp @ 2473:aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
but this should be a framework for adding Android support via JNI/NDK.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 18 Apr 2021 01:28:55 +0000 |
parents | |
children | a13e6db064f4 |
comparison
equal
deleted
inserted
replaced
2472:206a0643add6 | 2473:aa420e366b2b |
---|---|
1 /* | |
2 * Dynamic Windows: | |
3 * A GTK like GUI implementation of the Android GUI. | |
4 * | |
5 * (C) 2011-2021 Brian Smith <brian@dbsoft.org> | |
6 * (C) 2011-2021 Mark Hessling <mark@rexx.org> | |
7 * | |
8 * Compile with $CC -I. -D__ANDROID__ template/dw.c | |
9 * | |
10 */ | |
11 | |
12 #include <jni.h> | |
13 #include "dw.h" | |
14 #include <stdlib.h> | |
15 #include <string.h> | |
16 | |
17 #ifdef __cplusplus | |
18 extern "C" { | |
19 #endif | |
20 | |
21 JNIEXPORT jstring JNICALL | |
22 Java_org_dbsoft_dwindows_dwtest_DWindows_stringFromJNI( | |
23 JNIEnv* env, | |
24 jobject /* this */) { | |
25 char hello[] = "Hello from C++"; | |
26 return env->NewStringUTF(hello); | |
27 } | |
28 | |
29 /* Implement these to get and set the Box* pointer on the widget handle */ | |
30 void *_dw_window_pointer_get(HWND handle) | |
31 { | |
32 return NULL; | |
33 } | |
34 | |
35 void _dw_window_pointer_set(HWND handle, Box *box) | |
36 { | |
37 } | |
38 | |
39 /* This function calculates how much space the widgets and boxes require | |
40 * and does expansion as necessary. | |
41 */ | |
42 static void _dw_resize_box(Box *thisbox, int *depth, int x, int y, int pass) | |
43 { | |
44 /* Current item position */ | |
45 int z, currentx = thisbox->pad, currenty = thisbox->pad; | |
46 /* Used x, y and padding maximum values... | |
47 * These will be used to find the widest or | |
48 * tallest items in a box. | |
49 */ | |
50 int uymax = 0, uxmax = 0; | |
51 int upymax = 0, upxmax = 0; | |
52 | |
53 /* Reset the box sizes */ | |
54 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; | |
55 | |
56 #if 0 | |
57 /* If there are containers which have built-in padding like | |
58 * groupboxes.. calculate the padding size and add it to the layout. | |
59 */ | |
60 if(thisbox->grouphwnd) | |
61 { | |
62 char *text = dw_window_get_text(thisbox->grouphwnd); | |
63 | |
64 thisbox->grouppady = 0; | |
65 | |
66 if(text) | |
67 { | |
68 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); | |
69 dw_free(text); | |
70 } | |
71 | |
72 if(thisbox->grouppady) | |
73 thisbox->grouppady += 3; | |
74 else | |
75 thisbox->grouppady = 6; | |
76 | |
77 thisbox->grouppadx = 6; | |
78 | |
79 thisbox->minwidth += thisbox->grouppadx; | |
80 thisbox->usedpadx += thisbox->grouppadx; | |
81 thisbox->minheight += thisbox->grouppady; | |
82 thisbox->usedpady += thisbox->grouppady; | |
83 } | |
84 #endif | |
85 | |
86 /* Count up all the space for all items in the box */ | |
87 for(z=0;z<thisbox->count;z++) | |
88 { | |
89 int itempad, itemwidth, itemheight; | |
90 | |
91 if(thisbox->items[z].type == TYPEBOX) | |
92 { | |
93 Box *tmp = (Box *)_dw_window_pointer_get(thisbox->items[z].hwnd); | |
94 | |
95 if(tmp) | |
96 { | |
97 /* On the first pass calculate the box contents */ | |
98 if(pass == 1) | |
99 { | |
100 (*depth)++; | |
101 | |
102 /* Save the newly calculated values on the box */ | |
103 _dw_resize_box(tmp, depth, x, y, pass); | |
104 | |
105 /* Duplicate the values in the item list for use below */ | |
106 thisbox->items[z].width = tmp->minwidth; | |
107 thisbox->items[z].height = tmp->minheight; | |
108 | |
109 (*depth)--; | |
110 } | |
111 } | |
112 } | |
113 | |
114 /* Precalculate these values, since they will | |
115 * be used used repeatedly in the next section. | |
116 */ | |
117 itempad = thisbox->items[z].pad * 2; | |
118 itemwidth = thisbox->items[z].width + itempad; | |
119 itemheight = thisbox->items[z].height + itempad; | |
120 | |
121 /* Calculate the totals and maximums */ | |
122 if(thisbox->type == DW_VERT) | |
123 { | |
124 if(itemwidth > uxmax) | |
125 uxmax = itemwidth; | |
126 | |
127 if(thisbox->items[z].hsize != SIZEEXPAND) | |
128 { | |
129 if(itemwidth > upxmax) | |
130 upxmax = itemwidth; | |
131 } | |
132 else | |
133 { | |
134 if(itempad > upxmax) | |
135 upxmax = itempad; | |
136 } | |
137 thisbox->minheight += itemheight; | |
138 if(thisbox->items[z].vsize != SIZEEXPAND) | |
139 thisbox->usedpady += itemheight; | |
140 else | |
141 thisbox->usedpady += itempad; | |
142 } | |
143 else | |
144 { | |
145 if(itemheight > uymax) | |
146 uymax = itemheight; | |
147 if(thisbox->items[z].vsize != SIZEEXPAND) | |
148 { | |
149 if(itemheight > upymax) | |
150 upymax = itemheight; | |
151 } | |
152 else | |
153 { | |
154 if(itempad > upymax) | |
155 upymax = itempad; | |
156 } | |
157 thisbox->minwidth += itemwidth; | |
158 if(thisbox->items[z].hsize != SIZEEXPAND) | |
159 thisbox->usedpadx += itemwidth; | |
160 else | |
161 thisbox->usedpadx += itempad; | |
162 } | |
163 } | |
164 | |
165 /* Add the maximums which were calculated in the previous loop */ | |
166 thisbox->minwidth += uxmax; | |
167 thisbox->minheight += uymax; | |
168 thisbox->usedpadx += upxmax; | |
169 thisbox->usedpady += upymax; | |
170 | |
171 /* Move the groupbox start past the group border */ | |
172 if(thisbox->grouphwnd) | |
173 { | |
174 currentx += 3; | |
175 currenty += thisbox->grouppady - 3; | |
176 } | |
177 | |
178 /* The second pass is for actual placement. */ | |
179 if(pass > 1) | |
180 { | |
181 for(z=0;z<(thisbox->count);z++) | |
182 { | |
183 int height = thisbox->items[z].height; | |
184 int width = thisbox->items[z].width; | |
185 int itempad = thisbox->items[z].pad * 2; | |
186 int thispad = thisbox->pad * 2; | |
187 | |
188 /* Calculate the new sizes */ | |
189 if(thisbox->items[z].hsize == SIZEEXPAND) | |
190 { | |
191 if(thisbox->type == DW_HORZ) | |
192 { | |
193 int expandablex = thisbox->minwidth - thisbox->usedpadx; | |
194 | |
195 if(expandablex) | |
196 width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx)); | |
197 } | |
198 else | |
199 width = x - (itempad + thispad + thisbox->grouppadx); | |
200 } | |
201 if(thisbox->items[z].vsize == SIZEEXPAND) | |
202 { | |
203 if(thisbox->type == DW_VERT) | |
204 { | |
205 int expandabley = thisbox->minheight - thisbox->usedpady; | |
206 | |
207 if(expandabley) | |
208 height = (int)(((float)height / (float)expandabley) * (float)(y - thisbox->usedpady)); | |
209 } | |
210 else | |
211 height = y - (itempad + thispad + thisbox->grouppady); | |
212 } | |
213 | |
214 /* If the calculated size is valid... */ | |
215 if(width > 0 && height > 0) | |
216 { | |
217 int pad = thisbox->items[z].pad; | |
218 #if 0 | |
219 HWND handle = thisbox->items[z].hwnd; | |
220 | |
221 /* Here you put your platform specific placement widget placement code */ | |
222 PlaceWidget(handle, currentx + pad, currenty + pad, width, height); | |
223 | |
224 /* If any special handling needs to be done... like diving into | |
225 * controls that have sub-layouts... like notebooks or splitbars... | |
226 * do that here. Figure out the sub-layout size and call _dw_do_resize(). | |
227 */ | |
228 #endif | |
229 | |
230 /* Advance the current position in the box */ | |
231 if(thisbox->type == DW_HORZ) | |
232 currentx += width + (pad * 2); | |
233 if(thisbox->type == DW_VERT) | |
234 currenty += height + (pad * 2); | |
235 } | |
236 } | |
237 } | |
238 } | |
239 | |
240 /* This is a convenience function used in the window's resize event | |
241 * to relayout the controls in the window. | |
242 */ | |
243 void _dw_do_resize(Box *thisbox, int x, int y) | |
244 { | |
245 if(x != 0 && y != 0) | |
246 { | |
247 if(thisbox) | |
248 { | |
249 int depth = 0; | |
250 | |
251 /* Calculate space requirements */ | |
252 _dw_resize_box(thisbox, &depth, x, y, 1); | |
253 | |
254 /* Finally place all the boxes and controls */ | |
255 _dw_resize_box(thisbox, &depth, x, y, 2); | |
256 } | |
257 } | |
258 } | |
259 | |
260 /* | |
261 * Runs a message loop for Dynamic Windows. | |
262 */ | |
263 void API dw_main(void) | |
264 { | |
265 } | |
266 | |
267 /* | |
268 * Causes running dw_main() to return. | |
269 */ | |
270 void API dw_main_quit(void) | |
271 { | |
272 } | |
273 | |
274 /* | |
275 * Runs a message loop for Dynamic Windows, for a period of milliseconds. | |
276 * Parameters: | |
277 * milliseconds: Number of milliseconds to run the loop for. | |
278 */ | |
279 void API dw_main_sleep(int milliseconds) | |
280 { | |
281 } | |
282 | |
283 /* | |
284 * Processes a single message iteration and returns. | |
285 */ | |
286 void API dw_main_iteration(void) | |
287 { | |
288 } | |
289 | |
290 /* | |
291 * Cleanly terminates a DW session, should be signal handler safe. | |
292 * Parameters: | |
293 * exitcode: Exit code reported to the operating system. | |
294 */ | |
295 void API dw_exit(int exitcode) | |
296 { | |
297 exit(exitcode); | |
298 } | |
299 | |
300 /* | |
301 * Free's memory allocated by dynamic windows. | |
302 * Parameters: | |
303 * ptr: Pointer to dynamic windows allocated | |
304 * memory to be free()'d. | |
305 */ | |
306 void API dw_free(void *ptr) | |
307 { | |
308 free(ptr); | |
309 } | |
310 | |
311 /* | |
312 * Returns a pointer to a static buffer which contains the | |
313 * current user directory. Or the root directory if it could | |
314 * not be determined. | |
315 */ | |
316 char * API dw_user_dir(void) | |
317 { | |
318 static char _dw_user_dir[MAX_PATH+1] = {0}; | |
319 | |
320 if(!_dw_user_dir[0]) | |
321 { | |
322 char *home = getenv("HOME"); | |
323 | |
324 if(home) | |
325 strcpy(_dw_user_dir, home); | |
326 else | |
327 strcpy(_dw_user_dir, "/"); | |
328 } | |
329 return _dw_user_dir; | |
330 } | |
331 | |
332 /* | |
333 * Returns a pointer to a static buffer which containes the | |
334 * private application data directory. | |
335 */ | |
336 char * API dw_app_dir(void) | |
337 { | |
338 static char _dw_exec_dir[MAX_PATH+1] = {0}; | |
339 /* Code to determine the execution directory here, | |
340 * some implementations make this variable global | |
341 * and determin the location in dw_init(). | |
342 */ | |
343 return _dw_exec_dir; | |
344 } | |
345 | |
346 /* | |
347 * Sets the application ID used by this Dynamic Windows application instance. | |
348 * Parameters: | |
349 * appid: A string typically in the form: com.company.division.application | |
350 * appname: The application name used on Windows or NULL. | |
351 * Returns: | |
352 * DW_ERROR_NONE after successfully setting the application ID. | |
353 * DW_ERROR_UNKNOWN if unsupported on this system. | |
354 * DW_ERROR_GENERAL if the application ID is not allowed. | |
355 * Remarks: | |
356 * This must be called before dw_init(). If dw_init() is called first | |
357 * it will create a unique ID in the form: org.dbsoft.dwindows.application | |
358 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# | |
359 * The appname is only required on Windows. If NULL is passed the detected | |
360 * application name will be used, but a prettier name may be desired. | |
361 */ | |
362 int API dw_app_id_set(const char *appid, const char *appname) | |
363 { | |
364 return DW_ERROR_UNKNOWN; | |
365 } | |
366 | |
367 /* | |
368 * Displays a debug message on the console... | |
369 * Parameters: | |
370 * format: printf style format string. | |
371 * ...: Additional variables for use in the format. | |
372 */ | |
373 void API dw_debug(const char *format, ...) | |
374 { | |
375 va_list args; | |
376 char outbuf[1025] = {0}; | |
377 | |
378 va_start(args, format); | |
379 vsnprintf(outbuf, 1024, format, args); | |
380 va_end(args); | |
381 | |
382 /* Output to stderr, if there is another way to send it | |
383 * on the implementation platform, change this. | |
384 */ | |
385 fprintf(stderr, "%s", outbuf); | |
386 } | |
387 | |
388 /* | |
389 * Displays a Message Box with given text and title.. | |
390 * Parameters: | |
391 * title: The title of the message box. | |
392 * flags: flags to indicate buttons and icon | |
393 * format: printf style format string. | |
394 * ...: Additional variables for use in the format. | |
395 * Returns: | |
396 * DW_MB_RETURN_YES, DW_MB_RETURN_NO, DW_MB_RETURN_OK, | |
397 * or DW_MB_RETURN_CANCEL based on flags and user response. | |
398 */ | |
399 int API dw_messagebox(const char *title, int flags, const char *format, ...) | |
400 { | |
401 return 0; | |
402 } | |
403 | |
404 /* | |
405 * Opens a file dialog and queries user selection. | |
406 * Parameters: | |
407 * title: Title bar text for dialog. | |
408 * defpath: The default path of the open dialog. | |
409 * ext: Default file extention. | |
410 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
411 * Returns: | |
412 * NULL on error. A malloced buffer containing | |
413 * the file path on success. | |
414 * | |
415 */ | |
416 char * API dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) | |
417 { | |
418 return NULL; | |
419 } | |
420 | |
421 /* | |
422 * Gets the contents of the default clipboard as text. | |
423 * Parameters: | |
424 * None. | |
425 * Returns: | |
426 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not | |
427 * be converted to text. | |
428 */ | |
429 char * API dw_clipboard_get_text() | |
430 { | |
431 return NULL; | |
432 } | |
433 | |
434 /* | |
435 * Sets the contents of the default clipboard to the supplied text. | |
436 * Parameters: | |
437 * str: Text to put on the clipboard. | |
438 * len: Length of the text. | |
439 */ | |
440 void API dw_clipboard_set_text(const char *str, int len) | |
441 { | |
442 } | |
443 | |
444 | |
445 /* | |
446 * Allocates and initializes a dialog struct. | |
447 * Parameters: | |
448 * data: User defined data to be passed to functions. | |
449 * Returns: | |
450 * A handle to a dialog or NULL on failure. | |
451 */ | |
452 DWDialog * API dw_dialog_new(void *data) | |
453 { | |
454 #if 0 | |
455 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
456 | |
457 if(tmp) | |
458 { | |
459 tmp->eve = dw_event_new(); | |
460 dw_event_reset(tmp->eve); | |
461 tmp->data = data; | |
462 tmp->done = FALSE; | |
463 tmp->result = NULL; | |
464 } | |
465 return tmp; | |
466 #endif | |
467 return NULL; | |
468 } | |
469 | |
470 /* | |
471 * Accepts a dialog struct and returns the given data to the | |
472 * initial called of dw_dialog_wait(). | |
473 * Parameters: | |
474 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
475 * result: Data to be returned by dw_dialog_wait(). | |
476 * Returns: | |
477 * DW_ERROR_NONE (0) on success. | |
478 */ | |
479 int API dw_dialog_dismiss(DWDialog *dialog, void *result) | |
480 { | |
481 #if 0 | |
482 dialog->result = result; | |
483 dw_event_post(dialog->eve); | |
484 dialog->done = TRUE; | |
485 #endif | |
486 return DW_ERROR_GENERAL; | |
487 } | |
488 | |
489 /* | |
490 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
491 * called by a signal handler with the given dialog struct. | |
492 * Parameters: | |
493 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
494 * Returns: | |
495 * The data passed to dw_dialog_dismiss(). | |
496 */ | |
497 void * API dw_dialog_wait(DWDialog *dialog) | |
498 { | |
499 void *tmp = NULL; | |
500 | |
501 #if 0 | |
502 while(!dialog->done) | |
503 { | |
504 dw_main_iteration(); | |
505 } | |
506 dw_event_close(&dialog->eve); | |
507 tmp = dialog->result; | |
508 free(dialog); | |
509 #endif | |
510 return tmp; | |
511 } | |
512 | |
513 /* | |
514 * Create a new Box to be packed. | |
515 * Parameters: | |
516 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | |
517 * pad: Number of pixels to pad around the box. | |
518 * Returns: | |
519 * A handle to a box or NULL on failure. | |
520 */ | |
521 HWND API dw_box_new(int type, int pad) | |
522 { | |
523 return 0; | |
524 } | |
525 | |
526 /* | |
527 * Create a new Group Box to be packed. | |
528 * Parameters: | |
529 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | |
530 * pad: Number of pixels to pad around the box. | |
531 * title: Text to be displayined in the group outline. | |
532 * Returns: | |
533 * A handle to a groupbox window or NULL on failure. | |
534 */ | |
535 HWND API dw_groupbox_new(int type, int pad, const char *title) | |
536 { | |
537 return 0; | |
538 } | |
539 | |
540 /* | |
541 * Create a new scrollable Box to be packed. | |
542 * Parameters: | |
543 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | |
544 * pad: Number of pixels to pad around the box. | |
545 * Returns: | |
546 * A handle to a scrollbox or NULL on failure. | |
547 */ | |
548 HWND API dw_scrollbox_new( int type, int pad ) | |
549 { | |
550 return 0; | |
551 } | |
552 | |
553 /* | |
554 * Returns the position of the scrollbar in the scrollbox. | |
555 * Parameters: | |
556 * handle: Handle to the scrollbox to be queried. | |
557 * orient: The vertical or horizontal scrollbar. | |
558 * Returns: | |
559 * The vertical or horizontal position in the scrollbox. | |
560 */ | |
561 int API dw_scrollbox_get_pos(HWND handle, int orient) | |
562 { | |
563 return 0; | |
564 } | |
565 | |
566 /* | |
567 * Gets the range for the scrollbar in the scrollbox. | |
568 * Parameters: | |
569 * handle: Handle to the scrollbox to be queried. | |
570 * orient: The vertical or horizontal scrollbar. | |
571 * Returns: | |
572 * The vertical or horizontal range of the scrollbox. | |
573 */ | |
574 int API dw_scrollbox_get_range(HWND handle, int orient) | |
575 { | |
576 return 0; | |
577 } | |
578 | |
579 /* Internal box packing function called by the other 3 functions */ | |
580 void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, char *funcname) | |
581 { | |
582 Box *thisbox; | |
583 int z, x = 0; | |
584 Item *tmpitem, *thisitem; | |
585 | |
586 /* Sanity checks */ | |
587 if(!box || box == item) | |
588 return; | |
589 | |
590 thisbox = (Box *)_dw_window_pointer_get(box); | |
591 thisitem = thisbox->items; | |
592 | |
593 /* Do some sanity bounds checking */ | |
594 if(index < 0) | |
595 index = 0; | |
596 if(index > thisbox->count) | |
597 index = thisbox->count; | |
598 | |
599 /* Duplicate the existing data */ | |
600 tmpitem = (Item *)malloc(sizeof(Item)*(thisbox->count+1)); | |
601 | |
602 for(z=0;z<thisbox->count;z++) | |
603 { | |
604 if(z == index) | |
605 x++; | |
606 tmpitem[x] = thisitem[z]; | |
607 x++; | |
608 } | |
609 | |
610 /* Sanity checks */ | |
611 if(vsize && !height) | |
612 height = 1; | |
613 if(hsize && !width) | |
614 width = 1; | |
615 | |
616 /* Fill in the item data appropriately */ | |
617 if(0 /* Test to see if "item" is a box */) | |
618 tmpitem[index].type = TYPEBOX; | |
619 else | |
620 tmpitem[index].type = TYPEITEM; | |
621 | |
622 tmpitem[index].hwnd = item; | |
623 tmpitem[index].origwidth = tmpitem[index].width = width; | |
624 tmpitem[index].origheight = tmpitem[index].height = height; | |
625 tmpitem[index].pad = pad; | |
626 if(hsize) | |
627 tmpitem[index].hsize = SIZEEXPAND; | |
628 else | |
629 tmpitem[index].hsize = SIZESTATIC; | |
630 | |
631 if(vsize) | |
632 tmpitem[index].vsize = SIZEEXPAND; | |
633 else | |
634 tmpitem[index].vsize = SIZESTATIC; | |
635 | |
636 thisbox->items = tmpitem; | |
637 | |
638 /* Update the item count */ | |
639 thisbox->count++; | |
640 | |
641 /* Add the item to the box */ | |
642 #if 0 | |
643 /* Platform specific code to add item to box */ | |
644 BoxAdd(box, item); | |
645 #endif | |
646 | |
647 /* Free the old data */ | |
648 if(thisbox->count) | |
649 free(thisitem); | |
650 } | |
651 | |
652 /* | |
653 * Remove windows (widgets) from the box they are packed into. | |
654 * Parameters: | |
655 * handle: Window handle of the packed item to be removed. | |
656 * Returns: | |
657 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | |
658 */ | |
659 int API dw_box_unpack(HWND handle) | |
660 { | |
661 return DW_ERROR_GENERAL; | |
662 } | |
663 | |
664 /* | |
665 * Remove windows (widgets) from a box at an arbitrary location. | |
666 * Parameters: | |
667 * box: Window handle of the box to be removed from. | |
668 * index: 0 based index of packed items. | |
669 * Returns: | |
670 * Handle to the removed item on success, 0 on failure or padding. | |
671 */ | |
672 HWND API dw_box_unpack_at_index(HWND box, int index) | |
673 { | |
674 return 0; | |
675 } | |
676 | |
677 /* | |
678 * Pack windows (widgets) into a box at an arbitrary location. | |
679 * Parameters: | |
680 * box: Window handle of the box to be packed into. | |
681 * item: Window handle of the item to pack. | |
682 * index: 0 based index of packed items. | |
683 * width: Width in pixels of the item or -1 to be self determined. | |
684 * height: Height in pixels of the item or -1 to be self determined. | |
685 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
686 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
687 * pad: Number of pixels of padding around the item. | |
688 */ | |
689 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad) | |
690 { | |
691 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()"); | |
692 } | |
693 | |
694 /* | |
695 * Pack windows (widgets) into a box from the start (or top). | |
696 * Parameters: | |
697 * box: Window handle of the box to be packed into. | |
698 * item: Window handle of the item to pack. | |
699 * width: Width in pixels of the item or -1 to be self determined. | |
700 * height: Height in pixels of the item or -1 to be self determined. | |
701 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
702 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
703 * pad: Number of pixels of padding around the item. | |
704 */ | |
705 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
706 { | |
707 /* 65536 is the table limit on GTK... | |
708 * seems like a high enough value we will never hit it here either. | |
709 */ | |
710 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); | |
711 } | |
712 | |
713 /* | |
714 * Pack windows (widgets) into a box from the end (or bottom). | |
715 * Parameters: | |
716 * box: Window handle of the box to be packed into. | |
717 * item: Window handle of the item to pack. | |
718 * width: Width in pixels of the item or -1 to be self determined. | |
719 * height: Height in pixels of the item or -1 to be self determined. | |
720 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
721 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
722 * pad: Number of pixels of padding around the item. | |
723 */ | |
724 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
725 { | |
726 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); | |
727 } | |
728 | |
729 /* | |
730 * Create a new button window (widget) to be packed. | |
731 * Parameters: | |
732 * text: The text to be display by the static text widget. | |
733 * id: An ID to be used with dw_window_from_id() or 0L. | |
734 * Returns: | |
735 * A handle to a button window or NULL on failure. | |
736 */ | |
737 HWND API dw_button_new(const char *text, ULONG cid) | |
738 { | |
739 return 0; | |
740 } | |
741 | |
742 /* | |
743 * Create a new Entryfield window (widget) to be packed. | |
744 * Parameters: | |
745 * text: The default text to be in the entryfield widget. | |
746 * id: An ID to be used with dw_window_from_id() or 0L. | |
747 * Returns: | |
748 * A handle to an entryfield window or NULL on failure. | |
749 */ | |
750 HWND API dw_entryfield_new(const char *text, ULONG cid) | |
751 { | |
752 return 0; | |
753 } | |
754 | |
755 /* | |
756 * Create a new Entryfield (password) window (widget) to be packed. | |
757 * Parameters: | |
758 * text: The default text to be in the entryfield widget. | |
759 * id: An ID to be used with dw_window_from_id() or 0L. | |
760 * Returns: | |
761 * A handle to an entryfield password window or NULL on failure. | |
762 */ | |
763 HWND API dw_entryfield_password_new(const char *text, ULONG cid) | |
764 { | |
765 return 0; | |
766 } | |
767 | |
768 /* | |
769 * Sets the entryfield character limit. | |
770 * Parameters: | |
771 * handle: Handle to the spinbutton to be set. | |
772 * limit: Number of characters the entryfield will take. | |
773 */ | |
774 void API dw_entryfield_set_limit(HWND handle, ULONG limit) | |
775 { | |
776 } | |
777 | |
778 /* | |
779 * Create a new bitmap button window (widget) to be packed. | |
780 * Parameters: | |
781 * text: Bubble help text to be displayed. | |
782 * id: An ID of a bitmap in the resource file. | |
783 * Returns: | |
784 * A handle to a bitmap button window or NULL on failure. | |
785 */ | |
786 HWND API dw_bitmapbutton_new(const char *text, ULONG resid) | |
787 { | |
788 return 0; | |
789 } | |
790 | |
791 /* | |
792 * Create a new bitmap button window (widget) to be packed from a file. | |
793 * Parameters: | |
794 * text: Bubble help text to be displayed. | |
795 * id: An ID to be used with dw_window_from_id() or 0L. | |
796 * filename: Name of the file, omit extention to have | |
797 * DW pick the appropriate file extension. | |
798 * (BMP on OS/2 or Windows, XPM on Unix) | |
799 * Returns: | |
800 * A handle to a bitmap button window or NULL on failure. | |
801 */ | |
802 HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long cid, const char *filename) | |
803 { | |
804 return 0; | |
805 } | |
806 | |
807 /* | |
808 * Create a new bitmap button window (widget) to be packed from data. | |
809 * Parameters: | |
810 * text: Bubble help text to be displayed. | |
811 * id: An ID to be used with dw_window_from_id() or 0L. | |
812 * data: The contents of the image | |
813 * (BMP or ICO on OS/2 or Windows, XPM on Unix) | |
814 * len: length of str | |
815 * Returns: | |
816 * A handle to a bitmap button window or NULL on failure. | |
817 */ | |
818 HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long cid, const char *data, int len) | |
819 { | |
820 return 0; | |
821 } | |
822 | |
823 /* | |
824 * Create a new spinbutton window (widget) to be packed. | |
825 * Parameters: | |
826 * text: The text to be display by the static text widget. | |
827 * id: An ID to be used with dw_window_from_id() or 0L. | |
828 * Returns: | |
829 * A handle to a spinbutton window or NULL on failure. | |
830 */ | |
831 HWND API dw_spinbutton_new(const char *text, ULONG cid) | |
832 { | |
833 return 0; | |
834 } | |
835 | |
836 /* | |
837 * Sets the spinbutton value. | |
838 * Parameters: | |
839 * handle: Handle to the spinbutton to be set. | |
840 * position: Current value of the spinbutton. | |
841 */ | |
842 void API dw_spinbutton_set_pos(HWND handle, long position) | |
843 { | |
844 } | |
845 | |
846 /* | |
847 * Sets the spinbutton limits. | |
848 * Parameters: | |
849 * handle: Handle to the spinbutton to be set. | |
850 * upper: Upper limit. | |
851 * lower: Lower limit. | |
852 */ | |
853 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) | |
854 { | |
855 } | |
856 | |
857 /* | |
858 * Returns the current value of the spinbutton. | |
859 * Parameters: | |
860 * handle: Handle to the spinbutton to be queried. | |
861 * Returns: | |
862 * Number value displayed in the spinbutton. | |
863 */ | |
864 long API dw_spinbutton_get_pos(HWND handle) | |
865 { | |
866 return 0; | |
867 } | |
868 | |
869 /* | |
870 * Create a new radiobutton window (widget) to be packed. | |
871 * Parameters: | |
872 * text: The text to be display by the static text widget. | |
873 * id: An ID to be used with dw_window_from_id() or 0L. | |
874 * Returns: | |
875 * A handle to a radio button window or NULL on failure. | |
876 */ | |
877 HWND API dw_radiobutton_new(const char *text, ULONG cid) | |
878 { | |
879 return 0; | |
880 } | |
881 | |
882 /* | |
883 * Create a new slider window (widget) to be packed. | |
884 * Parameters: | |
885 * vertical: TRUE or FALSE if slider is vertical. | |
886 * increments: Number of increments available. | |
887 * id: An ID to be used with dw_window_from_id() or 0L. | |
888 * Returns: | |
889 * A handle to a slider window or NULL on failure. | |
890 */ | |
891 HWND API dw_slider_new(int vertical, int increments, ULONG cid) | |
892 { | |
893 return 0; | |
894 } | |
895 | |
896 /* | |
897 * Returns the position of the slider. | |
898 * Parameters: | |
899 * handle: Handle to the slider to be queried. | |
900 * Returns: | |
901 * Position of the slider in the set range. | |
902 */ | |
903 unsigned int API dw_slider_get_pos(HWND handle) | |
904 { | |
905 return 0; | |
906 } | |
907 | |
908 /* | |
909 * Sets the slider position. | |
910 * Parameters: | |
911 * handle: Handle to the slider to be set. | |
912 * position: Position of the slider withing the range. | |
913 */ | |
914 void API dw_slider_set_pos(HWND handle, unsigned int position) | |
915 { | |
916 } | |
917 | |
918 /* | |
919 * Create a new scrollbar window (widget) to be packed. | |
920 * Parameters: | |
921 * vertical: TRUE or FALSE if scrollbar is vertical. | |
922 * id: An ID to be used with dw_window_from_id() or 0L. | |
923 * Returns: | |
924 * A handle to a scrollbar window or NULL on failure. | |
925 */ | |
926 HWND API dw_scrollbar_new(int vertical, ULONG cid) | |
927 { | |
928 return 0; | |
929 } | |
930 | |
931 /* | |
932 * Returns the position of the scrollbar. | |
933 * Parameters: | |
934 * handle: Handle to the scrollbar to be queried. | |
935 * Returns: | |
936 * Position of the scrollbar in the set range. | |
937 */ | |
938 unsigned int API dw_scrollbar_get_pos(HWND handle) | |
939 { | |
940 return 0; | |
941 } | |
942 | |
943 /* | |
944 * Sets the scrollbar position. | |
945 * Parameters: | |
946 * handle: Handle to the scrollbar to be set. | |
947 * position: Position of the scrollbar withing the range. | |
948 */ | |
949 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) | |
950 { | |
951 } | |
952 | |
953 /* | |
954 * Sets the scrollbar range. | |
955 * Parameters: | |
956 * handle: Handle to the scrollbar to be set. | |
957 * range: Maximum range value. | |
958 * visible: Visible area relative to the range. | |
959 */ | |
960 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) | |
961 { | |
962 } | |
963 | |
964 /* | |
965 * Create a new percent bar window (widget) to be packed. | |
966 * Parameters: | |
967 * id: An ID to be used with dw_window_from_id() or 0L. | |
968 * Returns: | |
969 * A handle to a percent bar window or NULL on failure. | |
970 */ | |
971 HWND API dw_percent_new(ULONG cid) | |
972 { | |
973 return 0; | |
974 } | |
975 | |
976 /* | |
977 * Sets the percent bar position. | |
978 * Parameters: | |
979 * handle: Handle to the percent bar to be set. | |
980 * position: Position of the percent bar withing the range. | |
981 */ | |
982 void API dw_percent_set_pos(HWND handle, unsigned int position) | |
983 { | |
984 } | |
985 | |
986 /* | |
987 * Create a new checkbox window (widget) to be packed. | |
988 * Parameters: | |
989 * text: The text to be display by the static text widget. | |
990 * id: An ID to be used with dw_window_from_id() or 0L. | |
991 * Returns: | |
992 * A handle to a checkbox window or NULL on failure. | |
993 */ | |
994 HWND API dw_checkbox_new(const char *text, ULONG cid) | |
995 { | |
996 return 0; | |
997 } | |
998 | |
999 /* | |
1000 * Returns the state of the checkbox. | |
1001 * Parameters: | |
1002 * handle: Handle to the checkbox to be queried. | |
1003 * Returns: | |
1004 * State of checkbox (TRUE or FALSE). | |
1005 */ | |
1006 int API dw_checkbox_get(HWND handle) | |
1007 { | |
1008 return FALSE; | |
1009 } | |
1010 | |
1011 /* | |
1012 * Sets the state of the checkbox. | |
1013 * Parameters: | |
1014 * handle: Handle to the checkbox to be queried. | |
1015 * value: TRUE for checked, FALSE for unchecked. | |
1016 */ | |
1017 void API dw_checkbox_set(HWND handle, int value) | |
1018 { | |
1019 } | |
1020 | |
1021 /* | |
1022 * Create a new listbox window (widget) to be packed. | |
1023 * Parameters: | |
1024 * id: An ID to be used with dw_window_from_id() or 0L. | |
1025 * multi: Multiple select TRUE or FALSE. | |
1026 * Returns: | |
1027 * A handle to a listbox window or NULL on failure. | |
1028 */ | |
1029 HWND API dw_listbox_new(ULONG cid, int multi) | |
1030 { | |
1031 return 0; | |
1032 } | |
1033 | |
1034 /* | |
1035 * Appends the specified text to the listbox's (or combobox) entry list. | |
1036 * Parameters: | |
1037 * handle: Handle to the listbox to be appended to. | |
1038 * text: Text to append into listbox. | |
1039 */ | |
1040 void API dw_listbox_append(HWND handle, const char *text) | |
1041 { | |
1042 } | |
1043 | |
1044 /* | |
1045 * Inserts the specified text into the listbox's (or combobox) entry list. | |
1046 * Parameters: | |
1047 * handle: Handle to the listbox to be inserted into. | |
1048 * text: Text to insert into listbox. | |
1049 * pos: 0-based position to insert text | |
1050 */ | |
1051 void API dw_listbox_insert(HWND handle, const char *text, int pos) | |
1052 { | |
1053 } | |
1054 | |
1055 /* | |
1056 * Appends the specified text items to the listbox's (or combobox) entry list. | |
1057 * Parameters: | |
1058 * handle: Handle to the listbox to be appended to. | |
1059 * text: Text strings to append into listbox. | |
1060 * count: Number of text strings to append | |
1061 */ | |
1062 void API dw_listbox_list_append(HWND handle, char **text, int count) | |
1063 { | |
1064 } | |
1065 | |
1066 /* | |
1067 * Clears the listbox's (or combobox) list of all entries. | |
1068 * Parameters: | |
1069 * handle: Handle to the listbox to be cleared. | |
1070 */ | |
1071 void API dw_listbox_clear(HWND handle) | |
1072 { | |
1073 } | |
1074 | |
1075 /* | |
1076 * Returns the listbox's item count. | |
1077 * Parameters: | |
1078 * handle: Handle to the listbox to be counted. | |
1079 * Returns: | |
1080 * The number of items in the listbox. | |
1081 */ | |
1082 int API dw_listbox_count(HWND handle) | |
1083 { | |
1084 return 0; | |
1085 } | |
1086 | |
1087 /* | |
1088 * Sets the topmost item in the viewport. | |
1089 * Parameters: | |
1090 * handle: Handle to the listbox to be cleared. | |
1091 * top: Index to the top item. | |
1092 */ | |
1093 void API dw_listbox_set_top(HWND handle, int top) | |
1094 { | |
1095 } | |
1096 | |
1097 /* | |
1098 * Copies the given index item's text into buffer. | |
1099 * Parameters: | |
1100 * handle: Handle to the listbox to be queried. | |
1101 * index: Index into the list to be queried. | |
1102 * buffer: Buffer where text will be copied. | |
1103 * length: Length of the buffer (including NULL). | |
1104 */ | |
1105 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) | |
1106 { | |
1107 } | |
1108 | |
1109 /* | |
1110 * Sets the text of a given listbox entry. | |
1111 * Parameters: | |
1112 * handle: Handle to the listbox to be queried. | |
1113 * index: Index into the list to be queried. | |
1114 * buffer: Buffer where text will be copied. | |
1115 */ | |
1116 void API dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) | |
1117 { | |
1118 } | |
1119 | |
1120 /* | |
1121 * Returns the index to the item in the list currently selected. | |
1122 * Parameters: | |
1123 * handle: Handle to the listbox to be queried. | |
1124 * Returns: | |
1125 * The selected item index or DW_ERROR_UNKNOWN (-1) on error. | |
1126 */ | |
1127 int API dw_listbox_selected(HWND handle) | |
1128 { | |
1129 return DW_ERROR_UNKNOWN; | |
1130 } | |
1131 | |
1132 /* | |
1133 * Returns the index to the current selected item or -1 when done. | |
1134 * Parameters: | |
1135 * handle: Handle to the listbox to be queried. | |
1136 * where: Either the previous return or -1 to restart. | |
1137 * Returns: | |
1138 * The next selected item or DW_ERROR_UNKNOWN (-1) on error. | |
1139 */ | |
1140 int API dw_listbox_selected_multi(HWND handle, int where) | |
1141 { | |
1142 return DW_ERROR_UNKNOWN; | |
1143 } | |
1144 | |
1145 /* | |
1146 * Sets the selection state of a given index. | |
1147 * Parameters: | |
1148 * handle: Handle to the listbox to be set. | |
1149 * index: Item index. | |
1150 * state: TRUE if selected FALSE if unselected. | |
1151 */ | |
1152 void API dw_listbox_select(HWND handle, int index, int state) | |
1153 { | |
1154 } | |
1155 | |
1156 /* | |
1157 * Deletes the item with given index from the list. | |
1158 * Parameters: | |
1159 * handle: Handle to the listbox to be set. | |
1160 * index: Item index. | |
1161 */ | |
1162 void API dw_listbox_delete(HWND handle, int index) | |
1163 { | |
1164 } | |
1165 | |
1166 /* | |
1167 * Create a new Combobox window (widget) to be packed. | |
1168 * Parameters: | |
1169 * text: The default text to be in the combpbox widget. | |
1170 * id: An ID to be used with dw_window_from_id() or 0L. | |
1171 * Returns: | |
1172 * A handle to a combobox window or NULL on failure. | |
1173 */ | |
1174 HWND API dw_combobox_new(const char *text, ULONG cid) | |
1175 { | |
1176 return 0; | |
1177 } | |
1178 | |
1179 /* | |
1180 * Create a new Multiline Editbox window (widget) to be packed. | |
1181 * Parameters: | |
1182 * id: An ID to be used with dw_window_from_id() or 0L. | |
1183 * Returns: | |
1184 * A handle to a MLE window or NULL on failure. | |
1185 */ | |
1186 HWND API dw_mle_new(ULONG cid) | |
1187 { | |
1188 return 0; | |
1189 } | |
1190 | |
1191 /* | |
1192 * Adds text to an MLE box and returns the current point. | |
1193 * Parameters: | |
1194 * handle: Handle to the MLE to be queried. | |
1195 * buffer: Text buffer to be imported. | |
1196 * startpoint: Point to start entering text. | |
1197 * Returns: | |
1198 * Current position in the buffer. | |
1199 */ | |
1200 unsigned int API dw_mle_import(HWND handle, const char *buffer, int startpoint) | |
1201 { | |
1202 return 0; | |
1203 } | |
1204 | |
1205 /* | |
1206 * Grabs text from an MLE box. | |
1207 * Parameters: | |
1208 * handle: Handle to the MLE to be queried. | |
1209 * buffer: Text buffer to be exported. | |
1210 * startpoint: Point to start grabbing text. | |
1211 * length: Amount of text to be grabbed. | |
1212 */ | |
1213 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) | |
1214 { | |
1215 } | |
1216 | |
1217 /* | |
1218 * Obtains information about an MLE box. | |
1219 * Parameters: | |
1220 * handle: Handle to the MLE to be queried. | |
1221 * bytes: A pointer to a variable to return the total bytes. | |
1222 * lines: A pointer to a variable to return the number of lines. | |
1223 */ | |
1224 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) | |
1225 { | |
1226 if(bytes) | |
1227 *bytes = 0; | |
1228 if(lines) | |
1229 *lines = 0; | |
1230 } | |
1231 | |
1232 /* | |
1233 * Deletes text from an MLE box. | |
1234 * Parameters: | |
1235 * handle: Handle to the MLE to be deleted from. | |
1236 * startpoint: Point to start deleting text. | |
1237 * length: Amount of text to be deleted. | |
1238 */ | |
1239 void API dw_mle_delete(HWND handle, int startpoint, int length) | |
1240 { | |
1241 } | |
1242 | |
1243 /* | |
1244 * Clears all text from an MLE box. | |
1245 * Parameters: | |
1246 * handle: Handle to the MLE to be cleared. | |
1247 */ | |
1248 void API dw_mle_clear(HWND handle) | |
1249 { | |
1250 } | |
1251 | |
1252 /* | |
1253 * Sets the visible line of an MLE box. | |
1254 * Parameters: | |
1255 * handle: Handle to the MLE to be positioned. | |
1256 * line: Line to be visible. | |
1257 */ | |
1258 void API dw_mle_set_visible(HWND handle, int line) | |
1259 { | |
1260 } | |
1261 | |
1262 /* | |
1263 * Sets the editablity of an MLE box. | |
1264 * Parameters: | |
1265 * handle: Handle to the MLE. | |
1266 * state: TRUE if it can be edited, FALSE for readonly. | |
1267 */ | |
1268 void API dw_mle_set_editable(HWND handle, int state) | |
1269 { | |
1270 } | |
1271 | |
1272 /* | |
1273 * Sets the word wrap state of an MLE box. | |
1274 * Parameters: | |
1275 * handle: Handle to the MLE. | |
1276 * state: TRUE if it wraps, FALSE if it doesn't. | |
1277 */ | |
1278 void API dw_mle_set_word_wrap(HWND handle, int state) | |
1279 { | |
1280 } | |
1281 | |
1282 /* | |
1283 * Sets the current cursor position of an MLE box. | |
1284 * Parameters: | |
1285 * handle: Handle to the MLE to be positioned. | |
1286 * point: Point to position cursor. | |
1287 */ | |
1288 void API dw_mle_set_cursor(HWND handle, int point) | |
1289 { | |
1290 } | |
1291 | |
1292 /* | |
1293 * Sets the word auto complete state of an MLE box. | |
1294 * Parameters: | |
1295 * handle: Handle to the MLE. | |
1296 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE | |
1297 */ | |
1298 void API dw_mle_set_auto_complete(HWND handle, int state) | |
1299 { | |
1300 } | |
1301 | |
1302 /* | |
1303 * Finds text in an MLE box. | |
1304 * Parameters: | |
1305 * handle: Handle to the MLE to be cleared. | |
1306 * text: Text to search for. | |
1307 * point: Start point of search. | |
1308 * flags: Search specific flags. | |
1309 * Returns: | |
1310 * Position in buffer or DW_ERROR_UNKNOWN (-1) on error. | |
1311 */ | |
1312 int API dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) | |
1313 { | |
1314 return DW_ERROR_UNKNOWN; | |
1315 } | |
1316 | |
1317 /* | |
1318 * Stops redrawing of an MLE box. | |
1319 * Parameters: | |
1320 * handle: Handle to the MLE to freeze. | |
1321 */ | |
1322 void API dw_mle_freeze(HWND handle) | |
1323 { | |
1324 } | |
1325 | |
1326 /* | |
1327 * Resumes redrawing of an MLE box. | |
1328 * Parameters: | |
1329 * handle: Handle to the MLE to thaw. | |
1330 */ | |
1331 void API dw_mle_thaw(HWND handle) | |
1332 { | |
1333 } | |
1334 | |
1335 /* | |
1336 * Create a new status text window (widget) to be packed. | |
1337 * Parameters: | |
1338 * text: The text to be display by the static text widget. | |
1339 * id: An ID to be used with dw_window_from_id() or 0L. | |
1340 * Returns: | |
1341 * A handle to a status text window or NULL on failure. | |
1342 */ | |
1343 HWND API dw_status_text_new(const char *text, ULONG cid) | |
1344 { | |
1345 return 0; | |
1346 } | |
1347 | |
1348 /* | |
1349 * Create a new static text window (widget) to be packed. | |
1350 * Parameters: | |
1351 * text: The text to be display by the static text widget. | |
1352 * id: An ID to be used with dw_window_from_id() or 0L. | |
1353 * Returns: | |
1354 * A handle to a text window or NULL on failure. | |
1355 */ | |
1356 HWND API dw_text_new(const char *text, ULONG cid) | |
1357 { | |
1358 return 0; | |
1359 } | |
1360 | |
1361 /* | |
1362 * Creates a rendering context widget (window) to be packed. | |
1363 * Parameters: | |
1364 * id: An id to be used with dw_window_from_id. | |
1365 * Returns: | |
1366 * A handle to the widget or NULL on failure. | |
1367 */ | |
1368 HWND API dw_render_new(unsigned long cid) | |
1369 { | |
1370 return 0; | |
1371 } | |
1372 | |
1373 /* | |
1374 * Invalidate the render widget triggering an expose event. | |
1375 * Parameters: | |
1376 * handle: A handle to a render widget to be redrawn. | |
1377 */ | |
1378 void API dw_render_redraw(HWND handle) | |
1379 { | |
1380 } | |
1381 | |
1382 /* Sets the current foreground drawing color. | |
1383 * Parameters: | |
1384 * red: red value. | |
1385 * green: green value. | |
1386 * blue: blue value. | |
1387 */ | |
1388 void API dw_color_foreground_set(unsigned long value) | |
1389 { | |
1390 } | |
1391 | |
1392 /* Sets the current background drawing color. | |
1393 * Parameters: | |
1394 * red: red value. | |
1395 * green: green value. | |
1396 * blue: blue value. | |
1397 */ | |
1398 void API dw_color_background_set(unsigned long value) | |
1399 { | |
1400 } | |
1401 | |
1402 /* Allows the user to choose a color using the system's color chooser dialog. | |
1403 * Parameters: | |
1404 * value: current color | |
1405 * Returns: | |
1406 * The selected color or the current color if cancelled. | |
1407 */ | |
1408 unsigned long API dw_color_choose(unsigned long value) | |
1409 { | |
1410 return value; | |
1411 } | |
1412 | |
1413 /* Draw a point on a window (preferably a render window). | |
1414 * Parameters: | |
1415 * handle: Handle to the window. | |
1416 * pixmap: Handle to the pixmap. (choose only one of these) | |
1417 * x: X coordinate. | |
1418 * y: Y coordinate. | |
1419 */ | |
1420 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) | |
1421 { | |
1422 } | |
1423 | |
1424 /* Draw a line on a window (preferably a render window). | |
1425 * Parameters: | |
1426 * handle: Handle to the window. | |
1427 * pixmap: Handle to the pixmap. (choose only one of these) | |
1428 * x1: First X coordinate. | |
1429 * y1: First Y coordinate. | |
1430 * x2: Second X coordinate. | |
1431 * y2: Second Y coordinate. | |
1432 */ | |
1433 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) | |
1434 { | |
1435 } | |
1436 | |
1437 /* Draw text on a window (preferably a render window). | |
1438 * Parameters: | |
1439 * handle: Handle to the window. | |
1440 * pixmap: Handle to the pixmap. (choose only one of these) | |
1441 * x: X coordinate. | |
1442 * y: Y coordinate. | |
1443 * text: Text to be displayed. | |
1444 */ | |
1445 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) | |
1446 { | |
1447 } | |
1448 | |
1449 /* Query the width and height of a text string. | |
1450 * Parameters: | |
1451 * handle: Handle to the window. | |
1452 * pixmap: Handle to the pixmap. (choose only one of these) | |
1453 * text: Text to be queried. | |
1454 * width: Pointer to a variable to be filled in with the width. | |
1455 * height: Pointer to a variable to be filled in with the height. | |
1456 */ | |
1457 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) | |
1458 { | |
1459 } | |
1460 | |
1461 /* Draw a polygon on a window (preferably a render window). | |
1462 * Parameters: | |
1463 * handle: Handle to the window. | |
1464 * pixmap: Handle to the pixmap. (choose only one of these) | |
1465 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). | |
1466 * npoints: Number of points passed in. | |
1467 * x: Pointer to array of X coordinates. | |
1468 * y: Pointer to array of Y coordinates. | |
1469 */ | |
1470 void API dw_draw_polygon( HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y ) | |
1471 { | |
1472 } | |
1473 | |
1474 /* Draw a rectangle on a window (preferably a render window). | |
1475 * Parameters: | |
1476 * handle: Handle to the window. | |
1477 * pixmap: Handle to the pixmap. (choose only one of these) | |
1478 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0). | |
1479 * x: X coordinate. | |
1480 * y: Y coordinate. | |
1481 * width: Width of rectangle. | |
1482 * height: Height of rectangle. | |
1483 */ | |
1484 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) | |
1485 { | |
1486 } | |
1487 | |
1488 /* Draw an arc on a window (preferably a render window). | |
1489 * Parameters: | |
1490 * handle: Handle to the window. | |
1491 * pixmap: Handle to the pixmap. (choose only one of these) | |
1492 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0). | |
1493 * DW_DRAW_FULL will draw a complete circle/elipse. | |
1494 * xorigin: X coordinate of center of arc. | |
1495 * yorigin: Y coordinate of center of arc. | |
1496 * x1: X coordinate of first segment of arc. | |
1497 * y1: Y coordinate of first segment of arc. | |
1498 * x2: X coordinate of second segment of arc. | |
1499 * y2: Y coordinate of second segment of arc. | |
1500 */ | |
1501 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) | |
1502 { | |
1503 } | |
1504 | |
1505 /* | |
1506 * Create a tree object to be packed. | |
1507 * Parameters: | |
1508 * id: An ID to be used for getting the resource from the | |
1509 * resource file. | |
1510 * Returns: | |
1511 * A handle to a tree window or NULL on failure. | |
1512 */ | |
1513 HWND API dw_tree_new(ULONG cid) | |
1514 { | |
1515 return 0; | |
1516 } | |
1517 | |
1518 /* | |
1519 * Inserts an item into a tree window (widget) after another item. | |
1520 * Parameters: | |
1521 * handle: Handle to the tree to be inserted. | |
1522 * item: Handle to the item to be positioned after. | |
1523 * title: The text title of the entry. | |
1524 * icon: Handle to coresponding icon. | |
1525 * parent: Parent handle or 0 if root. | |
1526 * itemdata: Item specific data. | |
1527 * Returns: | |
1528 * A handle to a tree item or NULL on failure. | |
1529 */ | |
1530 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) | |
1531 { | |
1532 return 0; | |
1533 } | |
1534 | |
1535 /* | |
1536 * Inserts an item into a tree window (widget). | |
1537 * Parameters: | |
1538 * handle: Handle to the tree to be inserted. | |
1539 * title: The text title of the entry. | |
1540 * icon: Handle to coresponding icon. | |
1541 * parent: Parent handle or 0 if root. | |
1542 * itemdata: Item specific data. | |
1543 * Returns: | |
1544 * A handle to a tree item or NULL on failure. | |
1545 */ | |
1546 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) | |
1547 { | |
1548 return 0; | |
1549 } | |
1550 | |
1551 /* | |
1552 * Gets the text an item in a tree window (widget). | |
1553 * Parameters: | |
1554 * handle: Handle to the tree containing the item. | |
1555 * item: Handle of the item to be modified. | |
1556 * Returns: | |
1557 * A malloc()ed buffer of item text to be dw_free()ed or NULL on error. | |
1558 */ | |
1559 char * API dw_tree_get_title(HWND handle, HTREEITEM item) | |
1560 { | |
1561 return NULL; | |
1562 } | |
1563 | |
1564 /* | |
1565 * Gets the text an item in a tree window (widget). | |
1566 * Parameters: | |
1567 * handle: Handle to the tree containing the item. | |
1568 * item: Handle of the item to be modified. | |
1569 * Returns: | |
1570 * A handle to a tree item or NULL on failure. | |
1571 */ | |
1572 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) | |
1573 { | |
1574 return 0; | |
1575 } | |
1576 | |
1577 /* | |
1578 * Sets the text and icon of an item in a tree window (widget). | |
1579 * Parameters: | |
1580 * handle: Handle to the tree containing the item. | |
1581 * item: Handle of the item to be modified. | |
1582 * title: The text title of the entry. | |
1583 * icon: Handle to coresponding icon. | |
1584 */ | |
1585 void API dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) | |
1586 { | |
1587 } | |
1588 | |
1589 /* | |
1590 * Sets the item data of a tree item. | |
1591 * Parameters: | |
1592 * handle: Handle to the tree containing the item. | |
1593 * item: Handle of the item to be modified. | |
1594 * itemdata: User defined data to be associated with item. | |
1595 */ | |
1596 void API dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) | |
1597 { | |
1598 } | |
1599 | |
1600 /* | |
1601 * Gets the item data of a tree item. | |
1602 * Parameters: | |
1603 * handle: Handle to the tree containing the item. | |
1604 * item: Handle of the item to be modified. | |
1605 * Returns: | |
1606 * A pointer to tree item data or NULL on failure. | |
1607 */ | |
1608 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item) | |
1609 { | |
1610 return NULL; | |
1611 } | |
1612 | |
1613 /* | |
1614 * Sets this item as the active selection. | |
1615 * Parameters: | |
1616 * handle: Handle to the tree window (widget) to be selected. | |
1617 * item: Handle to the item to be selected. | |
1618 */ | |
1619 void API dw_tree_item_select(HWND handle, HTREEITEM item) | |
1620 { | |
1621 } | |
1622 | |
1623 /* | |
1624 * Removes all nodes from a tree. | |
1625 * Parameters: | |
1626 * handle: Handle to the window (widget) to be cleared. | |
1627 */ | |
1628 void API dw_tree_clear(HWND handle) | |
1629 { | |
1630 } | |
1631 | |
1632 /* | |
1633 * Expands a node on a tree. | |
1634 * Parameters: | |
1635 * handle: Handle to the tree window (widget). | |
1636 * item: Handle to node to be expanded. | |
1637 */ | |
1638 void API dw_tree_item_expand(HWND handle, HTREEITEM item) | |
1639 { | |
1640 } | |
1641 | |
1642 /* | |
1643 * Collapses a node on a tree. | |
1644 * Parameters: | |
1645 * handle: Handle to the tree window (widget). | |
1646 * item: Handle to node to be collapsed. | |
1647 */ | |
1648 void API dw_tree_item_collapse(HWND handle, HTREEITEM item) | |
1649 { | |
1650 } | |
1651 | |
1652 /* | |
1653 * Removes a node from a tree. | |
1654 * Parameters: | |
1655 * handle: Handle to the window (widget) to be cleared. | |
1656 * item: Handle to node to be deleted. | |
1657 */ | |
1658 void API dw_tree_item_delete(HWND handle, HTREEITEM item) | |
1659 { | |
1660 } | |
1661 | |
1662 /* | |
1663 * Create a container object to be packed. | |
1664 * Parameters: | |
1665 * id: An ID to be used for getting the resource from the | |
1666 * resource file. | |
1667 * Returns: | |
1668 * A handle to a container window or NULL on failure. | |
1669 */ | |
1670 HWND API dw_container_new(ULONG cid, int multi) | |
1671 { | |
1672 return 0; | |
1673 } | |
1674 | |
1675 /* | |
1676 * Sets up the container columns. | |
1677 * Parameters: | |
1678 * handle: Handle to the container to be configured. | |
1679 * flags: An array of unsigned longs with column flags. | |
1680 * titles: An array of strings with column text titles. | |
1681 * count: The number of columns (this should match the arrays). | |
1682 * separator: The column number that contains the main separator. | |
1683 * (this item may only be used in OS/2) | |
1684 * Returns: | |
1685 * DW_ERROR_NONE (0) on success. | |
1686 */ | |
1687 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | |
1688 { | |
1689 return DW_ERROR_GENERAL; | |
1690 } | |
1691 | |
1692 /* | |
1693 * Configures the main filesystem column title for localization. | |
1694 * Parameters: | |
1695 * handle: Handle to the container to be configured. | |
1696 * title: The title to be displayed in the main column. | |
1697 */ | |
1698 void API dw_filesystem_set_column_title(HWND handle, const char *title) | |
1699 { | |
1700 } | |
1701 | |
1702 /* | |
1703 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
1704 * Parameters: | |
1705 * handle: Handle to the container to be configured. | |
1706 * flags: An array of unsigned longs with column flags. | |
1707 * titles: An array of strings with column text titles. | |
1708 * count: The number of columns (this should match the arrays). | |
1709 * Returns: | |
1710 * DW_ERROR_NONE (0) on success. | |
1711 */ | |
1712 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | |
1713 { | |
1714 return DW_ERROR_GENERAL; | |
1715 } | |
1716 | |
1717 /* | |
1718 * Allocates memory used to populate a container. | |
1719 * Parameters: | |
1720 * handle: Handle to the container window (widget). | |
1721 * rowcount: The number of items to be populated. | |
1722 * Returns: | |
1723 * Handle to container items allocated or NULL on error. | |
1724 */ | |
1725 void * API dw_container_alloc(HWND handle, int rowcount) | |
1726 { | |
1727 return NULL; | |
1728 } | |
1729 | |
1730 /* | |
1731 * Sets an item in specified row and column to the given data. | |
1732 * Parameters: | |
1733 * handle: Handle to the container window (widget). | |
1734 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1735 * column: Zero based column of data being set. | |
1736 * row: Zero based row of data being set. | |
1737 * data: Pointer to the data to be added. | |
1738 */ | |
1739 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
1740 { | |
1741 } | |
1742 | |
1743 /* | |
1744 * Changes an existing item in specified row and column to the given data. | |
1745 * Parameters: | |
1746 * handle: Handle to the container window (widget). | |
1747 * column: Zero based column of data being set. | |
1748 * row: Zero based row of data being set. | |
1749 * data: Pointer to the data to be added. | |
1750 */ | |
1751 void API dw_container_change_item(HWND handle, int column, int row, void *data) | |
1752 { | |
1753 } | |
1754 | |
1755 /* | |
1756 * Changes an existing item in specified row and column to the given data. | |
1757 * Parameters: | |
1758 * handle: Handle to the container window (widget). | |
1759 * column: Zero based column of data being set. | |
1760 * row: Zero based row of data being set. | |
1761 * data: Pointer to the data to be added. | |
1762 */ | |
1763 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) | |
1764 { | |
1765 } | |
1766 | |
1767 /* | |
1768 * Changes an item in specified row and column to the given data. | |
1769 * Parameters: | |
1770 * handle: Handle to the container window (widget). | |
1771 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1772 * column: Zero based column of data being set. | |
1773 * row: Zero based row of data being set. | |
1774 * data: Pointer to the data to be added. | |
1775 */ | |
1776 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) | |
1777 { | |
1778 } | |
1779 | |
1780 /* | |
1781 * Sets an item in specified row and column to the given data. | |
1782 * Parameters: | |
1783 * handle: Handle to the container window (widget). | |
1784 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1785 * column: Zero based column of data being set. | |
1786 * row: Zero based row of data being set. | |
1787 * data: Pointer to the data to be added. | |
1788 */ | |
1789 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) | |
1790 { | |
1791 } | |
1792 | |
1793 /* | |
1794 * Sets an item in specified row and column to the given data. | |
1795 * Parameters: | |
1796 * handle: Handle to the container window (widget). | |
1797 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1798 * column: Zero based column of data being set. | |
1799 * row: Zero based row of data being set. | |
1800 * data: Pointer to the data to be added. | |
1801 */ | |
1802 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
1803 { | |
1804 } | |
1805 | |
1806 /* | |
1807 * Sets the data of a row in the container. | |
1808 * Parameters: | |
1809 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1810 * row: Zero based row of data being set. | |
1811 * data: Data pointer. | |
1812 */ | |
1813 void API dw_container_set_row_data(void *pointer, int row, void *data) | |
1814 { | |
1815 } | |
1816 | |
1817 /* | |
1818 * Changes the data of a row already inserted in the container. | |
1819 * Parameters: | |
1820 * handle: Handle to the container window (widget). | |
1821 * row: Zero based row of data being set. | |
1822 * data: Data pointer. | |
1823 */ | |
1824 void API dw_container_change_row_data(HWND handle, int row, void *data) | |
1825 { | |
1826 } | |
1827 | |
1828 /* | |
1829 * Gets column type for a container column. | |
1830 * Parameters: | |
1831 * handle: Handle to the container window (widget). | |
1832 * column: Zero based column. | |
1833 * Returns: | |
1834 * Constant identifying the the column type. | |
1835 */ | |
1836 int API dw_container_get_column_type(HWND handle, int column) | |
1837 { | |
1838 return 0; | |
1839 } | |
1840 | |
1841 /* | |
1842 * Gets column type for a filesystem container column. | |
1843 * Parameters: | |
1844 * handle: Handle to the container window (widget). | |
1845 * column: Zero based column. | |
1846 * Returns: | |
1847 * Constant identifying the the column type. | |
1848 */ | |
1849 int API dw_filesystem_get_column_type(HWND handle, int column) | |
1850 { | |
1851 return 0; | |
1852 } | |
1853 | |
1854 /* | |
1855 * Sets the alternating row colors for container window (widget) handle. | |
1856 * Parameters: | |
1857 * handle: The window (widget) handle. | |
1858 * oddcolor: Odd row background color in DW_RGB format or a default color index. | |
1859 * evencolor: Even row background color in DW_RGB format or a default color index. | |
1860 * DW_RGB_TRANSPARENT will disable coloring rows. | |
1861 * DW_CLR_DEFAULT will use the system default alternating row colors. | |
1862 */ | |
1863 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) | |
1864 { | |
1865 } | |
1866 | |
1867 /* | |
1868 * Sets the width of a column in the container. | |
1869 * Parameters: | |
1870 * handle: Handle to window (widget) of container. | |
1871 * column: Zero based column of width being set. | |
1872 * width: Width of column in pixels. | |
1873 */ | |
1874 void API dw_container_set_column_width(HWND handle, int column, int width) | |
1875 { | |
1876 } | |
1877 | |
1878 /* | |
1879 * Sets the title of a row in the container. | |
1880 * Parameters: | |
1881 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1882 * row: Zero based row of data being set. | |
1883 * title: String title of the item. | |
1884 */ | |
1885 void API dw_container_set_row_title(void *pointer, int row, const char *title) | |
1886 { | |
1887 } | |
1888 | |
1889 | |
1890 /* | |
1891 * Sets the title of a row in the container. | |
1892 * Parameters: | |
1893 * handle: Handle to window (widget) of container. | |
1894 * row: Zero based row of data being set. | |
1895 * title: String title of the item. | |
1896 */ | |
1897 void API dw_container_change_row_title(HWND handle, int row, const char *title) | |
1898 { | |
1899 } | |
1900 | |
1901 /* | |
1902 * Sets the title of a row in the container. | |
1903 * Parameters: | |
1904 * handle: Handle to the container window (widget). | |
1905 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
1906 * rowcount: The number of rows to be inserted. | |
1907 */ | |
1908 void API dw_container_insert(HWND handle, void *pointer, int rowcount) | |
1909 { | |
1910 } | |
1911 | |
1912 /* | |
1913 * Removes all rows from a container. | |
1914 * Parameters: | |
1915 * handle: Handle to the window (widget) to be cleared. | |
1916 * redraw: TRUE to cause the container to redraw immediately. | |
1917 */ | |
1918 void API dw_container_clear(HWND handle, int redraw) | |
1919 { | |
1920 } | |
1921 | |
1922 /* | |
1923 * Removes the first x rows from a container. | |
1924 * Parameters: | |
1925 * handle: Handle to the window (widget) to be deleted from. | |
1926 * rowcount: The number of rows to be deleted. | |
1927 */ | |
1928 void API dw_container_delete(HWND handle, int rowcount) | |
1929 { | |
1930 } | |
1931 | |
1932 /* | |
1933 * Scrolls container up or down. | |
1934 * Parameters: | |
1935 * handle: Handle to the window (widget) to be scrolled. | |
1936 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or | |
1937 * DW_SCROLL_BOTTOM. (rows is ignored for last two) | |
1938 * rows: The number of rows to be scrolled. | |
1939 */ | |
1940 void API dw_container_scroll(HWND handle, int direction, long rows) | |
1941 { | |
1942 } | |
1943 | |
1944 /* | |
1945 * Starts a new query of a container. | |
1946 * Parameters: | |
1947 * handle: Handle to the window (widget) to be queried. | |
1948 * flags: If this parameter is DW_CRA_SELECTED it will only | |
1949 * return items that are currently selected. Otherwise | |
1950 * it will return all records in the container. | |
1951 * Returns: | |
1952 * Pointer to data associated with first entry or NULL on error. | |
1953 */ | |
1954 char * API dw_container_query_start(HWND handle, unsigned long flags) | |
1955 { | |
1956 return NULL; | |
1957 } | |
1958 | |
1959 /* | |
1960 * Continues an existing query of a container. | |
1961 * Parameters: | |
1962 * handle: Handle to the window (widget) to be queried. | |
1963 * flags: If this parameter is DW_CRA_SELECTED it will only | |
1964 * return items that are currently selected. Otherwise | |
1965 * it will return all records in the container. | |
1966 * Returns: | |
1967 * Pointer to data associated with next entry or NULL on error or completion. | |
1968 */ | |
1969 char * API dw_container_query_next(HWND handle, unsigned long flags) | |
1970 { | |
1971 return NULL; | |
1972 } | |
1973 | |
1974 /* | |
1975 * Cursors the item with the text speficied, and scrolls to that item. | |
1976 * Parameters: | |
1977 * handle: Handle to the window (widget) to be queried. | |
1978 * text: Text usually returned by dw_container_query(). | |
1979 */ | |
1980 void API dw_container_cursor(HWND handle, const char *text) | |
1981 { | |
1982 } | |
1983 | |
1984 /* | |
1985 * Cursors the item with the data speficied, and scrolls to that item. | |
1986 * Parameters: | |
1987 * handle: Handle to the window (widget) to be queried. | |
1988 * data: Data usually returned by dw_container_query(). | |
1989 */ | |
1990 void API dw_container_cursor_by_data(HWND handle, void *data) | |
1991 { | |
1992 } | |
1993 | |
1994 /* | |
1995 * Deletes the item with the text speficied. | |
1996 * Parameters: | |
1997 * handle: Handle to the window (widget). | |
1998 * text: Text usually returned by dw_container_query(). | |
1999 */ | |
2000 void API dw_container_delete_row(HWND handle, const char *text) | |
2001 { | |
2002 } | |
2003 | |
2004 /* | |
2005 * Deletes the item with the data speficied. | |
2006 * Parameters: | |
2007 * handle: Handle to the window (widget). | |
2008 * data: Data usually returned by dw_container_query(). | |
2009 */ | |
2010 void API dw_container_delete_row_by_data(HWND handle, void *data) | |
2011 { | |
2012 } | |
2013 | |
2014 /* | |
2015 * Optimizes the column widths so that all data is visible. | |
2016 * Parameters: | |
2017 * handle: Handle to the window (widget) to be optimized. | |
2018 */ | |
2019 void API dw_container_optimize(HWND handle) | |
2020 { | |
2021 } | |
2022 | |
2023 /* | |
2024 * Inserts an icon into the taskbar. | |
2025 * Parameters: | |
2026 * handle: Window handle that will handle taskbar icon messages. | |
2027 * icon: Icon handle to display in the taskbar. | |
2028 * bubbletext: Text to show when the mouse is above the icon. | |
2029 */ | |
2030 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) | |
2031 { | |
2032 } | |
2033 | |
2034 /* | |
2035 * Deletes an icon from the taskbar. | |
2036 * Parameters: | |
2037 * handle: Window handle that was used with dw_taskbar_insert(). | |
2038 * icon: Icon handle that was used with dw_taskbar_insert(). | |
2039 */ | |
2040 void API dw_taskbar_delete(HWND handle, HICN icon) | |
2041 { | |
2042 } | |
2043 | |
2044 /* | |
2045 * Obtains an icon from a module (or header in GTK). | |
2046 * Parameters: | |
2047 * module: Handle to module (DLL) in OS/2 and Windows. | |
2048 * id: A unsigned long id int the resources on OS/2 and | |
2049 * Windows, on GTK this is converted to a pointer | |
2050 * to an embedded XPM. | |
2051 * Returns: | |
2052 * Handle to the created icon or NULL on error. | |
2053 */ | |
2054 HICN API dw_icon_load(unsigned long module, unsigned long resid) | |
2055 { | |
2056 return 0; | |
2057 } | |
2058 | |
2059 /* | |
2060 * Obtains an icon from a file. | |
2061 * Parameters: | |
2062 * filename: Name of the file, omit extention to have | |
2063 * DW pick the appropriate file extension. | |
2064 * (ICO on OS/2 or Windows, XPM on Unix) | |
2065 * Returns: | |
2066 * Handle to the created icon or NULL on error. | |
2067 */ | |
2068 HICN API dw_icon_load_from_file(const char *filename) | |
2069 { | |
2070 return 0; | |
2071 } | |
2072 | |
2073 /* | |
2074 * Obtains an icon from data. | |
2075 * Parameters: | |
2076 * data: Data for the icon (ICO on OS/2 or Windows, XPM on Unix, PNG on Mac) | |
2077 * len: Length of the passed in data. | |
2078 * Returns: | |
2079 * Handle to the created icon or NULL on error. | |
2080 */ | |
2081 HICN API dw_icon_load_from_data(const char *data, int len) | |
2082 { | |
2083 return 0; | |
2084 } | |
2085 | |
2086 /* | |
2087 * Frees a loaded icon resource. | |
2088 * Parameters: | |
2089 * handle: Handle to icon returned by dw_icon_load(). | |
2090 */ | |
2091 void API dw_icon_free(HICN handle) | |
2092 { | |
2093 } | |
2094 | |
2095 /* | |
2096 * Create a new MDI Frame to be packed. | |
2097 * Parameters: | |
2098 * id: An ID to be used with dw_window_from_id or 0L. | |
2099 * Returns: | |
2100 * Handle to the created MDI widget or NULL on error. | |
2101 */ | |
2102 HWND API dw_mdi_new(unsigned long cid) | |
2103 { | |
2104 return 0; | |
2105 } | |
2106 | |
2107 /* | |
2108 * Creates a splitbar window (widget) with given parameters. | |
2109 * Parameters: | |
2110 * type: Value can be DW_VERT or DW_HORZ. | |
2111 * topleft: Handle to the window to be top or left. | |
2112 * bottomright: Handle to the window to be bottom or right. | |
2113 * Returns: | |
2114 * A handle to a splitbar window or NULL on failure. | |
2115 */ | |
2116 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long cid) | |
2117 { | |
2118 return 0; | |
2119 } | |
2120 | |
2121 /* | |
2122 * Sets the position of a splitbar (pecentage). | |
2123 * Parameters: | |
2124 * handle: The handle to the splitbar returned by dw_splitbar_new(). | |
2125 * percent: The position of the splitbar. | |
2126 */ | |
2127 void API dw_splitbar_set(HWND handle, float percent) | |
2128 { | |
2129 } | |
2130 | |
2131 /* | |
2132 * Gets the position of a splitbar (pecentage). | |
2133 * Parameters: | |
2134 * handle: The handle to the splitbar returned by dw_splitbar_new(). | |
2135 * Returns: | |
2136 * Position of the splitbar (percentage). | |
2137 */ | |
2138 float API dw_splitbar_get(HWND handle) | |
2139 { | |
2140 return 0; | |
2141 } | |
2142 | |
2143 /* | |
2144 * Create a bitmap object to be packed. | |
2145 * Parameters: | |
2146 * id: An ID to be used with dw_window_from_id() or 0L. | |
2147 * Returns: | |
2148 * Handle to the created bitmap widget or NULL on error. | |
2149 */ | |
2150 HWND API dw_bitmap_new(ULONG cid) | |
2151 { | |
2152 return 0; | |
2153 } | |
2154 | |
2155 /* | |
2156 * Creates a pixmap with given parameters. | |
2157 * Parameters: | |
2158 * handle: Window handle the pixmap is associated with. | |
2159 * width: Width of the pixmap in pixels. | |
2160 * height: Height of the pixmap in pixels. | |
2161 * depth: Color depth of the pixmap. | |
2162 * Returns: | |
2163 * A handle to a pixmap or NULL on failure. | |
2164 */ | |
2165 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) | |
2166 { | |
2167 return 0; | |
2168 } | |
2169 | |
2170 /* | |
2171 * Creates a pixmap from a file. | |
2172 * Parameters: | |
2173 * handle: Window handle the pixmap is associated with. | |
2174 * filename: Name of the file, omit extention to have | |
2175 * DW pick the appropriate file extension. | |
2176 * (BMP on OS/2 or Windows, XPM on Unix) | |
2177 * Returns: | |
2178 * A handle to a pixmap or NULL on failure. | |
2179 */ | |
2180 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename) | |
2181 { | |
2182 return 0; | |
2183 } | |
2184 | |
2185 /* | |
2186 * Creates a pixmap from data in memory. | |
2187 * Parameters: | |
2188 * handle: Window handle the pixmap is associated with. | |
2189 * data: Source of the image data | |
2190 * (BMP on OS/2 or Windows, XPM on Unix) | |
2191 * len: Length of data | |
2192 * Returns: | |
2193 * A handle to a pixmap or NULL on failure. | |
2194 */ | |
2195 HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len) | |
2196 { | |
2197 return 0; | |
2198 } | |
2199 | |
2200 /* | |
2201 * Sets the transparent color for a pixmap. | |
2202 * Parameters: | |
2203 * pixmap: Handle to a pixmap returned by | |
2204 * dw_pixmap_new.. | |
2205 * color: Transparent RGB color | |
2206 * Note: This is only necessary on platforms that | |
2207 * don't handle transparency automatically | |
2208 */ | |
2209 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ) | |
2210 { | |
2211 } | |
2212 | |
2213 /* | |
2214 * Creates a pixmap from internal resource graphic specified by id. | |
2215 * Parameters: | |
2216 * handle: Window handle the pixmap is associated with. | |
2217 * id: Resource ID associated with requested pixmap. | |
2218 * Returns: | |
2219 * A handle to a pixmap or NULL on failure. | |
2220 */ | |
2221 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG resid) | |
2222 { | |
2223 return 0; | |
2224 } | |
2225 | |
2226 /* | |
2227 * Sets the font used by a specified pixmap. | |
2228 * Normally the pixmap font is obtained from the associated window handle. | |
2229 * However this can be used to override that, or for pixmaps with no window. | |
2230 * Parameters: | |
2231 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or | |
2232 * passed to the application via a callback. | |
2233 * fontname: Name and size of the font in the form "size.fontname" | |
2234 * Returns: | |
2235 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | |
2236 */ | |
2237 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) | |
2238 { | |
2239 return DW_ERROR_GENERAL; | |
2240 } | |
2241 | |
2242 /* | |
2243 * Destroys an allocated pixmap. | |
2244 * Parameters: | |
2245 * pixmap: Handle to a pixmap returned by | |
2246 * dw_pixmap_new.. | |
2247 */ | |
2248 void API dw_pixmap_destroy(HPIXMAP pixmap) | |
2249 { | |
2250 } | |
2251 | |
2252 /* | |
2253 * Copies from one item to another. | |
2254 * Parameters: | |
2255 * dest: Destination window handle. | |
2256 * destp: Destination pixmap. (choose only one). | |
2257 * xdest: X coordinate of destination. | |
2258 * ydest: Y coordinate of destination. | |
2259 * width: Width of area to copy. | |
2260 * height: Height of area to copy. | |
2261 * src: Source window handle. | |
2262 * srcp: Source pixmap. (choose only one). | |
2263 * xsrc: X coordinate of source. | |
2264 * ysrc: Y coordinate of source. | |
2265 */ | |
2266 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) | |
2267 { | |
2268 } | |
2269 | |
2270 /* | |
2271 * Copies from one surface to another allowing for stretching. | |
2272 * Parameters: | |
2273 * dest: Destination window handle. | |
2274 * destp: Destination pixmap. (choose only one). | |
2275 * xdest: X coordinate of destination. | |
2276 * ydest: Y coordinate of destination. | |
2277 * width: Width of the target area. | |
2278 * height: Height of the target area. | |
2279 * src: Source window handle. | |
2280 * srcp: Source pixmap. (choose only one). | |
2281 * xsrc: X coordinate of source. | |
2282 * ysrc: Y coordinate of source. | |
2283 * srcwidth: Width of area to copy. | |
2284 * srcheight: Height of area to copy. | |
2285 * Returns: | |
2286 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | |
2287 */ | |
2288 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) | |
2289 { | |
2290 return DW_ERROR_GENERAL; | |
2291 } | |
2292 | |
2293 /* | |
2294 * Create a new calendar window (widget) to be packed. | |
2295 * Parameters: | |
2296 * id: An ID to be used with dw_window_from_id() or 0L. | |
2297 * Returns: | |
2298 * Handle to the created calendar or NULL on error. | |
2299 */ | |
2300 HWND API dw_calendar_new(ULONG cid) | |
2301 { | |
2302 return 0; | |
2303 } | |
2304 | |
2305 /* | |
2306 * Sets the current date of a calendar. | |
2307 * Parameters: | |
2308 * handle: The handle to the calendar returned by dw_calendar_new(). | |
2309 * year, month, day: To set the calendar to display. | |
2310 */ | |
2311 void API dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) | |
2312 { | |
2313 } | |
2314 | |
2315 /* | |
2316 * Gets the year, month and day set in the calendar widget. | |
2317 * Parameters: | |
2318 * handle: The handle to the calendar returned by dw_calendar_new(). | |
2319 * year: Variable to store the year or NULL. | |
2320 * month: Variable to store the month or NULL. | |
2321 * day: Variable to store the day or NULL. | |
2322 */ | |
2323 void API dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) | |
2324 { | |
2325 } | |
2326 | |
2327 /* | |
2328 * Causes the embedded HTML widget to take action. | |
2329 * Parameters: | |
2330 * handle: Handle to the window. | |
2331 * action: One of the DW_HTML_* constants. | |
2332 */ | |
2333 void API dw_html_action(HWND handle, int action) | |
2334 { | |
2335 } | |
2336 | |
2337 /* | |
2338 * Render raw HTML code in the embedded HTML widget.. | |
2339 * Parameters: | |
2340 * handle: Handle to the window. | |
2341 * string: String buffer containt HTML code to | |
2342 * be rendered. | |
2343 * Returns: | |
2344 * DW_ERROR_NONE (0) on success. | |
2345 */ | |
2346 int API dw_html_raw(HWND handle, const char *string) | |
2347 { | |
2348 return DW_ERROR_GENERAL; | |
2349 } | |
2350 | |
2351 /* | |
2352 * Render file or web page in the embedded HTML widget.. | |
2353 * Parameters: | |
2354 * handle: Handle to the window. | |
2355 * url: Universal Resource Locator of the web or | |
2356 * file object to be rendered. | |
2357 * Returns: | |
2358 * DW_ERROR_NONE (0) on success. | |
2359 */ | |
2360 int API dw_html_url(HWND handle, const char *url) | |
2361 { | |
2362 return DW_ERROR_GENERAL; | |
2363 } | |
2364 | |
2365 /* | |
2366 * Executes the javascript contained in "script" in the HTML window. | |
2367 * Parameters: | |
2368 * handle: Handle to the HTML window. | |
2369 * script: Javascript code to execute. | |
2370 * scriptdata: Data passed to the signal handler. | |
2371 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. | |
2372 * Returns: | |
2373 * DW_ERROR_NONE (0) on success. | |
2374 */ | |
2375 int API dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) | |
2376 { | |
2377 return DW_ERROR_UNKNOWN; | |
2378 } | |
2379 | |
2380 /* | |
2381 * Create a new HTML window (widget) to be packed. | |
2382 * Parameters: | |
2383 * id: An ID to be used with dw_window_from_id() or 0L. | |
2384 * Returns: | |
2385 * Handle to the created html widget or NULL on error. | |
2386 */ | |
2387 HWND API dw_html_new(unsigned long cid) | |
2388 { | |
2389 return 0; | |
2390 } | |
2391 | |
2392 /* | |
2393 * Returns the current X and Y coordinates of the mouse pointer. | |
2394 * Parameters: | |
2395 * x: Pointer to variable to store X coordinate or NULL. | |
2396 * y: Pointer to variable to store Y coordinate or NULL. | |
2397 */ | |
2398 void API dw_pointer_query_pos(long *x, long *y) | |
2399 { | |
2400 } | |
2401 | |
2402 /* | |
2403 * Sets the X and Y coordinates of the mouse pointer. | |
2404 * Parameters: | |
2405 * x: X coordinate. | |
2406 * y: Y coordinate. | |
2407 */ | |
2408 void API dw_pointer_set_pos(long x, long y) | |
2409 { | |
2410 } | |
2411 | |
2412 /* | |
2413 * Create a menu object to be popped up. | |
2414 * Parameters: | |
2415 * id: An ID to be used associated with this menu. | |
2416 * Returns: | |
2417 * Handle to the created menu or NULL on error. | |
2418 */ | |
2419 HMENUI API dw_menu_new(ULONG cid) | |
2420 { | |
2421 return 0; | |
2422 } | |
2423 | |
2424 /* | |
2425 * Create a menubar on a window. | |
2426 * Parameters: | |
2427 * location: Handle of a window frame to be attached to. | |
2428 * Returns: | |
2429 * Handle to the created menu bar or NULL on error. | |
2430 */ | |
2431 HMENUI API dw_menubar_new(HWND location) | |
2432 { | |
2433 return 0; | |
2434 } | |
2435 | |
2436 /* | |
2437 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
2438 * Parameters: | |
2439 * menu: Handle of a menu. | |
2440 */ | |
2441 void API dw_menu_destroy(HMENUI *menu) | |
2442 { | |
2443 } | |
2444 | |
2445 /* | |
2446 * Deletes the menu item specified. | |
2447 * Parameters: | |
2448 * menu: The handle to the menu in which the item was appended. | |
2449 * id: Menuitem id. | |
2450 * Returns: | |
2451 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. | |
2452 */ | |
2453 int API dw_menu_delete_item(HMENUI menux, unsigned long id) | |
2454 { | |
2455 return DW_ERROR_UNKNOWN; | |
2456 } | |
2457 | |
2458 /* | |
2459 * Pops up a context menu at given x and y coordinates. | |
2460 * Parameters: | |
2461 * menu: The handle the the existing menu. | |
2462 * parent: Handle to the window initiating the popup. | |
2463 * x: X coordinate. | |
2464 * y: Y coordinate. | |
2465 */ | |
2466 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) | |
2467 { | |
2468 } | |
2469 | |
2470 /* | |
2471 * Adds a menuitem or submenu to an existing menu. | |
2472 * Parameters: | |
2473 * menu: The handle the the existing menu. | |
2474 * title: The title text on the menu item to be added. | |
2475 * id: An ID to be used for message passing. | |
2476 * flags: Extended attributes to set on the menu. | |
2477 * end: If TRUE memu is positioned at the end of the menu. | |
2478 * check: If TRUE menu is "check"able. | |
2479 * submenu: Handle to an existing menu to be a submenu or NULL. | |
2480 * Returns: | |
2481 * Handle to the created menu item or NULL on error. | |
2482 */ | |
2483 HWND API dw_menu_append_item(HMENUI menux, const char *title, ULONG itemid, ULONG flags, int end, int check, HMENUI submenux) | |
2484 { | |
2485 return 0; | |
2486 } | |
2487 | |
2488 /* | |
2489 * Sets the state of a menu item check. | |
2490 * Deprecated; use dw_menu_item_set_state() | |
2491 * Parameters: | |
2492 * menu: The handle the the existing menu. | |
2493 * id: Menuitem id. | |
2494 * check: TRUE for checked FALSE for not checked. | |
2495 */ | |
2496 void API dw_menu_item_set_check(HMENUI menux, unsigned long itemid, int check) | |
2497 { | |
2498 } | |
2499 | |
2500 /* | |
2501 * Sets the state of a menu item. | |
2502 * Parameters: | |
2503 * menu: The handle to the existing menu. | |
2504 * id: Menuitem id. | |
2505 * flags: DW_MIS_ENABLED/DW_MIS_DISABLED | |
2506 * DW_MIS_CHECKED/DW_MIS_UNCHECKED | |
2507 */ | |
2508 void API dw_menu_item_set_state(HMENUI menux, unsigned long itemid, unsigned long state) | |
2509 { | |
2510 } | |
2511 | |
2512 /* | |
2513 * Create a notebook object to be packed. | |
2514 * Parameters: | |
2515 * id: An ID to be used for getting the resource from the | |
2516 * resource file. | |
2517 * Returns: | |
2518 * Handle to the created notebook or NULL on error. | |
2519 */ | |
2520 HWND API dw_notebook_new(ULONG cid, int top) | |
2521 { | |
2522 return 0; | |
2523 } | |
2524 | |
2525 /* | |
2526 * Adds a new page to specified notebook. | |
2527 * Parameters: | |
2528 * handle: Window (widget) handle. | |
2529 * flags: Any additional page creation flags. | |
2530 * front: If TRUE page is added at the beginning. | |
2531 * Returns: | |
2532 * ID of newly created notebook page. | |
2533 */ | |
2534 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) | |
2535 { | |
2536 return 0; | |
2537 } | |
2538 | |
2539 /* | |
2540 * Remove a page from a notebook. | |
2541 * Parameters: | |
2542 * handle: Handle to the notebook widget. | |
2543 * pageid: ID of the page to be destroyed. | |
2544 */ | |
2545 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) | |
2546 { | |
2547 } | |
2548 | |
2549 /* | |
2550 * Queries the currently visible page ID. | |
2551 * Parameters: | |
2552 * handle: Handle to the notebook widget. | |
2553 * Returns: | |
2554 * ID of visible notebook page. | |
2555 */ | |
2556 unsigned long API dw_notebook_page_get(HWND handle) | |
2557 { | |
2558 return 0; | |
2559 } | |
2560 | |
2561 /* | |
2562 * Sets the currently visible page ID. | |
2563 * Parameters: | |
2564 * handle: Handle to the notebook widget. | |
2565 * pageid: ID of the page to be made visible. | |
2566 */ | |
2567 void API dw_notebook_page_set(HWND handle, unsigned int pageid) | |
2568 { | |
2569 } | |
2570 | |
2571 /* | |
2572 * Sets the text on the specified notebook tab. | |
2573 * Parameters: | |
2574 * handle: Notebook handle. | |
2575 * pageid: Page ID of the tab to set. | |
2576 * text: Pointer to the text to set. | |
2577 */ | |
2578 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, const char *text) | |
2579 { | |
2580 } | |
2581 | |
2582 /* | |
2583 * Sets the text on the specified notebook tab status area. | |
2584 * Parameters: | |
2585 * handle: Notebook handle. | |
2586 * pageid: Page ID of the tab to set. | |
2587 * text: Pointer to the text to set. | |
2588 */ | |
2589 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, const char *text) | |
2590 { | |
2591 } | |
2592 | |
2593 /* | |
2594 * Packs the specified box into the notebook page. | |
2595 * Parameters: | |
2596 * handle: Handle to the notebook to be packed. | |
2597 * pageid: Page ID in the notebook which is being packed. | |
2598 * page: Box handle to be packed. | |
2599 */ | |
2600 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) | |
2601 { | |
2602 } | |
2603 | |
2604 /* | |
2605 * Create a new Window Frame. | |
2606 * Parameters: | |
2607 * owner: The Owner's window handle or HWND_DESKTOP. | |
2608 * title: The Window title. | |
2609 * flStyle: Style flags. | |
2610 * Returns: | |
2611 * Handle to the created window or NULL on error. | |
2612 */ | |
2613 HWND API dw_window_new(HWND hwndOwner, const char *title, ULONG flStyle) | |
2614 { | |
2615 return 0; | |
2616 } | |
2617 | |
2618 /* | |
2619 * Call a function from the window (widget)'s context (typically the message loop thread). | |
2620 * Parameters: | |
2621 * handle: Window handle of the widget. | |
2622 * function: Function pointer to be called. | |
2623 * data: Pointer to the data to be passed to the function. | |
2624 */ | |
2625 void API dw_window_function(HWND handle, void *function, void *data) | |
2626 { | |
2627 } | |
2628 | |
2629 | |
2630 /* | |
2631 * Changes the appearance of the mouse pointer. | |
2632 * Parameters: | |
2633 * handle: Handle to widget for which to change. | |
2634 * cursortype: ID of the pointer you want. | |
2635 */ | |
2636 void API dw_window_set_pointer(HWND handle, int pointertype) | |
2637 { | |
2638 } | |
2639 | |
2640 /* | |
2641 * Makes the window visible. | |
2642 * Parameters: | |
2643 * handle: The window handle to make visible. | |
2644 * Returns: | |
2645 * DW_ERROR_NONE (0) on success. | |
2646 */ | |
2647 int API dw_window_show(HWND handle) | |
2648 { | |
2649 return DW_ERROR_GENERAL; | |
2650 } | |
2651 | |
2652 /* | |
2653 * Makes the window invisible. | |
2654 * Parameters: | |
2655 * handle: The window handle to hide. | |
2656 * Returns: | |
2657 * DW_ERROR_NONE (0) on success. | |
2658 */ | |
2659 int API dw_window_hide(HWND handle) | |
2660 { | |
2661 return DW_ERROR_GENERAL; | |
2662 } | |
2663 | |
2664 /* | |
2665 * Sets the colors used by a specified window (widget) handle. | |
2666 * Parameters: | |
2667 * handle: The window (widget) handle. | |
2668 * fore: Foreground color in DW_RGB format or a default color index. | |
2669 * back: Background color in DW_RGB format or a default color index. | |
2670 * Returns: | |
2671 * DW_ERROR_NONE (0) on success. | |
2672 */ | |
2673 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) | |
2674 { | |
2675 return DW_ERROR_GENERAL; | |
2676 } | |
2677 | |
2678 /* | |
2679 * Sets the border size of a specified window (widget) handle. | |
2680 * Parameters: | |
2681 * handle: The window (widget) handle. | |
2682 * border: Size of the window border in pixels. | |
2683 * Returns: | |
2684 * DW_ERROR_NONE (0) on success. | |
2685 */ | |
2686 int API dw_window_set_border(HWND handle, int border) | |
2687 { | |
2688 return DW_ERROR_GENERAL; | |
2689 } | |
2690 | |
2691 /* | |
2692 * Sets the style of a given window (widget). | |
2693 * Parameters: | |
2694 * handle: Window (widget) handle. | |
2695 * style: Style features enabled or disabled. | |
2696 * mask: Corresponding bitmask of features to be changed. | |
2697 */ | |
2698 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) | |
2699 { | |
2700 } | |
2701 | |
2702 /* | |
2703 * Sets the current focus item for a window/dialog. | |
2704 * Parameters: | |
2705 * handle: Handle to the dialog item to be focused. | |
2706 * Remarks: | |
2707 * This is for use after showing the window/dialog. | |
2708 */ | |
2709 void API dw_window_set_focus(HWND handle) | |
2710 { | |
2711 } | |
2712 | |
2713 /* | |
2714 * Sets the default focus item for a window/dialog. | |
2715 * Parameters: | |
2716 * window: Toplevel window or dialog. | |
2717 * defaultitem: Handle to the dialog item to be default. | |
2718 * Remarks: | |
2719 * This is for use before showing the window/dialog. | |
2720 */ | |
2721 void API dw_window_default(HWND handle, HWND defaultitem) | |
2722 { | |
2723 } | |
2724 | |
2725 /* | |
2726 * Sets window to click the default dialog item when an ENTER is pressed. | |
2727 * Parameters: | |
2728 * window: Window (widget) to look for the ENTER press. | |
2729 * next: Window (widget) to move to next (or click) | |
2730 */ | |
2731 void API dw_window_click_default(HWND handle, HWND next) | |
2732 { | |
2733 } | |
2734 | |
2735 /* | |
2736 * Captures the mouse input to this window even if it is outside the bounds. | |
2737 * Parameters: | |
2738 * handle: Handle to receive mouse input. | |
2739 */ | |
2740 void API dw_window_capture(HWND handle) | |
2741 { | |
2742 } | |
2743 | |
2744 /* | |
2745 * Releases previous mouse capture. | |
2746 */ | |
2747 void API dw_window_release(void) | |
2748 { | |
2749 } | |
2750 | |
2751 /* | |
2752 * Changes a window's parent to newparent. | |
2753 * Parameters: | |
2754 * handle: The window handle to destroy. | |
2755 * newparent: The window's new parent window. | |
2756 */ | |
2757 void API dw_window_reparent(HWND handle, HWND newparent) | |
2758 { | |
2759 } | |
2760 | |
2761 /* | |
2762 * Sets the font used by a specified window (widget) handle. | |
2763 * Parameters: | |
2764 * handle: The window (widget) handle. | |
2765 * fontname: Name and size of the font in the form "size.fontname" | |
2766 * Returns: | |
2767 * DW_ERROR_NONE (0) on success. | |
2768 */ | |
2769 int API dw_window_set_font(HWND handle, const char *fontname) | |
2770 { | |
2771 return DW_ERROR_GENERAL; | |
2772 } | |
2773 | |
2774 /* | |
2775 * Returns the current font for the specified window. | |
2776 * Parameters: | |
2777 * handle: The window handle from which to obtain the font. | |
2778 * Returns: | |
2779 * A malloc()ed font name string to be dw_free()ed or NULL on error. | |
2780 */ | |
2781 char * API dw_window_get_font(HWND handle) | |
2782 { | |
2783 return NULL; | |
2784 } | |
2785 | |
2786 /* Allows the user to choose a font using the system's font chooser dialog. | |
2787 * Parameters: | |
2788 * currfont: current font | |
2789 * Returns: | |
2790 * A malloced buffer with the selected font or NULL on error. | |
2791 */ | |
2792 char * API dw_font_choose(const char *currfont) | |
2793 { | |
2794 return NULL; | |
2795 } | |
2796 | |
2797 /* | |
2798 * Sets the default font used on text based widgets. | |
2799 * Parameters: | |
2800 * fontname: Font name in Dynamic Windows format. | |
2801 */ | |
2802 void API dw_font_set_default(const char *fontname) | |
2803 { | |
2804 } | |
2805 | |
2806 /* | |
2807 * Destroys a window and all of it's children. | |
2808 * Parameters: | |
2809 * handle: The window handle to destroy. | |
2810 * Returns: | |
2811 * DW_ERROR_NONE (0) on success. | |
2812 */ | |
2813 int API dw_window_destroy(HWND handle) | |
2814 { | |
2815 return DW_ERROR_GENERAL; | |
2816 } | |
2817 | |
2818 /* | |
2819 * Gets the text used for a given window. | |
2820 * Parameters: | |
2821 * handle: Handle to the window. | |
2822 * Returns: | |
2823 * The text associsated with a given window or NULL on error. | |
2824 */ | |
2825 char * API dw_window_get_text(HWND handle) | |
2826 { | |
2827 return NULL; | |
2828 } | |
2829 | |
2830 /* | |
2831 * Sets the text used for a given window. | |
2832 * Parameters: | |
2833 * handle: Handle to the window. | |
2834 * text: The text associsated with a given window. | |
2835 */ | |
2836 void API dw_window_set_text(HWND handle, const char *text) | |
2837 { | |
2838 } | |
2839 | |
2840 /* | |
2841 * Sets the text used for a given window's floating bubble help. | |
2842 * Parameters: | |
2843 * handle: Handle to the window (widget). | |
2844 * bubbletext: The text in the floating bubble tooltip. | |
2845 */ | |
2846 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) | |
2847 { | |
2848 } | |
2849 | |
2850 /* | |
2851 * Disables given window (widget). | |
2852 * Parameters: | |
2853 * handle: Handle to the window. | |
2854 */ | |
2855 void API dw_window_disable(HWND handle) | |
2856 { | |
2857 } | |
2858 | |
2859 /* | |
2860 * Enables given window (widget). | |
2861 * Parameters: | |
2862 * handle: Handle to the window. | |
2863 */ | |
2864 void API dw_window_enable(HWND handle) | |
2865 { | |
2866 } | |
2867 | |
2868 /* | |
2869 * Sets the bitmap used for a given static window. | |
2870 * Parameters: | |
2871 * handle: Handle to the window. | |
2872 * id: An ID to be used to specify the icon, | |
2873 * (pass 0 if you use the filename param) | |
2874 * data: memory buffer containing image (Bitmap on OS/2 or | |
2875 * Windows and a pixmap on Unix, pass | |
2876 * NULL if you use the id param) | |
2877 * len: Length of data passed | |
2878 */ | |
2879 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, const char *data, int len) | |
2880 { | |
2881 } | |
2882 | |
2883 /* | |
2884 * Sets the bitmap used for a given static window. | |
2885 * Parameters: | |
2886 * handle: Handle to the window. | |
2887 * id: An ID to be used to specify the icon, | |
2888 * (pass 0 if you use the filename param) | |
2889 * filename: a path to a file (Bitmap on OS/2 or | |
2890 * Windows and a pixmap on Unix, pass | |
2891 * NULL if you use the id param) | |
2892 */ | |
2893 void API dw_window_set_bitmap(HWND handle, unsigned long resid, const char *filename) | |
2894 { | |
2895 } | |
2896 | |
2897 /* | |
2898 * Sets the icon used for a given window. | |
2899 * Parameters: | |
2900 * handle: Handle to the window. | |
2901 * icon: Handle to icon to be used. | |
2902 */ | |
2903 void API dw_window_set_icon(HWND handle, HICN icon) | |
2904 { | |
2905 } | |
2906 | |
2907 /* | |
2908 * Gets the child window handle with specified ID. | |
2909 * Parameters: | |
2910 * handle: Handle to the parent window. | |
2911 * id: Integer ID of the child. | |
2912 * Returns: | |
2913 * HWND of window with ID or NULL on error. | |
2914 */ | |
2915 HWND API dw_window_from_id(HWND handle, int id) | |
2916 { | |
2917 return 0; | |
2918 } | |
2919 | |
2920 /* | |
2921 * Minimizes or Iconifies a top-level window. | |
2922 * Parameters: | |
2923 * handle: The window handle to minimize. | |
2924 * Returns: | |
2925 * DW_ERROR_NONE (0) on success. | |
2926 */ | |
2927 int API dw_window_minimize(HWND handle) | |
2928 { | |
2929 return DW_ERROR_GENERAL; | |
2930 } | |
2931 | |
2932 /* Causes entire window to be invalidated and redrawn. | |
2933 * Parameters: | |
2934 * handle: Toplevel window handle to be redrawn. | |
2935 */ | |
2936 void API dw_window_redraw(HWND handle) | |
2937 { | |
2938 } | |
2939 | |
2940 /* | |
2941 * Makes the window topmost. | |
2942 * Parameters: | |
2943 * handle: The window handle to make topmost. | |
2944 * Returns: | |
2945 * DW_ERROR_NONE (0) on success. | |
2946 */ | |
2947 int API dw_window_raise(HWND handle) | |
2948 { | |
2949 return DW_ERROR_GENERAL; | |
2950 } | |
2951 | |
2952 /* | |
2953 * Makes the window bottommost. | |
2954 * Parameters: | |
2955 * handle: The window handle to make bottommost. | |
2956 * Returns: | |
2957 * DW_ERROR_NONE (0) on success. | |
2958 */ | |
2959 int API dw_window_lower(HWND handle) | |
2960 { | |
2961 return DW_ERROR_GENERAL; | |
2962 } | |
2963 | |
2964 /* | |
2965 * Sets the size of a given window (widget). | |
2966 * Parameters: | |
2967 * handle: Window (widget) handle. | |
2968 * width: New width in pixels. | |
2969 * height: New height in pixels. | |
2970 */ | |
2971 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) | |
2972 { | |
2973 } | |
2974 | |
2975 /* | |
2976 * Gets the size the system thinks the widget should be. | |
2977 * Parameters: | |
2978 * handle: Window (widget) handle of the item to query. | |
2979 * width: Width in pixels of the item or NULL if not needed. | |
2980 * height: Height in pixels of the item or NULL if not needed. | |
2981 */ | |
2982 void API dw_window_get_preferred_size(HWND handle, int *width, int *height) | |
2983 { | |
2984 } | |
2985 | |
2986 /* | |
2987 * Sets the gravity of a given window (widget). | |
2988 * Gravity controls which corner of the screen and window the position is relative to. | |
2989 * Parameters: | |
2990 * handle: Window (widget) handle. | |
2991 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER. | |
2992 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER. | |
2993 */ | |
2994 void API dw_window_set_gravity(HWND handle, int horz, int vert) | |
2995 { | |
2996 } | |
2997 | |
2998 /* | |
2999 * Sets the position of a given window (widget). | |
3000 * Parameters: | |
3001 * handle: Window (widget) handle. | |
3002 * x: X location from the bottom left. | |
3003 * y: Y location from the bottom left. | |
3004 */ | |
3005 void API dw_window_set_pos(HWND handle, LONG x, LONG y) | |
3006 { | |
3007 } | |
3008 | |
3009 /* | |
3010 * Sets the position and size of a given window (widget). | |
3011 * Parameters: | |
3012 * handle: Window (widget) handle. | |
3013 * x: X location from the bottom left. | |
3014 * y: Y location from the bottom left. | |
3015 * width: Width of the widget. | |
3016 * height: Height of the widget. | |
3017 */ | |
3018 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height) | |
3019 { | |
3020 } | |
3021 | |
3022 /* | |
3023 * Gets the position and size of a given window (widget). | |
3024 * Parameters: | |
3025 * handle: Window (widget) handle. | |
3026 * x: X location from the bottom left or NULL. | |
3027 * y: Y location from the bottom left or NULL. | |
3028 * width: Width of the widget or NULL. | |
3029 * height: Height of the widget or NULL. | |
3030 */ | |
3031 void API dw_window_get_pos_size(HWND handle, LONG *x, LONG *y, ULONG *width, ULONG *height) | |
3032 { | |
3033 } | |
3034 | |
3035 /* | |
3036 * Returns the width of the screen. | |
3037 */ | |
3038 int API dw_screen_width(void) | |
3039 { | |
3040 return 0; | |
3041 } | |
3042 | |
3043 /* | |
3044 * Returns the height of the screen. | |
3045 */ | |
3046 int API dw_screen_height(void) | |
3047 { | |
3048 return 0; | |
3049 } | |
3050 | |
3051 /* This should return the current color depth. */ | |
3052 unsigned long API dw_color_depth_get(void) | |
3053 { | |
3054 return 0; | |
3055 } | |
3056 | |
3057 /* | |
3058 * Returns some information about the current operating environment. | |
3059 * Parameters: | |
3060 * env: Pointer to a DWEnv struct. | |
3061 */ | |
3062 void API dw_environment_query(DWEnv *env) | |
3063 { | |
3064 strcpy(env->osName, "Unknown"); | |
3065 | |
3066 strcpy(env->buildDate, __DATE__); | |
3067 strcpy(env->buildTime, __TIME__); | |
3068 env->DWMajorVersion = DW_MAJOR_VERSION; | |
3069 env->DWMinorVersion = DW_MINOR_VERSION; | |
3070 env->DWSubVersion = DW_SUB_VERSION; | |
3071 | |
3072 env->MajorVersion = 0; /* Operating system major */ | |
3073 env->MinorVersion = 0; /* Operating system minor */ | |
3074 env->MajorBuild = 0; /* Build versions... if available */ | |
3075 env->MinorBuild = 0; | |
3076 } | |
3077 | |
3078 /* | |
3079 * Emits a beep. | |
3080 * Parameters: | |
3081 * freq: Frequency. | |
3082 * dur: Duration. | |
3083 */ | |
3084 void API dw_beep(int freq, int dur) | |
3085 { | |
3086 } | |
3087 | |
3088 /* Call this after drawing to the screen to make sure | |
3089 * anything you have drawn is visible. | |
3090 */ | |
3091 void API dw_flush(void) | |
3092 { | |
3093 } | |
3094 | |
3095 /* | |
3096 * Add a named user data item to a window handle. | |
3097 * Parameters: | |
3098 * window: Window handle to save data to. | |
3099 * dataname: A string pointer identifying which data to be saved. | |
3100 * data: User data to be saved to the window handle. | |
3101 */ | |
3102 void API dw_window_set_data(HWND window, const char *dataname, void *data) | |
3103 { | |
3104 } | |
3105 | |
3106 /* | |
3107 * Gets a named user data item from a window handle. | |
3108 * Parameters: | |
3109 * window: Window handle to get data from. | |
3110 * dataname: A string pointer identifying which data to get. | |
3111 * Returns: | |
3112 * Pointer to data or NULL if no data is available. | |
3113 */ | |
3114 void * API dw_window_get_data(HWND window, const char *dataname) | |
3115 { | |
3116 return NULL; | |
3117 } | |
3118 | |
3119 /* | |
3120 * Add a callback to a timer event. | |
3121 * Parameters: | |
3122 * interval: Milliseconds to delay between calls. | |
3123 * sigfunc: The pointer to the function to be used as the callback. | |
3124 * data: User data to be passed to the handler function. | |
3125 * Returns: | |
3126 * Timer ID for use with dw_timer_disconnect(), 0 on error. | |
3127 */ | |
3128 int API dw_timer_connect(int interval, void *sigfunc, void *data) | |
3129 { | |
3130 return 0; | |
3131 } | |
3132 | |
3133 /* | |
3134 * Removes timer callback. | |
3135 * Parameters: | |
3136 * id: Timer ID returned by dw_timer_connect(). | |
3137 */ | |
3138 void API dw_timer_disconnect(int timerid) | |
3139 { | |
3140 } | |
3141 | |
3142 /* | |
3143 * Add a callback to a window event. | |
3144 * Parameters: | |
3145 * window: Window handle of signal to be called back. | |
3146 * signame: A string pointer identifying which signal to be hooked. | |
3147 * sigfunc: The pointer to the function to be used as the callback. | |
3148 * data: User data to be passed to the handler function. | |
3149 */ | |
3150 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) | |
3151 { | |
3152 dw_signal_connect_data(window, signame, sigfunc, NULL, data); | |
3153 } | |
3154 | |
3155 /* | |
3156 * Add a callback to a window event with a closure callback. | |
3157 * Parameters: | |
3158 * window: Window handle of signal to be called back. | |
3159 * signame: A string pointer identifying which signal to be hooked. | |
3160 * sigfunc: The pointer to the function to be used as the callback. | |
3161 * discfunc: The pointer to the function called when this handler is removed. | |
3162 * data: User data to be passed to the handler function. | |
3163 */ | |
3164 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) | |
3165 { | |
3166 } | |
3167 | |
3168 /* | |
3169 * Removes callbacks for a given window with given name. | |
3170 * Parameters: | |
3171 * window: Window handle of callback to be removed. | |
3172 * signame: Signal name to be matched on window. | |
3173 */ | |
3174 void API dw_signal_disconnect_by_name(HWND window, const char *signame) | |
3175 { | |
3176 } | |
3177 | |
3178 /* | |
3179 * Removes all callbacks for a given window. | |
3180 * Parameters: | |
3181 * window: Window handle of callback to be removed. | |
3182 */ | |
3183 void API dw_signal_disconnect_by_window(HWND window) | |
3184 { | |
3185 } | |
3186 | |
3187 /* | |
3188 * Removes all callbacks for a given window with specified data. | |
3189 * Parameters: | |
3190 * window: Window handle of callback to be removed. | |
3191 * data: Pointer to the data to be compared against. | |
3192 */ | |
3193 void API dw_signal_disconnect_by_data(HWND window, void *data) | |
3194 { | |
3195 } | |
3196 | |
3197 /* Open a shared library and return a handle. | |
3198 * Parameters: | |
3199 * name: Base name of the shared library. | |
3200 * handle: Pointer to a module handle, | |
3201 * will be filled in with the handle. | |
3202 * Returns: | |
3203 * DW_ERROR_NONE (0) on success. | |
3204 */ | |
3205 int API dw_module_load(const char *name, HMOD *handle) | |
3206 { | |
3207 return DW_ERROR_UNKNOWN; | |
3208 } | |
3209 | |
3210 /* Queries the address of a symbol within open handle. | |
3211 * Parameters: | |
3212 * handle: Module handle returned by dw_module_load() | |
3213 * name: Name of the symbol you want the address of. | |
3214 * func: A pointer to a function pointer, to obtain | |
3215 * the address. | |
3216 * Returns: | |
3217 * DW_ERROR_NONE (0) on success. | |
3218 */ | |
3219 int API dw_module_symbol(HMOD handle, const char *name, void**func) | |
3220 { | |
3221 return DW_ERROR_UNKNOWN; | |
3222 } | |
3223 | |
3224 /* Frees the shared library previously opened. | |
3225 * Parameters: | |
3226 * handle: Module handle returned by dw_module_load() | |
3227 * Returns: | |
3228 * DW_ERROR_NONE (0) on success. | |
3229 */ | |
3230 int API dw_module_close(HMOD handle) | |
3231 { | |
3232 return DW_ERROR_GENERAL; | |
3233 } | |
3234 | |
3235 /* | |
3236 * Returns the handle to an unnamed mutex semaphore or NULL on error. | |
3237 */ | |
3238 HMTX API dw_mutex_new(void) | |
3239 { | |
3240 return NULL; | |
3241 } | |
3242 | |
3243 /* | |
3244 * Closes a semaphore created by dw_mutex_new(). | |
3245 * Parameters: | |
3246 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
3247 */ | |
3248 void API dw_mutex_close(HMTX mutex) | |
3249 { | |
3250 } | |
3251 | |
3252 /* | |
3253 * Tries to gain access to the semaphore, if it can't it blocks. | |
3254 * Parameters: | |
3255 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
3256 */ | |
3257 void API dw_mutex_lock(HMTX mutex) | |
3258 { | |
3259 #if 0 | |
3260 /* We need to handle locks from the main thread differently... | |
3261 * since we can't stop message processing... otherwise we | |
3262 * will deadlock... so try to acquire the lock and continue | |
3263 * processing messages in between tries. | |
3264 */ | |
3265 if(_dw_thread == dw_thread_id()) | |
3266 { | |
3267 while(/* Attempt to lock the mutex */) | |
3268 { | |
3269 /* Process any pending events */ | |
3270 while(dw_main_iteration()) | |
3271 { | |
3272 /* Just loop */ | |
3273 } | |
3274 } | |
3275 } | |
3276 else | |
3277 { | |
3278 /* Lock the mutex */ | |
3279 } | |
3280 #endif | |
3281 } | |
3282 | |
3283 /* | |
3284 * Tries to gain access to the semaphore. | |
3285 * Parameters: | |
3286 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
3287 * Returns: | |
3288 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked. | |
3289 */ | |
3290 int API dw_mutex_trylock(HMTX mutex) | |
3291 { | |
3292 return DW_ERROR_GENERAL; | |
3293 } | |
3294 | |
3295 /* | |
3296 * Reliquishes the access to the semaphore. | |
3297 * Parameters: | |
3298 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
3299 */ | |
3300 void API dw_mutex_unlock(HMTX mutex) | |
3301 { | |
3302 } | |
3303 | |
3304 /* | |
3305 * Returns the handle to an unnamed event semaphore or NULL on error. | |
3306 */ | |
3307 HEV API dw_event_new(void) | |
3308 { | |
3309 return NULL; | |
3310 } | |
3311 | |
3312 /* | |
3313 * Resets a semaphore created by dw_event_new(). | |
3314 * Parameters: | |
3315 * eve: The handle to the event returned by dw_event_new(). | |
3316 * Returns: | |
3317 * DW_ERROR_NONE (0) on success. | |
3318 */ | |
3319 int API dw_event_reset (HEV eve) | |
3320 { | |
3321 return DW_ERROR_GENERAL; | |
3322 } | |
3323 | |
3324 /* | |
3325 * Posts a semaphore created by dw_event_new(). Causing all threads | |
3326 * waiting on this event in dw_event_wait to continue. | |
3327 * Parameters: | |
3328 * eve: The handle to the event returned by dw_event_new(). | |
3329 * Returns: | |
3330 * DW_ERROR_NONE (0) on success. | |
3331 */ | |
3332 int API dw_event_post (HEV eve) | |
3333 { | |
3334 return DW_ERROR_GENERAL; | |
3335 } | |
3336 | |
3337 /* | |
3338 * Waits on a semaphore created by dw_event_new(), until the | |
3339 * event gets posted or until the timeout expires. | |
3340 * Parameters: | |
3341 * eve: The handle to the event returned by dw_event_new(). | |
3342 * timeout: Number of milliseconds before timing out | |
3343 * or -1 if indefinite. | |
3344 * Returns: | |
3345 * DW_ERROR_NONE (0) on success. | |
3346 * DW_ERROR_TIMEOUT (2) if the timeout has expired. | |
3347 * Other values on other error. | |
3348 */ | |
3349 int API dw_event_wait(HEV eve, unsigned long timeout) | |
3350 { | |
3351 return DW_ERROR_GENERAL; | |
3352 } | |
3353 | |
3354 /* | |
3355 * Closes a semaphore created by dw_event_new(). | |
3356 * Parameters: | |
3357 * eve: The handle to the event returned by dw_event_new(). | |
3358 * Returns: | |
3359 * DW_ERROR_NONE (0) on success. | |
3360 */ | |
3361 int API dw_event_close(HEV *eve) | |
3362 { | |
3363 return DW_ERROR_GENERAL; | |
3364 } | |
3365 | |
3366 /* Create a named event semaphore which can be | |
3367 * opened from other processes. | |
3368 * Parameters: | |
3369 * name: Name given to semaphore which can be opened | |
3370 * by other processes. | |
3371 * Returns: | |
3372 * Handle to event semaphore or NULL on error. | |
3373 */ | |
3374 HEV API dw_named_event_new(const char *name) | |
3375 { | |
3376 return NULL; | |
3377 } | |
3378 | |
3379 /* Open an already existing named event semaphore. | |
3380 * Parameters: | |
3381 * name: Name given to semaphore which can be opened | |
3382 * by other processes. | |
3383 * Returns: | |
3384 * Handle to event semaphore or NULL on error. | |
3385 */ | |
3386 HEV API dw_named_event_get(const char *name) | |
3387 { | |
3388 return NULL; | |
3389 } | |
3390 | |
3391 /* Resets the event semaphore so threads who call wait | |
3392 * on this semaphore will block. | |
3393 * Parameters: | |
3394 * eve: Handle to the semaphore obtained by | |
3395 * an get or new call. | |
3396 * Returns: | |
3397 * DW_ERROR_NONE (0) on success. | |
3398 */ | |
3399 int API dw_named_event_reset(HEV eve) | |
3400 { | |
3401 return DW_ERROR_GENERAL; | |
3402 } | |
3403 | |
3404 /* Sets the posted state of an event semaphore, any threads | |
3405 * waiting on the semaphore will no longer block. | |
3406 * Parameters: | |
3407 * eve: Handle to the semaphore obtained by | |
3408 * an get or new call. | |
3409 * Returns: | |
3410 * DW_ERROR_NONE (0) on success. | |
3411 */ | |
3412 int API dw_named_event_post(HEV eve) | |
3413 { | |
3414 return DW_ERROR_GENERAL; | |
3415 } | |
3416 | |
3417 /* Waits on the specified semaphore until it becomes | |
3418 * posted, or returns immediately if it already is posted. | |
3419 * Parameters: | |
3420 * eve: Handle to the semaphore obtained by | |
3421 * an get or new call. | |
3422 * timeout: Number of milliseconds before timing out | |
3423 * or -1 if indefinite. | |
3424 * Returns: | |
3425 * DW_ERROR_NONE (0) on success. | |
3426 */ | |
3427 int API dw_named_event_wait(HEV eve, unsigned long timeout) | |
3428 { | |
3429 return DW_ERROR_UNKNOWN; | |
3430 } | |
3431 | |
3432 /* Release this semaphore, if there are no more open | |
3433 * handles on this semaphore the semaphore will be destroyed. | |
3434 * Parameters: | |
3435 * eve: Handle to the semaphore obtained by | |
3436 * an get or new call. | |
3437 * Returns: | |
3438 * DW_ERROR_NONE (0) on success. | |
3439 */ | |
3440 int API dw_named_event_close(HEV eve) | |
3441 { | |
3442 return DW_ERROR_UNKNOWN; | |
3443 } | |
3444 | |
3445 /* | |
3446 * Initializes the Dynamic Windows engine. | |
3447 * Parameters: | |
3448 * newthread: True if this is the only thread. | |
3449 * False if there is already a message loop running. | |
3450 * argc: Passed in from main() | |
3451 * argv: Passed in from main() | |
3452 * Returns: | |
3453 * DW_ERROR_NONE (0) on success. | |
3454 */ | |
3455 int API dw_init(int newthread, int argc, char *argv[]) | |
3456 { | |
3457 return DW_ERROR_NONE; | |
3458 } | |
3459 | |
3460 /* | |
3461 * Allocates a shared memory region with a name. | |
3462 * Parameters: | |
3463 * dest: A pointer to a pointer to receive the memory address. | |
3464 * size: Size in bytes of the shared memory region to allocate. | |
3465 * name: A string pointer to a unique memory name. | |
3466 * Returns: | |
3467 * Handle to shared memory or NULL on error. | |
3468 */ | |
3469 HSHM API dw_named_memory_new(void **dest, int size, const char *name) | |
3470 { | |
3471 return NULL; | |
3472 } | |
3473 | |
3474 /* | |
3475 * Aquires shared memory region with a name. | |
3476 * Parameters: | |
3477 * dest: A pointer to a pointer to receive the memory address. | |
3478 * size: Size in bytes of the shared memory region to requested. | |
3479 * name: A string pointer to a unique memory name. | |
3480 * Returns: | |
3481 * Handle to shared memory or NULL on error. | |
3482 */ | |
3483 HSHM API dw_named_memory_get(void **dest, int size, const char *name) | |
3484 { | |
3485 return NULL; | |
3486 } | |
3487 | |
3488 /* | |
3489 * Frees a shared memory region previously allocated. | |
3490 * Parameters: | |
3491 * handle: Handle obtained from dw_named_memory_new(). | |
3492 * ptr: The memory address aquired with dw_named_memory_new(). | |
3493 * Returns: | |
3494 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN (-1) on error. | |
3495 */ | |
3496 int API dw_named_memory_free(HSHM handle, void *ptr) | |
3497 { | |
3498 int rc = DW_ERROR_UNKNOWN; | |
3499 | |
3500 return rc; | |
3501 } | |
3502 | |
3503 /* | |
3504 * Generally an internal function called from a newly created | |
3505 * thread to setup the Dynamic Windows environment for the thread. | |
3506 * However it is exported so language bindings can call it when | |
3507 * they create threads that require access to Dynamic Windows. | |
3508 */ | |
3509 void API _dw_init_thread(void) | |
3510 { | |
3511 } | |
3512 | |
3513 /* | |
3514 * Generally an internal function called from a terminating | |
3515 * thread to cleanup the Dynamic Windows environment for the thread. | |
3516 * However it is exported so language bindings can call it when | |
3517 * they exit threads that require access to Dynamic Windows. | |
3518 */ | |
3519 void API _dw_deinit_thread(void) | |
3520 { | |
3521 } | |
3522 | |
3523 /* | |
3524 * Creates a new thread with a starting point of func. | |
3525 * Parameters: | |
3526 * func: Function which will be run in the new thread. | |
3527 * data: Parameter(s) passed to the function. | |
3528 * stack: Stack size of new thread (OS/2 and Windows only). | |
3529 * Returns: | |
3530 * Thread ID on success or DW_ERROR_UNKNOWN (-1) on error. | |
3531 */ | |
3532 DWTID API dw_thread_new(void *func, void *data, int stack) | |
3533 { | |
3534 return (DWTID)DW_ERROR_UNKNOWN; | |
3535 } | |
3536 | |
3537 /* | |
3538 * Ends execution of current thread immediately. | |
3539 */ | |
3540 void API dw_thread_end(void) | |
3541 { | |
3542 } | |
3543 | |
3544 /* | |
3545 * Returns the current thread's ID. | |
3546 */ | |
3547 DWTID API dw_thread_id(void) | |
3548 { | |
3549 return (DWTID)0; | |
3550 } | |
3551 | |
3552 /* | |
3553 * Cleanly terminates a DW session, should be signal handler safe. | |
3554 */ | |
3555 void API dw_shutdown(void) | |
3556 { | |
3557 } | |
3558 | |
3559 /* | |
3560 * Execute and external program in a seperate session. | |
3561 * Parameters: | |
3562 * program: Program name with optional path. | |
3563 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
3564 * params: An array of pointers to string arguements. | |
3565 * Returns: | |
3566 * Process ID on success or DW_ERROR_UNKNOWN (-1) on error. | |
3567 */ | |
3568 int API dw_exec(const char *program, int type, char **params) | |
3569 { | |
3570 int ret = DW_ERROR_UNKNOWN; | |
3571 | |
3572 return ret; | |
3573 } | |
3574 | |
3575 /* | |
3576 * Loads a web browser pointed at the given URL. | |
3577 * Parameters: | |
3578 * url: Uniform resource locator. | |
3579 * Returns: | |
3580 * DW_ERROR_UNKNOWN (-1) on error; DW_ERROR_NONE (0) or a positive Process ID on success. | |
3581 */ | |
3582 int API dw_browse(const char *url) | |
3583 { | |
3584 return DW_ERROR_UNKNOWN; | |
3585 } | |
3586 | |
3587 /* | |
3588 * Creates a new print object. | |
3589 * Parameters: | |
3590 * jobname: Name of the print job to show in the queue. | |
3591 * flags: Flags to initially configure the print object. | |
3592 * pages: Number of pages to print. | |
3593 * drawfunc: The pointer to the function to be used as the callback. | |
3594 * drawdata: User data to be passed to the handler function. | |
3595 * Returns: | |
3596 * A handle to the print object or NULL on failure. | |
3597 */ | |
3598 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) | |
3599 { | |
3600 return NULL; | |
3601 } | |
3602 | |
3603 /* | |
3604 * Runs the print job, causing the draw page callbacks to fire. | |
3605 * Parameters: | |
3606 * print: Handle to the print object returned by dw_print_new(). | |
3607 * flags: Flags to run the print job. | |
3608 * Returns: | |
3609 * DW_ERROR_UNKNOWN on error or DW_ERROR_NONE on success. | |
3610 */ | |
3611 int API dw_print_run(HPRINT print, unsigned long flags) | |
3612 { | |
3613 return DW_ERROR_UNKNOWN; | |
3614 } | |
3615 | |
3616 /* | |
3617 * Cancels the print job, typically called from a draw page callback. | |
3618 * Parameters: | |
3619 * print: Handle to the print object returned by dw_print_new(). | |
3620 */ | |
3621 void API dw_print_cancel(HPRINT print) | |
3622 { | |
3623 } | |
3624 | |
3625 /* | |
3626 * Creates a new system notification if possible. | |
3627 * Parameters: | |
3628 * title: The short title of the notification. | |
3629 * imagepath: Path to an image to display or NULL if none. | |
3630 * description: A longer description of the notification, | |
3631 * or NULL if none is necessary. | |
3632 * Returns: | |
3633 * A handle to the notification which can be used to attach a "clicked" event if desired, | |
3634 * or NULL if it fails or notifications are not supported by the system. | |
3635 * Remarks: | |
3636 * This will create a system notification that will show in the notifaction panel | |
3637 * on supported systems, which may be clicked to perform another task. | |
3638 */ | |
3639 HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...) | |
3640 { | |
3641 return 0; | |
3642 } | |
3643 | |
3644 /* | |
3645 * Sends a notification created by dw_notification_new() after attaching signal handler. | |
3646 * Parameters: | |
3647 * notification: The handle to the notification returned by dw_notification_new(). | |
3648 * Returns: | |
3649 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. | |
3650 */ | |
3651 int API dw_notification_send(HWND notification) | |
3652 { | |
3653 return DW_ERROR_UNKNOWN; | |
3654 } | |
3655 | |
3656 /* | |
3657 * Converts a UTF-8 encoded string into a wide string. | |
3658 * Parameters: | |
3659 * utf8string: UTF-8 encoded source string. | |
3660 * Returns: | |
3661 * Wide string that needs to be freed with dw_free() | |
3662 * or NULL on failure. | |
3663 */ | |
3664 wchar_t * API dw_utf8_to_wchar(const char *utf8string) | |
3665 { | |
3666 return NULL; | |
3667 } | |
3668 | |
3669 /* | |
3670 * Converts a wide string into a UTF-8 encoded string. | |
3671 * Parameters: | |
3672 * wstring: Wide source string. | |
3673 * Returns: | |
3674 * UTF-8 encoded string that needs to be freed with dw_free() | |
3675 * or NULL on failure. | |
3676 */ | |
3677 char * API dw_wchar_to_utf8(const wchar_t *wstring) | |
3678 { | |
3679 return NULL; | |
3680 } | |
3681 | |
3682 /* | |
3683 * Gets the state of the requested library feature. | |
3684 * Parameters: | |
3685 * feature: The requested feature for example DW_FEATURE_DARK_MODE | |
3686 * Returns: | |
3687 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. | |
3688 * DW_FEATURE_DISABLED if the feature is supported but disabled. | |
3689 * DW_FEATURE_ENABLED if the feature is supported and enabled. | |
3690 * Other value greater than 1, same as enabled but with extra info. | |
3691 */ | |
3692 int API dw_feature_get(DWFEATURE feature) | |
3693 { | |
3694 switch(feature) | |
3695 { | |
3696 #if 0 | |
3697 case DW_FEATURE_HTML: /* Supports the HTML Widget */ | |
3698 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ | |
3699 case DW_FEATURE_WINDOW_BORDER: /* Supports custom window border sizes */ | |
3700 case DW_FEATURE_WINDOW_TRANSPARENCY: /* Supports window frame transparency */ | |
3701 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ | |
3702 case DW_FEATURE_MLE_AUTO_COMPLETE: /* Supports auto completion in Multi-line Edit boxes */ | |
3703 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ | |
3704 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ | |
3705 case DW_FEATURE_MDI: /* Supports Multiple Document Interface window frame */ | |
3706 case DW_FEATURE_NOTEBOOK_STATUS_TEXT: /* Supports status text area on notebook/tabbed controls */ | |
3707 case DW_FEATURE_NOTIFICATION: /* Supports sending system notifications */ | |
3708 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ | |
3709 case DW_FEATURE_MLE_RICH_EDIT: /* Supports Rich Edit based MLE control (Windows) */ | |
3710 case DW_FEATURE_TASK_BAR: /* Supports icons in the taskbar or similar system widget */ | |
3711 case DW_FEATURE_TREE: .* Supports the Tree Widget */ | |
3712 return DW_FEATURE_ENABLED; | |
3713 #endif | |
3714 default: | |
3715 return DW_FEATURE_UNSUPPORTED; | |
3716 } | |
3717 } | |
3718 | |
3719 /* | |
3720 * Sets the state of the requested library feature. | |
3721 * Parameters: | |
3722 * feature: The requested feature for example DW_FEATURE_DARK_MODE | |
3723 * state: DW_FEATURE_DISABLED, DW_FEATURE_ENABLED or any value greater than 1. | |
3724 * Returns: | |
3725 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. | |
3726 * DW_ERROR_NONE if the feature is supported and successfully configured. | |
3727 * DW_ERROR_GENERAL if the feature is supported but could not be configured. | |
3728 * Remarks: | |
3729 * These settings are typically used during dw_init() so issue before | |
3730 * setting up the library with dw_init(). | |
3731 */ | |
3732 int API dw_feature_set(DWFEATURE feature, int state) | |
3733 { | |
3734 switch(feature) | |
3735 { | |
3736 /* These features are supported but not configurable */ | |
3737 #if 0 | |
3738 case DW_FEATURE_HTML: /* Supports the HTML Widget */ | |
3739 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ | |
3740 case DW_FEATURE_WINDOW_BORDER: /* Supports custom window border sizes */ | |
3741 case DW_FEATURE_WINDOW_TRANSPARENCY: /* Supports window frame transparency */ | |
3742 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ | |
3743 case DW_FEATURE_MLE_AUTO_COMPLETE: /* Supports auto completion in Multi-line Edit boxes */ | |
3744 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ | |
3745 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ | |
3746 case DW_FEATURE_MDI: /* Supports Multiple Document Interface window frame */ | |
3747 case DW_FEATURE_NOTEBOOK_STATUS_TEXT: /* Supports status text area on notebook/tabbed controls */ | |
3748 case DW_FEATURE_NOTIFICATION: /* Supports sending system notifications */ | |
3749 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ | |
3750 case DW_FEATURE_MLE_RICH_EDIT: /* Supports Rich Edit based MLE control (Windows) */ | |
3751 case DW_FEATURE_TASK_BAR: /* Supports icons in the taskbar or similar system widget */ | |
3752 case DW_FEATURE_TREE: .* Supports the Tree Widget */ | |
3753 return DW_ERROR_GENERAL; | |
3754 #endif | |
3755 /* These features are supported and configurable */ | |
3756 default: | |
3757 return DW_FEATURE_UNSUPPORTED; | |
3758 } | |
3759 } | |
3760 | |
3761 #ifdef __cplusplus | |
3762 } | |
3763 #endif |