Force Nagle algorithm off for loopback
[reactos.git] / rosapps / dflat32 / dflat.doc
1 Window Classes:
2
3 Window classes define the behavior of windows. Each class has its own
4 unique reaction to messages. Classes derive from other classes.
5
6 NORMAL base window for all window classes
7 APPLICATION application window. has the menu
8 (derived from NORMAL)
9 TEXTBOX textbox. base window for listbox, editbox, etc.
10 (derived from NORMAL)
11 LISTBOX listbox. base window for menubar
12 (derived from TEXTBOX)
13 PICTUREBOX picturebox. a text box onto which you can draw lines
14 (derived from TEXTBOX)
15 EDITBOX editbox
16 (derived from TEXTBOX)
17 MENUBAR the application's menu bar
18 (derived from NORMAL)
19 POPDOWNMENU popdown menu
20 (derived from LISTBOX)
21 BUTTON command button in a dialog box
22 (derived from TEXTBOX)
23 SPINBUTTON spin button in a dialog box
24 (derived from LISTBOX)
25 COMBOBOX combination editbox/listbox
26 (derived from EDITBOX)
27 DIALOG dialog box. parent to editbox, button, listbox, etc.
28 (derived from NORMAL)
29 ERRORBOX for displaying an error message
30 (derived from DIALOG)
31 MESSAGEBOX for displaying a message
32 (derived from DIALOG)
33 HELPBOX help window
34 (derived from DIALOG)
35 TEXT static text on a dialog box
36 (derived from TEXTBOX)
37 RADIOBUTTON radio button on a dialog box
38 (derived from TEXTBOX)
39 CHECKBOX check box on a dialog box
40 (derived from TEXTBOX)
41 STATUSBAR status bar at the bottom of application window
42 (derived from TEXTBOX)
43
44 D-Flat Window Class Tree
45 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
46 ³ ³
47 ³ NORMAL ³
48 ³ ³ ³
49 ³ ÃÄÄ APPLICATION ³
50 ³ ³ ³
51 ³ ÃÄÄ MENUBAR ³
52 ³ ³ ³
53 ³ ÃÄÄ TEXTBOX ³
54 ³ ³ ³ ³
55 ³ ³ ÃÄÄ LISTBOX ³
56 ³ ³ ³ ³ ³
57 ³ ³ ³ ÃÄÄÄÄ POPDOWNMENU ³
58 ³ ³ ³ ³ ³
59 ³ ³ ³ ÀÄÄÄÄ SPINBUTTON ³
60 ³ ³ ³ ³
61 ³ ³ ÃÄÄ EDITBOX ³
62 ³ ³ ³ ³ ³
63 ³ ³ ³ ÀÄÄÄÄ COMBOBOX ³
64 ³ ³ ³ ³
65 ³ ³ ÃÄÄ PICTUREBOX ³
66 ³ ³ ³ ³
67 ³ ³ ÃÄÄ STATUSBAR ³
68 ³ ³ ³ ³
69 ³ ³ ÃÄÄ TEXT ³
70 ³ ³ ³ ³
71 ³ ³ ÃÄÄ BUTTON ³
72 ³ ³ ³ ³
73 ³ ³ ÃÄÄ RADIOBUTTON ³
74 ³ ³ ³ ³
75 ³ ³ ÀÄÄ CHECKBOX ³
76 ³ ³ ³
77 ³ ÀÄÄ DIALOG ³
78 ³ ³ ³
79 ³ ÃÄÄ ERRORBOX ³
80 ³ ³ ³
81 ³ ÃÄÄ MESSAGEBOX ³
82 ³ ³ ³
83 ³ ÀÄÄ HELPBOX ³
84 ³ ³
85 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
86
87
88 Window Attributes:
89
90 Every window has an attribute word that defines some of its
91 appearance and behavior. The following values are bitwise flags that
92 OR together to make a window's attributes.
93
94 You can establish default attributes for a window's class, add
95 additional attributes when you create the window, and use the
96 AddAttribute, ClearAttribute, and TestAttribute macros to change and
97 test a window's attributes.
98
99 SHADOW has a shadow
100 MOVEABLE can move the window with mouse or cursor
101 SIZEABLE can resize the window with mouse or cursor
102 HASMENUBAR has a menubar (an application window)
103 VSCROLLBAR has a vertical scroll bar
104 HSCROLLBAR has a horizontal scroll bar
105 VISIBLE is visible
106 SAVESELF saves its own video memory
107 TITLEBAR has a title bar
108 CONTROLBOX has a control box and control menu
109 MINMAXBOX has a min/max box
110 NOCLIP is not clipped to its parent's borders
111 READONLY is a readonly textbox
112 MULTILINE is a multiline editbox or listbox
113 HASBORDER has a border
114 HASSTATUSBAR has a statusbar (application window only)
115
116 Messages:
117
118 A D-Flat program is message-driven. You initiate message processing
119 with the init_messages function, create a window with the
120 CreateWindow function, and go into the message dispatching loop with
121 the dispatch_message function.
122
123 A window can have a window-processing function. When the user causes
124 events to occur by pressing keys and using the mouse, D-Flat sends
125 messages to the window's function. That function can send messages to
126 itself and other windows with the SendMessage and PostMessage
127 functions.
128
129 Windows are declared as members of a class. Every class has a default
130 window-processing function. If you do not provide one for an instance
131 of a window class, the default one receives messages for the window.
132 Your custom window-processing function--if one exists--should chain to
133 the default window-processing function for the blass by calling the
134 DefaultWndProc function.
135
136 There are five things a window-processing function can do with a
137 message:
138 - ignore it and let the D-Flat default processing occur.
139 - suppress it by returning without chaining to the default
140 window-processing function for the window class.
141 - chain to the default window-processing function and then do some
142 additional processing.
143 - do some preliminary processing and then chain to the default
144 window-processing function.
145 - do all the processing of the message and then return without
146 chaining to the default window-processing function for the
147 window class.
148
149 Following are the messages that an application program would use.
150 There are other messages, but they are used by D-Flat only.
151
152 Process Communication Messages
153
154 START start message processing (not used now)
155 Sent:
156 P1:
157 P2:
158 Returns:
159
160 STOP stop message processing
161 Sent: by application window to NULL to stop message
162 dispatch loop
163 P1:
164 P2:
165 Returns:
166
167 COMMAND send a command to a window
168 Sent: to send command
169 P1: command code (commands.h)
170 P2: additional data (command-dependent)
171 If the command code is a menu selection, P2 is the
172 position of the selection on the menu (1,2,...)
173 If the command code is a dialog box control, P2 is
174 ENTERFOCUS when the command gets the focus, LEAVEFOCUS
175 when the command loses the focus, and 0 when the user
176 executes the control's command, e.g. presses a button.
177 Returns: Nothing if sent by PostCommand
178 Command-dependent value if sent by SendCommand
179
180
181 Window Management Messages
182
183 CREATE_WINDOW create a window
184 Sent: by DFLAT to new window after window is created
185 P1:
186 P2:
187 Returns:
188
189 OPEN_WINDOW open a window
190 Sent: (posted) by DFLAT to new window after window is created
191 P1:
192 P2:
193 Returns:
194
195 SHOW_WINDOW show a window
196 Sent: by the app to the window to display the window
197 P1:
198 P2:
199 Returns:
200
201 HIDE_WINDOW hide a window
202 Sent: by the app to the window to hide the window
203 P1:
204 P2:
205 Returns:
206
207 CLOSE_WINDOW delete a window
208 Sent: by the app to destroy a window
209 P1:
210 P2:
211 Returns:
212
213 SETFOCUS set and clear the focus
214 Sent: by D-Flat or the app to set or release the focus
215 P1: true = set, false = release
216 P2:
217 Returns:
218
219 PAINT paint the window's data space
220 Sent: to paint the client area of a window
221 P1: address of RECT relative to window (0/0 = upper left)
222 to paint or 0 to paint entire client area
223 P2: True to make non-focus window paint without clipping
224 Returns:
225
226 BORDER paint the window's border
227 Sent: to paint a window's border
228 P1: address of RECT relative to window (0/0 = upper left)
229 to paint or 0 to paint entire border
230 P2:
231 Returns: FALSE to suppress D-Flat title display
232 (e.g. the window displays its own border)
233
234 TITLE display the window's title
235 Sent: by D-Flat when it is about to display a window's title
236 P1: address of RECT relative to window (0/0 = upper left)
237 to paint or 0 to paint entire title
238 P2:
239 Returns: FALSE to suppress D-Flat title display
240 (e.g. the window displays its own title)
241
242 MOVE move the window
243 Sent: to move a window
244 P1: new left coordinate
245 P2: new upper coordinate
246 Returns:
247
248 SIZE change the window's size
249 Sent: to resize a window
250 P1: new right coordinate
251 P2: new lower coordinate
252 Returns:
253
254 MAXIMIZE maximize the window
255 Sent: to maximize a window within its parent's client area
256 P1:
257 P2:
258 Returns:
259
260 MINIMIZE minimize the window
261 Sent: to minimize a window to an icon
262 P1:
263 P2:
264 Returns:
265
266 RESTORE restore the window
267 Sent: to restore a window to its position and size prior to the
268 maximize or minimize operation
269 P1:
270 P2:
271 Returns:
272
273 INSIDE_WINDOW test x/y inside a window
274 Sent: to test to see if coordinates are inside a window
275 P1: x
276 P2: y
277 Returns: true or false
278
279
280 Clock Messages
281
282 CLOCKTICK the clock ticked
283 Sent: every second to a window that has captured the clock
284 P1: segment of time display string
285 P2: offset of time display string
286 Returns:
287
288 CAPTURE_CLOCK capture clock into a window
289 Sent: to capture the clock. To chain clock ticks, send this
290 message to wnd->PrevClock when you receive the message.
291 P1:
292 P2:
293 Returns:
294
295 RELEASE_CLOCK release clock to the system
296 Sent: to release the captured clock
297 P1:
298 P2:
299 Returns:
300
301
302 Keyboard and Screen Messages
303
304 KEYBOARD key was pressed
305 Sent: when key is pressed. sent to the window that has the focus
306 P1: keystroke
307 P2: shift key mask
308 Returns:
309
310 CAPTURE_KEYBOARD capture keyboard into a window
311 Sent: by window to itself to capture the keyboard
312 regardless of focus
313 P1:
314 P2:
315 Returns:
316
317 RELEASE_KEYBOARD release keyboard to system
318 Sent: by window to itelf to release the captured keyboard
319 P1:
320 P2:
321 Returns:
322
323 KEYBOARD_CURSOR position the keyboard cursor
324 Sent: to position the keyboard cursor
325 P1: x (if sent by window, 0 = left client area)
326 P2: y (if sent by window, 0 = top client area)
327 if sent with NULL, x/y are relative to the screen
328 Returns:
329
330 CURRENT_KEYBOARD_CURSOR read the cursor position
331 Sent: to retrieve the cursor position
332 P1: x (relative to the screen)
333 P2: y (relative to the screen)
334 Returns:
335
336 HIDE_CURSOR hide the keyboard cursor
337 Sent: to hide the keyboard cursor
338 P1:
339 P2:
340 Returns:
341
342 SHOW_CURSOR display the keyboard cursor
343 Sent: to display the keyboard cursor
344 P1:
345 P2:
346 Returns:
347
348 SAVE_CURSOR save the cursor's configuration
349 Sent: to save the keyboard cursor's current configuration
350 P1:
351 P2:
352 Returns:
353
354 RESTORE_CURSOR restore the saved cursor
355 Sent: to restore a keyboard cursor's saved configuration
356 P1:
357 P2:
358 Returns:
359
360 SHIFT_CHANGED the shift status changed
361 Sent: to in-focus window when the user presses or
362 releases shift, alt, or ctrl key
363 P1: BIOS shift key mask
364 P2:
365 Returns:
366
367 WAITKEYBOARD wait for key release
368 Sent: to wait for a keypress release
369 P1:
370 P2:
371 Returns:
372
373
374 Mouse Messages
375
376 RESET_MOUSE reset the mouse
377 Sent: to reset the mouse to the current screen configuration
378 P1:
379 P2:
380 Returns:
381
382 MOUSE_TRAVEL set the mouse's travel
383 Sent: to limit the mouse travel to a screen rectangle
384 P1: address of a RECT
385 P2:
386 Returns:
387
388 MOUSE_INSTALLED test for mouse installed
389 Sent: to see if the mouse is installed
390 P1:
391 P2:
392 Returns: true or false
393
394 RIGHT_BUTTON right button pressed
395 Sent: to window when the user presses the right button
396 (sent only when mouse cursor is within the window
397 or the window has captured the mouse)
398 P1: x
399 P2: y
400 Returns:
401
402 LEFT_BUTTON left button pressed
403 Sent: to window when the user presses the left button
404 (sent only when mouse cursor is within the window
405 or the window has captured the mouse)
406 P1: x
407 P2: y
408 Returns:
409
410 DOUBLE_CLICK left button doubleclicked
411 Sent: to window when the user double-clicks the left button
412 (sent only when mouse cursor is within the window
413 or the window has captured the mouse)
414 (a LEFT_BUTTON message will have preceded this one)
415 P1: x
416 P2: y
417 Returns:
418
419 MOUSE_MOVED mouse changed position
420 Sent: to window when the mouse has moved
421 (sent only when mouse cursor is within the window
422 or the window has captured the mouse)
423 P1: x
424 P2: y
425 Returns:
426
427 BUTTON_RELEASED mouse button released
428 Sent: to window when user releases mouse button
429 (sent only when mouse cursor is within the window
430 or the window has captured the mouse)
431 P1: x
432 P2: y
433 Returns:
434
435 CURRENT_MOUSE_CURSOR get mouse position
436 Sent: to determine the current mouse position
437 P1: address of x
438 P2: address of y
439 Returns: mouse coordinates in x and y. If no mouse is installed,
440 returns -1 in x and y.
441
442 MOUSE_CURSOR set mouse position
443 Sent: to set the current mouse position
444 P1: x
445 P2: y
446 Returns:
447
448 SHOW_MOUSE make mouse cursor visible
449 Sent: to display the mouse cursor
450 P1:
451 P2:
452 Returns:
453
454 HIDE_MOUSE hide mouse cursor
455 Sent: to hide the mouse cursor
456 P1:
457 P2:
458 Returns:
459
460 WAITMOUSE wait until button released
461 Sent: to wait until the user releases the mouse button
462 P1:
463 P2:
464 Returns:
465
466 TESTMOUSE test any mouse button pressed
467 Sent: to see if either mouse button is pressed
468 P1:
469 P2:
470 Returns: true or false
471
472 CAPTURE_MOUSE capture mouse into a window
473 Sent: by/to a window to capture all mouse activity
474 regardless of whether it occurs inside this window
475 P1:
476 P2:
477 Returns:
478
479 RELEASE_MOUSE release the mouse to system
480 Sent: release a captured mouse
481 P1:
482 P2:
483 Returns:
484
485
486 Text Box Messages
487
488 ADDTEXT add text to the text box
489 Sent: to append a line of text to the text box
490 P1: address of null-terminated string without \n
491 (textbox makes its own copy. string can go out of scope.)
492 P2:
493 Returns:
494
495 DELETETEXT delete line of text from the text box
496 Sent: to delete a line of text from the text box
497 P1: line number relative to zero
498 P2:
499 Returns:
500
501 INSERTTEXT insert line of text into the text box
502 Sent: to insert a line of text into the text box
503 P1: address of null-terminated string without \n
504 P2: line number relative to zero that will follow new line.
505 Returns:
506
507 CLEARTEXT clear the text box
508 Sent: clear all text from the text box
509 P1:
510 P2:
511 Returns:
512
513 SETTEXT set text buffer contents
514 Sent: To set text buffer to caller's text.
515 P1: address of text buffer
516 (lines are terminated by \n without \0)
517 (textbox makes its own copy. string can go out of scope.)
518 P2: length of text buffer
519 Returns:
520
521 SCROLL vertical scroll of text box
522 Sent: to scroll a text window vertically one line
523 P1: true = scroll up, false = scroll down
524 P2:
525 Returns:
526
527 HORIZSCROLL horizontal scroll of text box
528 Sent: to scroll a text window horizontally one column
529 P1: true = scroll left, false = scroll right
530 P2:
531 Returns:
532
533 SCROLLPAGE vertical scroll of text box 1 page
534 Sent: to scroll a text window vertically one page
535 P1: true = scroll up, false = scroll down
536 P2:
537 Returns:
538
539 HORIZSCROLLPAGE horizontal scroll of text box 1 page
540 Sent: to scroll a text window horizontally one page
541 P1: true = scroll left, false = scroll right
542 P2:
543 Returns:
544
545 SCROLLDOC document scroll of text box
546 Sent: to scroll a text window to beginning/end of document
547 P1: true = scroll to beginning, false = scroll to end
548 P2:
549 Returns:
550
551 Edit Box Messages
552
553 GETTEXT get text from an edit box
554 Sent: Get the line of text from a single-line editbox
555 P1: address of receiving buffer
556 P2: max length to copy
557 Returns:
558
559 SETTEXTLENGTH set maximum text length in an edit box
560 Sent: to set the maximum number of characters that an editbox
561 may hold in its buffer.
562 P1: maximum character count
563 P2:
564 Returns:
565
566
567 Application Window Messages
568
569 ADDSTATUS write text to the status bar
570 Sent: to write to or clear status bar text area
571 P1: address of text (null-terminated string) or NULL to clear
572 P2:
573 Returns:
574
575 List Box Messages
576
577 LB_SELECTION list box selection
578 Sent: sent by list box to self and to parent (if parent is not
579 a simple LISTBOX window) when user moves to an entry on
580 the list box.
581 P1: selection number: 0, 1, ...
582 P2: if multi-line selection listbox, shift status mask
583 if not, true = selection was same as choice (e.g. mouse)
584 Returns:
585
586 LB_CHOOSE list box choice
587 Sent: sent to parent of list box when user chooses an item
588 from the list box
589 P1: selection number: 0, 1, ...
590 P2:
591 Returns:
592
593 LB_CURRENTSELECTION return the current selection
594 Sent: To get the current selection number (where the listbox
595 cursor is positioned)
596 P1:
597 P2:
598 Returns: selection number: 0, 1, ..., or -1 if listbox is empty or
599 no line is selected.
600
601 LB_GETTEXT return the text of selection
602 Sent: To get a copy of the text at a specified line
603 P1: Address of string to receive copy of text
604 P2: Line number: 0, 1, ...
605 Returns:
606
607 LB_SETSELECTION sets the listbox selection
608 Sent: To change where the listbox cursor points
609 P1: Line number: 0, 1, ...
610 P2:
611 Returns:
612
613 Picture Box Messages
614
615 DRAWVECTOR Draws a vector
616 Sent: To draw a vector in the window's client area
617 P1: address of RECT that describes the vector relative to the
618 window's client area
619 (either lf = rt [vertical vector] or tp = bt [horizontal
620 vector])
621 P2:
622 Returns:
623
624 DRAWBOX Draws a box
625 Sent: To draw a box in the window's client area
626 P1: address of RECT that describes the box relative to the
627 window's client area
628 P2:
629 Returns:
630
631 DRAWBAR Draws a barchart bar
632 Sent: To draw a bar in the window's client area
633 P1: address of RECT that describes the bar relative to the
634 window's client area
635 (either lf = rt [vertical vector] or tp = bt [horizontal
636 vector])
637 P2: one of these: SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR
638 (4 different bar textures)
639 Returns:
640
641 =====================================================
642
643 API Functions & Macros:
644
645 These are functions and macros defined for use by applications
646 programs. There are many others defined in the header files. These
647 others are for D-Flat to use, and programmers need not be concerned
648 about them except as an expression of their curiosity about how
649 D-Flat works.
650
651
652 (Note: These specifications are not in any orderly sequence yet.)
653
654
655 -------------------------------------------------------------------
656 void init_messages(void)
657
658 Call this function first to initialize message processing. Continue
659 only if the function returns a true value. Otherwise, terminate the
660 processing of your program. A false return occurs from a longjmp that
661 is executed when D-Flat attempts to allocate memory that is not
662 available.
663
664 -------------------------------------------------------------------
665 WINDOW CreateWindow(
666 CLASS Class, /* class of this window */
667 char *ttl, /* title or NULL */
668 int left, int top, /* upper left coordinates */
669 int height, int width, /* dimensions */
670 void *extension, /* pointer to additional data */
671 WINDOW parent, /* parent of this window */
672 int (*wndproc)(struct window *,MESSAGE,PARAM,PARAM),
673 int attrib) /* window attribute */
674
675 This function creates a window. It returns the WINDOW handle that
676 messages and functions use to identify the window. If you specify
677 NULL for the parent, the APPLICATION window becomes the parent.
678
679 -------------------------------------------------------------------
680 void PostMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
681
682 Post a message to a window. The window will receive the message in
683 turn during the message-dispatching loop.
684
685 -------------------------------------------------------------------
686 int SendMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
687
688 Send a message to a window. The window will receive the message
689 immediately. Control returns to the sender after the window has
690 processed the message. The window can return an integer value.
691
692 This function can send system messages to NULL. System messages
693 are ones that D-Flat processes without regard to a particular window.
694 -------------------------------------------------------------------
695 int dispatch_message(void)
696
697 The message dispatching loop. After opening the first window (usually
698 the applications window), continue to call this function until it
699 returns a FALSE value.
700 -------------------------------------------------------------------
701 void handshake(void)
702
703 This function dispatches messages without allowing any keyboard or
704 click events to pass through. You use it to allow the clock to run or
705 the watch icon to move during a lengthy process without allowing
706 anything to execute a command that might interfere with what your
707 program is doing.
708
709 -------------------------------------------------------------------
710 int TestCriticalError(void)
711
712 -------------------------------------------------------------------
713 int DefaultWndProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
714
715 Call this from a window-processing function to chain to the default
716 window-processing function for the window's class.
717
718 -------------------------------------------------------------------
719 int BaseWndProc(CLASS Class, WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
720
721 Call this from the window-processing function of a derived window
722 class to chain to the window-processing function of the base window's
723 class.
724
725 -------------------------------------------------------------------
726 int WindowHeight(WINDOW wnd)
727 int WindowWidth(WINDOW wnd)
728
729 These functions return the window's height and width.
730 -------------------------------------------------------------------
731 int ClientWidth(WINDOW wnd)
732 int ClientHeight(WINDOW wnd)
733
734 These functions return the height and width of the window's client
735 area.
736
737 -------------------------------------------------------------------
738 int GetTop(WINDOW wnd)
739 int GetBottom(WINDOW wnd)
740 int GetLeft(WINDOW wnd)
741 int GetRight(WINDOW wnd)
742
743 These functions return the screen coordinates of the four corners of
744 the window.
745
746 -------------------------------------------------------------------
747 int GetClientTop(WINDOW wnd)
748 int GetClientBottom(WINDOW wnd)
749 int GetClientLeft(WINDOW wnd)
750 int GetClientRight(WINDOW wnd)
751
752 These functions return the screen coordinates of the four corners of
753 the window's client area.
754
755 -------------------------------------------------------------------
756 WINDOW GetParent(WINDOW wnd)
757
758 Returns the parent of the window or NULL if the window has no
759 parent.
760
761 -------------------------------------------------------------------
762 WINDOW FirstWindow(wnd)
763
764 Returns the first child window that wnd is a parent of or NULL if
765 wnd has no children.
766
767 -------------------------------------------------------------------
768 WINDOW LastWindow(wnd)
769
770 Returns the last child window that wnd is a parent of or NULL if
771 wnd has no children.
772
773 -------------------------------------------------------------------
774 WINDOW NextWindow(wnd)
775
776 Returns the next adjacent sibling window of wnd or NULL if wnd has no
777 siblings.
778
779 -------------------------------------------------------------------
780 WINDOW PrevWindow(wnd)
781
782 Returns the previous adjacent sibling window of wnd or NULL if wnd
783 has no siblings.
784
785 -------------------------------------------------------------------
786 int CharInView(WINDOW wnd, int x, int y)
787
788 Returns true if the x/y character position, relative to the window,
789 is in view (not clipped at the border of a parent window or the
790 screen.
791
792 -------------------------------------------------------------------
793 int TopBorderAdj(WINDOW wnd)
794
795 Returns the value to add to a y coordinate of the window's client
796 area to make it relative to the window top.
797
798 -------------------------------------------------------------------
799 int BorderAdj(WINDOW wnd)
800
801 Returns the value to add to an x coordinate relative to the window's
802 client area to make it relative to the window's left edge.
803
804 -------------------------------------------------------------------
805 char *GetTitle(WINDOW wnd)
806
807 Returns the address of a window's title, or NULL if the window has no
808 title.
809
810 -------------------------------------------------------------------
811 void AddTitle(WINDOW wnd, char *title)
812
813 Adds or changes the title to an existing window.
814
815 -------------------------------------------------------------------
816 CLASS GetClass(WINDOW wnd)
817
818 Returns the class of the window.
819
820 -------------------------------------------------------------------
821 int GetAttribute(WINDOW wnd)
822
823 Returns the attribute word of a window.
824
825 -------------------------------------------------------------------
826 void AddAttribute(WINDOW wnd, int attrib)
827
828 Adds one or more attributes to a window. OR the attribute values
829 together.
830
831 -------------------------------------------------------------------
832 void ClearAttribute(WINDOW wnd, int attrib)
833
834 Clears one or more attributes from a window. OR the attribute values
835 together.
836
837 -------------------------------------------------------------------
838 int TestAttribute(WINDOW wnd, int attrib)
839
840 Tests one or more attributes in a window. Returns true if any of them
841 are set. OR the attribute values together.
842
843 -------------------------------------------------------------------
844 int isVisible(WINDOW wnd)
845
846 Returns true if the window is visible.
847
848 -------------------------------------------------------------------
849 char *GetText(WINDOW wnd)
850
851 Returns the address of the text buffer for a TEXTBOX or derived
852 window class.
853
854 -------------------------------------------------------------------
855 int GetTextLines(WINDOW wnd)
856
857 Returns the number of text lines in a TEXTBOX or derived
858 window class.
859
860 -------------------------------------------------------------------
861 char *TextLine(WINDOW wnd, int line)
862
863 Returns the address of a specified line of text (0, 1, ...) in a
864 TEXTBOX or derived class.
865
866 -------------------------------------------------------------------
867 void SetProtected(WINDOW wnd)
868
869 Protects a TEXTBOX or control derived from a TEXT from having its
870 data displayed. Displays * for each displayable character. Typically
871 used for EDITBOX controls used for password input.
872
873 -------------------------------------------------------------------
874 int isActive(MENU *mnu, int command)
875
876 Returns true if the command (commands.h) on the menu is active
877 (enabled).
878
879 -------------------------------------------------------------------
880 char *GetCommandText(MBAR *mn, int cmd)
881
882 Returns the address of a menu command's title text.
883
884 -------------------------------------------------------------------
885 void ActivateCommand(MENU *mnu, int command)
886 void DeactivateCommand(MENU *mnu, int command)
887
888 Activate (enable) or deactivate (disable) a command (commands.h) on a
889 menu.
890
891 -------------------------------------------------------------------
892 int GetCommandToggle(MENU *mnu, int command)
893 void SetCommandToggle(MENU *mnu, int command)
894 void ClearCommandToggle(MENU *mnu, int command)
895 void InvertCommandToggle(MENU *mnu, int command)
896
897 Some menu commands are toggles rather than executors of processes.
898 Examples are the Insert and Word wrap commands on the Options menu.
899 These functions get, set, clear, and invert the toggle setting for a
900 specified command on a specified menu.
901
902 -------------------------------------------------------------------
903 int ItemSelected(WINDOW wnd, int line)
904
905 This function returns true if the specified item (0, 1, ...) on a
906 multiple-line selection listbox is selected.
907
908 -------------------------------------------------------------------
909 int DialogBox(
910 WINDOW wnd, /* parent window of the dialog box */
911 DBOX *db, /* address of dialog box definition array */
912 int Modal, /* true if it is a modal dialog box */
913 int (*wndproc)(struct window *, MESSAGE, PARAM, PARAM)
914 /* the window processing function or NULL */
915 )
916
917 This function executes a dialog box. If it is a modal dialog box, the
918 function does not return until the user completes the dialog box. The
919 return value will be true if the user has selected OK and false if
920 the user has selected Cancel on the dialog box. If the dialog box is
921 modeless, the function returns immediately, and the user can select
922 other things from the screen while the dialog box is still active.
923
924 -------------------------------------------------------------------
925 WINDOW ControlWindow(DBOX *db, enum commands cmd)
926
927 This function returns the WINDOW handle of the control specified by
928 the cmd parameter.
929 -------------------------------------------------------------------
930 void MessageBox(char *title, char *message)
931 void CancelBox(wnd, char *message)
932 void ErrorMessage(char *message)
933 int TestErrorMessage(char *message)
934 int YesNoBox(char *question)
935 WINDOW MomentaryMessage(char *message)
936
937 These functions display generic message boxes. The message text is
938 one null-terminated string with newlines (\n) to indicate where lines
939 are to be broken. The size of the boxes adjusts to the width of the
940 longest line and the number of lines of text. A message may have no
941 more lines of text than will fit into the largest window that the
942 screen can display. You must account for the window's border's and
943 the presence at the bottom of one or more command buttons.
944
945 The MessageBox function displays a message in a window with a title
946 provided by the caller. The window contains the message and an OK
947 command button.
948
949 The CancelBox function displays a message in a window with a
950 "Wait..." title. The window contains the message and a Cancel command
951 button. If the user presses the Cancel button before the program
952 closes the window, the COMMAND, ID_CANCEL message is sent to the
953 parent window.
954
955 The ErrorMessage function displays the message in an error box window
956 with an OK command button.
957
958 The TestErrorMessage function is an error message with OK and Cancel
959 command buttons. The function returns true if the user selects OK or
960 presses Enter and false if the user selects Cancel or presses Esc.
961
962 The YesNoBox function displays the message with Yes and No command
963 buttons. The function returns true if the user selects Yes or
964 presses Enter and false if the user selects No or presses Esc.
965
966 The MomentaryMessage function displays a message box and returns its
967 WINDOW handle. The caller must close the window. The purpose of this
968 function is to allow you to display a message while some time
969 consuming process is underway and then erase the message after the
970 process is done but without any action required from the user.
971
972 -------------------------------------------------------------------
973 int InputBox(WINDOW wnd, char *ttl, char *msg, char *text, int len, int wd)
974
975 This function executes a generic one-line user input dialog box. The
976 wnd parameter is the parent window of the dialog box. The ttl
977 parameter points to a title string for the dialog box. The msg
978 parameter points to a prompting text message. The text parameter
979 points to the string that will receive the user's input. The len
980 parameter is the length of the input string not including the null
981 terminator. The wd parameter is the width of the string display. If
982 the wd parameter is 0, the function computes a width based on the len
983 parameter.
984
985 The function returns a true value if the user chooses the OK command
986 button and false if the user selects Cancel.
987
988 -------------------------------------------------------------------
989 WINDOW SliderBox(int len, char *ttl, char *msg)
990
991 This function displays a dialog box with the specified title and
992 message, a slider bar of the specified length, and a Cancel button.
993 The slider bar displays a percent value.
994
995 You use the slider box to display feedback to the user when the
996 program is doing a time-consuming task, such as printing a file.
997 Periodically, through your process, you send a PAINT message to the
998 window handle that the SliderBox function returns. The second
999 parameter is the new percent value. When you have sent 100, the
1000 slider dialog box closes itself. If the user chooses the Cancel
1001 command on the dialog box, your next PAINT message returns FALSE.
1002 Otherwise it returns TRUE.
1003
1004 -------------------------------------------------------------------
1005 int RadioButtonSetting(DBOX *db, enum commands cmd)
1006
1007 This function returns true if the specified command on the specified
1008 dialog box is a pressed radio button.
1009
1010 -------------------------------------------------------------------
1011 void EnableButton(DBOX *db, enum commands cmd)
1012
1013 This function enables a command button on a dialog box. command
1014 buttons are initially enabled when the dialog box is first opened.
1015
1016 -------------------------------------------------------------------
1017 void DisableButton(DBOX *db, enum commands cmd)
1018
1019 This function disables a command button on a dialog box. command
1020 buttons are initially enabled when the dialog box is first opened.
1021
1022 -------------------------------------------------------------------
1023 int ButtonEnabled(DBOX *db, enum commands cmd)
1024
1025 Returns true if the button is enabled.
1026 -------------------------------------------------------------------
1027 void PushRadioButton(DBOX *db, enum commands cmd)
1028
1029 This function presses the specified radio button command on the
1030 specified dialog box.
1031
1032 -------------------------------------------------------------------
1033 void PutItemText(WINDOW wnd, enum commands cmd, char *text)
1034
1035 This function appends a line of text to a TEXT, TEXTBOX, EDITBOX,
1036 LISTBOX, SPINBUTTON, or COMBOBOX control window in a dialog box. The
1037 wnd parameter is the WINDOW handle of the dialog box. The cmd
1038 parameter specifies the command associated with the control item. The
1039 text parameter points to the text to be added. The control window
1040 makes its own copy of the text, so the caller's copy can go out of
1041 scope. If the control window is a COMBOBOX, TEXTBOX, or EDITBOX
1042 window, you must send a PAINT message to the control window so that
1043 the new text will display.
1044
1045 You must call this function while the dialog box is active. That
1046 means that if the dialog box is modal, you must call this function
1047 from within a custom window processing function that you supply when
1048 you call DialogBox.
1049
1050 -------------------------------------------------------------------
1051 void PutComboListText(WINDOW wnd, enum commands cmd, char *text)
1052
1053 This function appends a line of text to the LISTBOX of a COMBOBOX
1054 control window in a dialog box. The wnd parameter is the WINDOW
1055 handle of the dialog box. The cmd parameter specifies the command
1056 associated with the combo box. The text parameter points to the
1057 text to be added. The control window makes its own copy of the text,
1058 so the caller's copy can go out of scope.
1059
1060 You must call this function while the dialog box is active. That
1061 means that if the dialog box is modal, you must call this function
1062 from within a custom window processing function that you supply when
1063 you call DialogBox.
1064
1065 -------------------------------------------------------------------
1066 void GetItemText(WINDOW wnd, enum commands cmd, char *text, int length)
1067
1068 This function copies the text from a TEXT, TEXTBOX, COMBOBOX, or
1069 EDITBOX control window in a dialog box. The wnd parameter is the
1070 WINDOW handle of the dialog box. The cmd parameter specifies the
1071 command associated with the control item. The text parameter points
1072 to the caller's buffer where the text will be copied. The length
1073 parameter specifies the maximum number of characters to copy.
1074
1075 You must call this function while the dialog box is active. That
1076 means that if the dialog box is modal, you must call this function
1077 from within a custom window processing function that you supply when
1078 you call DialogBox.
1079
1080 -------------------------------------------------------------------
1081 char *GetEditBoxText(DBOX *db, enum commands cmd)
1082
1083 This function returns a pointer to the text associated with an
1084 editbox control in a dialog box. You can call it after the dialog box
1085 has completed processing. The buffer is on the heap. Do not free it.
1086 Instead, call SetEditBoxText with a NULL pointer.
1087
1088 -------------------------------------------------------------------
1089 char *GetComboBoxText(DBOX *db, enum commands cmd)
1090
1091 This function returns a pointer to the text associated with an
1092 combo box control in a dialog box. You can call it after the dialog box
1093 has completed processing. The buffer is on the heap. Do not free it.
1094 Instead, call SetEditBoxText with a NULL pointer.
1095
1096 -------------------------------------------------------------------
1097 void SetEditBoxText(DBOX *db, enum commands cmd, char *text)
1098
1099 This function sets the text of a dialog box editbox. You can call
1100 this function before or while the dialog box is open. The dialog box
1101 makes its own copy on the heap, so your text can go out of scope.
1102
1103 -------------------------------------------------------------------
1104 void SetComboBoxText(DBOX *db, enum commands cmd, char *text)
1105
1106 This function sets the text of a dialog box combo box. You can call
1107 this function before or while the dialog box is open. The dialog box
1108 makes its own copy on the heap, so your text can go out of scope.
1109
1110 -------------------------------------------------------------------
1111 char *GetDlgText(DBOX *db, enum commands cmd, char *text)
1112
1113 Similar to GetEditBoxText except that it works with text controls.
1114
1115 -------------------------------------------------------------------
1116 char *SetDlgText(DBOX *db, enum commands cmd, char *text)
1117
1118 Similar to SetEditBoxText except that it works with text controls.
1119
1120 -------------------------------------------------------------------
1121 char *GetDlgTextBox(DBOX *db, enum commands cmd, char *text)
1122
1123 Similar to GetEditBoxText except that it works with textbox controls.
1124
1125 -------------------------------------------------------------------
1126 char *SetDlgTextBox(DBOX *db, enum commands cmd, char *text)
1127
1128 Similar to SetEditBoxText except that it works with textbox controls.
1129
1130 -------------------------------------------------------------------
1131 void SetCheckBox(DBOX *db, enum commands cmd)
1132 void ClearCheckBox(DBOX *db, enum commands cmd)
1133 int CheckBoxSetting(DBOX *db, enum commands cmd)
1134
1135 These functions set, clear, and test the setting of a specified check
1136 box control item on a dialog box.
1137
1138 -------------------------------------------------------------------
1139 void SetDlgTitle(DBOX *db, char *ttl)
1140
1141 This function changes the specified dialog box's title.
1142 -------------------------------------------------------------------
1143 void LoadHelpFile(char *apname);
1144
1145 This function loads the help file. The apname parameter points to
1146 the helpfile name without the .hlp extension.
1147
1148 Call this function at the beginning of an application program or to
1149 change the help file midstream.
1150
1151 -------------------------------------------------------------------
1152 void DisplayHelp(WINDOW wnd, char *Help)
1153
1154 Display the help window identified by the Help parameter. See the
1155 comments in memopad.txt for the format of a help database. You can
1156 get the same effect by sending the DISPLAY_HELP message with a
1157 pointer to the Help string as the first parameter after the message
1158 id.
1159
1160 -------------------------------------------------------------------
1161 char *HelpComment(char *Help)
1162
1163 Retrieve a pointer to the comment text associated with the specified
1164 Help parameter.
1165
1166 -------------------------------------------------------------------
1167 void UnLoadHelpFile(void);
1168
1169 Call this function at the end of a D-Flat application to free the
1170 memory used by a help file.
1171
1172 -------------------------------------------------------------------
1173 void SearchText(WINDOW wnd)
1174
1175 Opens a dialog box for the user to enter a search string. Searches
1176 the wnd TEXTBOX for a match on the string.
1177
1178 -------------------------------------------------------------------
1179 void ReplaceText(WINDOW wnd)
1180
1181 Opens a dialog box for the user to enter search and replacement
1182 strings. Searches the wnd TEXTBOX for a match on the string and
1183 replaces it if found. The dialog box includes an option to replace
1184 all matches.
1185
1186 -------------------------------------------------------------------
1187 void SearchNext(WINDOW wnd)
1188
1189 Assumes that a previous SearchText call has found a match. Searches
1190 for the next match of the same string in the specified EDITBOX
1191 window.
1192
1193 -------------------------------------------------------------------
1194 void WriteTextLine(WINDOW wnd, RECT *rcc, int y, int reverse)
1195
1196 This function displays a text line from a TEXTBOX or derived window
1197 class. The text has already been added to the window with ADDTEXT,
1198 etc. The y parameter specifies which line (0, 1, ...) relative to the
1199 window's text buffer to display. If the specified line is not in
1200 view, the function does nothing. If the reverse parameter is true,
1201 the line displays in the reverse-video colors of the window. The rcc
1202 RECT pointer is usually NULL for applications calls. It points to a
1203 rectangle relative to the window outside of which displays will not
1204 occur.
1205
1206 -------------------------------------------------------------------
1207 void PutWindowLine(WINDOW wnd, void *s, int x, int y)
1208
1209 This function writes a line of text to a window. The x and y
1210 coordinates point to the first character in the window's client area
1211 where the line is to be written. The text must be null-terminated.
1212 This function clips the line if it goes beyond the window or the
1213 screen. The function clips the line if it goes outside the borders of
1214 the window's parent. If other windows overlap the target window, the
1215 text is clipped. Do not use negative values in x or y.
1216
1217 You can assign color values to the global variables foreground and
1218 background to affect the color of the line's display.
1219
1220 -------------------------------------------------------------------
1221 void PutWindowChar(WINDOW wnd, int c, int x, int y)
1222
1223 This function writes the character c to a window. The x and y
1224 coordinates are relative to the window's client area.
1225
1226 The function performs clipping. If the character is beyond the
1227 window's or the screen's borders it is not written. If the window
1228 does not have the NOCLIP attribute, the character is not written if
1229 its coordinates are beyond the margins of its parent window (if the
1230 window has a parent). If other windows overlap the target window, the
1231 text is clipped. Do not use negative values in x or y.
1232
1233 You can assign color values to the global variables foreground and
1234 background to affect the color of the character's display.
1235
1236 -------------------------------------------------------------------
1237 void DrawVector(WINDOW wnd, int x, int y, int len, int hv)
1238
1239 Draw a horizontal vector in a picture box. x and y are character
1240 coordinates relative to the starting position of the vector. len is
1241 the length. hv is TRUE for a horizontal vector and FALSE for a
1242 vertical vector. Sends a DRAWVECTOR message to the window.
1243
1244 Send a PAINT message to the window to display the vectors.
1245
1246 -------------------------------------------------------------------
1247 void DrawBox(WINDOW wnd, int x, int y, int ht, int wd)
1248
1249 Draw a box in a picture box. x and y are character coordinates
1250 relative to the upper left corner of the box. ht and wd are the
1251 height and width of the box. Sends a DRAWBOX message to the window.
1252
1253 Send a PAINT message to the window to display the box.
1254
1255 -------------------------------------------------------------------
1256 void DrawBar(WINDOW wnd, enum VectTypes vt, int x, int y, int len, int hv)
1257
1258 Draw a graph bar in a picture box. vt is one of the following values
1259 to specify the character box used to display the bar: SOLIDBAR,
1260 HEAVYBAR, CROSSBAR, LIGHTBAR. x and y are character coordinates
1261 relative to the starting position of the bar. len is the length. hv
1262 is TRUE for a horizontal bar and FALSE for a vertical bar. Sends a
1263 DRAWBAR message to the window.
1264
1265 Send a PAINT message to the window to display the bars.
1266
1267 -------------------------------------------------------------------
1268 void WindowClientColor(WINDOW wnd, int fg, int bg)
1269
1270 Changes the window client space's foreground and background colors.
1271 -------------------------------------------------------------------
1272 void WindowReverseColor(WINDOW wnd, int fg, int bg)
1273
1274 Changes the window's foreground and background reverse colors, which
1275 are used to display such things as selected text blocks.
1276 -------------------------------------------------------------------
1277 void WindowFrameColor(WINDOW wnd, int fg, int bg)
1278
1279 Changes the window's foreground and background frame colors.
1280 -------------------------------------------------------------------
1281 void WindowHighlightColor(WINDOW wnd, int fg, int bg)
1282
1283 Changes the window's foreground and background highlight colors,
1284 which are used to display highlighted items such as menu selector
1285 bars.
1286 -------------------------------------------------------------------
1287 void MarkTextBlock(WINDOW wnd, int BegLine, int BegCol,
1288 int EndLine, int EndCol)
1289
1290 Marks a block in the specified TEXTBOX window.
1291
1292 -------------------------------------------------------------------
1293 void ClearTextBlock(WINDOW wnd)
1294
1295 Unmarks a marked block in the specified TEXTBOX window.
1296
1297 -------------------------------------------------------------------
1298 void CopyToClipboard(WINDOW wnd)
1299
1300 Copies the marked block from the WINDOW into the Clipboard.
1301
1302 -------------------------------------------------------------------
1303 void CopyTextToClipboard(char *string)
1304
1305 Copies a null-terminated string into the Clipboard.
1306
1307 -------------------------------------------------------------------
1308 void PasteFromClipboard(WINDOW wnd)
1309
1310 Pastes the Clipboard's contents into the specified EDITBOX window at
1311 the current cursor location.
1312
1313 -------------------------------------------------------------------
1314 void ClearClipboard(void)
1315
1316 Clears the clipboard and frees the memory allocated for it. Called by
1317 D-Flat when message processing terminates.
1318
1319 -------------------------------------------------------------------
1320 WINDOW WatchIcon(void)
1321
1322 Displays a wristwatch icon on the screen. The icon has control of the
1323 keyboard and mouse. You must send the CLOSE_WINDOW message to the
1324 WINDOW handle that WatchIcon returns to get rid of the icon.
1325
1326 Use this icon to tell the user to please stand by during long
1327 processes. Call handshake frequently during these processes to
1328 update the date display in the status bar and to allow the watch icon
1329 to move when the user moves the mouse.
1330
1331 -------------------------------------------------------------------
1332 Configurable Items
1333
1334 Global Symbol File Value Description
1335 ------------- --------- ----- ---------------------------------------
1336 MAXMESSAGES DFLAT.H 50 Maximum D-Flat messages queued
1337 MAXCONTROLS DIALBOX.H 26 Maximum Controls on a dialog box
1338 MAXRADIOS DIALBOX.H 20 Maximum radio buttons in a group
1339 MAXSAVES SYSTEM.H 50 Maximum cursor saves
1340 MAXPULLDOWNS MENU.H 15 Maximum number of pull-down menus on
1341 a menu bar (including cascading menus)
1342 MAXSELECTIONS MENU.H 15 Maximum number of selections on
1343 a pull-down menu (includes separators)
1344 MAXCASCADES MENU.H 3 Maximum nesting level of cascaded menus
1345 MAXTEXTLEN DFLAT.H 65000 Maximum text buffer
1346 EDITLEN DFLAT.H 1024 Starting length for multiline EDITBOX
1347 ENTRYLEN DFLAT.H 256 Starting length for single-line EDITBOX
1348 GROWLENGTH DFLAT.H 64 EDITBOX buffers grow by this much
1349
1350