forked from alexfru/dflat20
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dflat.doc
1345 lines (1060 loc) · 49.1 KB
/
dflat.doc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Window Classes:
Window classes define the behavior of windows. Each class has its own
unique reaction to messages. Classes derive from other classes.
NORMAL base window for all window classes
APPLICATION application window. has the menu
(derived from NORMAL)
TEXTBOX textbox. base window for listbox, editbox, etc.
(derived from NORMAL)
LISTBOX listbox. base window for menubar
(derived from TEXTBOX)
PICTUREBOX picturebox. a text box onto which you can draw lines
(derived from TEXTBOX)
EDITBOX editbox
(derived from TEXTBOX)
MENUBAR the application's menu bar
(derived from NORMAL)
POPDOWNMENU popdown menu
(derived from LISTBOX)
BUTTON command button in a dialog box
(derived from TEXTBOX)
SPINBUTTON spin button in a dialog box
(derived from LISTBOX)
COMBOBOX combination editbox/listbox
(derived from EDITBOX)
DIALOG dialog box. parent to editbox, button, listbox, etc.
(derived from NORMAL)
ERRORBOX for displaying an error message
(derived from DIALOG)
MESSAGEBOX for displaying a message
(derived from DIALOG)
HELPBOX help window
(derived from DIALOG)
TEXT static text on a dialog box
(derived from TEXTBOX)
RADIOBUTTON radio button on a dialog box
(derived from TEXTBOX)
CHECKBOX check box on a dialog box
(derived from TEXTBOX)
STATUSBAR status bar at the bottom of application window
(derived from TEXTBOX)
D-Flat Window Class Tree
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ ³
³ NORMAL ³
³ ³ ³
³ ÃÄÄ APPLICATION ³
³ ³ ³
³ ÃÄÄ MENUBAR ³
³ ³ ³
³ ÃÄÄ TEXTBOX ³
³ ³ ³ ³
³ ³ ÃÄÄ LISTBOX ³
³ ³ ³ ³ ³
³ ³ ³ ÃÄÄÄÄ POPDOWNMENU ³
³ ³ ³ ³ ³
³ ³ ³ ÀÄÄÄÄ SPINBUTTON ³
³ ³ ³ ³
³ ³ ÃÄÄ EDITBOX ³
³ ³ ³ ³ ³
³ ³ ³ ÀÄÄÄÄ COMBOBOX ³
³ ³ ³ ³
³ ³ ÃÄÄ PICTUREBOX ³
³ ³ ³ ³
³ ³ ÃÄÄ STATUSBAR ³
³ ³ ³ ³
³ ³ ÃÄÄ TEXT ³
³ ³ ³ ³
³ ³ ÃÄÄ BUTTON ³
³ ³ ³ ³
³ ³ ÃÄÄ RADIOBUTTON ³
³ ³ ³ ³
³ ³ ÀÄÄ CHECKBOX ³
³ ³ ³
³ ÀÄÄ DIALOG ³
³ ³ ³
³ ÃÄÄ ERRORBOX ³
³ ³ ³
³ ÃÄÄ MESSAGEBOX ³
³ ³ ³
³ ÀÄÄ HELPBOX ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Window Attributes:
Every window has an attribute word that defines some of its
appearance and behavior. The following values are bitwise flags that
OR together to make a window's attributes.
You can establish default attributes for a window's class, add
additional attributes when you create the window, and use the
AddAttribute, ClearAttribute, and TestAttribute macros to change and
test a window's attributes.
SHADOW has a shadow
MOVEABLE can move the window with mouse or cursor
SIZEABLE can resize the window with mouse or cursor
HASMENUBAR has a menubar (an application window)
VSCROLLBAR has a vertical scroll bar
HSCROLLBAR has a horizontal scroll bar
VISIBLE is visible
SAVESELF saves its own video memory
TITLEBAR has a title bar
CONTROLBOX has a control box and control menu
MINMAXBOX has a min/max box
NOCLIP is not clipped to its parent's borders
READONLY is a readonly textbox
MULTILINE is a multiline editbox or listbox
HASBORDER has a border
HASSTATUSBAR has a statusbar (application window only)
Messages:
A D-Flat program is message-driven. You initiate message processing
with the init_messages function, create a window with the
CreateWindow function, and go into the message dispatching loop with
the dispatch_message function.
A window can have a window-processing function. When the user causes
events to occur by pressing keys and using the mouse, D-Flat sends
messages to the window's function. That function can send messages to
itself and other windows with the SendMessage and PostMessage
functions.
Windows are declared as members of a class. Every class has a default
window-processing function. If you do not provide one for an instance
of a window class, the default one receives messages for the window.
Your custom window-processing function--if one exists--should chain to
the default window-processing function for the blass by calling the
DefaultWndProc function.
There are five things a window-processing function can do with a
message:
- ignore it and let the D-Flat default processing occur.
- suppress it by returning without chaining to the default
window-processing function for the window class.
- chain to the default window-processing function and then do some
additional processing.
- do some preliminary processing and then chain to the default
window-processing function.
- do all the processing of the message and then return without
chaining to the default window-processing function for the
window class.
Following are the messages that an application program would use.
There are other messages, but they are used by D-Flat only.
Process Communication Messages
START start message processing (not used now)
Sent:
P1:
P2:
Returns:
STOP stop message processing
Sent: by application window to NULL to stop message
dispatch loop
P1:
P2:
Returns:
COMMAND send a command to a window
Sent: to send command
P1: command code (commands.h)
P2: additional data (command-dependent)
If the command code is a menu selection, P2 is the
position of the selection on the menu (1,2,...)
If the command code is a dialog box control, P2 is
ENTERFOCUS when the command gets the focus, LEAVEFOCUS
when the command loses the focus, and 0 when the user
executes the control's command, e.g. presses a button.
Returns: Nothing if sent by PostCommand
Command-dependent value if sent by SendCommand
Window Management Messages
CREATE_WINDOW create a window
Sent: by DFLAT to new window after window is created
P1:
P2:
Returns:
OPEN_WINDOW open a window
Sent: (posted) by DFLAT to new window after window is created
P1:
P2:
Returns:
SHOW_WINDOW show a window
Sent: by the app to the window to display the window
P1:
P2:
Returns:
HIDE_WINDOW hide a window
Sent: by the app to the window to hide the window
P1:
P2:
Returns:
CLOSE_WINDOW delete a window
Sent: by the app to destroy a window
P1:
P2:
Returns:
SETFOCUS set and clear the focus
Sent: by D-Flat or the app to set or release the focus
P1: true = set, false = release
P2:
Returns:
PAINT paint the window's data space
Sent: to paint the client area of a window
P1: address of RECT relative to window (0/0 = upper left)
to paint or 0 to paint entire client area
P2: True to make non-focus window paint without clipping
Returns:
BORDER paint the window's border
Sent: to paint a window's border
P1: address of RECT relative to window (0/0 = upper left)
to paint or 0 to paint entire border
P2:
Returns: FALSE to suppress D-Flat title display
(e.g. the window displays its own border)
TITLE display the window's title
Sent: by D-Flat when it is about to display a window's title
P1: address of RECT relative to window (0/0 = upper left)
to paint or 0 to paint entire title
P2:
Returns: FALSE to suppress D-Flat title display
(e.g. the window displays its own title)
MOVE move the window
Sent: to move a window
P1: new left coordinate
P2: new upper coordinate
Returns:
SIZE change the window's size
Sent: to resize a window
P1: new right coordinate
P2: new lower coordinate
Returns:
MAXIMIZE maximize the window
Sent: to maximize a window within its parent's client area
P1:
P2:
Returns:
MINIMIZE minimize the window
Sent: to minimize a window to an icon
P1:
P2:
Returns:
RESTORE restore the window
Sent: to restore a window to its position and size prior to the
maximize or minimize operation
P1:
P2:
Returns:
INSIDE_WINDOW test x/y inside a window
Sent: to test to see if coordinates are inside a window
P1: x
P2: y
Returns: true or false
Clock Messages
CLOCKTICK the clock ticked
Sent: every second to a window that has captured the clock
P1: segment of time display string
P2: offset of time display string
Returns:
CAPTURE_CLOCK capture clock into a window
Sent: to capture the clock. To chain clock ticks, send this
message to wnd->PrevClock when you receive the message.
P1:
P2:
Returns:
RELEASE_CLOCK release clock to the system
Sent: to release the captured clock
P1:
P2:
Returns:
Keyboard and Screen Messages
KEYBOARD key was pressed
Sent: when key is pressed. sent to the window that has the focus
P1: keystroke
P2: shift key mask
Returns:
CAPTURE_KEYBOARD capture keyboard into a window
Sent: by window to itself to capture the keyboard
regardless of focus
P1:
P2:
Returns:
RELEASE_KEYBOARD release keyboard to system
Sent: by window to itelf to release the captured keyboard
P1:
P2:
Returns:
KEYBOARD_CURSOR position the keyboard cursor
Sent: to position the keyboard cursor
P1: x (if sent by window, 0 = left client area)
P2: y (if sent by window, 0 = top client area)
if sent with NULL, x/y are relative to the screen
Returns:
CURRENT_KEYBOARD_CURSOR read the cursor position
Sent: to retrieve the cursor position
P1: x (relative to the screen)
P2: y (relative to the screen)
Returns:
HIDE_CURSOR hide the keyboard cursor
Sent: to hide the keyboard cursor
P1:
P2:
Returns:
SHOW_CURSOR display the keyboard cursor
Sent: to display the keyboard cursor
P1:
P2:
Returns:
SAVE_CURSOR save the cursor's configuration
Sent: to save the keyboard cursor's current configuration
P1:
P2:
Returns:
RESTORE_CURSOR restore the saved cursor
Sent: to restore a keyboard cursor's saved configuration
P1:
P2:
Returns:
SHIFT_CHANGED the shift status changed
Sent: to in-focus window when the user presses or
releases shift, alt, or ctrl key
P1: BIOS shift key mask
P2:
Returns:
WAITKEYBOARD wait for key release
Sent: to wait for a keypress release
P1:
P2:
Returns:
Mouse Messages
RESET_MOUSE reset the mouse
Sent: to reset the mouse to the current screen configuration
P1:
P2:
Returns:
MOUSE_TRAVEL set the mouse's travel
Sent: to limit the mouse travel to a screen rectangle
P1: address of a RECT
P2:
Returns:
MOUSE_INSTALLED test for mouse installed
Sent: to see if the mouse is installed
P1:
P2:
Returns: true or false
RIGHT_BUTTON right button pressed
Sent: to window when the user presses the right button
(sent only when mouse cursor is within the window
or the window has captured the mouse)
P1: x
P2: y
Returns:
LEFT_BUTTON left button pressed
Sent: to window when the user presses the left button
(sent only when mouse cursor is within the window
or the window has captured the mouse)
P1: x
P2: y
Returns:
DOUBLE_CLICK left button doubleclicked
Sent: to window when the user double-clicks the left button
(sent only when mouse cursor is within the window
or the window has captured the mouse)
(a LEFT_BUTTON message will have preceded this one)
P1: x
P2: y
Returns:
MOUSE_MOVED mouse changed position
Sent: to window when the mouse has moved
(sent only when mouse cursor is within the window
or the window has captured the mouse)
P1: x
P2: y
Returns:
BUTTON_RELEASED mouse button released
Sent: to window when user releases mouse button
(sent only when mouse cursor is within the window
or the window has captured the mouse)
P1: x
P2: y
Returns:
CURRENT_MOUSE_CURSOR get mouse position
Sent: to determine the current mouse position
P1: address of x
P2: address of y
Returns: mouse coordinates in x and y. If no mouse is installed,
returns -1 in x and y.
MOUSE_CURSOR set mouse position
Sent: to set the current mouse position
P1: x
P2: y
Returns:
SHOW_MOUSE make mouse cursor visible
Sent: to display the mouse cursor
P1:
P2:
Returns:
HIDE_MOUSE hide mouse cursor
Sent: to hide the mouse cursor
P1:
P2:
Returns:
WAITMOUSE wait until button released
Sent: to wait until the user releases the mouse button
P1:
P2:
Returns:
TESTMOUSE test any mouse button pressed
Sent: to see if either mouse button is pressed
P1:
P2:
Returns: true or false
CAPTURE_MOUSE capture mouse into a window
Sent: by/to a window to capture all mouse activity
regardless of whether it occurs inside this window
P1:
P2:
Returns:
RELEASE_MOUSE release the mouse to system
Sent: release a captured mouse
P1:
P2:
Returns:
Text Box Messages
ADDTEXT add text to the text box
Sent: to append a line of text to the text box
P1: address of null-terminated string without \n
(textbox makes its own copy. string can go out of scope.)
P2:
Returns:
DELETETEXT delete line of text from the text box
Sent: to delete a line of text from the text box
P1: line number relative to zero
P2:
Returns:
INSERTTEXT insert line of text into the text box
Sent: to insert a line of text into the text box
P1: address of null-terminated string without \n
P2: line number relative to zero that will follow new line.
Returns:
CLEARTEXT clear the text box
Sent: clear all text from the text box
P1:
P2:
Returns:
SETTEXT set text buffer contents
Sent: To set text buffer to caller's text.
P1: address of text buffer
(lines are terminated by \n without \0)
(textbox makes its own copy. string can go out of scope.)
P2: length of text buffer
Returns:
SCROLL vertical scroll of text box
Sent: to scroll a text window vertically one line
P1: true = scroll up, false = scroll down
P2:
Returns:
HORIZSCROLL horizontal scroll of text box
Sent: to scroll a text window horizontally one column
P1: true = scroll left, false = scroll right
P2:
Returns:
SCROLLPAGE vertical scroll of text box 1 page
Sent: to scroll a text window vertically one page
P1: true = scroll up, false = scroll down
P2:
Returns:
HORIZSCROLLPAGE horizontal scroll of text box 1 page
Sent: to scroll a text window horizontally one page
P1: true = scroll left, false = scroll right
P2:
Returns:
SCROLLDOC document scroll of text box
Sent: to scroll a text window to beginning/end of document
P1: true = scroll to beginning, false = scroll to end
P2:
Returns:
Edit Box Messages
GETTEXT get text from an edit box
Sent: Get the line of text from a single-line editbox
P1: address of receiving buffer
P2: max length to copy
Returns:
SETTEXTLENGTH set maximum text length in an edit box
Sent: to set the maximum number of characters that an editbox
may hold in its buffer.
P1: maximum character count
P2:
Returns:
Application Window Messages
ADDSTATUS write text to the status bar
Sent: to write to or clear status bar text area
P1: address of text (null-terminated string) or NULL to clear
P2:
Returns:
List Box Messages
LB_SELECTION list box selection
Sent: sent by list box to self and to parent (if parent is not
a simple LISTBOX window) when user moves to an entry on
the list box.
P1: selection number: 0, 1, ...
P2: if multi-line selection listbox, shift status mask
if not, true = selection was same as choice (e.g. mouse)
Returns:
LB_CHOOSE list box choice
Sent: sent to parent of list box when user chooses an item
from the list box
P1: selection number: 0, 1, ...
P2:
Returns:
LB_CURRENTSELECTION return the current selection
Sent: To get the current selection number (where the listbox
cursor is positioned)
P1:
P2:
Returns: selection number: 0, 1, ..., or -1 if listbox is empty or
no line is selected.
LB_GETTEXT return the text of selection
Sent: To get a copy of the text at a specified line
P1: Address of string to receive copy of text
P2: Line number: 0, 1, ...
Returns:
LB_SETSELECTION sets the listbox selection
Sent: To change where the listbox cursor points
P1: Line number: 0, 1, ...
P2:
Returns:
Picture Box Messages
DRAWVECTOR Draws a vector
Sent: To draw a vector in the window's client area
P1: address of RECT that describes the vector relative to the
window's client area
(either lf = rt [vertical vector] or tp = bt [horizontal
vector])
P2:
Returns:
DRAWBOX Draws a box
Sent: To draw a box in the window's client area
P1: address of RECT that describes the box relative to the
window's client area
P2:
Returns:
DRAWBAR Draws a barchart bar
Sent: To draw a bar in the window's client area
P1: address of RECT that describes the bar relative to the
window's client area
(either lf = rt [vertical vector] or tp = bt [horizontal
vector])
P2: one of these: SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR
(4 different bar textures)
Returns:
=====================================================
API Functions & Macros:
These are functions and macros defined for use by applications
programs. There are many others defined in the header files. These
others are for D-Flat to use, and programmers need not be concerned
about them except as an expression of their curiosity about how
D-Flat works.
(Note: These specifications are not in any orderly sequence yet.)
-------------------------------------------------------------------
void init_messages(void)
Call this function first to initialize message processing. Continue
only if the function returns a true value. Otherwise, terminate the
processing of your program. A false return occurs from a longjmp that
is executed when D-Flat attempts to allocate memory that is not
available.
-------------------------------------------------------------------
WINDOW CreateWindow(
CLASS Class, /* class of this window */
char *ttl, /* title or NULL */
int left, int top, /* upper left coordinates */
int height, int width, /* dimensions */
void *extension, /* pointer to additional data */
WINDOW parent, /* parent of this window */
int (*wndproc)(struct window *,MESSAGE,PARAM,PARAM),
int attrib) /* window attribute */
This function creates a window. It returns the WINDOW handle that
messages and functions use to identify the window. If you specify
NULL for the parent, the APPLICATION window becomes the parent.
-------------------------------------------------------------------
void PostMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
Post a message to a window. The window will receive the message in
turn during the message-dispatching loop.
-------------------------------------------------------------------
int SendMessage(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
Send a message to a window. The window will receive the message
immediately. Control returns to the sender after the window has
processed the message. The window can return an integer value.
This function can send system messages to NULL. System messages
are ones that D-Flat processes without regard to a particular window.
-------------------------------------------------------------------
int dispatch_message(void)
The message dispatching loop. After opening the first window (usually
the applications window), continue to call this function until it
returns a FALSE value.
-------------------------------------------------------------------
void handshake(void)
This function dispatches messages without allowing any keyboard or
click events to pass through. You use it to allow the clock to run or
the watch icon to move during a lengthy process without allowing
anything to execute a command that might interfere with what your
program is doing.
-------------------------------------------------------------------
int DefaultWndProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
Call this from a window-processing function to chain to the default
window-processing function for the window's class.
-------------------------------------------------------------------
int BaseWndProc(CLASS Class, WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
Call this from the window-processing function of a derived window
class to chain to the window-processing function of the base window's
class.
-------------------------------------------------------------------
int WindowHeight(WINDOW wnd)
int WindowWidth(WINDOW wnd)
These functions return the window's height and width.
-------------------------------------------------------------------
int ClientWidth(WINDOW wnd)
int ClientHeight(WINDOW wnd)
These functions return the height and width of the window's client
area.
-------------------------------------------------------------------
int GetTop(WINDOW wnd)
int GetBottom(WINDOW wnd)
int GetLeft(WINDOW wnd)
int GetRight(WINDOW wnd)
These functions return the screen coordinates of the four corners of
the window.
-------------------------------------------------------------------
int GetClientTop(WINDOW wnd)
int GetClientBottom(WINDOW wnd)
int GetClientLeft(WINDOW wnd)
int GetClientRight(WINDOW wnd)
These functions return the screen coordinates of the four corners of
the window's client area.
-------------------------------------------------------------------
WINDOW GetParent(WINDOW wnd)
Returns the parent of the window or NULL if the window has no
parent.
-------------------------------------------------------------------
WINDOW FirstWindow(wnd)
Returns the first child window that wnd is a parent of or NULL if
wnd has no children.
-------------------------------------------------------------------
WINDOW LastWindow(wnd)
Returns the last child window that wnd is a parent of or NULL if
wnd has no children.
-------------------------------------------------------------------
WINDOW NextWindow(wnd)
Returns the next adjacent sibling window of wnd or NULL if wnd has no
siblings.
-------------------------------------------------------------------
WINDOW PrevWindow(wnd)
Returns the previous adjacent sibling window of wnd or NULL if wnd
has no siblings.
-------------------------------------------------------------------
int CharInView(WINDOW wnd, int x, int y)
Returns true if the x/y character position, relative to the window,
is in view (not clipped at the border of a parent window or the
screen.
-------------------------------------------------------------------
int TopBorderAdj(WINDOW wnd)
Returns the value to add to a y coordinate of the window's client
area to make it relative to the window top.
-------------------------------------------------------------------
int BorderAdj(WINDOW wnd)
Returns the value to add to an x coordinate relative to the window's
client area to make it relative to the window's left edge.
-------------------------------------------------------------------
char *GetTitle(WINDOW wnd)
Returns the address of a window's title, or NULL if the window has no
title.
-------------------------------------------------------------------
void AddTitle(WINDOW wnd, char *title)
Adds or changes the title to an existing window.
-------------------------------------------------------------------
CLASS GetClass(WINDOW wnd)
Returns the class of the window.
-------------------------------------------------------------------
int GetAttribute(WINDOW wnd)
Returns the attribute word of a window.
-------------------------------------------------------------------
void AddAttribute(WINDOW wnd, int attrib)
Adds one or more attributes to a window. OR the attribute values
together.
-------------------------------------------------------------------
void ClearAttribute(WINDOW wnd, int attrib)
Clears one or more attributes from a window. OR the attribute values
together.
-------------------------------------------------------------------
int TestAttribute(WINDOW wnd, int attrib)
Tests one or more attributes in a window. Returns true if any of them
are set. OR the attribute values together.
-------------------------------------------------------------------
int isVisible(WINDOW wnd)
Returns true if the window is visible.
-------------------------------------------------------------------
char *GetText(WINDOW wnd)
Returns the address of the text buffer for a TEXTBOX or derived
window class.
-------------------------------------------------------------------
int GetTextLines(WINDOW wnd)
Returns the number of text lines in a TEXTBOX or derived
window class.
-------------------------------------------------------------------
char *TextLine(WINDOW wnd, int line)
Returns the address of a specified line of text (0, 1, ...) in a
TEXTBOX or derived class.
-------------------------------------------------------------------
void SetProtected(WINDOW wnd)
Protects a TEXTBOX or control derived from a TEXT from having its
data displayed. Displays * for each displayable character. Typically
used for EDITBOX controls used for password input.
-------------------------------------------------------------------
int isActive(MENU *mnu, int command)
Returns true if the command (commands.h) on the menu is active
(enabled).
-------------------------------------------------------------------
char *GetCommandText(MBAR *mn, int cmd)
Returns the address of a menu command's title text.
-------------------------------------------------------------------
void ActivateCommand(MENU *mnu, int command)
void DeactivateCommand(MENU *mnu, int command)
Activate (enable) or deactivate (disable) a command (commands.h) on a
menu.
-------------------------------------------------------------------
int GetCommandToggle(MENU *mnu, int command)
void SetCommandToggle(MENU *mnu, int command)
void ClearCommandToggle(MENU *mnu, int command)
void InvertCommandToggle(MENU *mnu, int command)
Some menu commands are toggles rather than executors of processes.
Examples are the Insert and Word wrap commands on the Options menu.
These functions get, set, clear, and invert the toggle setting for a
specified command on a specified menu.
-------------------------------------------------------------------
int ItemSelected(WINDOW wnd, int line)
This function returns true if the specified item (0, 1, ...) on a
multiple-line selection listbox is selected.
-------------------------------------------------------------------
int DialogBox(
WINDOW wnd, /* parent window of the dialog box */
DBOX *db, /* address of dialog box definition array */
int Modal, /* true if it is a modal dialog box */
int (*wndproc)(struct window *, MESSAGE, PARAM, PARAM)
/* the window processing function or NULL */
)
This function executes a dialog box. If it is a modal dialog box, the
function does not return until the user completes the dialog box. The
return value will be true if the user has selected OK and false if
the user has selected Cancel on the dialog box. If the dialog box is
modeless, the function returns immediately, and the user can select
other things from the screen while the dialog box is still active.
-------------------------------------------------------------------
WINDOW ControlWindow(DBOX *db, enum commands cmd)
This function returns the WINDOW handle of the control specified by
the cmd parameter.
-------------------------------------------------------------------
void MessageBox(char *title, char *message)
void CancelBox(wnd, char *message)
void ErrorMessage(char *message)
int TestErrorMessage(char *message)
int YesNoBox(char *question)
WINDOW MomentaryMessage(char *message)
These functions display generic message boxes. The message text is
one null-terminated string with newlines (\n) to indicate where lines
are to be broken. The size of the boxes adjusts to the width of the
longest line and the number of lines of text. A message may have no
more lines of text than will fit into the largest window that the
screen can display. You must account for the window's border's and
the presence at the bottom of one or more command buttons.
The MessageBox function displays a message in a window with a title
provided by the caller. The window contains the message and an OK
command button.
The CancelBox function displays a message in a window with a
"Wait..." title. The window contains the message and a Cancel command
button. If the user presses the Cancel button before the program
closes the window, the COMMAND, ID_CANCEL message is sent to the
parent window.
The ErrorMessage function displays the message in an error box window
with an OK command button.
The TestErrorMessage function is an error message with OK and Cancel
command buttons. The function returns true if the user selects OK or
presses Enter and false if the user selects Cancel or presses Esc.
The YesNoBox function displays the message with Yes and No command
buttons. The function returns true if the user selects Yes or
presses Enter and false if the user selects No or presses Esc.
The MomentaryMessage function displays a message box and returns its
WINDOW handle. The caller must close the window. The purpose of this
function is to allow you to display a message while some time
consuming process is underway and then erase the message after the
process is done but without any action required from the user.
-------------------------------------------------------------------
int InputBox(WINDOW wnd, char *ttl, char *msg, char *text, int len, int wd)
This function executes a generic one-line user input dialog box. The
wnd parameter is the parent window of the dialog box. The ttl
parameter points to a title string for the dialog box. The msg
parameter points to a prompting text message. The text parameter
points to the string that will receive the user's input. The len
parameter is the length of the input string not including the null
terminator. The wd parameter is the width of the string display. If
the wd parameter is 0, the function computes a width based on the len
parameter.
The function returns a true value if the user chooses the OK command
button and false if the user selects Cancel.
-------------------------------------------------------------------
WINDOW SliderBox(int len, char *ttl, char *msg)
This function displays a dialog box with the specified title and
message, a slider bar of the specified length, and a Cancel button.
The slider bar displays a percent value.
You use the slider box to display feedback to the user when the
program is doing a time-consuming task, such as printing a file.
Periodically, through your process, you send a PAINT message to the
window handle that the SliderBox function returns. The second
parameter is the new percent value. When you have sent 100, the
slider dialog box closes itself. If the user chooses the Cancel
command on the dialog box, your next PAINT message returns FALSE.
Otherwise it returns TRUE.