comparison template/dw.c @ 984:57cb9edb8944

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