home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / M / MacStarter.sit / applicationProcs.c < prev    next >
MacBinary  |  1992-10-11  |  27.6 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: applicationProcs.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sun Oct 11 16:18:59 1992, modified Sun Oct 11 16:18:59 1992, creator Think C, type ASCII, 27154 bytes "applicationProcs.c" , at 0x6a92 822 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 12 61 70 70 6c 69 63 | 61 74 69 6f 6e 50 72 6f |..applic|ationPro|
|00000010| 63 73 2e 63 00 00 00 00 | 00 00 00 00 00 00 00 00 |cs.c....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 00 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 6a 12 00 | 00 03 36 a6 fe 3c b3 a6 |.....j..|..6..<..|
|00000060| fe 3c b3 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.<......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 53 ae 00 00 |........|....S...|
|00000080| 2f 2a 20 4d 61 63 53 74 | 61 72 74 65 72 20 69 73 |/* MacSt|arter is|
|00000090| 20 61 20 73 68 65 6c 6c | 20 66 6f 72 20 73 69 6d | a shell| for sim|
|000000a0| 70 6c 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 61 70 |ple Maci|ntosh ap|
|000000b0| 70 6c 69 63 61 74 69 6f | 6e 73 20 73 68 65 6c 6c |plicatio|ns shell|
|000000c0| 20 77 72 69 74 74 65 6e | 20 69 6e 0d 20 20 20 54 | written| in. T|
|000000d0| 48 49 4e 4b 20 43 2c 20 | 77 69 74 68 20 73 6f 6d |HINK C, |with som|
|000000e0| 65 20 73 6d 61 6c 6c 20 | 75 73 65 20 6f 66 20 69 |e small |use of i|
|000000f0| 74 73 20 6f 62 6a 65 63 | 74 2d 6f 72 69 65 6e 74 |ts objec|t-orient|
|00000100| 65 64 20 66 65 61 74 75 | 72 65 73 2e 0d 20 20 20 |ed featu|res.. |
|00000110| 54 68 69 73 20 66 69 6c | 65 20 69 73 20 74 68 65 |This fil|e is the|
|00000120| 20 70 6c 61 63 65 20 74 | 6f 20 73 74 61 72 74 20 | place t|o start |
|00000130| 77 68 65 6e 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |when you| want to|
|00000140| 20 77 72 69 74 65 20 61 | 20 6e 65 77 20 61 70 70 | write a| new app|
|00000150| 6c 69 63 61 74 69 6f 6e | 0d 20 20 20 77 69 74 68 |lication|. with|
|00000160| 20 4d 61 63 53 74 61 72 | 74 65 72 2e 20 20 54 68 | MacStar|ter. Th|
|00000170| 65 20 77 68 6f 6c 65 20 | 73 79 73 74 65 6d 20 69 |e whole |system i|
|00000180| 73 20 64 65 73 63 72 69 | 62 65 64 20 69 6e 20 61 |s descri|bed in a|
|00000190| 20 52 45 41 44 4d 45 20 | 66 69 6c 65 20 74 68 61 | README |file tha|
|000001a0| 74 0d 20 20 20 73 68 6f | 75 6c 64 20 62 65 20 69 |t. sho|uld be i|
|000001b0| 6e 20 74 68 65 20 73 61 | 6d 65 20 66 6f 6c 64 65 |n the sa|me folde|
|000001c0| 72 20 77 69 74 68 20 74 | 68 69 73 20 66 69 6c 65 |r with t|his file|
|000001d0| 2e 20 20 54 68 65 72 65 | 20 73 68 6f 75 6c 64 20 |. There| should |
|000001e0| 61 6c 73 6f 20 62 65 0d | 20 20 20 73 61 6d 70 6c |also be.| sampl|
|000001f0| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 50 72 6f |e applic|ationPro|
|00000200| 63 20 66 69 6c 65 73 20 | 28 6b 61 6c 65 69 64 6f |c files |(kaleido|
|00000210| 53 6b 65 74 63 68 2e 63 | 2c 20 70 65 6e 74 6f 6d |Sketch.c|, pentom|
|00000220| 69 6e 6f 73 2e 63 20 61 | 6e 64 0d 20 20 20 73 69 |inos.c a|nd. si|
|00000230| 6d 70 6c 65 53 63 72 6f | 6c 6c 2e 63 29 2e 20 20 |mpleScro|ll.c). |
|00000240| 46 69 6e 61 6c 6c 79 2c | 20 74 68 65 20 66 69 6c |Finally,| the fil|
|00000250| 65 20 75 6e 63 6f 6d 6d | 65 6e 74 65 64 50 72 6f |e uncomm|entedPro|
|00000260| 63 73 2e 63 20 69 73 20 | 61 20 63 6f 70 79 0d 20 |cs.c is |a copy. |
|00000270| 20 20 6f 66 20 74 68 69 | 73 20 66 69 6c 65 20 77 | of thi|s file w|
|00000280| 69 74 68 6f 75 74 20 61 | 6e 79 20 63 6f 6d 6d 65 |ithout a|ny comme|
|00000290| 6e 74 73 2c 20 69 6e 20 | 63 61 73 65 20 79 6f 75 |nts, in |case you|
|000002a0| 20 77 6f 75 6c 64 20 72 | 61 74 68 65 72 20 75 73 | would r|ather us|
|000002b0| 65 20 74 68 61 74 0d 20 | 20 20 61 73 20 61 20 73 |e that. | as a s|
|000002c0| 74 61 72 74 69 6e 67 20 | 70 6f 69 6e 74 2e 0d 20 |tarting |point.. |
|000002d0| 20 20 20 20 20 54 6f 20 | 77 72 69 74 65 20 61 6e | To |write an|
|000002e0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2c 20 79 6f | applica|tion, yo|
|000002f0| 75 20 6e 65 65 64 20 74 | 6f 20 66 69 6c 6c 20 69 |u need t|o fill i|
|00000300| 6e 20 6f 72 20 6d 6f 64 | 69 66 79 20 61 74 20 6c |n or mod|ify at l|
|00000310| 65 61 73 74 20 73 6f 6d | 65 0d 20 20 20 6f 66 20 |east som|e. of |
|00000320| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 73 20 69 6e |the func|tions in|
|00000330| 20 74 68 69 73 20 66 69 | 6c 65 2e 20 20 28 59 6f | this fi|le. (Yo|
|00000340| 75 20 73 68 6f 75 6c 64 | 20 73 74 61 72 74 20 62 |u should| start b|
|00000350| 79 20 63 6f 70 79 69 6e | 67 20 61 6e 64 20 72 65 |y copyin|g and re|
|00000360| 6e 61 6d 69 6e 67 0d 20 | 20 20 74 68 65 20 66 69 |naming. | the fi|
|00000370| 6c 65 2e 29 20 20 54 68 | 65 20 70 6c 61 63 65 73 |le.) Th|e places|
|00000380| 20 69 6e 20 74 68 65 20 | 66 69 6c 65 20 77 68 65 | in the |file whe|
|00000390| 72 65 20 79 6f 75 20 6d | 69 67 68 74 20 6e 65 65 |re you m|ight nee|
|000003a0| 64 20 74 6f 20 64 6f 20 | 73 6f 6d 65 20 77 6f 72 |d to do |some wor|
|000003b0| 6b 0d 20 20 20 61 72 65 | 20 61 6c 6c 20 63 6f 6d |k. are| all com|
|000003c0| 6d 65 6e 74 65 64 20 77 | 69 74 68 20 63 6f 6d 6d |mented w|ith comm|
|000003d0| 65 6e 74 73 20 62 65 67 | 69 6e 6e 69 6e 67 20 77 |ents beg|inning w|
|000003e0| 69 74 68 20 2f 2f 2e 20 | 20 4d 6f 73 74 20 6f 66 |ith //. | Most of|
|000003f0| 20 74 68 65 6d 20 61 72 | 65 0d 20 20 20 61 6c 73 | them ar|e. als|
|00000400| 6f 20 69 6e 20 74 68 65 | 20 22 6d 61 72 6b 20 6d |o in the| "mark m|
|00000410| 65 6e 75 22 20 74 68 61 | 74 20 79 6f 75 20 73 65 |enu" tha|t you se|
|00000420| 65 20 77 68 65 6e 20 79 | 6f 75 20 68 6f 6c 64 20 |e when y|ou hold |
|00000430| 64 6f 77 6e 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 |down the| command|
|00000440| 20 6b 65 79 0d 20 20 20 | 61 6e 64 20 70 72 65 73 | key. |and pres|
|00000450| 73 20 74 68 65 20 6d 6f | 75 73 65 20 69 6e 20 74 |s the mo|use in t|
|00000460| 68 65 20 74 69 74 6c 65 | 20 62 61 72 20 6f 66 20 |he title| bar of |
|00000470| 74 68 69 73 20 77 69 6e | 64 6f 77 2e 0d 2a 2f 0d |this win|dow..*/.|
|00000480| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 67 6c 6f 62 |..#inclu|de "glob|
|00000490| 61 6c 73 2d 4d 61 63 53 | 74 61 72 74 65 72 2e 68 |als-MacS|tarter.h|
|000004a0| 22 0d 0d 6c 6f 6e 67 20 | 67 45 76 65 6e 74 57 61 |"..long |gEventWa|
|000004b0| 69 74 54 69 6d 65 20 3d | 20 31 30 30 30 30 30 30 |itTime =| 1000000|
|000004c0| 3b 20 20 2f 2f 20 54 68 | 69 73 20 69 73 20 75 73 |; // Th|is is us|
|000004d0| 65 64 20 62 79 20 66 75 | 6e 63 74 69 6f 6e 20 57 |ed by fu|nction W|
|000004e0| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 20 69 6e 20 |aitNextE|vent in |
|000004f0| 74 68 65 0d 20 20 20 20 | 20 20 20 20 20 20 2f 2f |the. | //|
|00000500| 20 6d 61 69 6e 20 70 72 | 6f 67 72 61 6d 20 61 73 | main pr|ogram as|
|00000510| 20 74 68 65 20 6d 61 78 | 69 6d 75 6d 20 61 63 63 | the max|imum acc|
|00000520| 65 70 74 61 62 6c 65 20 | 74 69 6d 65 20 66 6f 72 |eptable |time for|
|00000530| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 74 6f 0d | the pro|gram to.|
|00000540| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 62 65 20 | | // be |
|00000550| 22 70 75 74 20 74 6f 20 | 73 6c 65 65 70 22 20 77 |"put to |sleep" w|
|00000560| 68 69 6c 65 20 77 61 69 | 74 69 6e 67 20 66 6f 72 |hile wai|ting for|
|00000570| 20 74 68 65 20 6e 65 78 | 74 20 65 76 65 6e 74 2e | the nex|t event.|
|00000580| 20 20 49 66 20 79 6f 75 | 72 0d 20 20 20 20 20 20 | If you|r. |
|00000590| 20 20 20 20 2f 2f 20 70 | 72 6f 67 72 61 6d 20 68 | // p|rogram h|
|000005a0| 61 73 20 61 6e 20 22 41 | 70 70 6c 69 63 61 74 69 |as an "A|pplicati|
|000005b0| 6f 6e 49 64 6c 65 22 20 | 66 75 6e 63 74 69 6f 6e |onIdle" |function|
|000005c0| 2c 20 79 6f 75 20 77 69 | 6c 6c 20 6e 65 65 64 20 |, you wi|ll need |
|000005d0| 74 6f 0d 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 |to. | // |
|000005e0| 63 68 61 6e 67 65 20 74 | 68 69 73 20 76 61 6c 75 |change t|his valu|
|000005f0| 65 2e 20 20 53 65 65 20 | 74 68 65 20 63 6f 6d 6d |e. See |the comm|
|00000600| 65 6e 74 20 6f 6e 20 74 | 68 61 74 20 66 75 6e 63 |ent on t|hat func|
|00000610| 74 69 6f 6e 2e 20 20 4f | 74 68 65 72 77 69 73 65 |tion. O|therwise|
|00000620| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 79 |,. | // y|
|00000630| 6f 75 20 63 61 6e 20 69 | 67 6e 6f 72 65 20 67 45 |ou can i|gnore gE|
|00000640| 76 65 6e 74 57 61 69 74 | 54 69 6d 65 2e 0d 0d 0d |ventWait|Time....|
|00000650| 4d 65 6e 75 48 61 6e 64 | 6c 65 20 65 64 69 74 4d |MenuHand|le editM|
|00000660| 65 6e 75 2c 20 66 69 6c | 65 4d 65 6e 75 3b 20 20 |enu, fil|eMenu; |
|00000670| 2f 2f 20 54 68 65 73 65 | 20 76 61 72 69 61 62 6c |// These| variabl|
|00000680| 65 73 20 61 72 65 20 64 | 65 66 69 6e 65 64 20 74 |es are d|efined t|
|00000690| 6f 20 70 72 6f 76 69 64 | 65 20 61 0d 20 20 20 20 |o provid|e a. |
|000006a0| 20 20 20 20 20 20 2f 2f | 20 77 61 79 20 74 6f 20 | //| way to |
|000006b0| 72 65 66 65 72 20 74 6f | 20 74 68 65 20 66 69 6c |refer to| the fil|
|000006c0| 65 20 61 6e 64 20 65 64 | 69 74 20 6d 65 6e 75 73 |e and ed|it menus|
|000006d0| 20 69 6e 20 66 75 6e 63 | 74 69 6f 6e 20 55 70 64 | in func|tion Upd|
|000006e0| 61 74 61 4d 65 6e 75 73 | 2e 0d 20 20 20 20 20 20 |ataMenus|.. |
|000006f0| 20 20 20 20 2f 2f 20 49 | 66 20 79 6f 75 20 61 64 | // I|f you ad|
|00000700| 64 20 6f 74 68 65 72 20 | 6d 65 6e 75 73 2c 20 79 |d other |menus, y|
|00000710| 6f 75 20 77 69 6c 6c 20 | 6e 65 65 64 20 74 6f 20 |ou will |need to |
|00000720| 64 65 66 69 6e 65 20 4d | 65 6e 75 48 61 6e 64 6c |define M|enuHandl|
|00000730| 65 73 20 66 6f 72 0d 20 | 20 20 20 20 20 20 20 20 |es for. | |
|00000740| 20 2f 2f 20 74 68 65 6d | 2e 0d 0d 0d 76 6f 69 64 | // them|....void|
|00000750| 20 49 6e 69 74 41 70 70 | 6c 69 63 61 74 69 6f 6e | InitApp|lication|
|00000760| 28 76 6f 69 64 29 3b 20 | 20 20 20 20 20 20 20 20 |(void); | |
|00000770| 20 20 20 20 20 20 20 20 | 2f 2f 20 54 68 69 73 20 | |// This |
|00000780| 69 73 20 61 20 6c 69 73 | 74 20 6f 66 20 74 68 65 |is a lis|t of the|
|00000790| 20 66 75 6e 63 74 69 6f | 6e 73 0d 76 6f 69 64 20 | functio|ns.void |
|000007a0| 55 70 64 61 74 65 4d 65 | 6e 75 73 28 76 6f 69 64 |UpdateMe|nus(void|
|000007b0| 29 3b 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |); | |
|000007c0| 20 20 20 20 20 20 20 2f | 2f 20 64 65 66 69 6e 65 | /|/ define|
|000007d0| 64 20 69 6e 20 74 68 69 | 73 20 66 69 6c 65 2e 20 |d in thi|s file. |
|000007e0| 20 28 49 20 68 61 76 65 | 20 74 6f 0d 76 6f 69 64 | (I have| to.void|
|000007f0| 20 44 6f 45 64 69 74 4d | 65 6e 75 28 69 6e 74 20 | DoEditM|enu(int |
|00000800| 69 74 65 6d 4e 75 6d 29 | 3b 20 20 20 20 20 20 20 |itemNum)|; |
|00000810| 20 20 20 20 20 20 20 20 | 2f 2f 20 64 65 63 6c 61 | |// decla|
|00000820| 72 65 20 66 75 6e 63 74 | 69 6f 6e 73 20 62 65 66 |re funct|ions bef|
|00000830| 6f 72 65 0d 76 6f 69 64 | 20 44 6f 46 69 6c 65 4d |ore.void| DoFileM|
|00000840| 65 6e 75 28 69 6e 74 20 | 69 74 65 6d 4e 75 6d 2c |enu(int |itemNum,|
|00000850| 20 69 6e 74 2a 20 64 6f | 6e 65 29 3b 20 20 20 20 | int* do|ne); |
|00000860| 2f 2f 20 64 65 66 69 6e | 69 6e 67 20 74 68 65 6d |// defin|ing them|
|00000870| 20 62 65 63 61 75 73 65 | 20 49 20 74 75 72 6e 65 | because| I turne|
|00000880| 64 20 0d 76 6f 69 64 20 | 44 6f 4f 74 68 65 72 4d |d .void |DoOtherM|
|00000890| 65 6e 75 28 69 6e 74 20 | 6d 65 6e 75 49 44 2c 20 |enu(int |menuID, |
|000008a0| 69 6e 74 20 69 74 65 6d | 4e 75 6d 29 3b 20 20 2f |int item|Num); /|
|000008b0| 2f 20 6f 6e 20 74 68 65 | 20 22 52 65 71 75 69 72 |/ on the| "Requir|
|000008c0| 65 20 50 72 6f 74 6f 74 | 79 70 65 73 22 0d 76 6f |e Protot|ypes".vo|
|000008d0| 69 64 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 49 64 |id Appli|cationId|
|000008e0| 6c 65 28 76 6f 69 64 29 | 3b 20 20 20 20 20 20 20 |le(void)|; |
|000008f0| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 6f 70 74 | | // opt|
|00000900| 69 6f 6e 20 69 6e 20 74 | 68 65 20 4c 61 6e 67 75 |ion in t|he Langu|
|00000910| 61 67 65 20 53 65 74 74 | 69 6e 67 73 0d 76 6f 69 |age Sett|ings.voi|
|00000920| 64 20 43 6c 65 61 6e 55 | 70 41 70 70 6c 69 63 61 |d CleanU|pApplica|
|00000930| 74 69 6f 6e 28 76 6f 69 | 64 29 3b 20 20 20 20 20 |tion(voi|d); |
|00000940| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 70 61 6e 65 | | // pane|
|00000950| 6c 20 6f 66 20 74 68 65 | 20 4f 70 74 69 6f 6e 73 |l of the| Options|
|00000960| 20 64 69 61 6c 6f 67 2e | 29 0d 76 6f 69 64 20 41 | dialog.|).void A|
|00000970| 62 6f 75 74 42 6f 78 28 | 76 6f 69 64 29 3b 0d 76 |boutBox(|void);.v|
|00000980| 6f 69 64 20 44 6f 4e 65 | 77 43 6f 6d 6d 61 6e 64 |oid DoNe|wCommand|
|00000990| 28 76 6f 69 64 29 3b 0d | 0d 0d 0d 2f 2a 2a 2a 2a |(void);.|.../****|
|000009a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009b0| 2a 2a 2a 20 20 57 69 6e | 64 6f 77 20 64 65 66 69 |*** Win|dow defi|
|000009c0| 6e 69 74 69 6f 6e 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |nition *|********|
|000009d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2f 0d 0d 0d 63 6c 61 |********|*/...cla|
|000009f0| 73 73 20 6d 79 57 69 6e | 64 6f 77 20 3a 20 70 75 |ss myWin|dow : pu|
|00000a00| 62 6c 69 63 20 78 57 69 | 6e 64 6f 77 20 7b 0d 0d |blic xWi|ndow {..|
|00000a10| 20 20 20 2f 2f 20 54 68 | 65 20 63 6c 61 73 73 20 | // Th|e class |
|00000a20| 78 57 69 6e 64 6f 77 20 | 69 73 20 64 65 66 69 6e |xWindow |is defin|
|00000a30| 65 64 20 69 6e 20 67 6c | 6f 62 61 6c 73 2d 4d 61 |ed in gl|obals-Ma|
|00000a40| 63 53 74 61 72 74 65 72 | 2e 63 2e 20 20 49 74 20 |cStarter|.c. It |
|00000a50| 70 72 6f 76 69 64 65 73 | 20 74 68 65 0d 20 20 20 |provides| the. |
|00000a60| 2f 2f 20 62 61 73 69 63 | 20 66 75 6e 63 74 69 6f |// basic| functio|
|00000a70| 6e 61 6c 69 74 79 20 6f | 66 20 4d 61 63 69 6e 74 |nality o|f Macint|
|00000a80| 6f 73 68 20 77 69 6e 64 | 6f 77 73 2e 20 20 59 6f |osh wind|ows. Yo|
|00000a90| 75 20 64 65 66 69 6e 65 | 20 74 68 65 20 62 65 68 |u define| the beh|
|00000aa0| 61 76 69 6f 75 72 20 6f | 66 0d 20 20 20 2f 2f 20 |aviour o|f. // |
|00000ab0| 61 63 74 75 61 6c 20 77 | 69 6e 64 6f 77 73 20 69 |actual w|indows i|
|00000ac0| 6e 20 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 62 |n your p|rogram b|
|00000ad0| 79 20 64 65 66 69 6e 69 | 6e 67 20 74 68 65 20 73 |y defini|ng the s|
|00000ae0| 75 62 63 6c 61 73 73 20 | 6d 79 57 69 6e 64 6f 77 |ubclass |myWindow|
|00000af0| 20 6f 66 0d 20 20 20 2f | 2f 20 63 6c 61 73 73 20 | of. /|/ class |
|00000b00| 78 57 69 6e 64 6f 77 2e | 20 20 54 6f 20 64 6f 20 |xWindow.| To do |
|00000b10| 74 68 69 73 2c 20 79 6f | 75 20 6a 75 73 74 20 68 |this, yo|u just h|
|00000b20| 61 76 65 20 74 6f 20 73 | 61 79 20 68 6f 77 20 79 |ave to s|ay how y|
|00000b30| 6f 75 72 20 77 69 6e 64 | 6f 77 0d 20 20 20 2f 2f |our wind|ow. //|
|00000b40| 20 72 65 73 70 6f 6e 64 | 73 20 74 6f 20 63 65 72 | respond|s to cer|
|00000b50| 74 61 69 6e 20 65 76 65 | 6e 74 73 2c 20 62 79 20 |tain eve|nts, by |
|00000b60| 66 69 6c 6c 69 6e 67 20 | 69 6e 20 74 68 65 20 64 |filling |in the d|
|00000b70| 65 66 69 6e 69 74 69 6f | 6e 73 20 6f 66 20 74 68 |efinitio|ns of th|
|00000b80| 65 0d 20 20 20 2f 2f 20 | 66 75 6e 63 74 69 6f 6e |e. // |function|
|00000b90| 73 20 74 68 61 74 20 61 | 72 65 20 63 61 6c 6c 65 |s that a|re calle|
|00000ba0| 64 20 69 6e 20 72 65 73 | 70 6f 6e 73 65 20 74 6f |d in res|ponse to|
|00000bb0| 20 74 68 6f 73 65 20 65 | 76 65 6e 74 73 2e 20 20 | those e|vents. |
|00000bc0| 54 68 65 20 6c 69 73 74 | 0d 20 20 20 2f 2f 20 6f |The list|. // o|
|00000bd0| 66 20 66 75 6e 63 74 69 | 6f 6e 73 20 74 68 61 74 |f functi|ons that|
|00000be0| 20 79 6f 75 20 6d 69 67 | 68 74 20 68 61 76 65 20 | you mig|ht have |
|00000bf0| 74 6f 20 63 68 61 6e 67 | 65 20 69 73 20 67 69 76 |to chang|e is giv|
|00000c00| 65 6e 20 69 6e 20 74 68 | 69 73 0d 20 20 20 2f 2f |en in th|is. //|
|00000c10| 20 22 73 75 62 63 6c 61 | 73 73 20 64 65 63 6c 61 | "subcla|ss decla|
|00000c20| 72 61 74 69 6f 6e 22 20 | 66 6f 72 20 6d 79 57 69 |ration" |for myWi|
|00000c30| 6e 64 6f 77 2e 20 20 54 | 68 65 20 61 63 74 75 61 |ndow. T|he actua|
|00000c40| 6c 20 66 75 6e 63 74 69 | 6f 6e 73 20 66 6f 6c 6c |l functi|ons foll|
|00000c50| 6f 77 2e 0d 20 20 20 2f | 2f 20 53 65 65 20 74 68 |ow.. /|/ See th|
|00000c60| 65 20 69 6e 64 69 76 69 | 64 75 61 6c 20 66 75 6e |e indivi|dual fun|
|00000c70| 63 74 69 6f 6e 73 20 66 | 6f 72 20 6d 6f 72 65 20 |ctions f|or more |
|00000c80| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2e 0d 20 20 20 |informat|ion.. |
|00000c90| 20 20 20 0d 20 20 20 2f | 2f 20 59 6f 75 20 77 69 | . /|/ You wi|
|00000ca0| 6c 6c 20 61 6c 6d 6f 73 | 74 20 63 65 72 74 61 69 |ll almos|t certai|
|00000cb0| 6e 6c 79 20 6e 65 65 64 | 20 74 6f 20 61 64 64 20 |nly need| to add |
|00000cc0| 73 6f 6d 65 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |some inf|ormation|
|00000cd0| 20 74 6f 20 74 68 69 73 | 0d 20 20 20 2f 2f 20 64 | to this|. // d|
|00000ce0| 65 66 69 6e 69 74 69 6f | 6e 20 6f 66 20 6d 79 57 |efinitio|n of myW|
|00000cf0| 69 6e 64 6f 77 2e 20 20 | 59 6f 75 20 73 68 6f 75 |indow. |You shou|
|00000d00| 6c 64 20 69 6e 73 65 72 | 74 20 68 65 72 65 20 74 |ld inser|t here t|
|00000d10| 68 65 20 0d 20 20 20 2f | 2f 20 64 65 63 6c 61 72 |he . /|/ declar|
|00000d20| 61 74 69 6f 6e 73 20 6f | 66 20 61 6e 79 20 76 61 |ations o|f any va|
|00000d30| 72 69 61 62 6c 65 73 20 | 79 6f 75 20 6e 65 65 64 |riables |you need|
|00000d40| 20 74 6f 20 68 6f 6c 64 | 20 64 61 74 61 20 72 65 | to hold| data re|
|00000d50| 6c 65 76 61 6e 74 0d 20 | 20 20 2f 2f 20 74 6f 20 |levant. | // to |
|00000d60| 74 68 65 20 63 6f 6e 74 | 65 6e 74 73 20 6f 66 20 |the cont|ents of |
|00000d70| 74 68 65 20 77 69 6e 64 | 6f 77 2e 20 20 54 68 65 |the wind|ow. The|
|00000d80| 73 65 20 76 61 72 69 61 | 62 6c 65 73 20 73 68 6f |se varia|bles sho|
|00000d90| 75 6c 64 20 62 65 20 64 | 65 66 69 6e 65 64 0d 20 |uld be d|efined. |
|00000da0| 20 20 2f 2f 20 48 45 52 | 45 2c 20 6e 6f 74 20 61 | // HER|E, not a|
|00000db0| 73 20 67 6c 6f 62 61 6c | 20 76 61 72 69 61 62 6c |s global| variabl|
|00000dc0| 65 73 2c 20 73 69 6e 63 | 65 20 65 61 63 68 20 77 |es, sinc|e each w|
|00000dd0| 69 6e 64 6f 77 20 6e 65 | 65 64 73 20 69 74 73 20 |indow ne|eds its |
|00000de0| 6f 77 6e 0d 20 20 20 2f | 2f 20 76 65 72 73 69 6f |own. /|/ versio|
|00000df0| 6e 20 6f 66 20 74 68 65 | 20 76 61 72 69 61 62 6c |n of the| variabl|
|00000e00| 65 73 2e 20 20 59 6f 75 | 20 63 61 6e 20 61 6c 73 |es. You| can als|
|00000e10| 6f 20 61 64 64 20 6e 65 | 77 20 66 75 6e 63 74 69 |o add ne|w functi|
|00000e20| 6f 6e 73 20 74 6f 20 74 | 68 65 0d 20 20 20 2f 2f |ons to t|he. //|
|00000e30| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6c 69 73 74 20 | followi|ng list |
|00000e40| 6f 66 20 66 75 6e 63 74 | 69 6f 6e 73 2e 20 20 28 |of funct|ions. (|
|00000e50| 4e 4f 54 45 3a 20 59 6f | 75 20 63 61 6e 20 63 65 |NOTE: Yo|u can ce|
|00000e60| 72 74 61 69 6e 6c 79 20 | 64 65 66 69 6e 65 0d 20 |rtainly |define. |
|00000e70| 20 20 2f 2f 20 61 64 64 | 69 74 69 6f 6e 61 6c 20 | // add|itional |
|00000e80| 77 69 6e 64 6f 77 20 63 | 6c 61 73 73 65 73 2c 20 |window c|lasses, |
|00000e90| 69 66 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 20 |if your |program |
|00000ea0| 6e 65 65 64 73 20 77 69 | 6e 64 6f 77 73 20 77 69 |needs wi|ndows wi|
|00000eb0| 74 68 20 61 0d 20 20 20 | 2f 2f 20 76 61 72 69 65 |th a. |// varie|
|00000ec0| 74 79 20 6f 66 20 62 65 | 68 61 76 69 6f 75 72 73 |ty of be|haviours|
|00000ed0| 2e 29 0d 20 20 20 0d 20 | 70 75 62 6c 69 63 3a 0d |.). . |public:.|
|00000ee0| 20 20 20 76 69 72 74 75 | 61 6c 20 76 6f 69 64 20 | virtu|al void |
|00000ef0| 4f 70 65 6e 49 6e 52 65 | 63 74 28 53 74 72 32 35 |OpenInRe|ct(Str25|
|00000f00| 35 20 74 69 74 6c 65 2c | 20 69 6e 74 20 6c 65 66 |5 title,| int lef|
|00000f10| 74 2c 20 69 6e 74 20 74 | 6f 70 2c 20 69 6e 74 20 |t, int t|op, int |
|00000f20| 72 69 67 68 74 2c 20 69 | 6e 74 20 62 6f 74 74 6f |right, i|nt botto|
|00000f30| 6d 29 3b 20 20 20 0d 20 | 20 20 76 69 72 74 75 61 |m); . | virtua|
|00000f40| 6c 20 73 68 6f 72 74 20 | 43 6c 6f 73 65 28 76 6f |l short |Close(vo|
|00000f50| 69 64 29 3b 0d 20 20 20 | 0d 20 70 72 6f 74 65 63 |id);. |. protec|
|00000f60| 74 65 64 3a 20 20 2f 2f | 20 28 4e 6f 74 65 3a 20 |ted: //| (Note: |
|00000f70| 59 6f 75 20 77 69 6c 6c | 20 6e 65 76 65 72 20 61 |You will| never a|
|00000f80| 63 74 75 61 6c 6c 79 20 | 43 41 4c 4c 20 74 68 65 |ctually |CALL the|
|00000f90| 73 65 20 66 75 6e 63 74 | 69 6f 6e 73 20 64 69 72 |se funct|ions dir|
|00000fa0| 65 63 74 6c 79 3b 0d 20 | 20 20 20 20 20 20 20 20 |ectly;. | |
|00000fb0| 20 20 20 20 2f 2f 20 20 | 6a 75 73 74 20 64 65 66 | // |just def|
|00000fc0| 69 6e 65 20 77 68 61 74 | 20 74 68 65 79 20 64 6f |ine what| they do|
|00000fd0| 2e 29 0d 20 20 20 76 69 | 72 74 75 61 6c 20 76 6f |.). vi|rtual vo|
|00000fe0| 69 64 20 53 65 74 44 65 | 66 61 75 6c 74 73 28 76 |id SetDe|faults(v|
|00000ff0| 6f 69 64 29 3b 0d 20 20 | 20 76 69 72 74 75 61 6c |oid);. | virtual|
|00001000| 20 76 6f 69 64 20 64 6f | 4b 65 79 28 63 68 61 72 | void do|Key(char|
|00001010| 20 63 68 29 3b 0d 20 20 | 20 76 69 72 74 75 61 6c | ch);. | virtual|
|00001020| 20 76 6f 69 64 20 64 6f | 43 6f 6e 74 65 6e 74 43 | void do|ContentC|
|00001030| 6c 69 63 6b 28 50 6f 69 | 6e 74 20 6c 6f 63 61 6c |lick(Poi|nt local|
|00001040| 50 74 29 3b 0d 20 20 20 | 76 69 72 74 75 61 6c 20 |Pt);. |virtual |
|00001050| 76 6f 69 64 20 61 64 6a | 75 73 74 54 6f 4e 65 77 |void adj|ustToNew|
|00001060| 53 69 7a 65 28 76 6f 69 | 64 29 3b 0d 20 20 20 76 |Size(voi|d);. v|
|00001070| 69 72 74 75 61 6c 20 76 | 6f 69 64 20 64 6f 52 65 |irtual v|oid doRe|
|00001080| 64 72 61 77 28 52 65 63 | 74 2a 20 62 61 64 52 65 |draw(Rec|t* badRe|
|00001090| 63 74 29 3b 0d 20 20 20 | 76 69 72 74 75 61 6c 20 |ct);. |virtual |
|000010a0| 76 6f 69 64 20 64 6f 48 | 53 63 72 6f 6c 6c 28 69 |void doH|Scroll(i|
|000010b0| 6e 74 20 64 68 29 3b 0d | 20 20 20 76 69 72 74 75 |nt dh);.| virtu|
|000010c0| 61 6c 20 76 6f 69 64 20 | 64 6f 56 53 63 72 6f 6c |al void |doVScrol|
|000010d0| 6c 28 69 6e 74 20 64 76 | 29 3b 0d 20 20 20 76 69 |l(int dv|);. vi|
|000010e0| 72 74 75 61 6c 20 76 6f | 69 64 20 64 6f 41 63 74 |rtual vo|id doAct|
|000010f0| 69 76 61 74 65 28 69 6e | 74 20 61 63 74 69 76 65 |ivate(in|t active|
|00001100| 29 3b 0d 20 20 20 0d 7d | 3b 0d 0d 0d 2f 2f 20 46 |);. .}|;...// F|
|00001110| 75 6e 63 74 69 6f 6e 20 | 53 65 74 44 65 66 61 75 |unction |SetDefau|
|00001120| 6c 74 73 20 69 73 20 63 | 61 6c 6c 65 64 20 61 75 |lts is c|alled au|
|00001130| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 77 68 65 6e |tomatica|lly when|
|00001140| 20 61 20 6e 65 77 20 77 | 69 6e 64 6f 77 20 69 73 | a new w|indow is|
|00001150| 20 6f 70 65 6e 65 64 2c | 0d 2f 2f 20 42 45 46 4f | opened,|.// BEFO|
|00001160| 52 45 20 74 68 65 20 61 | 63 74 75 61 6c 20 77 69 |RE the a|ctual wi|
|00001170| 6e 64 6f 77 20 69 73 20 | 63 72 65 61 74 65 64 2e |ndow is |created.|
|00001180| 20 20 49 74 20 73 65 74 | 73 20 75 70 20 74 68 65 | It set|s up the|
|00001190| 20 61 70 70 65 61 72 61 | 6e 63 65 20 6f 66 20 74 | appeara|nce of t|
|000011a0| 68 65 0d 2f 2f 20 77 69 | 6e 64 6f 77 20 61 6e 64 |he.// wi|ndow and|
|000011b0| 20 69 6e 69 74 69 61 6c | 69 7a 65 73 20 76 61 72 | initial|izes var|
|000011c0| 69 61 62 6c 65 73 20 61 | 73 73 6f 63 69 61 74 65 |iables a|ssociate|
|000011d0| 64 20 77 69 74 68 20 74 | 68 65 20 77 69 6e 64 6f |d with t|he windo|
|000011e0| 77 2e 20 20 54 68 69 73 | 20 66 75 6e 63 74 69 6f |w. This| functio|
|000011f0| 6e 20 0d 2f 2f 20 73 68 | 6f 75 6c 64 20 61 6c 77 |n .// sh|ould alw|
|00001200| 61 79 73 20 53 54 41 52 | 54 20 62 79 20 63 61 6c |ays STAR|T by cal|
|00001210| 6c 69 6e 67 20 69 6e 68 | 65 72 69 74 65 64 3a 3a |ling inh|erited::|
|00001220| 53 65 74 44 65 66 61 75 | 6c 74 73 2c 20 77 68 69 |SetDefau|lts, whi|
|00001230| 63 68 20 73 65 74 73 20 | 75 70 20 74 68 65 0d 2f |ch sets |up the./|
|00001240| 2f 20 64 65 66 61 75 6c | 74 20 61 70 70 65 61 72 |/ defaul|t appear|
|00001250| 61 6e 63 65 20 61 6e 64 | 20 62 65 68 61 76 69 6f |ance and| behavio|
|00001260| 75 72 2e 20 20 54 48 45 | 4e 2c 20 79 6f 75 20 63 |ur. THE|N, you c|
|00001270| 61 6e 20 6d 61 6b 65 20 | 61 6e 79 20 63 68 61 6e |an make |any chan|
|00001280| 67 65 73 20 79 6f 75 0d | 2f 2f 20 77 61 6e 74 2e |ges you.|// want.|
|00001290| 20 0d 2f 2f 20 20 20 20 | 54 68 65 20 69 6e 68 65 | .// |The inhe|
|000012a0| 72 69 74 65 64 20 66 75 | 6e 63 74 69 6f 6e 20 67 |rited fu|nction g|
|000012b0| 69 76 65 73 20 64 65 66 | 61 75 6c 74 20 76 61 6c |ives def|ault val|
|000012c0| 75 65 73 20 74 6f 20 74 | 68 65 20 76 61 72 69 61 |ues to t|he varia|
|000012d0| 62 6c 65 73 0d 2f 2f 20 | 66 65 61 74 75 72 65 73 |bles.// |features|
|000012e0| 2c 20 74 6f 70 53 63 72 | 6f 6c 6c 4f 66 66 73 65 |, topScr|ollOffse|
|000012f0| 74 2c 20 62 6f 74 74 6f | 6d 53 63 72 6f 6c 6c 4f |t, botto|mScrollO|
|00001300| 66 66 73 65 74 2c 20 6c | 65 66 74 53 63 72 6f 6c |ffset, l|eftScrol|
|00001310| 6c 4f 66 66 73 65 74 2c | 0d 2f 2f 20 72 69 67 68 |lOffset,|.// righ|
|00001320| 74 53 63 72 6f 6c 6c 4f | 66 66 73 65 74 2c 20 6d |tScrollO|ffset, m|
|00001330| 69 6e 48 2c 20 6d 69 6e | 56 2c 20 6d 61 78 48 2c |inH, min|V, maxH,|
|00001340| 20 6d 61 78 56 2c 20 68 | 4c 69 6e 65 73 50 65 72 | maxV, h|LinesPer|
|00001350| 50 61 67 65 20 61 6e 64 | 20 0d 2f 2f 20 76 4c 69 |Page and| .// vLi|
|00001360| 6e 65 73 50 65 72 50 61 | 67 65 2e 20 20 54 68 65 |nesPerPa|ge. The|
|00001370| 20 6d 6f 73 74 20 69 6d | 70 6f 72 74 61 6e 74 20 | most im|portant |
|00001380| 6f 66 20 74 68 65 73 65 | 20 69 73 20 46 45 41 54 |of these| is FEAT|
|00001390| 55 52 45 53 2c 20 77 68 | 69 63 68 0d 2f 2f 20 64 |URES, wh|ich.// d|
|000013a0| 65 74 65 72 6d 69 6e 65 | 73 20 77 68 65 74 68 65 |etermine|s whethe|
|000013b0| 72 20 6f 72 20 6e 6f 74 | 20 74 68 65 20 77 69 6e |r or not| the win|
|000013c0| 64 6f 77 20 68 61 73 20 | 61 20 67 6f 2d 61 77 61 |dow has |a go-awa|
|000013d0| 79 20 62 6f 78 2c 20 61 | 20 7a 6f 6f 6d 20 62 6f |y box, a| zoom bo|
|000013e0| 78 2c 0d 2f 2f 20 61 20 | 67 72 6f 77 20 62 6f 78 |x,.// a |grow box|
|000013f0| 2c 20 61 20 68 6f 72 69 | 7a 6f 6e 74 61 6c 20 73 |, a hori|zontal s|
|00001400| 63 72 6f 6c 6c 20 62 61 | 72 2c 20 61 6e 64 20 61 |croll ba|r, and a|
|00001410| 20 76 65 72 74 69 63 61 | 6c 20 73 63 72 6f 6c 6c | vertica|l scroll|
|00001420| 20 62 61 72 2e 20 20 49 | 74 73 0d 2f 2f 20 64 65 | bar. I|ts.// de|
|00001430| 66 61 75 6c 74 20 76 61 | 6c 75 65 20 69 73 20 68 |fault va|lue is h|
|00001440| 61 73 47 6f 41 77 61 79 | 20 2b 20 68 61 73 5a 6f |asGoAway| + hasZo|
|00001450| 6f 6d 20 2b 20 68 61 73 | 47 72 6f 77 20 2b 20 68 |om + has|Grow + h|
|00001460| 61 73 48 53 63 72 6f 6c | 6c 20 2b 20 68 61 73 56 |asHScrol|l + hasV|
|00001470| 53 63 72 6f 6c 6c 2c 0d | 2f 2f 20 77 68 69 63 68 |Scroll,.|// which|
|00001480| 20 77 69 6c 6c 20 70 72 | 6f 64 75 63 65 20 61 20 | will pr|oduce a |
|00001490| 77 69 6e 64 6f 77 20 77 | 69 74 68 20 61 6c 6c 20 |window w|ith all |
|000014a0| 70 6f 73 73 69 62 6c 65 | 20 66 65 61 74 75 72 65 |possible| feature|
|000014b0| 73 2e 20 20 49 66 20 79 | 6f 75 20 77 61 6e 74 0d |s. If y|ou want.|
|000014c0| 2f 2f 20 6f 6e 6c 79 20 | 61 20 73 75 62 73 65 74 |// only |a subset|
|000014d0| 20 6f 66 20 66 65 61 74 | 75 72 65 73 2c 20 79 6f | of feat|ures, yo|
|000014e0| 75 20 73 68 6f 75 6c 64 | 20 73 65 74 20 74 68 65 |u should| set the|
|000014f0| 20 76 61 6c 75 65 20 6f | 66 20 66 65 61 74 75 72 | value o|f featur|
|00001500| 65 73 0d 2f 2f 20 61 70 | 70 72 6f 70 72 69 61 74 |es.// ap|propriat|
|00001510| 65 6c 79 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |ely. Fo|r exampl|
|00001520| 65 2c 20 20 66 65 61 74 | 75 72 65 73 20 3d 20 68 |e, feat|ures = h|
|00001530| 61 73 47 6f 41 77 61 79 | 20 20 77 69 6c 6c 20 70 |asGoAway| will p|
|00001540| 72 6f 64 75 63 65 20 61 | 0d 2f 2f 20 6e 6f 6e 2d |roduce a|.// non-|
|00001550| 72 65 73 69 7a 61 62 6c | 65 2c 20 75 6e 73 63 72 |resizabl|e, unscr|
|00001560| 6f 6c 6c 61 62 6c 65 20 | 77 69 6e 64 6f 77 20 77 |ollable |window w|
|00001570| 69 74 68 20 61 20 67 6f | 2d 61 77 61 79 20 62 6f |ith a go|-away bo|
|00001580| 78 20 69 6e 20 74 68 65 | 20 75 70 70 65 72 20 6c |x in the| upper l|
|00001590| 65 66 74 20 0d 2f 2f 20 | 63 6f 72 6e 65 72 20 74 |eft .// |corner t|
|000015a0| 68 61 74 20 74 68 65 20 | 75 73 65 72 20 63 61 6e |hat the |user can|
|000015b0| 20 63 6c 69 63 6b 20 6f | 6e 20 74 6f 20 63 6c 6f | click o|n to clo|
|000015c0| 73 65 20 74 68 65 20 77 | 69 6e 64 6f 77 2e 0d 2f |se the w|indow../|
|000015d0| 2f 20 20 20 20 59 6f 75 | 20 77 69 6c 6c 20 70 72 |/ You| will pr|
|000015e0| 6f 62 61 62 6c 79 20 6e | 6f 74 20 6e 65 65 64 20 |obably n|ot need |
|000015f0| 74 6f 20 77 6f 72 72 79 | 20 61 62 6f 75 74 20 74 |to worry| about t|
|00001600| 68 65 20 6f 74 68 65 72 | 20 76 61 72 61 69 62 6c |he other| varaibl|
|00001610| 65 73 2c 0d 2f 2f 20 62 | 75 74 2c 20 66 6f 72 20 |es,.// b|ut, for |
|00001620| 74 68 65 20 72 65 63 6f | 72 64 3a 20 20 6d 69 6e |the reco|rd: min|
|00001630| 48 2c 20 6d 69 6e 56 2c | 20 6d 61 78 48 20 61 6e |H, minV,| maxH an|
|00001640| 64 20 6d 61 78 56 20 64 | 65 74 65 72 6d 69 6e 65 |d maxV d|etermine|
|00001650| 20 68 6f 77 20 62 69 67 | 0d 2f 2f 20 61 6e 64 20 | how big|.// and |
|00001660| 68 6f 77 20 73 6d 61 6c | 6c 20 74 68 65 20 75 73 |how smal|l the us|
|00001670| 65 72 20 63 61 6e 20 6d | 61 6b 65 20 74 68 65 20 |er can m|ake the |
|00001680| 77 69 6e 64 6f 77 20 62 | 79 20 64 72 61 67 67 69 |window b|y draggi|
|00001690| 6e 67 20 74 68 65 20 67 | 72 6f 77 20 62 6f 78 20 |ng the g|row box |
|000016a0| 69 6e 0d 2f 2f 20 74 68 | 65 20 6c 6f 77 65 72 20 |in.// th|e lower |
|000016b0| 72 69 67 68 74 20 63 6f | 72 6e 65 72 20 6f 66 20 |right co|rner of |
|000016c0| 74 68 65 20 77 69 6e 64 | 6f 77 2e 20 20 54 68 65 |the wind|ow. The|
|000016d0| 20 64 65 66 61 75 6c 74 | 73 20 61 6c 6c 6f 77 20 | default|s allow |
|000016e0| 76 65 72 79 20 6c 61 72 | 67 65 20 61 6e 64 0d 2f |very lar|ge and./|
|000016f0| 2f 20 76 65 72 79 20 73 | 6d 61 6c 6c 20 76 61 6c |/ very s|mall val|
|00001700| 75 65 73 2e 20 20 54 68 | 65 20 72 61 6e 67 65 20 |ues. Th|e range |
|00001710| 6f 66 20 61 6c 6c 6f 77 | 61 62 6c 65 20 68 6f 72 |of allow|able hor|
|00001720| 69 7a 6f 6e 74 61 6c 20 | 73 69 7a 65 73 20 20 66 |izontal |sizes f|
|00001730| 6f 72 20 74 68 65 20 77 | 69 6e 64 6f 77 20 69 73 |or the w|indow is|
|00001740| 0d 2f 2f 20 66 72 6f 6d | 20 6d 69 6e 48 20 74 6f |.// from| minH to|
|00001750| 20 6d 61 78 48 2c 20 61 | 6e 64 20 66 6f 72 20 76 | maxH, a|nd for v|
|00001760| 65 72 74 69 63 61 6c 20 | 73 69 7a 65 73 20 69 73 |ertical |sizes is|
|00001770| 20 6d 69 6e 56 20 74 6f | 20 6d 61 78 56 2e 20 20 | minV to| maxV. |
|00001780| 59 6f 75 20 6d 69 67 68 | 74 20 77 65 6c 6c 0d 2f |You migh|t well./|
|00001790| 2f 20 77 61 6e 74 20 74 | 6f 20 63 68 61 6e 67 65 |/ want t|o change|
|000017a0| 20 6d 69 6e 48 20 61 6e | 64 20 6d 69 6e 56 20 74 | minH an|d minV t|
|000017b0| 6f 20 70 72 65 76 65 6e | 74 20 72 65 61 6c 6c 79 |o preven|t really|
|000017c0| 20 73 6d 61 6c 6c 20 77 | 69 6e 64 6f 77 73 2e 20 | small w|indows. |
|000017d0| 20 59 6f 75 0d 2f 2f 20 | 63 61 6e 20 73 65 74 20 | You.// |can set |
|000017e0| 6d 69 6e 48 20 74 6f 20 | 68 61 76 65 20 74 68 65 |minH to |have the|
|000017f0| 20 73 61 6d 65 20 76 61 | 6c 75 65 20 61 73 20 6d | same va|lue as m|
|00001800| 61 78 48 2e 20 20 49 6e | 20 74 68 61 74 20 63 61 |axH. In| that ca|
|00001810| 73 65 2c 20 74 68 65 20 | 77 69 6e 64 6f 77 0d 2f |se, the |window./|
|00001820| 2f 20 63 61 6e 20 6f 6e | 6c 79 20 62 65 20 72 65 |/ can on|ly be re|
|00001830| 73 69 7a 65 64 20 76 65 | 72 74 69 63 61 6c 6c 79 |sized ve|rtically|
|00001840| 2e 20 20 28 42 75 74 20 | 62 65 20 73 75 72 65 20 |. (But |be sure |
|00001850| 74 68 61 74 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |that the| window |
|00001860| 69 73 20 66 69 72 73 74 | 0d 2f 2f 20 6f 70 65 6e |is first|.// open|
|00001870| 65 64 20 61 74 20 74 68 | 65 20 63 6f 72 72 65 63 |ed at th|e correc|
|00001880| 74 20 73 69 7a 65 21 29 | 20 20 49 66 20 79 6f 75 |t size!)| If you|
|00001890| 72 20 77 69 6e 64 6f 77 | 20 68 61 73 20 61 20 6d |r window| has a m|
|000018a0| 61 78 69 6d 75 6d 20 73 | 69 7a 65 2c 20 69 74 20 |aximum s|ize, it |
|000018b0| 73 68 6f 75 6c 64 0d 2f | 2f 20 6e 6f 74 20 68 61 |should./|/ not ha|
|000018c0| 76 65 20 61 20 7a 6f 6f | 6d 20 62 6f 78 2c 20 73 |ve a zoo|m box, s|
|000018d0| 69 6e 63 65 20 7a 6f 6f | 6d 69 6e 67 20 77 69 6c |ince zoo|ming wil|
|000018e0| 6c 20 6e 6f 74 20 72 65 | 73 70 65 63 74 20 74 68 |l not re|spect th|
|000018f0| 65 20 6d 61 78 69 6d 75 | 6d 20 73 69 7a 65 2e 0d |e maximu|m size..|
|00001900| 2f 2f 20 20 20 20 57 68 | 65 6e 20 61 20 75 73 65 |// Wh|en a use|
|00001910| 72 20 63 6c 69 63 6b 73 | 20 69 6e 20 74 68 65 20 |r clicks| in the |
|00001920| 67 72 61 79 20 72 65 67 | 69 6f 6e 20 6f 66 20 61 |gray reg|ion of a|
|00001930| 20 73 63 72 6f 6c 6c 20 | 62 61 72 2c 20 74 68 65 | scroll |bar, the|
|00001940| 20 77 69 6e 64 6f 77 0d | 2f 2f 20 73 68 6f 75 6c | window.|// shoul|
|00001950| 64 20 73 63 72 6f 6c 6c | 20 62 79 20 61 20 67 72 |d scroll| by a gr|
|00001960| 65 61 74 65 72 20 61 6d | 6f 75 6e 74 20 74 68 61 |eater am|ount tha|
|00001970| 6e 20 77 68 65 6e 20 74 | 68 65 20 75 73 65 72 20 |n when t|he user |
|00001980| 63 6c 69 63 6b 73 20 69 | 6e 20 61 6e 0d 2f 2f 20 |clicks i|n an.// |
|00001990| 61 72 72 6f 77 2e 20 20 | 54 68 65 20 76 61 72 69 |arrow. |The vari|
|000019a0| 61 62 6c 65 73 20 68 4c | 69 6e 65 73 50 65 72 50 |ables hL|inesPerP|
|000019b0| 61 67 65 20 61 6e 64 20 | 76 4c 69 6e 65 73 50 65 |age and |vLinesPe|
|000019c0| 72 50 61 67 65 20 63 6f | 6e 74 72 6f 6c 20 74 68 |rPage co|ntrol th|
|000019d0| 69 73 20 0d 2f 2f 20 62 | 65 68 61 76 69 6f 75 72 |is .// b|ehaviour|
|000019e0| 2e 20 20 42 79 20 64 65 | 66 69 6e 69 74 69 6f 6e |. By de|finition|
|000019f0| 2c 20 61 20 63 6c 69 63 | 6b 20 69 6e 20 74 68 65 |, a clic|k in the|
|00001a00| 20 67 72 61 79 20 61 72 | 65 61 20 6f 66 20 74 68 | gray ar|ea of th|
|00001a10| 65 20 68 6f 72 69 7a 6f | 6e 74 61 6c 20 73 63 72 |e horizo|ntal scr|
|00001a20| 6f 6c 6c 0d 2f 2f 20 62 | 61 72 20 69 73 20 65 71 |oll.// b|ar is eq|
|00001a30| 75 69 76 61 6c 65 6e 74 | 20 74 6f 20 68 4c 69 6e |uivalent| to hLin|
|00001a40| 65 73 50 65 72 50 61 67 | 65 20 63 6c 69 63 6b 73 |esPerPag|e clicks|
|00001a50| 20 6f 6e 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 68 | on one |of the h|
|00001a60| 6f 72 69 7a 6f 6e 74 61 | 6c 20 73 63 72 6f 6c 6c |orizonta|l scroll|
|00001a70| 27 73 0d 2f 2f 20 61 72 | 72 6f 77 73 2e 20 20 53 |'s.// ar|rows. S|
|00001a80| 69 6d 69 6c 61 72 6c 79 | 20 66 6f 72 20 76 4c 69 |imilarly| for vLi|
|00001a90| 6e 65 73 50 65 72 50 61 | 67 65 2e 20 20 55 73 75 |nesPerPa|ge. Usu|
|00001aa0| 61 6c 6c 79 2c 20 74 68 | 65 20 63 6f 72 72 65 63 |ally, th|e correc|
|00001ab0| 74 20 76 61 6c 75 65 73 | 0d 2f 2f 20 66 6f 72 20 |t values|.// for |
|00001ac0| 74 68 65 73 65 20 76 61 | 72 69 61 62 6c 65 73 20 |these va|riables |
|00001ad0| 64 65 70 65 6e 64 20 6f | 6e 20 74 68 65 20 73 69 |depend o|n the si|
|00001ae0| 7a 65 20 6f 66 20 74 68 | 65 20 77 69 6e 64 6f 77 |ze of th|e window|
|00001af0| 2c 20 73 6f 20 74 68 65 | 79 20 77 6f 75 6c 64 0d |, so the|y would.|
|00001b00| 2f 2f 20 6f 72 64 69 6e | 61 72 69 6c 79 20 62 65 |// ordin|arily be|
|00001b10| 20 72 65 73 65 74 20 69 | 6e 20 66 75 6e 63 74 69 | reset i|n functi|
|00001b20| 6f 6e 20 61 64 6a 75 73 | 74 54 6f 4e 65 77 53 69 |on adjus|tToNewSi|
|00001b30| 7a 65 28 29 2e 0d 2f 2f | 20 20 20 20 20 42 79 20 |ze()..//| By |
|00001b40| 64 65 66 61 75 6c 74 2c | 20 74 68 65 20 77 69 6e |default,| the win|
|00001b50| 64 6f 77 27 73 20 73 63 | 72 6f 6c 6c 20 62 61 72 |dow's sc|roll bar|
|00001b60| 73 20 77 69 6c 6c 20 65 | 78 74 65 6e 64 20 61 6c |s will e|xtend al|
|00001b70| 6c 20 74 68 65 20 77 61 | 79 20 61 63 72 6f 73 73 |l the wa|y across|
|00001b80| 2c 0d 2f 2f 20 6f 72 20 | 75 70 20 61 6e 64 20 64 |,.// or |up and d|
|00001b90| 6f 77 6e 2c 20 74 68 65 | 20 77 69 6e 64 6f 77 2e |own, the| window.|
|00001ba0| 20 20 53 6f 6d 65 74 69 | 6d 65 73 2c 20 79 6f 75 | Someti|mes, you|
|00001bb0| 20 6d 69 67 68 74 20 77 | 61 6e 74 20 74 6f 20 6c | might w|ant to l|
|00001bc0| 65 61 76 65 20 73 6f 6d | 65 0d 2f 2f 20 73 70 61 |eave som|e.// spa|
|00001bd0| 63 65 20 61 74 20 6f 6e | 65 20 65 6e 64 20 6f 72 |ce at on|e end or|
|00001be0| 20 61 6e 6f 74 68 65 72 | 20 6f 66 20 61 20 73 63 | another| of a sc|
|00001bf0| 72 6f 6c 6c 20 62 61 72 | 2e 20 20 49 66 20 73 6f |roll bar|. If so|
|00001c00| 2c 20 79 6f 75 20 63 61 | 6e 20 73 65 74 0d 2f 2f |, you ca|n set.//|
|00001c10| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 6f 6e | the val|ue of on|
|00001c20| 65 20 6f 66 20 74 68 65 | 20 76 61 72 69 61 62 6c |e of the| variabl|
|00001c30| 65 73 20 74 6f 70 53 63 | 72 6f 6c 6c 4f 66 66 73 |es topSc|rollOffs|
|00001c40| 65 74 2c 20 62 6f 74 74 | 6f 6d 53 63 72 6f 6c 6c |et, bott|omScroll|
|00001c50| 4f 66 66 73 65 74 2c 20 | 0d 2f 2f 20 6c 65 66 74 |Offset, |.// left|
|00001c60| 53 63 72 6f 6c 6c 4f 66 | 66 73 65 74 20 6f 72 20 |ScrollOf|fset or |
|00001c70| 72 69 67 68 74 53 63 72 | 6f 6c 6c 4f 66 66 73 65 |rightScr|ollOffse|
|00001c80| 74 2e 20 20 54 68 65 73 | 65 20 77 6f 72 6b 20 69 |t. Thes|e work i|
|00001c90| 6e 20 77 68 61 74 20 73 | 68 6f 75 6c 64 20 62 65 |n what s|hould be|
|00001ca0| 0d 2f 2f 20 61 20 6f 62 | 76 69 6f 75 73 20 77 61 |.// a ob|vious wa|
|00001cb0| 79 2e 0d 0d 76 6f 69 64 | 20 6d 79 57 69 6e 64 6f |y...void| myWindo|
|00001cc0| 77 3a 3a 53 65 74 44 65 | 66 61 75 6c 74 73 28 76 |w::SetDe|faults(v|
|00001cd0| 6f 69 64 29 20 7b 0d 20 | 20 20 69 6e 68 65 72 69 |oid) {. | inheri|
|00001ce0| 74 65 64 3a 3a 53 65 74 | 44 65 66 61 75 6c 74 73 |ted::Set|Defaults|
|00001cf0| 28 29 3b 0d 20 20 20 2f | 2f 20 4d 61 6b 65 20 63 |();. /|/ Make c|
|00001d00| 68 61 6e 67 65 73 20 74 | 6f 20 64 65 66 61 75 6c |hanges t|o defaul|
|00001d10| 74 73 2e 20 59 6f 75 20 | 61 6c 73 6f 20 63 61 6e |ts. You |also can|
|00001d20| 20 69 6e 69 74 69 61 6c | 69 7a 65 20 74 68 65 20 | initial|ize the |
|00001d30| 77 69 6e 64 6f 77 27 73 | 20 64 61 74 61 2e 0d 20 |window's| data.. |
|00001d40| 20 20 2f 2f 20 4d 6f 73 | 74 20 6c 69 6b 65 6c 79 | // Mos|t likely|
|00001d50| 20 63 68 61 6e 67 65 20 | 69 73 20 65 72 61 73 65 | change |is erase|
|00001d60| 20 73 6f 6d 65 20 6f 66 | 20 74 68 65 20 69 74 65 | some of| the ite|
|00001d70| 6d 73 20 6f 6e 20 74 68 | 65 20 72 69 67 68 74 20 |ms on th|e right |
|00001d80| 6f 66 3a 0d 20 20 20 2f | 2f 20 66 65 61 74 75 72 |of:. /|/ featur|
|00001d90| 65 73 20 3d 20 68 61 73 | 48 53 63 72 6f 6c 6c 20 |es = has|HScroll |
|00001da0| 2b 20 68 61 73 56 53 63 | 72 6f 6c 6c 20 2b 20 68 |+ hasVSc|roll + h|
|00001db0| 61 73 47 6f 41 77 61 79 | 20 2b 20 68 61 73 5a 6f |asGoAway| + hasZo|
|00001dc0| 6f 6d 20 2b 20 68 61 73 | 47 72 6f 77 3b 0d 7d 0d |om + has|Grow;.}.|
|00001dd0| 0d 0d 2f 2f 20 46 75 6e | 63 74 69 6f 6e 20 4f 70 |..// Fun|ction Op|
|00001de0| 65 6e 49 6e 52 65 63 74 | 20 69 73 20 63 61 6c 6c |enInRect| is call|
|00001df0| 65 64 20 77 68 65 6e 65 | 76 65 72 20 61 20 77 69 |ed whene|ver a wi|
|00001e00| 6e 64 6f 77 20 6e 65 65 | 64 73 20 74 6f 20 62 65 |ndow nee|ds to be|
|00001e10| 20 6f 70 65 6e 65 64 2e | 20 49 74 20 73 68 6f 75 | opened.| It shou|
|00001e20| 6c 64 0d 2f 2f 20 73 74 | 61 72 74 20 62 79 20 63 |ld.// st|art by c|
|00001e30| 61 6c 6c 69 6e 67 20 74 | 68 65 20 64 65 66 61 75 |alling t|he defau|
|00001e40| 6c 74 20 69 6e 68 65 72 | 69 74 65 64 3a 3a 4f 70 |lt inher|ited::Op|
|00001e50| 65 6e 49 6e 52 65 63 74 | 2c 20 77 68 69 63 68 20 |enInRect|, which |
|00001e60| 61 63 74 75 61 6c 6c 79 | 20 6f 70 65 6e 73 0d 2f |actually| opens./|
|00001e70| 2f 20 74 68 65 20 77 69 | 6e 64 6f 77 20 28 69 6e |/ the wi|ndow (in|
|00001e80| 63 6c 75 64 69 6e 67 20 | 63 61 6c 6c 69 6e 67 20 |cluding |calling |
|00001e90| 53 65 74 44 65 66 61 75 | 6c 74 73 20 69 6e 20 74 |SetDefau|lts in t|
|00001ea0| 75 72 6e 29 2e 20 20 41 | 66 74 65 72 20 74 68 69 |urn). A|fter thi|
|00001eb0| 73 2c 20 79 6f 75 20 63 | 61 6e 0d 2f 2f 20 64 6f |s, you c|an.// do|
|00001ec0| 20 61 6e 79 20 66 75 72 | 74 68 65 72 20 69 6e 69 | any fur|ther ini|
|00001ed0| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 20 79 6f 75 72 |tializat|ion your|
|00001ee0| 20 77 69 6e 64 6f 77 20 | 6d 69 67 68 74 20 6e 65 | window |might ne|
|00001ef0| 65 64 2e 20 20 28 4d 6f | 73 74 20 69 6e 69 74 69 |ed. (Mo|st initi|
|00001f00| 61 6c 69 7a 61 74 69 6f | 6e 0d 2f 2f 20 63 61 6e |alizatio|n.// can|
|00001f10| 20 62 65 20 64 6f 6e 65 | 20 69 6e 20 53 65 74 44 | be done| in SetD|
|00001f20| 65 66 61 75 6c 74 73 2c | 20 62 75 74 20 77 68 65 |efaults,| but whe|
|00001f30| 6e 20 53 65 74 44 65 66 | 61 75 6c 74 73 20 69 73 |n SetDef|aults is|
|00001f40| 20 63 61 6c 6c 65 64 2c | 20 74 68 65 20 61 63 74 | called,| the act|
|00001f50| 75 61 6c 0d 2f 2f 20 77 | 69 6e 64 6f 77 20 64 6f |ual.// w|indow do|
|00001f60| 65 73 6e 27 74 20 65 78 | 69 73 74 20 79 65 74 2e |esn't ex|ist yet.|
|00001f70| 20 20 49 6e 20 73 6f 6d | 65 20 63 61 73 65 73 2c | In som|e cases,|
|00001f80| 20 73 75 63 68 20 61 73 | 20 69 6e 73 74 61 6c 6c | such as| install|
|00001f90| 69 6e 67 20 61 20 54 45 | 64 69 74 20 6f 72 0d 2f |ing a TE|dit or./|
|00001fa0| 2f 20 61 20 43 6f 6e 74 | 72 6f 6c 2c 20 79 6f 75 |/ a Cont|rol, you|
|00001fb0| 20 6e 65 65 64 20 74 68 | 65 20 61 63 74 75 61 6c | need th|e actual|
|00001fc0| 20 77 69 6e 64 6f 77 2e | 20 20 54 68 65 73 65 20 | window.| These |
|00001fd0| 74 68 69 6e 67 73 20 63 | 61 6e 20 62 65 20 64 6f |things c|an be do|
|00001fe0| 6e 65 20 69 6e 20 74 68 | 65 0d 2f 2f 20 66 75 6e |ne in th|e.// fun|
|00001ff0| 63 74 69 6f 6e 20 62 65 | 6c 6f 77 2c 20 61 66 74 |ction be|low, aft|
|00002000| 65 72 20 74 68 65 20 63 | 61 6c 6c 20 74 6f 20 69 |er the c|all to i|
|00002010| 6e 68 65 72 69 74 65 64 | 3a 3a 4f 70 65 6e 49 6e |nherited|::OpenIn|
|00002020| 52 65 63 74 2e 20 20 54 | 68 65 20 76 61 72 69 61 |Rect. T|he varia|
|00002030| 62 6c 65 0d 2f 2f 20 74 | 68 61 74 20 70 6f 69 6e |ble.// t|hat poin|
|00002040| 74 73 20 74 6f 20 74 68 | 65 20 4d 61 63 20 77 69 |ts to th|e Mac wi|
|00002050| 6e 64 6f 77 20 64 61 74 | 61 20 73 74 72 75 63 74 |ndow dat|a struct|
|00002060| 75 72 65 20 69 73 20 63 | 61 6c 6c 65 64 20 20 74 |ure is c|alled t|
|00002070| 68 65 57 69 6e 64 6f 77 | 2e 29 0d 0d 76 6f 69 64 |heWindow|.)..void|
|00002080| 20 6d 79 57 69 6e 64 6f | 77 3a 3a 4f 70 65 6e 49 | myWindo|w::OpenI|
|00002090| 6e 52 65 63 74 28 53 74 | 72 32 35 35 20 74 69 74 |nRect(St|r255 tit|
|000020a0| 6c 65 2c 20 69 6e 74 20 | 6c 65 66 74 2c 20 69 6e |le, int |left, in|
|000020b0| 74 20 74 6f 70 2c 20 69 | 6e 74 20 72 69 67 68 74 |t top, i|nt right|
|000020c0| 2c 20 69 6e 74 20 62 6f | 74 74 6f 6d 29 20 7b 0d |, int bo|ttom) {.|
|000020d0| 20 20 20 69 6e 68 65 72 | 69 74 65 64 3a 3a 4f 70 | inher|ited::Op|
|000020e0| 65 6e 49 6e 52 65 63 74 | 28 74 69 74 6c 65 2c 6c |enInRect|(title,l|
|000020f0| 65 66 74 2c 74 6f 70 2c | 72 69 67 68 74 2c 62 6f |eft,top,|right,bo|
|00002100| 74 74 6f 6d 29 3b 0d 20 | 20 20 2f 2f 20 69 6e 73 |ttom);. | // ins|
|00002110| 65 72 74 20 61 6e 79 20 | 61 64 64 69 74 69 6f 6e |ert any |addition|
|00002120| 61 6c 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |al initi|alizatio|
|00002130| 6e 20 6f 66 20 77 69 6e | 64 6f 77 20 64 61 74 61 |n of win|dow data|
|00002140| 20 68 65 72 65 2e 0d 7d | 0d 0d 0d 2f 2f 20 46 75 | here..}|...// Fu|
|00002150| 6e 63 74 69 6f 6e 20 6d | 79 57 69 6e 64 6f 77 3a |nction m|yWindow:|
|00002160| 3a 43 6c 6f 73 65 20 69 | 73 20 63 61 6c 6c 65 64 |:Close i|s called|
|00002170| 20 77 68 65 6e 20 74 68 | 65 20 77 69 6e 64 6f 77 | when th|e window|
|00002180| 20 69 73 20 63 6c 6f 73 | 69 6e 67 20 28 66 6f 72 | is clos|ing (for|
|00002190| 20 65 78 61 6d 70 6c 65 | 2c 0d 2f 2f 20 77 68 65 | example|,.// whe|
|000021a0| 6e 20 74 68 65 20 75 73 | 65 72 20 63 6c 69 63 6b |n the us|er click|
|000021b0| 73 20 69 6e 20 69 74 73 | 20 47 6f 41 77 61 79 20 |s in its| GoAway |
|000021c0| 62 6f 78 29 2e 20 49 66 | 20 79 6f 75 20 68 61 76 |box). If| you hav|
|000021d0| 65 20 61 6e 79 20 64 79 | 6e 61 6d 69 63 61 6c 6c |e any dy|namicall|
|000021e0| 79 20 61 6c 6c 6f 63 61 | 74 65 64 0d 2f 2f 20 76 |y alloca|ted.// v|
|000021f0| 61 72 69 61 62 6c 65 73 | 20 69 6e 20 74 68 65 20 |ariables| in the |
|00002200| 77 69 6e 64 6f 77 2c 20 | 74 68 69 73 20 69 73 20 |window, |this is |
|00002210| 74 68 65 20 70 6c 61 63 | 65 20 74 6f 20 64 65 6c |the plac|e to del|
|00002220| 65 74 65 20 74 68 65 69 | 72 20 73 74 6f 72 61 67 |ete thei|r storag|
|00002230| 65 2e 0d 2f 2f 20 49 74 | 20 69 73 20 45 53 53 45 |e..// It| is ESSE|
|00002240| 4e 54 49 41 4c 20 74 68 | 61 74 20 74 68 65 20 63 |NTIAL th|at the c|
|00002250| 61 6c 6c 20 74 6f 20 69 | 6e 68 65 72 69 74 65 64 |all to i|nherited|
|00002260| 3a 3a 43 6c 6f 73 65 20 | 62 65 20 74 68 65 20 4c |::Close |be the L|
|00002270| 41 53 54 20 74 68 69 6e | 67 20 69 6e 0d 2f 2f 20 |AST thin|g in.// |
|00002280| 74 68 69 73 20 66 75 6e | 63 74 69 6f 6e 2e 20 20 |this fun|ction. |
|00002290| 28 54 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 69 |(This fu|nction i|
|000022a0| 73 20 64 65 63 6c 61 72 | 65 64 20 74 6f 20 72 65 |s declar|ed to re|
|000022b0| 74 75 72 6e 20 61 20 73 | 68 6f 72 74 20 69 6e 20 |turn a s|hort in |
|000022c0| 63 61 73 65 20 79 6f 75 | 0d 2f 2f 20 77 61 6e 74 |case you|.// want|
|000022d0| 20 61 20 43 6c 6f 73 65 | 20 66 75 6e 63 74 69 6f | a Close| functio|
|000022e0| 6e 20 74 68 61 74 20 63 | 61 6e 20 22 72 65 66 75 |n that c|an "refu|
|000022f0| 73 65 20 74 6f 20 63 6c | 6f 73 65 22 20 62 79 20 |se to cl|ose" by |
|00002300| 72 65 74 75 72 6e 69 6e | 67 20 61 20 76 61 6c 75 |returnin|g a valu|
|00002310| 65 0d 2f 2f 20 6f 66 20 | 7a 65 72 6f 2e 20 20 54 |e.// of |zero. T|
|00002320| 79 70 69 63 61 6c 6c 79 | 2c 20 79 6f 75 20 6d 69 |ypically|, you mi|
|00002330| 67 68 74 20 61 73 6b 20 | 69 66 20 74 68 65 20 75 |ght ask |if the u|
|00002340| 73 65 72 20 77 61 6e 74 | 73 20 74 6f 20 73 61 76 |ser want|s to sav|
|00002350| 65 20 74 68 65 20 77 69 | 6e 64 6f 77 0d 2f 2f 20 |e the wi|ndow.// |
|00002360| 63 6f 6e 74 65 6e 74 73 | 20 62 65 66 6f 72 65 20 |contents| before |
|00002370| 63 6c 6f 73 69 6e 67 2c | 20 61 6e 64 20 79 6f 75 |closing,| and you|
|00002380| 20 6d 69 67 68 74 20 70 | 72 6f 76 69 64 65 20 61 | might p|rovide a|
|00002390| 20 43 41 4e 43 45 4c 20 | 6f 70 74 69 6f 6e 20 74 | CANCEL |option t|
|000023a0| 68 61 74 0d 2f 2f 20 73 | 68 6f 75 6c 64 20 61 62 |hat.// s|hould ab|
|000023b0| 6f 72 74 20 74 68 65 20 | 63 6c 6f 73 69 6e 67 2e |ort the |closing.|
|000023c0| 20 20 49 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 | If the| window |
|000023d0| 69 73 20 63 6c 6f 73 69 | 6e 67 20 62 65 63 61 75 |is closi|ng becau|
|000023e0| 73 65 20 74 68 65 20 75 | 73 65 72 0d 2f 2f 20 63 |se the u|ser.// c|
|000023f0| 68 6f 73 65 20 51 55 49 | 54 20 66 72 6f 6d 20 74 |hose QUI|T from t|
|00002400| 68 65 20 66 69 6c 65 20 | 6d 65 6e 75 2c 20 79 6f |he file |menu, yo|
|00002410| 75 20 77 69 6c 6c 20 6e | 65 65 64 20 74 6f 20 6b |u will n|eed to k|
|00002420| 6e 6f 77 20 74 68 61 74 | 20 74 68 65 20 75 73 65 |now that| the use|
|00002430| 72 0d 2f 2f 20 64 65 63 | 69 64 65 64 20 74 6f 20 |r.// dec|ided to |
|00002440| 63 61 6e 63 65 6c 2e 20 | 20 59 6f 75 20 63 6f 75 |cancel. | You cou|
|00002450| 6c 64 20 74 68 65 6e 20 | 63 61 6c 6c 20 74 68 65 |ld then |call the|
|00002460| 20 63 6c 6f 73 65 20 66 | 75 6e 63 74 69 6f 6e 20 | close f|unction |
|00002470| 6c 69 6b 65 20 74 68 69 | 73 3a 0d 2f 2f 20 69 66 |like thi|s:.// if|
|00002480| 20 28 20 77 69 6e 2d 3e | 43 6c 6f 73 65 28 29 20 | ( win->|Close() |
|00002490| 29 20 2e 2e 2e 20 29 0d | 0d 73 68 6f 72 74 20 6d |) ... ).|.short m|
|000024a0| 79 57 69 6e 64 6f 77 3a | 3a 43 6c 6f 73 65 28 76 |yWindow:|:Close(v|
|000024b0| 6f 69 64 29 20 7b 0d 20 | 20 20 2f 2f 20 43 6c 65 |oid) {. | // Cle|
|000024c0| 61 6e 2d 75 70 20 62 65 | 66 6f 72 65 20 63 6c 6f |an-up be|fore clo|
|000024d0| 73 69 6e 67 20 77 69 6e | 64 6f 77 2e 0d 20 20 20 |sing win|dow.. |
|000024e0| 69 6e 68 65 72 69 74 65 | 64 3a 3a 43 6c 6f 73 65 |inherite|d::Close|
|000024f0| 28 29 3b 20 20 2f 2f 20 | 59 6f 75 20 63 61 6e 27 |(); // |You can'|
|00002500| 74 20 72 65 66 65 72 20 | 74 6f 20 61 6e 79 20 77 |t refer |to any w|
|00002510| 69 6e 64 6f 77 20 64 61 | 74 61 20 61 66 74 65 72 |indow da|ta after|
|00002520| 20 74 68 69 73 20 63 61 | 6c 6c 20 21 0d 20 20 20 | this ca|ll !. |
|00002530| 72 65 74 75 72 6e 20 31 | 3b 20 20 2f 2f 20 6e 6f |return 1|; // no|
|00002540| 74 20 75 73 65 64 20 69 | 6e 20 74 68 65 20 65 78 |t used i|n the ex|
|00002550| 69 73 74 69 6e 67 20 70 | 72 6f 67 72 61 6d 0d 7d |isting p|rogram.}|
|00002560| 0d 0d 0d 2f 2f 20 46 75 | 6e 63 74 69 6f 6e 20 64 |...// Fu|nction d|
|00002570| 6f 4b 65 79 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |oKey is |called w|
|00002580| 68 65 6e 20 74 68 65 20 | 75 73 65 72 20 74 79 70 |hen the |user typ|
|00002590| 65 73 20 61 6e 79 20 63 | 68 61 72 61 63 74 65 72 |es any c|haracter|
|000025a0| 2e 20 20 54 68 65 20 63 | 68 61 72 61 63 74 65 72 |. The c|haracter|
|000025b0| 0d 2f 2f 20 74 79 70 65 | 64 20 69 73 20 70 61 73 |.// type|d is pas|
|000025c0| 73 65 64 20 61 73 20 74 | 68 65 20 70 61 72 61 6d |sed as t|he param|
|000025d0| 65 74 65 72 20 63 68 2e | 20 20 49 66 20 79 6f 75 |eter ch.| If you|
|000025e0| 20 77 61 6e 74 20 74 6f | 20 67 65 74 20 61 74 20 | want to| get at |
|000025f0| 74 68 65 20 61 63 74 75 | 61 6c 0d 2f 2f 20 65 76 |the actu|al.// ev|
|00002600| 65 6e 74 20 72 65 63 6f | 72 64 20 74 68 61 74 20 |ent reco|rd that |
|00002610| 67 65 6e 65 72 61 74 65 | 64 20 74 68 69 73 20 66 |generate|d this f|
|00002620| 75 6e 63 74 69 6f 6e 20 | 63 61 6c 6c 2c 20 79 6f |unction |call, yo|
|00002630| 75 20 63 61 6e 20 66 69 | 6e 64 20 69 74 20 69 6e |u can fi|nd it in|
|00002640| 20 74 68 65 0d 2f 2f 20 | 67 6c 6f 62 61 6c 20 76 | the.// |global v|
|00002650| 61 72 69 61 62 6c 65 20 | 67 45 76 65 6e 74 2e 20 |ariable |gEvent. |
|00002660| 20 59 6f 75 20 63 61 6e | 2c 20 66 6f 72 20 65 78 | You can|, for ex|
|00002670| 61 6d 70 6c 65 2c 20 63 | 68 65 63 6b 20 77 68 65 |ample, c|heck whe|
|00002680| 74 68 65 72 20 74 68 65 | 20 75 73 65 72 0d 2f 2f |ther the| user.//|
|00002690| 20 77 61 73 20 68 6f 6c | 64 69 6e 67 20 64 6f 77 | was hol|ding dow|
|000026a0| 6e 20 74 68 65 20 6f 70 | 74 69 6f 6e 20 6b 65 79 |n the op|tion key|
|000026b0| 20 62 79 20 63 68 65 63 | 6b 69 6e 67 3a 0d 2f 2f | by chec|king:.//|
|000026c0| 20 69 66 20 28 20 67 45 | 76 65 6e 74 2e 6d 6f 64 | if ( gE|vent.mod|
|000026d0| 69 66 69 65 72 73 20 26 | 20 6f 70 74 69 6f 6e 4b |ifiers &| optionK|
|000026e0| 65 79 20 29 20 2e 2e 2e | 20 20 4e 6f 74 65 20 74 |ey ) ...| Note t|
|000026f0| 68 61 74 20 63 6f 6d 6d | 61 6e 64 20 6b 65 79 20 |hat comm|and key |
|00002700| 65 76 65 6e 74 73 0d 2f | 2f 20 61 72 65 20 4e 4f |events./|/ are NO|
|00002710| 54 20 73 65 6e 74 20 74 | 6f 20 74 68 69 73 20 66 |T sent t|o this f|
|00002720| 75 6e 63 74 69 6f 6e 2e | 20 20 54 68 65 79 20 61 |unction.| They a|
|00002730| 72 65 20 61 75 74 6f 6d | 61 74 69 63 61 6c 6c 79 |re autom|atically|
|00002740| 20 69 6e 74 65 72 63 65 | 70 74 65 64 20 61 6e 64 | interce|pted and|
|00002750| 0d 2f 2f 20 63 68 61 6e | 67 65 64 20 69 6e 74 6f |.// chan|ged into|
|00002760| 20 6d 65 6e 75 20 65 76 | 65 6e 74 73 2e 0d 2f 2f | menu ev|ents..//|
|00002770| 20 20 20 20 4e 4f 54 45 | 3a 20 42 65 66 6f 72 65 | NOTE|: Before|
|00002780| 20 74 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 69 | this fu|nction i|
|00002790| 73 20 63 61 6c 6c 65 64 | 2c 20 74 68 65 20 22 67 |s called|, the "g|
|000027a0| 72 61 70 68 69 63 73 20 | 70 6f 72 74 22 20 69 73 |raphics |port" is|
|000027b0| 20 73 65 74 20 74 6f 0d | 2f 2f 20 74 68 69 73 20 | set to.|// this |
|000027c0| 77 69 6e 64 6f 77 2e 20 | 20 54 68 61 74 20 6a 75 |window. | That ju|
|000027d0| 73 74 20 6d 65 61 6e 73 | 20 74 68 61 74 20 41 4e |st means| that AN|
|000027e0| 59 20 64 72 61 77 69 6e | 67 20 79 6f 75 20 64 6f |Y drawin|g you do|
|000027f0| 20 69 6e 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f | in this| functio|
|00002800| 6e 0d 2f 2f 20 77 69 6c | 6c 20 61 70 70 6c 79 20 |n.// wil|l apply |
|00002810| 74 6f 20 74 68 69 73 20 | 77 69 6e 64 6f 77 2e 0d |to this |window..|
|00002820| 0d 76 6f 69 64 20 6d 79 | 57 69 6e 64 6f 77 3a 3a |.void my|Window::|
|00002830| 64 6f 4b 65 79 28 63 68 | 61 72 20 63 68 29 20 7b |doKey(ch|ar ch) {|
|00002840| 0d 20 20 20 2f 2f 20 48 | 61 6e 64 6c 65 20 6b 65 |. // H|andle ke|
|00002850| 79 2d 63 6c 69 63 6b 0d | 7d 0d 0d 0d 2f 2f 20 46 |y-click.|}...// F|
|00002860| 75 6e 63 74 69 6f 6e 20 | 64 6f 43 6f 6e 74 65 6e |unction |doConten|
|00002870| 74 43 6c 69 63 6b 20 69 | 73 20 63 61 6c 6c 65 64 |tClick i|s called|
|00002880| 20 77 68 65 6e 20 79 6f | 75 72 20 70 72 6f 67 72 | when yo|ur progr|
|00002890| 61 6d 20 6e 65 65 64 73 | 20 74 6f 20 72 65 73 70 |am needs| to resp|
|000028a0| 6f 6e 64 20 74 6f 0d 2f | 2f 20 61 20 75 73 65 72 |ond to./|/ a user|
|000028b0| 20 63 6c 69 63 6b 69 6e | 67 20 74 68 65 20 6d 6f | clickin|g the mo|
|000028c0| 75 73 65 20 6f 6e 20 74 | 68 69 73 20 77 69 64 6f |use on t|his wido|
|000028d0| 77 2e 20 20 28 43 6c 69 | 63 6b 73 20 6f 6e 20 73 |w. (Cli|cks on s|
|000028e0| 63 72 6f 6c 6c 20 62 61 | 72 73 2c 20 67 72 6f 77 |croll ba|rs, grow|
|000028f0| 0d 2f 2f 20 62 6f 78 65 | 73 2c 20 65 74 63 2c 20 |.// boxe|s, etc, |
|00002900| 61 72 65 20 68 61 6e 64 | 6c 65 64 20 61 75 74 6f |are hand|led auto|
|00002910| 6d 61 74 69 63 61 6c 6c | 79 20 61 6e 64 20 61 72 |maticall|y and ar|
|00002920| 65 20 4e 4f 54 20 73 65 | 6e 74 20 74 6f 20 74 68 |e NOT se|nt to th|
|00002930| 69 73 20 66 75 6e 63 74 | 69 6f 6e 2e 0d 2f 2f 20 |is funct|ion..// |
|00002940| 41 6c 73 6f 2c 20 77 68 | 65 6e 20 74 68 65 20 75 |Also, wh|en the u|
|00002950| 73 65 72 20 63 6c 69 63 | 6b 73 20 6f 6e 20 61 6e |ser clic|ks on an|
|00002960| 20 69 6e 61 63 74 69 76 | 65 20 77 69 6e 64 6f 77 | inactiv|e window|
|00002970| 2c 20 74 68 61 74 20 63 | 6c 69 63 6b 20 69 73 20 |, that c|lick is |
|00002980| 68 61 6e 64 6c 65 64 0d | 2f 2f 20 62 79 20 61 63 |handled.|// by ac|
|00002990| 74 69 76 61 74 69 6e 67 | 20 74 68 65 20 77 69 6e |tivating| the win|
|000029a0| 64 6f 77 20 61 6e 64 20 | 69 73 20 4e 4f 54 20 73 |dow and |is NOT s|
|000029b0| 65 6e 74 20 74 6f 20 74 | 68 69 73 20 66 75 6e 63 |ent to t|his func|
|000029c0| 74 69 6f 6e 2e 29 20 20 | 54 68 65 20 63 6f 6f 72 |tion.) |The coor|
|000029d0| 64 69 6e 61 74 65 73 0d | 2f 2f 20 6f 66 20 74 68 |dinates.|// of th|
|000029e0| 65 20 70 6f 69 6e 74 20 | 77 68 65 72 65 20 74 68 |e point |where th|
|000029f0| 65 20 75 73 65 72 20 63 | 6c 69 63 6b 65 64 20 61 |e user c|licked a|
|00002a00| 72 65 20 73 65 6e 74 20 | 69 6e 20 74 68 65 20 70 |re sent |in the p|
|00002a10| 61 72 61 6d 65 74 65 72 | 20 6c 6f 63 61 6c 50 74 |arameter| localPt|
|00002a20| 2e 0d 2f 2f 20 54 68 65 | 73 65 20 63 6f 6f 72 64 |..// The|se coord|
|00002a30| 69 6e 61 74 65 73 20 61 | 72 65 20 69 6e 20 74 68 |inates a|re in th|
|00002a40| 65 20 77 69 6e 64 6f 77 | 27 73 20 6c 6f 63 61 6c |e window|'s local|
|00002a50| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 20 28 69 6e | coordin|ates (in|
|00002a60| 20 77 68 69 63 68 20 74 | 68 65 0d 2f 2f 20 74 6f | which t|he.// to|
|00002a70| 70 2c 20 6c 65 66 74 20 | 63 6f 72 6e 65 72 20 69 |p, left |corner i|
|00002a80| 73 20 28 30 2c 30 29 20 | 75 6e 6c 65 73 73 20 79 |s (0,0) |unless y|
|00002a90| 6f 75 20 68 61 76 65 20 | 63 68 61 6e 67 65 64 20 |ou have |changed |
|00002aa0| 74 68 65 6d 29 2e 20 20 | 59 6f 75 20 63 61 6e 20 |them). |You can |
|00002ab0| 67 65 74 0d 2f 2f 20 66 | 75 6c 6c 20 69 6e 66 6f |get.// f|ull info|
|00002ac0| 72 6d 61 74 69 6f 6e 20 | 61 62 6f 75 74 20 74 68 |rmation |about th|
|00002ad0| 65 20 6d 6f 75 73 65 2d | 64 6f 77 6e 20 65 76 65 |e mouse-|down eve|
|00002ae0| 6e 74 20 66 72 6f 6d 20 | 74 68 65 20 67 6c 6f 62 |nt from |the glob|
|00002af0| 61 6c 20 76 61 72 69 61 | 62 6c 65 0d 2f 2f 20 67 |al varia|ble.// g|
|00002b00| 45 76 65 6e 74 2e 20 20 | 46 6f 72 20 65 78 61 6d |Event. |For exam|
|00002b10| 70 6c 65 2c 20 22 69 66 | 20 28 67 45 76 65 6e 74 |ple, "if| (gEvent|
|00002b20| 2e 6d 6f 64 69 66 69 65 | 72 73 20 26 20 63 6d 64 |.modifie|rs & cmd|
|00002b30| 4b 65 79 29 2e 2e 2e 22 | 20 77 69 6c 6c 20 74 65 |Key)..."| will te|
|00002b40| 73 74 0d 2f 2f 20 77 68 | 65 74 68 65 72 20 74 68 |st.// wh|ether th|
|00002b50| 65 20 75 73 65 72 20 77 | 61 73 20 68 6f 6c 64 69 |e user w|as holdi|
|00002b60| 6e 67 20 64 6f 77 6e 20 | 74 68 65 20 63 6f 6d 6d |ng down |the comm|
|00002b70| 61 6e 64 20 6b 65 79 20 | 77 68 65 6e 20 74 68 65 |and key |when the|
|00002b80| 20 6d 6f 75 73 65 20 77 | 61 73 20 63 6c 69 63 6b | mouse w|as click|
|00002b90| 65 64 2e 0d 2f 2f 20 49 | 6e 20 61 64 64 69 74 69 |ed..// I|n additi|
|00002ba0| 6f 6e 2c 20 74 68 65 20 | 67 6c 6f 62 61 6c 20 76 |on, the |global v|
|00002bb0| 61 72 69 61 62 6c 65 20 | 67 43 6c 69 63 6b 43 6f |ariable |gClickCo|
|00002bc0| 75 6e 74 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |unt can |be used |
|00002bd0| 74 6f 20 64 65 74 65 72 | 6d 69 6e 65 0d 2f 2f 20 |to deter|mine.// |
|00002be0| 77 68 65 74 68 65 72 20 | 74 68 69 73 20 69 73 20 |whether |this is |
|00002bf0| 61 20 64 6f 75 62 6c 65 | 20 63 6c 69 63 6b 3b 20 |a double| click; |
|00002c00| 74 68 69 73 20 76 61 72 | 69 61 62 6c 65 20 69 73 |this var|iable is|
|00002c10| 20 73 65 74 20 74 6f 20 | 31 20 66 6f 72 20 61 20 | set to |1 for a |
|00002c20| 73 69 6e 67 6c 65 0d 2f | 2f 20 63 6c 69 63 6b 2c |single./|/ click,|
|00002c30| 20 74 6f 20 32 20 66 6f | 72 20 74 68 65 20 73 65 | to 2 fo|r the se|
|00002c40| 63 6f 6e 64 20 63 6c 69 | 63 6b 20 6f 66 20 61 20 |cond cli|ck of a |
|00002c50| 64 6f 75 62 6c 65 20 63 | 6c 69 63 6b 2c 20 74 6f |double c|lick, to|
|00002c60| 20 33 20 66 6f 72 20 74 | 68 65 20 74 68 69 72 64 | 3 for t|he third|
|00002c70| 0d 2f 2f 20 63 6c 69 63 | 6b 20 6f 66 20 61 20 74 |.// clic|k of a t|
|00002c80| 72 69 70 6c 65 20 63 6c | 69 63 6b 2c 20 65 74 63 |riple cl|ick, etc|
|00002c90| 2e 20 20 46 6f 72 20 61 | 20 64 6f 75 62 6c 65 20 |. For a| double |
|00002ca0| 63 6c 69 63 6b 2c 20 66 | 6f 72 20 65 78 61 6d 70 |click, f|or examp|
|00002cb0| 6c 65 2c 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f |le, this| functio|
|00002cc0| 6e 0d 2f 2f 20 67 65 74 | 73 20 42 4f 54 48 20 63 |n.// get|s BOTH c|
|00002cd0| 6c 69 63 6b 73 20 69 6e | 20 73 75 63 63 65 73 73 |licks in| success|
|00002ce0| 69 6f 6e 2c 20 77 69 74 | 68 20 67 43 6c 69 63 6b |ion, wit|h gClick|
|00002cf0| 43 6f 75 6e 74 20 73 65 | 74 20 74 6f 20 31 20 74 |Count se|t to 1 t|
|00002d00| 68 65 20 66 69 72 73 74 | 0d 2f 2f 20 74 69 6d 65 |he first|.// time|
|00002d10| 20 61 6e 64 20 74 6f 20 | 32 20 74 68 65 20 73 65 | and to |2 the se|
|00002d20| 63 6f 6e 64 20 74 69 6d | 65 2e 20 20 28 41 6c 73 |cond tim|e. (Als|
|00002d30| 6f 20 4e 4f 54 45 3a 20 | 20 54 68 65 20 4d 61 63 |o NOTE: | The Mac|
|00002d40| 69 6e 74 6f 73 68 20 74 | 6f 6f 6c 62 6f 78 20 66 |intosh t|oolbox f|
|00002d50| 75 6e 63 74 69 6f 6e 0d | 2f 2f 20 53 74 69 6c 6c |unction.|// Still|
|00002d60| 44 6f 77 6e 28 29 20 77 | 69 6c 6c 20 62 65 20 74 |Down() w|ill be t|
|00002d70| 72 75 65 20 61 73 20 6c | 6f 6e 67 20 61 73 20 74 |rue as l|ong as t|
|00002d80| 68 65 20 75 73 65 72 20 | 63 6f 6e 74 69 6e 75 65 |he user |continue|
|00002d90| 73 20 74 6f 20 68 6f 6c | 64 20 64 6f 77 6e 20 74 |s to hol|d down t|
|00002da0| 68 65 0d 2f 2f 20 6d 6f | 75 73 65 20 6b 65 79 2e |he.// mo|use key.|
|00002db0| 20 20 59 6f 75 20 6d 69 | 67 68 74 2c 20 66 6f 72 | You mi|ght, for|
|00002dc0| 20 65 78 61 6d 70 6c 65 | 2c 20 75 73 65 20 61 20 | example|, use a |
|00002dd0| 20 77 68 69 6c 65 20 28 | 53 74 69 6c 6c 44 6f 77 | while (|StillDow|
|00002de0| 6e 28 29 29 20 6c 6f 6f | 70 20 74 6f 0d 2f 2f 20 |n()) loo|p to.// |
|00002df0| 66 6f 6c 6c 6f 77 20 74 | 68 65 20 6d 6f 75 73 65 |follow t|he mouse|
|00002e00| 20 6f 72 20 70 65 72 66 | 6f 72 6d 20 73 6f 6d 65 | or perf|orm some|
|00002e10| 20 61 63 74 69 6f 6e 20 | 61 73 20 6c 6f 6e 67 20 | action |as long |
|00002e20| 61 73 20 74 68 65 20 75 | 73 65 72 20 68 6f 6c 64 |as the u|ser hold|
|00002e30| 73 20 64 6f 77 6e 0d 2f | 2f 20 74 68 65 20 62 75 |s down./|/ the bu|
|00002e40| 74 74 6f 6e 2e 29 0d 2f | 2f 20 20 20 20 4e 4f 54 |tton.)./|/ NOT|
|00002e50| 45 3a 20 42 65 66 6f 72 | 65 20 74 68 69 73 20 66 |E: Befor|e this f|
|00002e60| 75 6e 63 74 69 6f 6e 20 | 69 73 20 63 61 6c 6c 65 |unction |is calle|
|00002e70| 64 2c 20 74 68 65 20 22 | 67 72 61 70 68 69 63 73 |d, the "|graphics|
|00002e80| 20 70 6f 72 74 22 20 69 | 73 20 73 65 74 20 74 6f | port" i|s set to|
|00002e90| 0d 2f 2f 20 74 68 69 73 | 20 77 69 6e 64 6f 77 2e |.// this| window.|
|00002ea0| 20 20 54 68 61 74 20 6a | 75 73 74 20 6d 65 61 6e | That j|ust mean|
|00002eb0| 73 20 74 68 61 74 20 41 | 4e 59 20 64 72 61 77 69 |s that A|NY drawi|
|00002ec0| 6e 67 20 79 6f 75 20 64 | 6f 20 69 6e 20 74 68 69 |ng you d|o in thi|
|00002ed0| 73 20 66 75 6e 63 74 69 | 6f 6e 0d 2f 2f 20 77 69 |s functi|on.// wi|
|00002ee0| 6c 6c 20 61 70 70 6c 79 | 20 74 6f 20 74 68 69 73 |ll apply| to this|
|00002ef0| 20 77 69 6e 64 6f 77 2e | 0d 0d 76 6f 69 64 20 6d | window.|..void m|
|00002f00| 79 57 69 6e 64 6f 77 3a | 3a 64 6f 43 6f 6e 74 65 |yWindow:|:doConte|
|00002f10| 6e 74 43 6c 69 63 6b 28 | 50 6f 69 6e 74 20 6c 6f |ntClick(|Point lo|
|00002f20| 63 61 6c 50 74 29 20 7b | 0d 20 20 20 2f 2f 20 48 |calPt) {|. // H|
|00002f30| 61 6e 64 6c 65 20 61 20 | 6d 6f 75 73 65 20 63 6c |andle a |mouse cl|
|00002f40| 69 63 6b 0d 7d 0d 0d 0d | 2f 2f 20 46 75 6e 63 74 |ick.}...|// Funct|
|00002f50| 69 6f 6e 20 64 6f 52 65 | 64 72 61 77 20 69 73 20 |ion doRe|draw is |
|00002f60| 63 61 6c 6c 65 64 20 77 | 68 65 6e 20 74 68 65 20 |called w|hen the |
|00002f70| 77 69 6e 64 6f 77 2c 20 | 6f 72 20 61 20 70 6f 72 |window, |or a por|
|00002f80| 74 69 6f 6e 20 6f 66 20 | 69 74 2c 20 6e 65 65 64 |tion of |it, need|
|00002f90| 73 20 74 6f 0d 2f 2f 20 | 62 65 20 72 65 64 72 61 |s to.// |be redra|
|00002fa0| 77 6e 20 28 62 65 63 61 | 75 73 65 20 74 68 65 20 |wn (beca|use the |
|00002fb0| 77 69 6e 64 6f 77 20 68 | 61 73 20 62 65 65 6e 20 |window h|as been |
|00002fc0| 72 65 73 69 7a 65 64 20 | 6f 72 20 6d 6f 76 65 64 |resized |or moved|
|00002fd0| 20 66 72 6f 6d 20 62 65 | 68 69 6e 64 0d 2f 2f 20 | from be|hind.// |
|00002fe0| 61 6e 6f 74 68 65 72 20 | 77 69 6e 64 6f 77 2c 20 |another |window, |
|00002ff0| 66 6f 72 20 65 78 61 6d | 70 6c 65 2e 29 20 20 49 |for exam|ple.) I|
|00003000| 74 20 69 73 20 61 6c 73 | 6f 20 63 61 6c 6c 65 64 |t is als|o called|
|00003010| 20 77 68 65 6e 20 74 68 | 65 20 77 69 6e 64 6f 77 | when th|e window|
|00003020| 20 69 73 0d 2f 2f 20 66 | 69 72 73 74 20 6f 70 65 | is.// f|irst ope|
|00003030| 6e 65 64 20 28 61 66 74 | 65 72 20 61 6c 6c 20 74 |ned (aft|er all t|
|00003040| 68 65 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |he initi|alizatio|
|00003050| 6e 20 64 6f 6e 65 20 69 | 6e 20 53 65 74 44 65 66 |n done i|n SetDef|
|00003060| 61 75 6c 74 73 20 61 6e | 64 0d 2f 2f 20 4f 70 65 |aults an|d.// Ope|
|00003070| 6e 49 6e 52 65 63 74 29 | 2e 20 20 4e 6f 74 65 20 |nInRect)|. Note |
|00003080| 74 68 61 74 20 79 6f 75 | 72 20 77 69 6e 64 6f 77 |that you|r window|
|00003090| 20 61 6c 77 61 79 73 20 | 6e 65 65 64 73 20 74 6f | always |needs to|
|000030a0| 20 73 61 76 65 20 65 6e | 6f 75 67 68 20 64 61 74 | save en|ough dat|
|000030b0| 61 0d 2f 2f 20 74 6f 20 | 72 65 64 72 61 77 20 69 |a.// to |redraw i|
|000030c0| 74 73 65 6c 66 20 28 69 | 66 20 79 6f 75 20 77 61 |tself (i|f you wa|
|000030d0| 6e 74 20 79 6f 75 72 20 | 61 70 70 6c 69 63 61 74 |nt your |applicat|
|000030e0| 69 6f 6e 20 74 6f 20 61 | 63 74 20 6c 69 6b 65 20 |ion to a|ct like |
|000030f0| 61 20 72 65 61 6c 20 4d | 61 63 20 70 72 6f 67 72 |a real M|ac progr|
|00003100| 61 6d 29 2e 0d 2f 2f 20 | 4f 72 64 69 6e 61 72 69 |am)..// |Ordinari|
|00003110| 6c 79 2c 20 79 6f 75 20 | 77 69 6c 6c 20 73 69 6d |ly, you |will sim|
|00003120| 70 6c 79 20 72 65 64 72 | 61 77 20 74 68 65 20 65 |ply redr|aw the e|
|00003130| 6e 74 69 72 65 20 63 6f | 6e 74 65 6e 74 73 20 6f |ntire co|ntents o|
|00003140| 66 20 74 68 65 20 77 69 | 6e 64 6f 77 2e 0d 2f 2f |f the wi|ndow..//|
|00003150| 20 48 6f 77 65 76 65 72 | 2c 20 69 66 20 79 6f 75 | However|, if you|
|00003160| 72 20 77 69 6e 64 6f 77 | 20 69 73 20 76 65 72 79 |r window| is very|
|00003170| 20 63 6f 6d 70 6c 69 63 | 61 74 65 64 2c 20 79 6f | complic|ated, yo|
|00003180| 75 20 6d 69 67 68 74 20 | 73 61 76 65 20 73 6f 6d |u might |save som|
|00003190| 65 20 74 69 6d 65 0d 2f | 2f 20 62 79 20 75 73 69 |e time./|/ by usi|
|000031a0| 6e 67 20 74 68 65 20 70 | 61 72 61 6d 65 74 65 72 |ng the p|arameter|
|000031b0| 20 62 61 64 52 65 63 74 | 2e 20 20 54 68 69 73 20 | badRect|. This |
|000031c0| 69 73 20 61 20 72 65 63 | 74 61 6e 67 6c 65 20 74 |is a rec|tangle t|
|000031d0| 68 61 74 20 63 6f 6e 74 | 61 69 6e 73 20 74 68 65 |hat cont|ains the|
|000031e0| 0d 2f 2f 20 70 6f 72 74 | 69 6f 6e 20 6f 66 20 74 |.// port|ion of t|
|000031f0| 68 65 20 77 69 6e 64 6f | 77 20 74 68 61 74 20 61 |he windo|w that a|
|00003200| 63 74 75 61 6c 6c 79 20 | 6e 65 65 64 73 20 74 6f |ctually |needs to|
|00003210| 20 62 65 20 72 65 64 72 | 61 77 6e 2e 0d 2f 2f 20 | be redr|awn..// |
|00003220| 20 20 20 49 66 20 79 6f | 75 72 20 77 69 6e 64 6f | If yo|ur windo|
|00003230| 77 20 75 73 65 73 20 73 | 63 72 6f 6c 6c 20 62 61 |w uses s|croll ba|
|00003240| 72 73 2c 20 79 6f 75 20 | 77 69 6c 6c 20 6e 65 65 |rs, you |will nee|
|00003250| 64 20 74 6f 20 6b 6e 6f | 77 20 74 68 65 20 63 75 |d to kno|w the cu|
|00003260| 72 72 65 6e 74 0d 2f 2f | 20 73 65 74 74 69 6e 67 |rrent.//| setting|
|00003270| 73 20 61 6e 64 20 6d 61 | 78 69 6d 75 6d 73 20 6f |s and ma|ximums o|
|00003280| 6e 20 74 68 6f 73 65 20 | 73 63 72 6f 6c 6c 20 62 |n those |scroll b|
|00003290| 61 72 73 2e 20 20 59 6f | 75 20 63 61 6e 20 66 69 |ars. Yo|u can fi|
|000032a0| 6e 64 20 6f 75 74 20 62 | 79 0d 2f 2f 20 63 61 6c |nd out b|y.// cal|
|000032b0| 6c 69 6e 67 20 74 68 65 | 20 66 75 6e 63 74 69 6f |ling the| functio|
|000032c0| 6e 73 20 47 65 74 48 56 | 61 6c 28 29 2c 20 47 65 |ns GetHV|al(), Ge|
|000032d0| 74 56 56 61 6c 28 29 2c | 20 47 65 74 48 4d 61 78 |tVVal(),| GetHMax|
|000032e0| 28 29 20 61 6e 64 20 47 | 65 74 56 4d 61 78 28 29 |() and G|etVMax()|
|000032f0| 2e 0d 2f 2f 20 20 20 20 | 28 50 65 6f 70 6c 65 20 |..// |(People |
|00003300| 73 6f 6d 65 74 69 6d 65 | 73 20 68 61 76 65 20 74 |sometime|s have t|
|00003310| 72 6f 75 62 6c 65 20 75 | 6e 64 65 72 73 74 61 6e |rouble u|nderstan|
|00003320| 64 69 6e 67 20 74 68 69 | 73 20 66 75 6e 63 74 69 |ding thi|s functi|
|00003330| 6f 6e 2e 20 20 49 74 20 | 68 61 73 20 74 6f 0d 2f |on. It |has to./|
|00003340| 2f 20 65 78 69 73 74 20 | 62 65 63 61 75 73 65 20 |/ exist |because |
|00003350| 74 68 65 20 4d 61 63 20 | 64 6f 65 73 6e 27 74 20 |the Mac |doesn't |
|00003360| 61 63 74 75 61 6c 6c 79 | 20 72 65 6d 65 6d 62 65 |actually| remembe|
|00003370| 72 20 77 68 61 74 27 73 | 20 69 6e 20 79 6f 75 72 |r what's| in your|
|00003380| 20 77 69 6e 64 6f 77 2e | 0d 2f 2f 20 57 68 65 6e | window.|.// When|
|00003390| 20 6f 6e 65 20 77 69 6e | 64 6f 77 20 63 6f 76 65 | one win|dow cove|
|000033a0| 72 73 20 61 6e 6f 74 68 | 65 72 2c 20 61 6e 79 74 |rs anoth|er, anyt|
|000033b0| 68 69 6e 67 20 69 6e 20 | 74 68 65 20 62 6f 74 74 |hing in |the bott|
|000033c0| 6f 6d 20 77 69 6e 64 6f | 77 20 69 73 20 66 6f 72 |om windo|w is for|
|000033d0| 67 6f 74 74 65 6e 0d 2f | 2f 20 57 68 65 6e 20 74 |gotten./|/ When t|
|000033e0| 68 65 20 77 69 6e 64 6f | 77 20 69 73 20 6c 61 74 |he windo|w is lat|
|000033f0| 65 72 20 75 6e 63 6f 76 | 65 72 65 64 2c 20 74 68 |er uncov|ered, th|
|00003400| 65 20 4d 61 63 20 73 74 | 69 63 6b 73 20 79 6f 75 |e Mac st|icks you|
|00003410| 20 77 69 74 68 20 74 68 | 65 20 0d 2f 2f 20 72 65 | with th|e .// re|
|00003420| 73 70 6f 6e 73 69 62 69 | 6c 69 74 79 20 6f 66 20 |sponsibi|lity of |
|00003430| 72 65 6d 65 6d 62 65 72 | 69 6e 67 20 77 68 61 74 |remember|ing what|
|00003440| 20 77 61 73 20 74 68 65 | 72 65 20 61 6e 64 20 72 | was the|re and r|
|00003450| 65 63 6f 6e 73 74 69 74 | 75 74 69 6e 67 20 69 74 |econstit|uting it|
|00003460| 2e 0d 2f 2f 20 53 6f 2c | 20 6f 72 64 69 6e 61 72 |..// So,| ordinar|
|00003470| 69 6c 79 2c 20 74 68 69 | 73 20 66 75 6e 63 74 69 |ily, thi|s functi|
|00003480| 6f 6e 20 69 73 20 72 65 | 64 6f 69 6e 67 20 6f 6c |on is re|doing ol|
|00003490| 64 20 77 6f 72 6b 20 72 | 61 74 68 65 72 20 74 68 |d work r|ather th|
|000034a0| 61 6e 20 67 65 74 74 69 | 6e 67 0d 2f 2f 20 6e 65 |an getti|ng.// ne|
|000034b0| 77 20 77 6f 72 6b 20 64 | 6f 6e 65 2e 20 20 54 68 |w work d|one. Th|
|000034c0| 69 73 20 69 6d 70 6f 73 | 65 73 20 74 68 65 20 67 |is impos|es the g|
|000034d0| 72 65 61 74 20 62 75 72 | 64 65 6e 20 6f 6e 20 74 |reat bur|den on t|
|000034e0| 68 65 20 70 72 6f 67 72 | 61 6d 6d 65 72 20 6f 66 |he progr|ammer of|
|000034f0| 0d 2f 2f 20 72 65 6d 65 | 6d 62 65 72 69 6e 67 20 |.// reme|mbering |
|00003500| 77 68 61 74 27 73 20 69 | 6e 20 65 61 63 68 20 77 |what's i|n each w|
|00003510| 69 6e 64 6f 77 2e 29 0d | 2f 2f 20 20 20 20 4e 4f |indow.).|// NO|
|00003520| 54 45 3a 20 42 65 66 6f | 72 65 20 74 68 69 73 20 |TE: Befo|re this |
|00003530| 66 75 6e 63 74 69 6f 6e | 20 69 73 20 63 61 6c 6c |function| is call|
|00003540| 65 64 2c 20 74 68 65 20 | 22 67 72 61 70 68 69 63 |ed, the |"graphic|
|00003550| 73 20 70 6f 72 74 22 20 | 69 73 20 73 65 74 20 74 |s port" |is set t|
|00003560| 6f 0d 2f 2f 20 74 68 69 | 73 20 77 69 6e 64 6f 77 |o.// thi|s window|
|00003570| 2e 20 20 54 68 61 74 20 | 6a 75 73 74 20 6d 65 61 |. That |just mea|
|00003580| 6e 73 20 74 68 61 74 20 | 41 4e 59 20 64 72 61 77 |ns that |ANY draw|
|00003590| 69 6e 67 20 79 6f 75 20 | 64 6f 20 69 6e 20 74 68 |ing you |do in th|
|000035a0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 0d 2f 2f 20 77 |is funct|ion.// w|
|000035b0| 69 6c 6c 20 61 70 70 6c | 79 20 74 6f 20 74 68 69 |ill appl|y to thi|
|000035c0| 73 20 77 69 6e 64 6f 77 | 2e 0d 0d 76 6f 69 64 20 |s window|...void |
|000035d0| 6d 79 57 69 6e 64 6f 77 | 3a 3a 64 6f 52 65 64 72 |myWindow|::doRedr|
|000035e0| 61 77 28 52 65 63 74 2a | 20 62 61 64 52 65 63 74 |aw(Rect*| badRect|
|000035f0| 29 7b 0d 20 20 20 2f 2f | 20 72 65 64 72 61 77 20 |){. //| redraw |
|00003600| 63 75 72 72 65 6e 74 20 | 63 6f 6e 74 65 6e 74 73 |current |contents|
|00003610| 20 6f 66 20 77 69 6e 64 | 6f 77 2e 0d 7d 0d 0d 0d | of wind|ow..}...|
|00003620| 2f 2f 20 46 75 6e 63 74 | 69 6f 6e 20 61 64 6a 75 |// Funct|ion adju|
|00003630| 73 74 54 6f 4e 65 77 53 | 69 7a 65 20 69 73 20 63 |stToNewS|ize is c|
|00003640| 61 6c 6c 65 64 20 77 68 | 65 6e 65 76 65 72 20 74 |alled wh|enever t|
|00003650| 68 65 20 77 69 6e 64 6f | 77 20 63 68 61 6e 67 65 |he windo|w change|
|00003660| 73 20 73 69 7a 65 20 62 | 65 63 61 75 73 65 0d 2f |s size b|ecause./|
|00003670| 2f 20 74 68 65 20 75 73 | 65 72 20 64 72 61 67 73 |/ the us|er drags|
|00003680| 20 69 74 73 20 67 72 6f | 77 20 62 6f 78 20 6f 72 | its gro|w box or|
|00003690| 20 63 6c 69 63 6b 73 20 | 69 74 73 20 7a 6f 6f 6d | clicks |its zoom|
|000036a0| 20 62 6f 78 2e 20 20 49 | 66 20 79 6f 75 20 6e 65 | box. I|f you ne|
|000036b0| 65 64 20 74 6f 20 6d 61 | 6b 65 0d 2f 2f 20 61 6e |ed to ma|ke.// an|
|000036c0| 79 20 63 68 61 6e 67 65 | 73 20 74 6f 20 61 63 63 |y change|s to acc|
|000036d0| 6f 6d 6f 64 61 74 65 20 | 74 68 65 20 6e 65 77 20 |omodate |the new |
|000036e0| 73 69 7a 65 2c 20 64 6f | 20 69 74 20 68 65 72 65 |size, do| it here|
|000036f0| 2e 20 20 48 6f 77 65 76 | 65 72 2c 20 44 4f 20 4e |. Howev|er, DO N|
|00003700| 4f 54 0d 2f 2f 20 72 65 | 64 72 61 77 20 74 68 65 |OT.// re|draw the|
|00003710| 20 77 69 6e 64 6f 77 20 | 68 65 72 65 3b 20 66 75 | window |here; fu|
|00003720| 6e 63 74 69 6f 6e 20 64 | 6f 52 65 64 72 61 77 28 |nction d|oRedraw(|
|00003730| 29 20 69 73 20 67 6f 69 | 6e 67 20 74 6f 20 62 65 |) is goi|ng to be|
|00003740| 20 63 61 6c 6c 65 64 20 | 0d 2f 2f 20 61 75 74 6f | called |.// auto|
|00003750| 6d 61 74 69 63 61 6c 6c | 79 20 61 66 74 65 72 20 |maticall|y after |
|00003760| 74 68 69 73 20 66 75 6e | 63 74 69 6f 6e 20 74 6f |this fun|ction to|
|00003770| 20 64 6f 20 74 68 65 20 | 61 63 74 75 61 6c 20 72 | do the |actual r|
|00003780| 65 64 72 61 77 69 6e 67 | 2e 0d 2f 2f 20 54 68 65 |edrawing|..// The|
|00003790| 20 69 6e 68 65 72 69 74 | 65 64 20 66 75 6e 63 74 | inherit|ed funct|
|000037a0| 69 6f 6e 20 73 69 6d 70 | 6c 79 20 72 65 73 69 7a |ion simp|ly resiz|
|000037b0| 65 73 20 61 6e 64 20 6d | 6f 76 65 73 20 74 68 65 |es and m|oves the|
|000037c0| 20 73 63 72 6f 6c 6c 20 | 62 61 72 73 2c 20 69 66 | scroll |bars, if|
|000037d0| 20 61 6e 79 2e 0d 2f 2f | 20 41 66 74 65 72 20 74 | any..//| After t|
|000037e0| 68 69 73 2c 20 79 6f 75 | 20 6d 69 67 68 74 20 6e |his, you| might n|
|000037f0| 65 65 64 20 74 6f 20 72 | 65 61 64 6a 75 73 74 20 |eed to r|eadjust |
|00003800| 74 68 65 20 76 61 6c 75 | 65 73 2c 20 6d 61 78 69 |the valu|es, maxi|
|00003810| 6d 75 6d 73 20 6f 72 0d | 2f 2f 20 6c 69 6e 65 73 |mums or.|// lines|
|00003820| 50 65 72 50 61 67 65 20 | 61 73 73 6f 63 69 61 74 |PerPage |associat|
|00003830| 65 64 20 77 69 74 68 20 | 74 68 65 20 73 63 72 6f |ed with |the scro|
|00003840| 6c 6c 20 62 61 72 73 2e | 20 20 54 68 65 20 66 75 |ll bars.| The fu|
|00003850| 6e 63 74 69 6f 6e 73 20 | 53 65 74 48 56 61 6c 28 |nctions |SetHVal(|
|00003860| 29 2c 0d 2f 2f 20 53 65 | 74 56 56 61 6c 28 29 2c |),.// Se|tVVal(),|
|00003870| 20 53 65 74 48 4d 61 78 | 28 29 2c 20 53 65 74 56 | SetHMax|(), SetV|
|00003880| 4d 61 78 28 29 2c 20 53 | 65 74 48 4c 69 6e 65 73 |Max(), S|etHLines|
|00003890| 50 65 72 50 61 67 65 28 | 29 20 61 6e 64 20 53 65 |PerPage(|) and Se|
|000038a0| 74 56 4c 69 6e 65 73 50 | 65 72 50 61 67 65 28 29 |tVLinesP|erPage()|
|000038b0| 0d 2f 2f 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |.// can |be used |
|000038c0| 74 6f 20 63 68 61 6e 67 | 65 20 74 68 65 73 65 20 |to chang|e these |
|000038d0| 73 65 74 74 69 6e 67 73 | 2e 20 20 49 66 20 79 6f |settings|. If yo|
|000038e0| 75 20 68 61 76 65 20 54 | 45 64 69 74 73 20 6f 72 |u have T|Edits or|
|000038f0| 0d 2f 2f 20 63 6f 6e 74 | 72 6f 6c 73 20 6f 66 20 |.// cont|rols of |
|00003900| 79 6f 75 72 20 6f 77 6e | 2c 20 74 68 65 79 20 77 |your own|, they w|
|00003910| 69 6c 6c 20 68 61 76 65 | 20 74 6f 20 62 65 20 72 |ill have| to be r|
|00003920| 65 73 69 7a 65 64 20 61 | 6e 64 20 6d 6f 76 65 64 |esized a|nd moved|
|00003930| 2e 20 20 49 66 20 74 68 | 65 0d 2f 2f 20 73 74 75 |. If th|e.// stu|
|00003940| 66 66 20 64 72 61 77 6e | 20 69 6e 20 74 68 65 20 |ff drawn| in the |
|00003950| 77 69 6e 64 6f 77 20 6e | 65 65 64 73 20 74 6f 20 |window n|eeds to |
|00003960| 62 65 20 73 63 61 6c 65 | 64 20 74 6f 20 74 68 65 |be scale|d to the|
|00003970| 20 6e 65 77 20 73 69 7a | 65 2c 20 79 6f 75 20 63 | new siz|e, you c|
|00003980| 61 6e 20 64 6f 0d 2f 2f | 20 69 74 20 68 65 72 65 |an do.//| it here|
|00003990| 2e 0d 0d 76 6f 69 64 20 | 6d 79 57 69 6e 64 6f 77 |...void |myWindow|
|000039a0| 3a 3a 61 64 6a 75 73 74 | 54 6f 4e 65 77 53 69 7a |::adjust|ToNewSiz|
|000039b0| 65 28 76 6f 69 64 29 20 | 7b 0d 20 20 20 69 6e 68 |e(void) |{. inh|
|000039c0| 65 72 69 74 65 64 3a 3a | 61 64 6a 75 73 74 54 6f |erited::|adjustTo|
|000039d0| 4e 65 77 53 69 7a 65 28 | 29 3b 0d 20 20 20 2f 2f |NewSize(|);. //|
|000039e0| 20 72 65 73 70 6f 6e 64 | 20 74 6f 20 63 68 61 6e | respond| to chan|
|000039f0| 67 65 20 69 6e 20 77 69 | 6e 64 6f 77 20 73 69 7a |ge in wi|ndow siz|
|00003a00| 65 0d 7d 0d 0d 0d 2f 2f | 20 46 75 6e 63 74 69 6f |e.}...//| Functio|
|00003a10| 6e 20 64 6f 48 53 63 72 | 6f 6c 6c 20 69 73 20 63 |n doHScr|oll is c|
|00003a20| 61 6c 6c 65 64 20 77 68 | 65 6e 20 74 68 65 20 75 |alled wh|en the u|
|00003a30| 73 65 72 20 63 68 61 6e | 67 65 73 20 74 68 65 20 |ser chan|ges the |
|00003a40| 70 6f 73 69 74 69 6f 6e | 20 6f 66 20 74 68 65 0d |position| of the.|
|00003a50| 2f 2f 20 68 6f 72 69 7a | 6f 6e 74 61 6c 20 73 63 |// horiz|ontal sc|
|00003a60| 72 6f 6c 6c 2e 20 20 49 | 74 20 77 69 6c 6c 20 62 |roll. I|t will b|
|00003a70| 65 20 63 61 6c 6c 65 64 | 20 72 65 70 65 61 74 65 |e called| repeate|
|00003a80| 64 6c 79 20 69 66 20 74 | 68 65 20 75 73 65 72 20 |dly if t|he user |
|00003a90| 68 6f 6c 64 73 20 64 6f | 77 6e 20 74 68 65 0d 2f |holds do|wn the./|
|00003aa0| 2f 20 6d 6f 75 73 65 20 | 62 75 74 74 6f 6e 20 6f |/ mouse |button o|
|00003ab0| 6e 20 61 6e 20 61 72 72 | 6f 77 20 6f 72 20 69 6e |n an arr|ow or in|
|00003ac0| 20 74 68 65 20 67 72 61 | 79 20 61 72 65 61 20 6f | the gra|y area o|
|00003ad0| 66 20 74 68 65 20 73 63 | 72 6f 6c 6c 2e 20 20 54 |f the sc|roll. T|
|00003ae0| 68 65 20 69 6e 68 65 72 | 69 74 65 64 0d 2f 2f 20 |he inher|ited.// |
|00003af0| 66 75 6e 63 74 69 6f 6e | 20 73 69 6d 70 6c 79 20 |function| simply |
|00003b00| 65 72 61 73 65 73 20 74 | 68 65 20 73 72 65 65 6e |erases t|he sreen|
|00003b10| 20 61 6e 64 20 74 68 65 | 6e 20 63 61 6c 6c 73 20 | and the|n calls |
|00003b20| 79 6f 75 72 20 44 6f 52 | 65 64 72 61 77 28 29 20 |your DoR|edraw() |
|00003b30| 66 75 6e 63 74 69 6f 6e | 0d 2f 2f 20 74 6f 20 72 |function|.// to r|
|00003b40| 65 64 72 61 77 20 74 68 | 65 20 73 63 72 65 65 6e |edraw th|e screen|
|00003b50| 20 63 6f 6e 74 65 6e 74 | 73 20 28 70 72 65 73 75 | content|s (presu|
|00003b60| 6d 61 62 6c 79 20 72 65 | 66 6c 65 63 74 69 6e 67 |mably re|flecting|
|00003b70| 20 74 68 65 20 6e 65 77 | 20 70 6f 73 69 74 69 6f | the new| positio|
|00003b80| 6e 20 6f 66 0d 2f 2f 20 | 74 68 65 20 73 63 72 6f |n of.// |the scro|
|00003b90| 6c 6c 29 2e 20 20 44 65 | 70 65 6e 64 69 6e 67 20 |ll). De|pending |
|00003ba0| 6f 6e 20 79 6f 75 72 20 | 61 70 70 6c 69 63 61 74 |on your |applicat|
|00003bb0| 69 6f 6e 2c 20 74 68 69 | 73 20 6d 69 67 68 74 20 |ion, thi|s might |
|00003bc0| 62 65 20 66 69 6e 65 2c | 20 62 75 74 20 69 74 0d |be fine,| but it.|
|00003bd0| 2f 2f 20 63 61 6e 20 63 | 61 75 73 65 20 61 6e 20 |// can c|ause an |
|00003be0| 61 6e 6e 6f 79 69 6e 67 | 20 66 6c 69 63 6b 65 72 |annoying| flicker|
|00003bf0| 20 61 6e 64 20 63 61 6e | 20 62 65 20 74 6f 6f 20 | and can| be too |
|00003c00| 74 69 6d 65 2d 63 6f 6e | 73 75 6d 69 6e 67 2e 20 |time-con|suming. |
|00003c10| 20 49 66 20 79 6f 75 0d | 2f 2f 20 77 61 6e 74 20 | If you.|// want |
|00003c20| 74 6f 20 63 68 61 6e 67 | 65 20 74 68 69 73 2c 20 |to chang|e this, |
|00003c30| 79 6f 75 20 73 68 6f 75 | 6c 64 20 45 52 41 53 45 |you shou|ld ERASE|
|00003c40| 20 74 68 65 20 63 61 6c | 6c 20 74 6f 20 69 6e 68 | the cal|l to inh|
|00003c50| 65 72 69 74 65 64 3a 3a | 64 6f 48 53 63 72 6f 6c |erited::|doHScrol|
|00003c60| 6c 0d 2f 2f 20 61 6e 64 | 20 73 75 62 73 74 69 74 |l.// and| substit|
|00003c70| 75 74 65 20 79 6f 75 72 | 20 6f 77 6e 20 63 6f 64 |ute your| own cod|
|00003c80| 65 2e 20 20 28 54 79 70 | 69 63 61 6c 6c 79 2c 20 |e. (Typ|ically, |
|00003c90| 79 6f 75 20 77 69 6c 6c | 20 63 61 6c 6c 20 74 68 |you will| call th|
|00003ca0| 65 20 4d 61 63 0d 2f 2f | 20 54 6f 6f 6c 62 6f 78 |e Mac.//| Toolbox|
|00003cb0| 20 72 6f 75 74 69 6e 65 | 20 53 63 72 6f 6c 6c 52 | routine| ScrollR|
|00003cc0| 65 63 74 28 29 20 61 6e | 64 20 74 68 65 6e 20 6a |ect() an|d then j|
|00003cd0| 75 73 74 20 64 6f 20 74 | 68 65 20 6d 69 6e 69 6d |ust do t|he minim|
|00003ce0| 61 6c 20 72 65 64 72 61 | 77 69 6e 67 0d 2f 2f 20 |al redra|wing.// |
|00003cf0| 6e 65 63 65 73 73 61 72 | 79 2e 29 20 20 54 68 65 |necessar|y.) The|
|00003d00| 20 70 61 72 61 6d 65 74 | 65 72 20 74 65 6c 6c 73 | paramet|er tells|
|00003d10| 20 74 68 65 20 43 48 41 | 4e 47 45 20 69 6e 20 74 | the CHA|NGE in t|
|00003d20| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 74 68 65 20 |he value| of the |
|00003d30| 68 6f 72 69 7a 6f 6e 74 | 61 6c 0d 2f 2f 20 73 63 |horizont|al.// sc|
|00003d40| 72 6f 6c 6c 2e 20 20 59 | 6f 75 20 63 61 6e 20 67 |roll. Y|ou can g|
|00003d50| 65 74 20 74 68 65 20 61 | 63 74 75 61 6c 20 6e 65 |et the a|ctual ne|
|00003d60| 77 20 76 61 6c 75 65 20 | 62 79 20 63 61 6c 6c 69 |w value |by calli|
|00003d70| 6e 67 20 47 65 74 48 56 | 61 6c 28 29 2e 0d 0d 76 |ng GetHV|al()...v|
|00003d80| 6f 69 64 20 6d 79 57 69 | 6e 64 6f 77 3a 3a 64 6f |oid myWi|ndow::do|
|00003d90| 48 53 63 72 6f 6c 6c 28 | 69 6e 74 20 64 68 29 20 |HScroll(|int dh) |
|00003da0| 7b 0d 20 20 20 69 6e 68 | 65 72 69 74 65 64 3a 3a |{. inh|erited::|
|00003db0| 64 6f 48 53 63 72 6f 6c | 6c 28 64 68 29 3b 20 20 |doHScrol|l(dh); |
|00003dc0| 2f 2f 20 72 65 70 6c 61 | 63 65 20 77 69 74 68 20 |// repla|ce with |
|00003dd0| 79 6f 75 72 20 6f 77 6e | 20 63 6f 64 65 20 69 66 |your own| code if|
|00003de0| 20 79 6f 75 0d 20 20 20 | 20 20 20 20 20 20 20 20 | you. | |
|00003df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003e00| 20 20 20 2f 2f 20 64 6f | 6e 27 74 20 6c 69 6b 65 | // do|n't like|
|00003e10| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 62 65 68 | the def|ault beh|
|00003e20| 61 76 69 6f 75 72 0d 7d | 0d 0d 0d 2f 2f 20 46 75 |aviour.}|...// Fu|
|00003e30| 6e 63 74 69 6f 6e 20 64 | 6f 56 53 63 72 6f 6c 6c |nction d|oVScroll|
|00003e40| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|00003e50| 74 68 65 20 75 73 65 72 | 20 63 68 61 6e 67 65 73 |the user| changes|
|00003e60| 20 74 68 65 20 70 6f 73 | 69 74 69 6f 6e 20 6f 66 | the pos|ition of|
|00003e70| 20 74 68 65 0d 2f 2f 20 | 76 65 72 74 69 63 61 6c | the.// |vertical|
|00003e80| 20 73 63 72 6f 6c 6c 2e | 20 20 53 69 6d 69 6c 61 | scroll.| Simila|
|00003e90| 72 20 63 6f 6d 6d 65 6e | 74 73 20 74 6f 20 74 68 |r commen|ts to th|
|00003ea0| 6f 73 65 20 6f 6e 20 64 | 6f 48 53 63 72 6f 6c 6c |ose on d|oHScroll|
|00003eb0| 28 29 20 61 70 70 6c 79 | 2e 0d 0d 76 6f 69 64 20 |() apply|...void |
|00003ec0| 6d 79 57 69 6e 64 6f 77 | 3a 3a 64 6f 56 53 63 72 |myWindow|::doVScr|
|00003ed0| 6f 6c 6c 28 69 6e 74 20 | 64 76 29 20 7b 0d 20 20 |oll(int |dv) {. |
|00003ee0| 20 69 6e 68 65 72 69 74 | 65 64 3a 3a 64 6f 56 53 | inherit|ed::doVS|
|00003ef0| 63 72 6f 6c 6c 28 64 76 | 29 3b 20 20 2f 2f 20 72 |croll(dv|); // r|
|00003f00| 65 70 6c 61 63 65 20 77 | 69 74 68 20 79 6f 75 72 |eplace w|ith your|
|00003f10| 20 6f 77 6e 20 63 6f 64 | 65 20 69 66 20 79 6f 75 | own cod|e if you|
|00003f20| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00003f30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00003f40| 2f 20 64 6f 6e 27 74 20 | 6c 69 6b 65 20 74 68 65 |/ don't |like the|
|00003f50| 20 64 65 66 61 75 6c 74 | 20 62 65 68 61 76 69 6f | default| behavio|
|00003f60| 75 72 0d 7d 0d 0d 0d 2f | 2f 20 46 75 6e 63 74 69 |ur.}.../|/ Functi|
|00003f70| 6f 6e 20 64 6f 41 63 74 | 69 76 61 74 65 20 69 73 |on doAct|ivate is|
|00003f80| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 79 6f 75 | called |when you|
|00003f90| 72 20 77 69 6e 64 6f 77 | 20 69 73 20 64 65 61 63 |r window| is deac|
|00003fa0| 74 69 76 61 74 65 64 20 | 28 62 65 63 61 75 73 65 |tivated |(because|
|00003fb0| 0d 2f 2f 20 74 68 65 20 | 75 73 65 72 20 63 6c 69 |.// the |user cli|
|00003fc0| 63 6b 73 20 6f 6e 20 61 | 6e 6f 74 68 65 72 20 77 |cks on a|nother w|
|00003fd0| 69 6e 64 6f 77 29 20 6f | 72 20 61 63 74 69 76 61 |indow) o|r activa|
|00003fe0| 74 65 64 20 28 62 65 63 | 61 75 73 65 20 74 68 65 |ted (bec|ause the|
|00003ff0| 20 75 73 65 72 20 63 6c | 69 63 6b 73 0d 2f 2f 20 | user cl|icks.// |
|00004000| 6f 6e 20 74 68 69 73 20 | 77 69 6e 64 6f 77 20 61 |on this |window a|
|00004010| 6e 64 20 69 74 20 69 73 | 20 62 65 69 6e 67 20 6d |nd it is| being m|
|00004020| 6f 76 65 64 20 74 6f 20 | 74 68 65 20 66 72 6f 6e |oved to |the fron|
|00004030| 74 29 2e 20 20 54 68 65 | 20 69 6e 68 65 72 69 74 |t). The| inherit|
|00004040| 65 64 0d 2f 2f 20 66 75 | 6e 63 74 69 6f 6e 20 74 |ed.// fu|nction t|
|00004050| 61 6b 65 73 20 63 61 72 | 65 20 6f 66 20 61 63 74 |akes car|e of act|
|00004060| 69 76 61 74 69 6e 67 20 | 6f 72 20 64 65 61 63 74 |ivating |or deact|
|00004070| 69 76 61 74 69 6e 67 20 | 74 68 65 20 73 63 72 6f |ivating |the scro|
|00004080| 6c 6c 20 62 61 72 73 2e | 20 20 49 66 0d 2f 2f 20 |ll bars.| If.// |
|00004090| 79 6f 75 72 20 77 69 6e | 64 6f 77 20 68 61 73 20 |your win|dow has |
|000040a0| 69 74 73 20 6f 77 6e 20 | 63 6f 6e 74 72 6f 6c 20 |its own |control |
|000040b0| 6f 72 20 54 45 64 69 74 | 2c 20 79 6f 75 20 63 61 |or TEdit|, you ca|
|000040c0| 6e 20 61 63 74 69 76 61 | 74 65 20 6f 72 20 64 65 |n activa|te or de|
|000040d0| 61 63 74 69 76 61 74 65 | 0d 2f 2f 20 74 68 65 6d |activate|.// them|
|000040e0| 20 68 65 72 65 2e 20 20 | 4f 74 68 65 72 77 69 73 | here. |Otherwis|
|000040f0| 65 2c 20 74 68 65 72 65 | 20 69 73 20 70 72 6f 62 |e, there| is prob|
|00004100| 61 62 6c 79 20 6e 6f 74 | 68 69 6e 67 20 74 68 61 |ably not|hing tha|
|00004110| 74 20 74 68 69 73 20 66 | 75 6e 63 74 69 6f 6e 0d |t this f|unction.|
|00004120| 2f 2f 20 6e 65 65 64 73 | 20 74 6f 20 64 6f 2e 20 |// needs| to do. |
|00004130| 20 28 49 6e 20 70 61 72 | 74 69 63 75 6c 61 72 2c | (In par|ticular,|
|00004140| 20 74 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 64 | this fu|nction d|
|00004150| 6f 65 73 20 4e 4f 54 20 | 72 65 64 72 61 77 20 74 |oes NOT |redraw t|
|00004160| 68 65 20 77 69 6e 64 6f | 77 2e 29 0d 2f 2f 20 54 |he windo|w.).// T|
|00004170| 68 65 20 70 61 72 61 6d | 65 74 65 72 20 22 61 63 |he param|eter "ac|
|00004180| 74 69 76 65 22 20 69 73 | 20 30 20 69 66 20 74 68 |tive" is| 0 if th|
|00004190| 65 20 77 69 6e 64 6f 77 | 20 69 73 20 62 65 69 6e |e window| is bein|
|000041a0| 67 20 64 65 61 63 74 69 | 76 61 74 65 64 20 61 6e |g deacti|vated an|
|000041b0| 64 20 69 73 0d 2f 2f 20 | 6e 6f 6e 2d 7a 65 72 6f |d is.// |non-zero|
|000041c0| 20 69 66 20 69 74 20 69 | 73 20 62 65 69 6e 67 20 | if it i|s being |
|000041d0| 61 63 74 69 76 61 74 65 | 64 2e 0d 0d 76 6f 69 64 |activate|d...void|
|000041e0| 20 6d 79 57 69 6e 64 6f | 77 3a 3a 64 6f 41 63 74 | myWindo|w::doAct|
|000041f0| 69 76 61 74 65 28 69 6e | 74 20 61 63 74 69 76 65 |ivate(in|t active|
|00004200| 29 20 7b 0d 20 20 20 69 | 6e 68 65 72 69 74 65 64 |) {. i|nherited|
|00004210| 3a 3a 64 6f 41 63 74 69 | 76 61 74 65 28 61 63 74 |::doActi|vate(act|
|00004220| 69 76 65 29 3b 0d 20 20 | 20 2f 2f 20 61 63 74 69 |ive);. | // acti|
|00004230| 76 61 74 65 2f 64 65 61 | 63 74 69 76 61 74 65 20 |vate/dea|ctivate |
|00004240| 63 6f 6e 74 72 6f 6c 73 | 2c 20 54 45 64 69 74 73 |controls|, TEdits|
|00004250| 2c 20 65 74 63 2e 20 20 | 28 69 66 20 61 6e 79 29 |, etc. |(if any)|
|00004260| 0d 7d 0d 0d 0d 2f 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |.}.../**|********|
|00004270| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004280| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000042a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000042b0| 2a 2a 2f 0d 0d 0d 2f 2f | 20 46 75 6e 63 74 69 6f |**/...//| Functio|
|000042c0| 6e 20 49 6e 69 74 41 70 | 70 6c 69 63 61 74 69 6f |n InitAp|plicatio|
|000042d0| 6e 20 69 73 20 63 61 6c | 6c 65 64 20 77 68 65 6e |n is cal|led when|
|000042e0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000042f0| 20 66 69 72 73 74 20 73 | 74 61 72 74 73 20 75 70 | first s|tarts up|
|00004300| 2e 0d 2f 2f 20 49 74 20 | 73 68 6f 75 6c 64 20 62 |..// It |should b|
|00004310| 65 20 75 73 65 64 20 74 | 6f 20 69 6e 69 74 69 61 |e used t|o initia|
|00004320| 6c 69 7a 65 20 61 6e 79 | 20 67 6c 6f 62 61 6c 20 |lize any| global |
|00004330| 76 61 72 69 61 62 6c 65 | 73 20 74 68 61 74 20 72 |variable|s that r|
|00004340| 65 71 75 69 72 65 0d 2f | 2f 20 69 6e 69 74 69 61 |equire./|/ initia|
|00004350| 6c 69 7a 61 74 69 6f 6e | 2e 20 20 48 65 72 65 2c |lization|. Here,|
|00004360| 20 69 74 20 69 73 20 61 | 6c 73 6f 20 75 73 65 64 | it is a|lso used|
|00004370| 20 74 6f 20 6f 70 65 6e | 20 74 68 65 20 66 69 72 | to open| the fir|
|00004380| 73 74 20 77 69 6e 64 6f | 77 0d 2f 2f 20 6f 66 20 |st windo|w.// of |
|00004390| 74 68 65 20 70 72 6f 67 | 72 61 6d 2e 0d 0d 76 6f |the prog|ram...vo|
|000043a0| 69 64 20 49 6e 69 74 41 | 70 70 6c 69 63 61 74 69 |id InitA|pplicati|
|000043b0| 6f 6e 28 76 6f 69 64 29 | 20 7b 0d 20 20 4d 65 6e |on(void)| {. Men|
|000043c0| 75 48 61 6e 64 6c 65 20 | 61 70 70 6c 65 4d 65 6e |uHandle |appleMen|
|000043d0| 75 3b 0d 20 20 66 69 6c | 65 4d 65 6e 75 20 3d 20 |u;. fil|eMenu = |
|000043e0| 47 65 74 4d 48 61 6e 64 | 6c 65 28 32 29 3b 20 20 |GetMHand|le(2); |
|000043f0| 2f 2f 20 67 65 74 20 68 | 61 6e 64 6c 65 73 20 74 |// get h|andles t|
|00004400| 6f 20 74 68 65 20 6d 65 | 6e 75 73 2c 20 66 6f 72 |o the me|nus, for|
|00004410| 20 75 73 65 20 69 6e 20 | 55 70 64 61 74 65 4d 65 | use in |UpdateMe|
|00004420| 6e 75 73 0d 20 20 65 64 | 69 74 4d 65 6e 75 20 3d |nus. ed|itMenu =|
|00004430| 20 47 65 74 4d 48 61 6e | 64 6c 65 28 33 29 3b 0d | GetMHan|dle(3);.|
|00004440| 20 20 61 70 70 6c 65 4d | 65 6e 75 20 3d 20 47 65 | appleM|enu = Ge|
|00004450| 74 4d 48 61 6e 64 6c 65 | 28 31 29 3b 20 2f 2f 20 |tMHandle|(1); // |
|00004460| 4e 6f 74 65 20 74 68 61 | 74 20 79 6f 75 72 20 70 |Note tha|t your p|
|00004470| 72 6f 67 72 61 6d 20 69 | 73 20 6e 6f 74 20 72 65 |rogram i|s not re|
|00004480| 73 70 6f 6e 73 69 62 6c | 65 20 66 6f 72 20 0d 20 |sponsibl|e for . |
|00004490| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000044a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 6d | | // m|
|000044b0| 61 6e 61 67 69 6e 67 20 | 74 68 65 20 61 70 70 6c |anaging |the appl|
|000044c0| 65 20 6d 65 6e 75 2c 20 | 65 78 63 65 70 74 20 74 |e menu, |except t|
|000044d0| 6f 20 73 65 74 20 74 68 | 65 0d 20 20 20 20 20 20 |o set th|e. |
|000044e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000044f0| 20 20 20 20 20 20 20 2f | 2f 20 70 72 6f 67 72 61 | /|/ progra|
|00004500| 6d 20 6e 61 6d 65 20 69 | 6e 20 74 68 65 20 66 69 |m name i|n the fi|
|00004510| 72 73 74 20 6c 69 6e 65 | 20 6f 66 20 74 68 65 0d |rst line| of the.|
|00004520| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004530| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00004540| 6d 65 6e 75 2c 20 61 73 | 20 69 73 20 64 6f 6e 65 |menu, as| is done|
|00004550| 20 69 6e 20 74 68 65 20 | 6e 65 78 74 20 6c 69 6e | in the |next lin|
|00004560| 65 2e 0d 20 20 53 65 74 | 49 74 65 6d 28 61 70 70 |e.. Set|Item(app|
|00004570| 6c 65 4d 65 6e 75 2c 31 | 2c 22 5c 70 41 62 6f 75 |leMenu,1|,"\pAbou|
|00004580| 74 20 47 65 6e 65 72 69 | 63 2e 2e 2e 22 29 3b 0d |t Generi|c...");.|
|00004590| 20 20 44 6f 4e 65 77 43 | 6f 6d 6d 61 6e 64 28 29 | DoNewC|ommand()|
|000045a0| 3b 20 20 2f 2f 20 6f 70 | 65 6e 73 20 61 20 77 69 |; // op|ens a wi|
|000045b0| 6e 64 6f 77 2e 0d 7d 0d | 0d 0d 2f 2f 20 46 75 6e |ndow..}.|..// Fun|
|000045c0| 63 74 69 6f 6e 20 55 70 | 64 61 74 65 4d 65 6e 75 |ction Up|dateMenu|
|000045d0| 73 28 29 20 69 73 20 63 | 61 6c 6c 65 64 20 6a 75 |s() is c|alled ju|
|000045e0| 73 74 20 62 65 66 6f 72 | 65 20 61 6e 79 20 75 73 |st befor|e any us|
|000045f0| 65 72 20 61 63 74 69 6f | 6e 20 64 69 72 65 63 74 |er actio|n direct|
|00004600| 65 64 20 61 74 20 74 68 | 65 0d 2f 2f 20 6d 65 6e |ed at th|e.// men|
|00004610| 75 20 62 61 72 20 69 73 | 20 70 72 6f 63 65 73 73 |u bar is| process|
|00004620| 65 64 2e 20 20 54 68 61 | 74 20 69 73 2c 20 69 74 |ed. Tha|t is, it|
|00004630| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|00004640| 74 68 65 20 75 73 65 72 | 20 63 6c 69 63 6b 73 20 |the user| clicks |
|00004650| 69 6e 0d 2f 2f 20 74 68 | 65 20 6d 65 6e 75 20 62 |in.// th|e menu b|
|00004660| 61 72 20 28 62 75 74 20 | 62 65 66 6f 72 65 20 74 |ar (but |before t|
|00004670| 68 65 20 75 73 65 72 20 | 73 65 65 73 20 61 6e 79 |he user |sees any|
|00004680| 20 6d 65 6e 75 73 29 2c | 20 6f 72 20 77 68 65 6e | menus),| or when|
|00004690| 20 74 68 65 20 75 73 65 | 72 0d 2f 2f 20 63 6f 6d | the use|r.// com|
|000046a0| 6d 61 6e 64 2d 70 72 65 | 73 73 65 73 20 61 20 6b |mand-pre|sses a k|
|000046b0| 65 79 62 6f 61 72 64 20 | 6b 65 79 20 28 62 75 74 |eyboard |key (but|
|000046c0| 20 62 65 66 6f 72 65 20 | 74 68 61 74 20 63 6f 6d | before |that com|
|000046d0| 6d 61 6e 64 20 69 73 20 | 6c 6f 6f 6b 65 64 20 75 |mand is |looked u|
|000046e0| 70 0d 2f 2f 20 69 6e 20 | 74 68 65 20 6d 65 6e 75 |p.// in |the menu|
|000046f0| 73 29 2e 20 20 54 68 65 | 20 70 75 72 70 6f 73 65 |s). The| purpose|
|00004700| 20 6f 66 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f | of this| functio|
|00004710| 6e 20 69 73 20 74 6f 20 | 65 6e 61 62 6c 65 20 61 |n is to |enable a|
|00004720| 6e 64 0d 2f 2f 20 64 69 | 73 61 62 6c 65 20 63 6f |nd.// di|sable co|
|00004730| 6d 6d 61 6e 64 73 20 61 | 73 20 61 70 70 72 6f 70 |mmands a|s approp|
|00004740| 72 69 61 74 65 2e 20 20 | 41 20 63 6f 6d 6d 61 6e |riate. |A comman|
|00004750| 64 20 74 68 61 74 20 69 | 73 20 22 64 69 73 61 62 |d that i|s "disab|
|00004760| 6c 65 64 22 20 69 73 0d | 2f 2f 20 67 72 61 79 65 |led" is.|// graye|
|00004770| 64 20 6f 75 74 20 69 6e | 20 74 68 65 20 6d 65 6e |d out in| the men|
|00004780| 75 20 61 6e 64 20 69 73 | 20 75 6e 61 76 61 69 61 |u and is| unavaia|
|00004790| 6c 62 6c 65 20 74 6f 20 | 74 68 65 20 75 73 65 72 |lble to |the user|
|000047a0| 2e 20 20 46 6f 72 20 65 | 78 61 6d 70 6c 65 2c 0d |. For e|xample,.|
|000047b0| 2f 2f 20 69 66 20 74 68 | 65 72 65 20 69 73 20 6e |// if th|ere is n|
|000047c0| 6f 20 77 69 6e 64 6f 77 | 20 6f 70 65 6e 2c 20 74 |o window| open, t|
|000047d0| 68 65 6e 20 74 68 65 20 | 43 6c 6f 73 65 20 57 69 |hen the |Close Wi|
|000047e0| 6e 64 6f 77 20 63 6f 6d | 6d 61 6e 64 20 73 68 6f |ndow com|mand sho|
|000047f0| 75 6c 64 0d 2f 2f 20 63 | 65 72 74 61 69 6e 6c 79 |uld.// c|ertainly|
|00004800| 20 62 65 20 64 69 73 61 | 62 6c 65 64 2e 20 20 54 | be disa|bled. T|
|00004810| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 55 70 64 61 |he funct|ion Upda|
|00004820| 74 65 4d 65 6e 75 73 20 | 73 68 6f 75 6c 64 20 73 |teMenus |should s|
|00004830| 65 74 20 74 68 65 0d 2f | 2f 20 65 6e 61 62 6c 65 |et the./|/ enable|
|00004840| 2f 64 69 73 61 62 6c 65 | 20 73 74 61 74 75 73 20 |/disable| status |
|00004850| 6f 66 20 61 6e 79 20 6d | 65 6e 75 20 69 74 65 6d |of any m|enu item|
|00004860| 20 77 68 6f 73 65 20 73 | 74 61 74 75 73 20 63 61 | whose s|tatus ca|
|00004870| 6e 20 63 68 61 6e 67 65 | 2e 0d 2f 2f 20 28 49 6e |n change|..// (In|
|00004880| 20 74 68 65 20 65 78 69 | 73 74 69 6e 67 20 70 72 | the exi|sting pr|
|00004890| 6f 67 72 61 6d 27 73 20 | 66 69 6c 65 20 6d 65 6e |ogram's |file men|
|000048a0| 75 2c 20 66 6f 72 20 65 | 78 61 6d 70 6c 65 2c 20 |u, for e|xample, |
|000048b0| 74 68 65 20 4e 65 77 20 | 61 6e 64 0d 2f 2f 20 51 |the New |and.// Q|
|000048c0| 75 69 74 20 63 6f 6d 6d | 61 6e 64 73 20 61 72 65 |uit comm|ands are|
|000048d0| 20 61 6c 77 61 79 73 20 | 65 6e 61 62 6c 65 64 2e | always |enabled.|
|000048e0| 20 20 54 68 65 20 43 6c | 6f 73 65 20 63 6f 6d 6d | The Cl|ose comm|
|000048f0| 61 6e 64 20 69 73 20 65 | 6e 61 62 6c 65 64 20 61 |and is e|nabled a|
|00004900| 6e 64 0d 2f 2f 20 64 69 | 73 61 62 6c 65 64 20 61 |nd.// di|sabled a|
|00004910| 73 20 61 70 70 72 6f 70 | 72 69 61 74 65 20 62 79 |s approp|riate by|
|00004920| 20 74 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 2e 29 | this fu|nction.)|
|00004930| 0d 2f 2f 20 20 20 20 20 | 54 68 65 20 45 64 69 74 |.// |The Edit|
|00004940| 20 6d 65 6e 75 20 69 73 | 20 61 20 73 70 65 63 69 | menu is| a speci|
|00004950| 61 6c 20 63 61 73 65 2e | 20 20 54 68 69 73 20 6d |al case.| This m|
|00004960| 65 6e 75 20 69 73 20 73 | 75 70 70 6f 73 65 64 20 |enu is s|upposed |
|00004970| 74 6f 20 62 65 0d 2f 2f | 20 61 76 61 69 6c 61 62 |to be.//| availab|
|00004980| 6c 65 2c 20 77 69 74 68 | 20 61 6c 6c 20 69 74 73 |le, with| all its|
|00004990| 20 73 74 61 6e 64 61 72 | 64 20 63 6f 6d 6d 61 6e | standar|d comman|
|000049a0| 64 73 20 65 6e 61 62 6c | 65 64 2c 20 69 66 20 74 |ds enabl|ed, if t|
|000049b0| 68 65 20 66 72 6f 6e 74 | 20 77 69 6e 64 6f 77 0d |he front| window.|
|000049c0| 2f 2f 20 6f 6e 20 74 68 | 65 20 73 63 72 65 65 6e |// on th|e screen|
|000049d0| 20 62 65 6c 6f 6e 67 73 | 20 74 6f 20 61 20 64 65 | belongs| to a de|
|000049e0| 73 6b 20 61 63 63 65 73 | 73 6f 72 79 20 72 61 74 |sk acces|sory rat|
|000049f0| 68 65 72 20 74 68 61 6e | 20 74 6f 20 79 6f 75 72 |her than| to your|
|00004a00| 20 70 72 6f 67 72 61 6d | 2e 0d 2f 2f 20 54 68 69 | program|..// Thi|
|00004a10| 73 20 69 73 20 68 61 6e | 64 6c 65 64 20 62 79 20 |s is han|dled by |
|00004a20| 74 68 65 20 66 69 72 73 | 74 20 66 65 77 20 6c 69 |the firs|t few li|
|00004a30| 6e 65 73 20 6f 66 20 74 | 68 65 20 66 75 6e 63 74 |nes of t|he funct|
|00004a40| 69 6f 6e 20 62 65 6c 6f | 77 2c 20 77 68 69 63 68 |ion belo|w, which|
|00004a50| 0d 2f 2f 20 79 6f 75 20 | 73 68 6f 75 6c 64 20 6e |.// you |should n|
|00004a60| 6f 74 20 63 68 61 6e 67 | 65 2e 20 20 59 6f 75 20 |ot chang|e. You |
|00004a70| 73 68 6f 75 6c 64 20 61 | 6c 73 6f 20 6e 6f 74 20 |should a|lso not |
|00004a80| 69 6e 73 65 72 74 20 6e | 65 77 20 69 74 65 6d 73 |insert n|ew items|
|00004a90| 20 69 6e 74 6f 0d 2f 2f | 20 74 68 65 20 65 64 69 | into.//| the edi|
|00004aa0| 74 20 6d 65 6e 75 2c 20 | 65 78 63 65 70 74 20 61 |t menu, |except a|
|00004ab0| 74 20 74 68 65 20 65 6e | 64 2c 20 61 66 74 65 72 |t the en|d, after|
|00004ac0| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 69 74 | the sta|ndard it|
|00004ad0| 65 6d 73 2e 0d 0d 76 6f | 69 64 20 55 70 64 61 74 |ems...vo|id Updat|
|00004ae0| 65 4d 65 6e 75 73 28 76 | 6f 69 64 29 20 7b 0d 0d |eMenus(v|oid) {..|
|00004af0| 20 20 20 73 68 6f 72 74 | 20 69 3b 0d 20 20 20 57 | short| i;. W|
|00004b00| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 3b 20 20 2f |indowPtr| win; /|
|00004b10| 2f 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 6d 61 63 |/ pointe|r to mac|
|00004b20| 69 6e 74 6f 73 68 20 77 | 69 6e 64 6f 77 20 64 61 |intosh w|indow da|
|00004b30| 74 61 20 73 74 72 75 63 | 74 75 72 65 0d 20 20 20 |ta struc|ture. |
|00004b40| 78 57 69 6e 64 6f 77 20 | 2a 78 77 69 6e 3b 20 20 |xWindow |*xwin; |
|00004b50| 2f 2f 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 78 57 |// point|er to xW|
|00004b60| 69 6e 64 6f 77 20 64 61 | 74 61 20 73 74 72 75 63 |indow da|ta struc|
|00004b70| 74 75 72 65 0d 0d 20 20 | 20 77 69 6e 20 3d 20 46 |ture.. | win = F|
|00004b80| 72 6f 6e 74 57 69 6e 64 | 6f 77 28 29 3b 20 20 20 |rontWind|ow(); |
|00004b90| 2f 2f 20 74 68 69 73 20 | 69 73 20 74 68 65 20 66 |// this |is the f|
|00004ba0| 72 6f 6e 74 20 77 69 6e | 64 6f 77 20 6f 6e 20 74 |ront win|dow on t|
|00004bb0| 68 65 20 73 63 72 65 65 | 6e 0d 0d 20 20 20 69 66 |he scree|n.. if|
|00004bc0| 20 28 20 77 69 6e 20 26 | 26 20 28 28 57 69 6e 64 | ( win &|& ((Wind|
|00004bd0| 6f 77 50 65 65 6b 29 77 | 69 6e 29 2d 3e 77 69 6e |owPeek)w|in)->win|
|00004be0| 64 6f 77 4b 69 6e 64 20 | 3c 20 30 20 29 20 7b 20 |dowKind |< 0 ) { |
|00004bf0| 20 2f 2f 20 44 65 73 6b | 20 61 63 63 65 73 73 6f | // Desk| accesso|
|00004c00| 72 79 20 77 69 6e 64 6f | 77 0d 20 20 20 20 20 20 |ry windo|w. |
|00004c10| 45 6e 61 62 6c 65 49 74 | 65 6d 28 65 64 69 74 4d |EnableIt|em(editM|
|00004c20| 65 6e 75 2c 31 29 3b 20 | 20 20 20 20 20 20 20 20 |enu,1); | |
|00004c30| 20 2f 2f 20 44 6f 20 6e | 6f 74 20 63 68 61 6e 67 | // Do n|ot chang|
|00004c40| 65 20 74 68 69 73 20 73 | 65 63 74 69 6f 6e 2e 0d |e this s|ection..|
|00004c50| 20 20 20 20 20 20 66 6f | 72 20 28 69 3d 33 3b 20 | fo|r (i=3; |
|00004c60| 69 3c 37 3b 20 69 2b 2b | 29 20 20 20 20 20 20 20 |i<7; i++|) |
|00004c70| 20 20 20 20 20 20 20 2f | 2f 20 54 68 69 73 20 68 | /|/ This h|
|00004c80| 61 73 20 6e 6f 74 68 69 | 6e 67 20 74 6f 20 64 6f |as nothi|ng to do|
|00004c90| 20 77 69 74 68 0d 20 20 | 20 20 20 20 20 20 20 45 | with. | E|
|00004ca0| 6e 61 62 6c 65 49 74 65 | 6d 28 65 64 69 74 4d 65 |nableIte|m(editMe|
|00004cb0| 6e 75 2c 69 29 3b 20 20 | 20 20 20 20 20 2f 2f 20 |nu,i); | // |
|00004cc0| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 0d 20 20 20 |your pro|gram. |
|00004cd0| 7d 0d 20 20 20 65 6c 73 | 65 20 7b 20 20 20 2f 2f |}. els|e { //|
|00004ce0| 20 65 6e 61 62 6c 65 2f | 64 69 73 61 62 6c 65 20 | enable/|disable |
|00004cf0| 65 64 69 74 20 69 74 65 | 6d 20 6d 65 6e 75 73 20 |edit ite|m menus |
|00004d00| 61 73 20 72 65 6c 65 76 | 61 6e 74 20 74 6f 20 79 |as relev|ant to y|
|00004d10| 6f 75 72 20 70 72 6f 67 | 72 61 6d 0d 20 20 20 20 |our prog|ram. |
|00004d20| 20 20 44 69 73 61 62 6c | 65 49 74 65 6d 28 65 64 | Disabl|eItem(ed|
|00004d30| 69 74 4d 65 6e 75 2c 31 | 29 3b 0d 20 20 20 20 20 |itMenu,1|);. |
|00004d40| 20 66 6f 72 20 28 69 3d | 33 3b 20 69 3c 37 3b 20 | for (i=|3; i<7; |
|00004d50| 69 2b 2b 29 20 20 20 20 | 20 20 20 20 20 2f 2f 20 |i++) | // |
|00004d60| 48 65 72 65 2c 20 49 20 | 6a 75 73 74 20 64 69 73 |Here, I |just dis|
|00004d70| 61 62 6c 65 20 74 68 65 | 6d 20 61 6c 6c 0d 20 20 |able the|m all. |
|00004d80| 20 20 20 20 20 20 20 44 | 69 73 61 62 6c 65 49 74 | D|isableIt|
|00004d90| 65 6d 28 65 64 69 74 4d | 65 6e 75 2c 69 29 3b 0d |em(editM|enu,i);.|
|00004da0| 20 20 20 7d 0d 0d 20 20 | 20 69 66 20 28 77 69 6e | }.. | if (win|
|00004db0| 20 26 26 20 78 57 69 6e | 64 6f 77 3a 3a 57 69 6e | && xWin|dow::Win|
|00004dc0| 64 6f 77 32 58 57 69 6e | 64 6f 77 28 77 69 6e 2c |dow2XWin|dow(win,|
|00004dd0| 26 78 77 69 6e 29 29 20 | 7b 20 20 2f 2f 69 66 20 |&xwin)) |{ //if |
|00004de0| 66 72 6f 6e 74 20 77 69 | 6e 64 6f 77 20 69 73 20 |front wi|ndow is |
|00004df0| 6d 69 6e 65 2e 2e 2e 0d | 20 20 20 20 20 20 45 6e |mine....| En|
|00004e00| 61 62 6c 65 49 74 65 6d | 28 66 69 6c 65 4d 65 6e |ableItem|(fileMen|
|00004e10| 75 2c 32 29 3b 20 20 2f | 2f 20 65 6e 61 62 6c 65 |u,2); /|/ enable|
|00004e20| 20 43 6c 6f 73 65 20 63 | 6f 6d 6d 61 6e 64 0d 20 | Close c|ommand. |
|00004e30| 20 20 7d 0d 20 20 20 65 | 6c 73 65 20 7b 0d 20 20 | }. e|lse {. |
|00004e40| 20 20 20 20 44 69 73 61 | 62 6c 65 49 74 65 6d 28 | Disa|bleItem(|
|00004e50| 66 69 6c 65 4d 65 6e 75 | 2c 32 29 3b 20 2f 2f 20 |fileMenu|,2); // |
|00004e60| 64 69 73 61 62 6c 65 20 | 43 6c 6f 73 65 20 63 6f |disable |Close co|
|00004e70| 6d 6d 61 6e 64 0d 20 20 | 20 7d 0d 7d 0d 0d 0d 2f |mmand. | }.}.../|
|00004e80| 2f 20 46 75 6e 63 74 69 | 6f 6e 20 44 6f 45 64 69 |/ Functi|on DoEdi|
|00004e90| 74 4d 65 6e 75 20 69 73 | 20 63 61 6c 6c 65 64 20 |tMenu is| called |
|00004ea0| 69 66 20 74 68 65 20 75 | 73 65 72 20 73 65 6c 65 |if the u|ser sele|
|00004eb0| 63 74 73 20 61 20 63 6f | 6d 6d 61 6e 64 20 66 72 |cts a co|mmand fr|
|00004ec0| 6f 6d 20 74 68 65 0d 2f | 2f 20 45 64 69 74 20 6d |om the./|/ Edit m|
|00004ed0| 65 6e 75 2e 20 20 28 42 | 79 20 64 65 66 61 75 6c |enu. (B|y defaul|
|00004ee0| 74 2c 20 74 68 65 73 65 | 20 63 6f 6d 6d 61 6e 64 |t, these| command|
|00004ef0| 73 20 61 72 65 20 64 69 | 73 61 62 6c 65 64 2c 20 |s are di|sabled, |
|00004f00| 73 6f 20 74 68 69 73 20 | 66 75 6e 63 74 69 6f 6e |so this |function|
|00004f10| 0d 2f 2f 20 77 6f 6e 27 | 74 20 62 65 20 63 61 6c |.// won'|t be cal|
|00004f20| 6c 65 64 20 75 6e 6c 65 | 73 73 20 79 6f 75 20 65 |led unle|ss you e|
|00004f30| 6e 61 62 6c 65 20 74 68 | 65 6d 20 69 6e 20 66 75 |nable th|em in fu|
|00004f40| 6e 63 74 69 6f 6e 20 55 | 70 64 61 74 65 4d 65 6e |nction U|pdateMen|
|00004f50| 75 73 28 29 2e 29 0d 2f | 2f 20 54 68 65 20 70 61 |us().)./|/ The pa|
|00004f60| 72 61 6d 65 74 65 72 20 | 67 69 76 65 73 20 74 68 |rameter |gives th|
|00004f70| 65 20 69 74 65 6d 20 6e | 75 6d 62 65 72 20 6f 66 |e item n|umber of|
|00004f80| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 2c 20 63 6f | the com|mand, co|
|00004f90| 75 6e 74 69 6e 67 20 66 | 72 6f 6d 20 74 68 65 0d |unting f|rom the.|
|00004fa0| 2f 2f 20 74 6f 70 20 6f | 66 20 74 68 65 20 6d 65 |// top o|f the me|
|00004fb0| 6e 75 2e 0d 0d 76 6f 69 | 64 20 44 6f 45 64 69 74 |nu...voi|d DoEdit|
|00004fc0| 4d 65 6e 75 28 69 6e 74 | 20 69 74 65 6d 4e 75 6d |Menu(int| itemNum|
|00004fd0| 29 20 7b 0d 20 20 20 2f | 2f 20 68 61 6e 64 6c 65 |) {. /|/ handle|
|00004fe0| 20 63 6f 6d 6d 61 6e 64 | 20 66 72 6f 6d 20 65 64 | command| from ed|
|00004ff0| 69 74 20 6d 65 6e 75 0d | 7d 0d 0d 0d 2f 2f 20 46 |it menu.|}...// F|
|00005000| 75 6e 63 74 69 6f 6e 20 | 44 6f 46 69 6c 65 4d 65 |unction |DoFileMe|
|00005010| 6e 75 28 29 20 69 73 20 | 63 61 6c 6c 65 64 20 69 |nu() is |called i|
|00005020| 66 20 74 68 65 20 75 73 | 65 72 20 73 65 6c 65 63 |f the us|er selec|
|00005030| 74 73 20 61 20 63 6f 6d | 6d 61 6e 64 20 66 72 6f |ts a com|mand fro|
|00005040| 6d 20 74 68 65 0d 2f 2f | 20 46 69 6c 65 20 6d 65 |m the.//| File me|
|00005050| 6e 75 2e 20 20 54 68 65 | 20 70 61 72 61 6d 65 74 |nu. The| paramet|
|00005060| 65 72 20 69 74 65 6d 4e | 75 6d 20 67 69 76 65 73 |er itemN|um gives|
|00005070| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 74 | the num|ber of t|
|00005080| 68 65 20 63 6f 6d 6d 61 | 6e 64 20 63 6f 75 6e 74 |he comma|nd count|
|00005090| 69 6e 67 0d 2f 2f 20 64 | 6f 77 6e 20 66 72 6f 6d |ing.// d|own from|
|000050a0| 20 74 68 65 20 74 6f 70 | 20 6f 66 20 74 68 65 20 | the top| of the |
|000050b0| 6d 65 6e 75 2e 20 20 4e | 4f 54 45 20 74 68 61 74 |menu. N|OTE that|
|000050c0| 20 69 66 20 79 6f 75 20 | 69 6e 73 65 72 74 20 69 | if you |insert i|
|000050d0| 74 65 6d 73 20 69 6e 74 | 6f 20 74 68 65 0d 2f 2f |tems int|o the.//|
|000050e0| 20 6d 65 6e 75 2c 20 74 | 68 65 20 63 6f 6d 6d 61 | menu, t|he comma|
|000050f0| 6e 64 20 6e 75 6d 62 65 | 72 73 20 66 6f 72 20 74 |nd numbe|rs for t|
|00005100| 68 65 20 65 78 69 73 74 | 69 6e 67 20 63 6f 6d 6d |he exist|ing comm|
|00005110| 61 6e 64 73 20 77 69 6c | 6c 20 63 68 61 6e 67 65 |ands wil|l change|
|00005120| 2c 20 61 6e 64 20 74 68 | 65 73 65 0d 2f 2f 20 63 |, and th|ese.// c|
|00005130| 68 61 6e 67 65 73 20 77 | 69 6c 6c 20 68 61 76 65 |hanges w|ill have|
|00005140| 20 74 6f 20 62 65 20 72 | 65 66 6c 65 63 74 65 64 | to be r|eflected|
|00005150| 20 69 6e 20 74 68 65 20 | 69 66 20 73 74 61 74 65 | in the |if state|
|00005160| 6d 65 6e 74 73 20 69 6e | 20 74 68 69 73 20 66 75 |ments in| this fu|
|00005170| 6e 63 74 69 6f 6e 2e 0d | 2f 2f 20 54 68 65 20 70 |nction..|// The p|
|00005180| 61 72 61 6d 65 74 65 72 | 20 22 64 6f 6e 65 22 20 |arameter| "done" |
|00005190| 73 68 6f 75 6c 64 20 62 | 65 20 73 65 74 20 74 6f |should b|e set to|
|000051a0| 20 31 20 69 66 20 74 68 | 65 20 75 73 65 72 20 63 | 1 if th|e user c|
|000051b0| 68 6f 6f 73 65 73 20 51 | 55 49 54 20 66 72 6f 6d |hooses Q|UIT from|
|000051c0| 20 74 68 65 0d 2f 2f 20 | 66 69 6c 65 20 6d 65 6e | the.// |file men|
|000051d0| 75 3b 20 68 6f 77 65 76 | 65 72 2c 20 79 6f 75 20 |u; howev|er, you |
|000051e0| 68 61 76 65 20 74 68 65 | 20 70 6f 73 73 69 62 69 |have the| possibi|
|000051f0| 6c 69 74 79 20 6f 66 20 | 41 42 4f 52 54 49 4e 47 |lity of |ABORTING|
|00005200| 20 74 68 69 73 20 63 6f | 6d 6d 61 6e 64 0d 2f 2f | this co|mmand.//|
|00005210| 20 73 69 6d 70 6c 79 20 | 62 79 20 6e 6f 74 20 73 | simply |by not s|
|00005220| 65 74 74 69 6e 67 20 74 | 68 69 73 20 76 61 6c 75 |etting t|his valu|
|00005230| 65 2e 20 20 28 46 6f 72 | 20 65 78 61 6d 70 6c 65 |e. (For| example|
|00005240| 2c 20 79 6f 75 20 6d 69 | 67 68 74 20 61 73 20 74 |, you mi|ght as t|
|00005250| 68 65 20 75 73 65 72 0d | 2f 2f 20 69 66 20 73 68 |he user.|// if sh|
|00005260| 65 20 77 61 6e 74 73 20 | 74 6f 20 73 61 76 65 20 |e wants |to save |
|00005270| 68 65 72 20 64 61 74 61 | 20 62 65 66 6f 72 65 20 |her data| before |
|00005280| 71 75 69 74 74 69 6e 67 | 20 61 6e 64 20 73 68 65 |quitting| and she|
|00005290| 20 6d 69 67 68 74 20 63 | 6c 69 63 6b 20 6f 6e 20 | might c|lick on |
|000052a0| 74 68 65 0d 2f 2f 20 63 | 61 6e 63 65 6c 20 62 75 |the.// c|ancel bu|
|000052b0| 74 74 6f 6e 20 69 6e 20 | 74 68 65 20 64 69 61 6c |tton in |the dial|
|000052c0| 6f 67 20 62 6f 78 2e 29 | 0d 0d 76 6f 69 64 20 44 |og box.)|..void D|
|000052d0| 6f 46 69 6c 65 4d 65 6e | 75 28 69 6e 74 20 69 74 |oFileMen|u(int it|
|000052e0| 65 6d 4e 75 6d 2c 20 69 | 6e 74 2a 20 64 6f 6e 65 |emNum, i|nt* done|
|000052f0| 29 20 7b 0d 20 20 20 78 | 57 69 6e 64 6f 77 20 2a |) {. x|Window *|
|00005300| 77 69 6e 3b 0d 20 20 20 | 2f 2f 20 48 61 6e 64 6c |win;. |// Handl|
|00005310| 65 20 66 69 6c 65 20 6d | 65 6e 75 20 63 6f 6d 6d |e file m|enu comm|
|00005320| 61 6e 64 73 3a 0d 20 20 | 20 69 66 20 28 69 74 65 |ands:. | if (ite|
|00005330| 6d 4e 75 6d 20 3d 3d 20 | 34 29 0d 20 20 20 20 20 |mNum == |4). |
|00005340| 20 2a 64 6f 6e 65 20 3d | 20 31 3b 0d 20 20 20 65 | *done =| 1;. e|
|00005350| 6c 73 65 20 69 66 20 28 | 69 74 65 6d 4e 75 6d 20 |lse if (|itemNum |
|00005360| 3d 3d 20 31 29 0d 20 20 | 20 20 20 20 44 6f 4e 65 |== 1). | DoNe|
|00005370| 77 43 6f 6d 6d 61 6e 64 | 28 29 3b 0d 20 20 20 65 |wCommand|();. e|
|00005380| 6c 73 65 20 69 66 20 28 | 69 74 65 6d 4e 75 6d 20 |lse if (|itemNum |
|00005390| 3d 3d 20 32 20 26 26 20 | 78 57 69 6e 64 6f 77 3a |== 2 && |xWindow:|
|000053a0| 3a 57 69 6e 64 6f 77 32 | 58 57 69 6e 64 6f 77 28 |:Window2|XWindow(|
|000053b0| 46 72 6f 6e 74 57 69 6e | 64 6f 77 28 29 2c 26 77 |FrontWin|dow(),&w|
|000053c0| 69 6e 29 29 0d 20 20 20 | 20 20 20 77 69 6e 2d 3e |in)). | win->|
|000053d0| 43 6c 6f 73 65 28 29 3b | 0d 7d 0d 0d 0d 2f 2f 20 |Close();|.}...// |
|000053e0| 49 66 20 79 6f 75 20 68 | 61 76 65 20 61 64 64 65 |If you h|ave adde|
|000053f0| 64 20 6f 74 68 65 72 20 | 6d 65 6e 75 73 20 62 65 |d other |menus be|
|00005400| 73 69 64 65 73 20 74 68 | 65 20 41 70 70 6c 65 2c |sides th|e Apple,|
|00005410| 20 46 69 6c 65 20 61 6e | 64 20 45 64 69 74 20 6d | File an|d Edit m|
|00005420| 65 6e 75 73 2c 0d 2f 2f | 20 74 68 69 73 20 66 75 |enus,.//| this fu|
|00005430| 6e 63 74 69 6f 6e 20 77 | 69 6c 6c 20 62 65 20 63 |nction w|ill be c|
|00005440| 61 6c 6c 65 64 20 77 68 | 65 6e 20 74 68 65 20 75 |alled wh|en the u|
|00005450| 73 65 72 20 63 68 6f 6f | 73 65 73 20 61 20 63 6f |ser choo|ses a co|
|00005460| 6d 6d 61 6e 64 20 66 72 | 6f 6d 0d 2f 2f 20 73 75 |mmand fr|om.// su|
|00005470| 63 68 20 61 20 6d 65 6e | 75 2e 20 20 54 68 65 20 |ch a men|u. The |
|00005480| 70 61 72 61 6d 65 74 65 | 72 73 20 74 65 6c 6c 20 |paramete|rs tell |
|00005490| 79 6f 75 20 74 68 65 20 | 6d 65 6e 75 20 61 6e 64 |you the |menu and|
|000054a0| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 74 | the num|ber of t|
|000054b0| 68 65 0d 2f 2f 20 69 74 | 65 6d 20 69 6e 20 74 68 |he.// it|em in th|
|000054c0| 65 20 6d 65 6e 75 2e 20 | 20 4e 6f 74 65 20 74 68 |e menu. | Note th|
|000054d0| 61 74 20 74 68 65 20 66 | 69 72 73 74 20 70 61 72 |at the f|irst par|
|000054e0| 61 6d 65 74 65 72 20 69 | 73 20 74 68 65 20 6d 65 |ameter i|s the me|
|000054f0| 6e 75 49 44 2c 0d 2f 2f | 20 4e 4f 54 20 74 68 65 |nuID,.//| NOT the|
|00005500| 20 70 6f 73 69 74 69 6f | 6e 20 6f 66 20 74 68 65 | positio|n of the|
|00005510| 20 6d 65 6e 75 20 69 6e | 20 74 68 65 20 6d 65 6e | menu in| the men|
|00005520| 75 20 62 61 72 2e 20 20 | 28 49 66 20 74 68 65 20 |u bar. |(If the |
|00005530| 6d 65 6e 75 20 63 6f 6d | 65 73 20 6f 75 74 0d 2f |menu com|es out./|
|00005540| 2f 20 6f 66 20 61 20 72 | 65 73 6f 75 72 63 65 20 |/ of a r|esource |
|00005550| 66 69 6c 65 2c 20 74 68 | 65 20 6d 65 6e 75 49 44 |file, th|e menuID|
|00005560| 20 69 73 20 74 68 65 20 | 72 65 73 6f 75 72 63 65 | is the |resource|
|00005570| 20 6e 75 6d 62 65 72 3b | 20 69 66 20 79 6f 75 20 | number;| if you |
|00005580| 63 72 65 61 74 65 20 69 | 74 0d 2f 2f 20 22 6f 6e |create i|t.// "on|
|00005590| 20 74 68 65 20 66 6c 79 | 22 2c 20 79 6f 75 20 73 | the fly|", you s|
|000055a0| 65 74 20 74 68 65 20 6d | 65 6e 75 49 44 20 77 68 |et the m|enuID wh|
|000055b0| 65 6e 20 79 6f 75 20 63 | 72 65 61 74 65 20 69 74 |en you c|reate it|
|000055c0| 2e 29 0d 0d 76 6f 69 64 | 20 44 6f 4f 74 68 65 72 |.)..void| DoOther|
|000055d0| 4d 65 6e 75 28 69 6e 74 | 20 6d 65 6e 75 49 44 2c |Menu(int| menuID,|
|000055e0| 20 69 6e 74 20 69 74 65 | 6d 4e 75 6d 29 20 7b 0d | int ite|mNum) {.|
|000055f0| 20 20 20 2f 2f 20 68 61 | 6e 64 6c 65 20 63 6f 6d | // ha|ndle com|
|00005600| 6d 61 6e 64 20 28 66 72 | 6f 6d 20 6d 65 6e 75 20 |mand (fr|om menu |
|00005610| 6f 74 68 65 72 20 74 68 | 61 6e 20 61 70 70 6c 65 |other th|an apple|
|00005620| 2c 20 66 69 6c 65 20 6f | 72 20 65 64 69 74 20 6d |, file o|r edit m|
|00005630| 65 6e 75 29 0d 7d 0d 0d | 0d 2f 2f 20 46 75 6e 63 |enu).}..|.// Func|
|00005640| 74 69 6f 6e 20 41 70 70 | 6c 69 63 61 74 69 6f 6e |tion App|lication|
|00005650| 49 64 6c 65 20 69 73 20 | 63 61 6c 6c 65 64 20 70 |Idle is |called p|
|00005660| 65 72 69 6f 64 69 63 61 | 6c 6c 79 20 77 68 69 6c |eriodica|lly whil|
|00005670| 65 20 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 69 |e your p|rogram i|
|00005680| 73 0d 2f 2f 20 72 75 6e | 6e 69 6e 67 2e 20 20 53 |s.// run|ning. S|
|00005690| 70 65 63 69 66 69 63 61 | 6c 6c 79 2c 20 69 74 20 |pecifica|lly, it |
|000056a0| 69 73 20 63 61 6c 6c 65 | 64 20 65 61 63 68 20 74 |is calle|d each t|
|000056b0| 69 6d 65 20 61 6e 20 22 | 65 76 65 6e 74 22 20 69 |ime an "|event" i|
|000056c0| 73 20 67 65 6e 65 72 61 | 74 65 64 0d 2f 2f 20 62 |s genera|ted.// b|
|000056d0| 79 20 74 68 65 20 75 73 | 65 72 20 6f 72 20 62 79 |y the us|er or by|
|000056e0| 20 74 68 65 20 6f 70 65 | 72 61 74 69 6e 67 20 73 | the ope|rating s|
|000056f0| 79 73 74 65 6d 2e 20 20 | 55 73 65 72 20 65 76 65 |ystem. |User eve|
|00005700| 6e 74 73 20 69 6e 63 6c | 75 64 65 20 6d 6f 75 73 |nts incl|ude mous|
|00005710| 65 20 61 6e 64 0d 2f 2f | 20 6b 65 79 20 63 6c 69 |e and.//| key cli|
|00005720| 63 6b 73 2e 20 20 4f 70 | 65 72 61 74 69 6e 67 20 |cks. Op|erating |
|00005730| 73 79 73 74 65 6d 20 65 | 76 65 6e 74 73 20 61 72 |system e|vents ar|
|00005740| 65 20 74 68 69 6e 67 73 | 20 6c 69 6b 65 20 77 69 |e things| like wi|
|00005750| 6e 64 6f 77 2d 61 63 74 | 69 76 61 74 69 6f 6e 0d |ndow-act|ivation.|
|00005760| 2f 2f 20 65 76 65 6e 74 | 73 2e 20 20 49 6e 20 61 |// event|s. In a|
|00005770| 64 64 69 74 69 6f 6e 2c | 20 69 66 20 6e 6f 20 6f |ddition,| if no o|
|00005780| 74 68 65 72 20 65 76 65 | 6e 74 20 6f 63 63 75 72 |ther eve|nt occur|
|00005790| 73 2c 20 74 68 65 20 6f | 70 65 72 61 74 69 6e 67 |s, the o|perating|
|000057a0| 20 73 79 73 74 65 6d 0d | 2f 2f 20 63 61 6e 20 73 | system.|// can s|
|000057b0| 65 6e 64 20 61 20 22 6e | 75 6c 6c 22 20 65 76 65 |end a "n|ull" eve|
|000057c0| 6e 74 2e 20 20 54 68 65 | 20 70 75 72 70 6f 73 65 |nt. The| purpose|
|000057d0| 20 6f 66 20 73 75 63 68 | 20 61 6e 20 65 76 65 6e | of such| an even|
|000057e0| 74 20 69 73 20 65 78 61 | 63 74 6c 79 20 74 6f 0d |t is exa|ctly to.|
|000057f0| 2f 2f 20 6d 61 6b 65 20 | 73 75 72 65 20 74 68 61 |// make |sure tha|
|00005800| 74 20 61 20 66 75 6e 63 | 74 69 6f 6e 20 6c 69 6b |t a func|tion lik|
|00005810| 65 20 41 70 70 6c 69 63 | 61 74 69 6f 6e 49 64 6c |e Applic|ationIdl|
|00005820| 65 20 67 65 74 73 20 63 | 61 6c 6c 65 64 20 73 75 |e gets c|alled su|
|00005830| 66 66 69 63 69 65 6e 74 | 6c 79 0d 2f 2f 20 6f 66 |fficient|ly.// of|
|00005840| 74 65 6e 2e 20 20 54 68 | 65 20 66 72 65 71 75 65 |ten. Th|e freque|
|00005850| 6e 63 79 20 6f 66 20 6e | 75 6c 6c 20 65 76 65 6e |ncy of n|ull even|
|00005860| 74 73 20 69 73 20 64 65 | 74 65 72 6d 69 6e 65 64 |ts is de|termined|
|00005870| 20 62 79 20 74 68 65 20 | 67 6c 6f 62 61 6c 0d 2f | by the |global./|
|00005880| 2f 20 76 61 72 69 61 6c | 62 6c 65 20 67 45 76 65 |/ varial|ble gEve|
|00005890| 6e 74 57 61 69 74 54 69 | 6d 65 2e 20 20 49 66 20 |ntWaitTi|me. If |
|000058a0| 79 6f 75 20 70 75 74 20 | 61 6e 79 74 68 69 6e 67 |you put |anything|
|000058b0| 20 69 6e 74 6f 20 74 68 | 69 73 20 66 75 6e 63 74 | into th|is funct|
|000058c0| 69 6f 6e 2c 0d 2f 2f 20 | 79 6f 75 20 73 68 6f 75 |ion,.// |you shou|
|000058d0| 6c 64 20 63 68 61 6e 67 | 65 20 74 68 65 20 76 61 |ld chang|e the va|
|000058e0| 6c 75 65 20 6f 66 20 74 | 68 69 73 20 76 61 72 69 |lue of t|his vari|
|000058f0| 61 62 6c 65 20 61 74 20 | 74 68 65 20 74 6f 70 20 |able at |the top |
|00005900| 6f 66 20 74 68 69 73 0d | 2f 2f 20 66 69 6c 65 2e |of this.|// file.|
|00005910| 20 20 67 45 76 65 6e 74 | 57 61 69 74 54 69 6d 65 | gEvent|WaitTime|
|00005920| 20 69 73 20 6d 65 61 73 | 75 72 65 64 20 69 6e 20 | is meas|ured in |
|00005930| 31 2f 36 30 2d 74 68 73 | 20 6f 66 20 61 20 73 65 |1/60-ths| of a se|
|00005940| 63 6f 6e 64 2e 20 20 49 | 74 20 72 65 70 72 65 73 |cond. I|t repres|
|00005950| 65 6e 74 73 0d 2f 2f 20 | 74 68 65 20 6d 61 78 69 |ents.// |the maxi|
|00005960| 6d 75 6d 20 74 69 6d 65 | 20 74 68 61 74 20 79 6f |mum time| that yo|
|00005970| 75 20 77 6f 75 6c 64 20 | 6c 69 6b 65 20 62 65 74 |u would |like bet|
|00005980| 77 65 65 6e 20 63 61 6c | 6c 73 20 74 6f 20 41 70 |ween cal|ls to Ap|
|00005990| 70 6c 69 63 61 74 69 6f | 6e 49 64 6c 65 2e 0d 2f |plicatio|nIdle../|
|000059a0| 2f 20 28 49 74 20 69 73 | 20 6e 6f 74 20 61 20 67 |/ (It is| not a g|
|000059b0| 75 61 72 61 6e 74 65 65 | 64 20 74 68 61 74 20 74 |uarantee|d that t|
|000059c0| 68 65 20 6f 70 65 72 61 | 74 69 6e 67 20 73 79 73 |he opera|ting sys|
|000059d0| 74 65 6d 20 77 69 6c 6c | 20 61 6c 77 61 79 73 20 |tem will| always |
|000059e0| 62 65 20 61 62 6c 65 20 | 74 6f 0d 2f 2f 20 6d 65 |be able |to.// me|
|000059f0| 65 74 20 74 68 69 73 20 | 64 65 61 64 6c 69 6e 65 |et this |deadline|
|00005a00| 3b 20 69 74 20 64 65 70 | 65 6e 64 73 20 6f 6e 20 |; it dep|ends on |
|00005a10| 77 68 61 74 20 65 6c 73 | 65 20 69 73 20 67 6f 69 |what els|e is goi|
|00005a20| 6e 67 20 6f 6e 20 69 6e | 20 74 68 65 20 73 79 73 |ng on in| the sys|
|00005a30| 74 65 6d 2e 29 0d 2f 2f | 20 20 20 20 4f 6e 65 20 |tem.).//| One |
|00005a40| 63 6f 6d 6d 6f 6e 20 75 | 73 65 20 6f 66 20 41 70 |common u|se of Ap|
|00005a50| 70 6c 69 63 61 74 69 6f | 6e 49 64 6c 65 20 69 73 |plicatio|nIdle is|
|00005a60| 20 74 6f 20 73 65 74 20 | 74 68 65 20 63 75 72 73 | to set |the curs|
|00005a70| 6f 72 20 73 74 79 6c 65 | 20 74 6f 20 72 65 66 6c |or style| to refl|
|00005a80| 65 63 74 0d 2f 2f 20 74 | 68 65 20 70 61 72 74 20 |ect.// t|he part |
|00005a90| 6f 66 20 74 68 65 20 73 | 63 72 65 65 6e 20 74 68 |of the s|creen th|
|00005aa0| 61 74 20 74 68 65 20 6d | 6f 75 73 65 20 69 73 20 |at the m|ouse is |
|00005ab0| 63 75 72 72 65 6e 74 6c | 79 20 6f 76 65 72 2e 20 |currentl|y over. |
|00005ac0| 20 49 66 20 79 6f 75 20 | 64 6f 20 74 68 69 73 2c | If you |do this,|
|00005ad0| 0d 2f 2f 20 61 20 76 61 | 6c 75 65 20 6f 66 20 67 |.// a va|lue of g|
|00005ae0| 45 76 65 6e 74 57 61 69 | 74 54 69 6d 65 20 6f 66 |EventWai|tTime of|
|00005af0| 20 61 62 6f 75 74 20 33 | 20 73 65 65 6d 73 20 74 | about 3| seems t|
|00005b00| 6f 20 77 6f 72 6b 20 77 | 65 6c 6c 2e 0d 2f 2f 20 |o work w|ell..// |
|00005b10| 20 20 20 41 6e 6f 74 68 | 65 72 20 75 73 65 20 69 | Anoth|er use i|
|00005b20| 73 20 74 6f 20 61 6c 6c | 6f 77 20 74 68 65 20 6e |s to all|ow the n|
|00005b30| 75 6c 6c 20 65 76 65 6e | 74 73 20 74 6f 20 22 64 |ull even|ts to "d|
|00005b40| 72 69 76 65 22 20 61 20 | 6c 6f 6e 67 20 63 6f 6d |rive" a |long com|
|00005b50| 70 75 74 61 74 69 6f 6e | 0d 2f 2f 20 6f 72 20 61 |putation|.// or a|
|00005b60| 6e 20 61 6e 69 6d 61 74 | 69 6f 6e 2e 20 20 49 66 |n animat|ion. If|
|00005b70| 20 79 6f 75 20 6a 75 73 | 74 20 67 6f 20 61 68 65 | you jus|t go ahe|
|00005b80| 61 64 20 61 6e 64 20 64 | 6f 20 61 6e 20 61 6e 69 |ad and d|o an ani|
|00005b90| 6d 61 74 69 6f 6e 2c 20 | 73 61 79 2c 20 77 69 74 |mation, |say, wit|
|00005ba0| 68 20 61 0d 2f 2f 20 6c | 6f 6e 67 20 66 6f 72 20 |h a.// l|ong for |
|00005bb0| 6c 6f 6f 70 2c 20 74 68 | 65 72 65 20 77 69 6c 6c |loop, th|ere will|
|00005bc0| 20 62 65 20 6e 6f 20 77 | 61 79 20 66 6f 72 20 74 | be no w|ay for t|
|00005bd0| 68 65 20 75 73 65 72 20 | 74 6f 20 69 6e 74 65 72 |he user |to inter|
|00005be0| 72 75 70 74 20 69 74 2e | 20 20 49 74 20 69 73 0d |rupt it.| It is.|
|00005bf0| 2f 2f 20 62 65 74 74 65 | 72 20 74 6f 20 75 73 65 |// bette|r to use|
|00005c00| 20 41 70 70 6c 69 63 61 | 74 69 6f 6e 49 64 6c 65 | Applica|tionIdle|
|00005c10| 20 74 6f 20 64 6f 20 6a | 75 73 74 20 6f 6e 65 20 | to do j|ust one |
|00005c20| 66 72 61 6d 65 20 6f 66 | 20 61 6e 20 61 6e 69 6d |frame of| an anim|
|00005c30| 61 74 69 6f 6e 20 6f 72 | 0d 2f 2f 20 6f 6e 65 20 |ation or|.// one |
|00005c40| 73 6d 61 6c 6c 20 70 69 | 65 63 65 20 6f 66 20 61 |small pi|ece of a|
|00005c50| 20 63 6f 6d 70 75 74 61 | 74 69 6f 6e 2e 20 20 4f | computa|tion. O|
|00005c60| 66 20 63 6f 75 72 73 65 | 2c 20 74 68 69 73 20 69 |f course|, this i|
|00005c70| 73 20 6d 75 63 68 20 6d | 6f 72 65 20 64 69 66 66 |s much m|ore diff|
|00005c80| 69 63 75 6c 74 2d 2d 0d | 2f 2f 20 79 6f 75 20 6e |icult--.|// you n|
|00005c90| 65 65 64 20 74 6f 20 6b | 65 65 70 20 74 72 61 63 |eed to k|eep trac|
|00005ca0| 6b 20 6f 66 20 77 68 61 | 74 20 79 6f 75 20 61 72 |k of wha|t you ar|
|00005cb0| 65 20 64 6f 69 6e 67 20 | 69 6e 20 67 6c 6f 62 61 |e doing |in globa|
|00005cc0| 6c 20 76 61 72 69 61 62 | 6c 65 73 20 6f 72 0d 2f |l variab|les or./|
|00005cd0| 2f 20 77 69 6e 64 6f 77 | 20 64 61 74 61 20 76 61 |/ window| data va|
|00005ce0| 72 69 61 62 6c 65 73 2e | 20 20 41 6e 79 77 61 79 |riables.| Anyway|
|00005cf0| 2c 20 69 66 20 79 6f 75 | 20 64 6f 20 64 6f 20 74 |, if you| do do t|
|00005d00| 68 69 73 2c 20 79 6f 75 | 20 73 68 6f 75 6c 64 20 |his, you| should |
|00005d10| 73 65 74 0d 2f 2f 20 67 | 45 76 65 6e 74 57 61 69 |set.// g|EventWai|
|00005d20| 74 54 69 6d 65 20 74 6f | 20 30 2e 20 20 54 68 69 |tTime to| 0. Thi|
|00005d30| 73 20 6a 75 73 74 20 61 | 73 6b 73 20 74 68 65 20 |s just a|sks the |
|00005d40| 6f 70 65 72 61 74 69 6e | 67 20 73 79 73 74 65 6d |operatin|g system|
|00005d50| 20 74 6f 20 73 70 65 6e | 64 0d 2f 2f 20 61 73 20 | to spen|d.// as |
|00005d60| 6c 69 74 74 6c 65 20 74 | 69 6d 65 20 61 73 20 70 |little t|ime as p|
|00005d70| 6f 73 73 69 62 6c 65 20 | 61 77 61 79 20 66 72 6f |ossible |away fro|
|00005d80| 6d 20 79 6f 75 72 20 70 | 72 6f 67 72 61 6d 2e 0d |m your p|rogram..|
|00005d90| 2f 2f 20 20 20 20 49 66 | 20 79 6f 75 72 20 70 72 |// If| your pr|
|00005da0| 6f 67 72 61 6d 20 75 73 | 65 73 20 61 20 54 45 64 |ogram us|es a TEd|
|00005db0| 69 74 20 28 54 68 69 73 | 20 69 73 20 61 20 73 74 |it (This| is a st|
|00005dc0| 61 6e 64 61 72 64 20 4d | 61 63 20 74 65 78 74 20 |andard M|ac text |
|00005dd0| 65 64 69 74 20 62 6f 78 | 29 2c 0d 2f 2f 20 54 68 |edit box|),.// Th|
|00005de0| 65 6e 20 79 6f 75 20 73 | 68 6f 75 6c 64 20 63 61 |en you s|hould ca|
|00005df0| 6c 6c 20 54 45 49 64 6c | 65 20 69 6e 20 74 68 69 |ll TEIdl|e in thi|
|00005e00| 73 20 66 75 6e 63 74 69 | 6f 6e 20 61 6e 64 20 73 |s functi|on and s|
|00005e10| 65 74 20 67 45 76 65 6e | 74 77 61 69 74 54 69 6d |et gEven|twaitTim|
|00005e20| 65 0d 2f 2f 20 74 6f 20 | 61 20 76 61 6c 75 65 20 |e.// to |a value |
|00005e30| 6e 6f 20 67 72 65 61 74 | 65 72 20 74 68 61 6e 20 |no great|er than |
|00005e40| 61 62 6f 75 74 20 31 30 | 2e 0d 2f 2f 20 20 20 20 |about 10|..// |
|00005e50| 20 54 68 65 20 72 65 61 | 73 6f 6e 20 66 6f 72 20 | The rea|son for |
|00005e60| 6e 6f 74 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c |not auto|maticall|
|00005e70| 79 20 73 65 74 74 69 6e | 67 20 67 45 76 65 6e 74 |y settin|g gEvent|
|00005e80| 57 61 69 74 54 69 6d 65 | 20 74 6f 20 61 20 73 6d |WaitTime| to a sm|
|00005e90| 61 6c 6c 0d 2f 2f 20 76 | 61 6c 75 65 20 69 73 20 |all.// v|alue is |
|00005ea0| 74 68 61 74 20 74 68 65 | 20 6f 70 65 72 61 74 69 |that the| operati|
|00005eb0| 6e 67 20 73 79 73 74 65 | 6d 20 63 61 6e 20 67 69 |ng syste|m can gi|
|00005ec0| 76 65 20 74 69 6d 65 20 | 74 6f 20 6f 74 68 65 72 |ve time |to other|
|00005ed0| 20 70 72 6f 67 72 61 6d | 73 0d 2f 2f 20 72 75 6e | program|s.// run|
|00005ee0| 6e 69 6e 67 20 69 6e 20 | 74 68 65 20 62 61 63 6b |ning in |the back|
|00005ef0| 67 72 6f 75 6e 64 20 69 | 66 20 74 68 65 72 65 20 |ground i|f there |
|00005f00| 69 73 20 6e 6f 74 68 69 | 6e 67 20 66 6f 72 20 79 |is nothi|ng for y|
|00005f10| 6f 75 72 20 70 72 6f 67 | 72 61 6d 20 74 6f 20 64 |our prog|ram to d|
|00005f20| 6f 2e 0d 0d 76 6f 69 64 | 20 41 70 70 6c 69 63 61 |o...void| Applica|
|00005f30| 74 69 6f 6e 49 64 6c 65 | 28 76 6f 69 64 29 20 7b |tionIdle|(void) {|
|00005f40| 0d 20 20 20 2f 2f 20 50 | 65 72 66 6f 72 6d 20 61 |. // P|erform a|
|00005f50| 6e 79 20 70 65 72 69 6f | 64 69 63 20 74 61 73 6b |ny perio|dic task|
|00005f60| 20 72 65 71 75 69 72 65 | 64 20 62 79 20 79 6f 75 | require|d by you|
|00005f70| 72 20 70 72 6f 67 72 61 | 6d 0d 7d 0d 0d 0d 2f 2f |r progra|m.}...//|
|00005f80| 20 46 75 6e 63 74 69 6f | 6e 20 43 6c 65 61 6e 55 | Functio|n CleanU|
|00005f90| 70 41 70 70 6c 69 63 61 | 74 69 6f 6e 20 69 73 20 |pApplica|tion is |
|00005fa0| 63 61 6c 6c 65 64 20 6a | 75 73 74 20 62 65 66 6f |called j|ust befo|
|00005fb0| 72 65 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 65 |re the p|rogram e|
|00005fc0| 6e 64 73 20 6e 6f 72 6d | 61 6c 6c 79 2e 0d 2f 2f |nds norm|ally..//|
|00005fd0| 20 59 6f 75 20 77 69 6c | 6c 20 70 72 6f 62 61 62 | You wil|l probab|
|00005fe0| 6c 79 20 68 61 76 65 20 | 6e 6f 74 68 69 6e 67 20 |ly have |nothing |
|00005ff0| 74 6f 20 64 6f 20 68 65 | 72 65 2c 20 65 73 70 65 |to do he|re, espe|
|00006000| 63 69 61 6c 6c 79 20 73 | 69 6e 63 65 20 74 68 65 |cially s|ince the|
|00006010| 72 65 20 69 73 0d 2f 2f | 20 6e 6f 20 77 61 79 20 |re is.//| no way |
|00006020| 74 6f 20 61 62 6f 72 74 | 20 74 68 65 20 70 72 6f |to abort| the pro|
|00006030| 67 72 61 6d 20 74 65 72 | 6d 69 6e 61 74 69 6f 6e |gram ter|mination|
|00006040| 2c 20 62 75 74 2c 20 6a | 75 73 74 20 69 6e 20 63 |, but, j|ust in c|
|00006050| 61 73 65 2e 2e 2e 0d 0d | 76 6f 69 64 20 43 6c 65 |ase.....|void Cle|
|00006060| 61 6e 55 70 41 70 70 6c | 69 63 61 74 69 6f 6e 28 |anUpAppl|ication(|
|00006070| 76 6f 69 64 29 20 7b 0d | 7d 0d 0d 0d 2f 2f 20 46 |void) {.|}...// F|
|00006080| 75 6e 63 74 69 6f 6e 20 | 41 62 6f 75 74 42 6f 78 |unction |AboutBox|
|00006090| 20 69 73 20 63 61 6c 6c | 65 64 20 77 68 65 6e 20 | is call|ed when |
|000060a0| 74 68 65 20 75 73 65 72 | 20 63 68 6f 6f 73 65 73 |the user| chooses|
|000060b0| 20 74 68 65 20 66 69 72 | 73 74 20 69 74 65 6d 20 | the fir|st item |
|000060c0| 69 6e 20 74 68 65 20 0d | 2f 2f 20 41 70 70 6c 65 |in the .|// Apple|
|000060d0| 20 6d 65 6e 75 2c 20 75 | 73 75 61 6c 6c 79 20 61 | menu, u|sually a|
|000060e0| 20 63 6f 6d 6d 61 6e 64 | 20 6f 66 20 74 68 65 20 | command| of the |
|000060f0| 66 6f 72 6d 20 22 41 62 | 6f 75 74 20 3c 70 72 6f |form "Ab|out <pro|
|00006100| 67 72 61 6d 2d 6e 61 6d | 65 3e 2e 2e 2e 22 2e 0d |gram-nam|e>..."..|
|00006110| 2f 2f 20 49 74 20 73 68 | 6f 75 6c 64 20 64 69 73 |// It sh|ould dis|
|00006120| 70 6c 61 79 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |play inf|ormation|
|00006130| 20 61 62 6f 75 74 20 79 | 6f 75 72 20 70 72 6f 67 | about y|our prog|
|00006140| 72 61 6d 2e 20 20 54 68 | 69 73 20 64 65 66 61 75 |ram. Th|is defau|
|00006150| 6c 74 0d 2f 2f 20 76 65 | 72 73 69 6f 6e 20 73 69 |lt.// ve|rsion si|
|00006160| 6d 70 6c 79 20 64 69 73 | 70 6c 61 79 73 20 61 20 |mply dis|plays a |
|00006170| 62 6f 78 20 74 68 61 74 | 20 68 61 73 20 66 6f 75 |box that| has fou|
|00006180| 72 20 66 69 6c 6c 2d 69 | 6e 2d 74 68 65 2d 62 6c |r fill-i|n-the-bl|
|00006190| 61 6e 6b 20 61 72 65 61 | 73 0d 2f 2f 20 74 68 61 |ank area|s.// tha|
|000061a0| 74 20 61 72 65 20 73 65 | 74 20 62 79 20 74 68 65 |t are se|t by the|
|000061b0| 20 63 61 6c 6c 20 74 6f | 20 50 61 72 61 6d 54 65 | call to| ParamTe|
|000061c0| 78 74 28 29 2e 20 20 59 | 6f 75 20 63 61 6e 20 6a |xt(). Y|ou can j|
|000061d0| 75 73 74 20 6d 61 6b 65 | 20 63 68 61 6e 67 65 73 |ust make| changes|
|000061e0| 0d 2f 2f 20 74 6f 20 74 | 68 69 73 2e 20 20 48 6f |.// to t|his. Ho|
|000061f0| 77 65 76 65 72 2c 20 69 | 66 20 79 6f 75 20 68 61 |wever, i|f you ha|
|00006200| 70 70 65 6e 20 74 6f 20 | 75 73 65 20 74 68 69 73 |ppen to |use this|
|00006210| 20 73 68 65 6c 6c 20 74 | 6f 20 77 72 69 74 65 20 | shell t|o write |
|00006220| 61 20 73 65 72 69 6f 75 | 73 0d 2f 2f 20 70 72 6f |a seriou|s.// pro|
|00006230| 67 72 61 6d 2c 20 79 6f | 75 20 77 69 6c 6c 20 77 |gram, yo|u will w|
|00006240| 61 6e 74 20 74 6f 20 64 | 6f 20 73 6f 6d 65 74 68 |ant to d|o someth|
|00006250| 69 6e 67 20 64 69 66 66 | 65 72 65 6e 74 2e 20 20 |ing diff|erent. |
|00006260| 46 6f 72 20 6f 6e 65 20 | 74 68 69 6e 67 2c 20 74 |For one |thing, t|
|00006270| 68 69 73 0d 2f 2f 20 6d | 65 74 68 6f 64 20 69 73 |his.// m|ethod is|
|00006280| 20 74 6f 74 61 6c 6c 79 | 20 69 6e 73 65 63 75 72 | totally| insecur|
|00006290| 65 2e 20 20 53 69 6e 63 | 65 20 69 74 20 6a 75 73 |e. Sinc|e it jus|
|000062a0| 74 20 75 73 65 73 20 6f | 6e 65 20 6f 66 20 74 68 |t uses o|ne of th|
|000062b0| 65 20 72 65 73 6f 75 72 | 63 65 73 20 69 6e 0d 2f |e resour|ces in./|
|000062c0| 2f 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 66 |/ the re|source f|
|000062d0| 69 6c 65 20 4d 61 63 53 | 74 61 72 74 65 72 2e b9 |ile MacS|tarter..|
|000062e0| 2e 72 73 72 63 2c 20 61 | 6e 79 6f 6e 65 20 77 68 |.rsrc, a|nyone wh|
|000062f0| 6f 20 77 61 6e 74 65 64 | 20 74 6f 20 73 74 65 61 |o wanted| to stea|
|00006300| 6c 20 63 72 65 64 69 74 | 0d 2f 2f 20 66 6f 72 20 |l credit|.// for |
|00006310| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 20 63 6f 75 |your pro|gram cou|
|00006320| 6c 64 20 64 6f 20 73 6f | 20 62 79 20 65 64 69 74 |ld do so| by edit|
|00006330| 69 6e 67 20 69 74 73 20 | 72 65 73 6f 75 72 63 65 |ing its |resource|
|00006340| 20 66 6f 72 6b 20 77 69 | 74 68 20 52 65 73 45 64 | fork wi|th ResEd|
|00006350| 69 74 2e 0d 2f 2f 20 28 | 49 74 20 77 6f 75 6c 64 |it..// (|It would|
|00006360| 20 62 65 20 62 65 74 74 | 65 72 20 74 6f 20 6f 70 | be bett|er to op|
|00006370| 65 6e 20 61 20 77 69 6e | 64 6f 77 20 61 6e 64 20 |en a win|dow and |
|00006380| 64 72 61 77 20 69 6e 74 | 6f 20 69 74 20 64 69 72 |draw int|o it dir|
|00006390| 65 63 74 6c 79 2e 29 0d | 2f 2f 20 20 20 20 4e 6f |ectly.).|// No|
|000063a0| 74 65 3a 20 20 54 68 65 | 20 5c 72 27 73 20 69 6e |te: The| \r's in|
|000063b0| 20 74 68 65 20 74 68 69 | 72 64 20 6c 69 6e 65 20 | the thi|rd line |
|000063c0| 68 65 72 65 20 72 65 70 | 72 65 73 65 6e 74 20 6c |here rep|resent l|
|000063d0| 69 6e 65 20 62 72 65 61 | 6b 73 2e 20 20 54 68 65 |ine brea|ks. The|
|000063e0| 72 65 0d 2f 2f 20 69 73 | 20 72 6f 6f 6d 20 66 6f |re.// is| room fo|
|000063f0| 72 20 74 68 72 65 65 20 | 66 61 69 72 6c 79 20 73 |r three |fairly s|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.