1 | ; File name : Menu.inc
|
---|
2 | ; Project name : Assembly Library
|
---|
3 | ; Created date : 13.7.2010
|
---|
4 | ; Last update : 15.9.2010
|
---|
5 | ; Author : Tomi Tilli
|
---|
6 | ; Description : Defines for Menu library.
|
---|
7 | %ifndef MENU_INC
|
---|
8 | %define MENU_INC
|
---|
9 |
|
---|
10 | ;--------------------------------------------------------------------
|
---|
11 | ; Menu Library users need to use this macro since it will provide
|
---|
12 | ; compatibility with future library versions.
|
---|
13 | ;
|
---|
14 | ; CALL_MENU_LIBRARY
|
---|
15 | ; Parameters:
|
---|
16 | ; %1: Function to call (functionName from MENU_LIB)
|
---|
17 | ; BP: Menu handle
|
---|
18 | ; Registers: Depends on function to call
|
---|
19 | ; Returns:
|
---|
20 | ; Depends on function to call
|
---|
21 | ; Corrupts registers:
|
---|
22 | ; AX (unless used as a return register), DI
|
---|
23 | ;--------------------------------------------------------------------
|
---|
24 | %macro CALL_MENU_LIBRARY 1
|
---|
25 | %ifidn %1, Close
|
---|
26 | call MenuInit_CloseMenuWindow
|
---|
27 |
|
---|
28 | %elifidn %1, SetUserDataFromDSSI
|
---|
29 | call MenuInit_SetUserDataFromDSSI
|
---|
30 |
|
---|
31 | %elifidn %1, GetUserDataToDSSI
|
---|
32 | call MenuInit_GetUserDataToDSSI
|
---|
33 |
|
---|
34 | %elifidn %1, SetTitleHeightFromAL
|
---|
35 | call MenuInit_SetTitleHeightFromAL
|
---|
36 |
|
---|
37 | %elifidn %1, SetTotalItemsFromAX
|
---|
38 | call MenuInit_SetTotalItemsFromAX
|
---|
39 |
|
---|
40 | %elifidn %1, SetInformationHeightFromAL
|
---|
41 | call MenuInit_SetInformationHeightFromAL
|
---|
42 |
|
---|
43 | %elifidn %1, SetTimeoutValueFromAX
|
---|
44 | call MenuTime_SetSelectionTimeoutValueFromAX
|
---|
45 |
|
---|
46 | %else
|
---|
47 | mov di, MENU_LIB.%1
|
---|
48 | call Menu_FunctionFromDI
|
---|
49 | %endif
|
---|
50 | %endmacro
|
---|
51 |
|
---|
52 | ; Menu library functions
|
---|
53 | struc MENU_LIB
|
---|
54 | .DisplayWithHandlerInBXandUserDataInDXAX resb 2
|
---|
55 | .Close:
|
---|
56 | .RefreshWindow resb 2
|
---|
57 |
|
---|
58 | .SetUserDataFromDSSI:
|
---|
59 | .GetUserDataToDSSI:
|
---|
60 |
|
---|
61 | .SetTitleHeightFromAL:
|
---|
62 | .RefreshTitle resb 2
|
---|
63 |
|
---|
64 | .HighlightItemFromAX resb 2
|
---|
65 | .SetTotalItemsFromAX:
|
---|
66 | .RefreshItemFromAX resb 2
|
---|
67 |
|
---|
68 | .SetInformationHeightFromAL:
|
---|
69 | .RefreshInformation resb 2
|
---|
70 |
|
---|
71 | .RestartTimeout resb 2
|
---|
72 | .SetTimeoutValueFromAX:
|
---|
73 |
|
---|
74 | %ifdef INCLUDE_MENU_DIALOGS
|
---|
75 | .StartProgressTaskWithIoInDSSIandParamInDXAX resb 2
|
---|
76 | .SetProgressValueFromAX resb 2
|
---|
77 |
|
---|
78 | .DisplayMessageWithInputInDSSI resb 2
|
---|
79 | .GetSelectionToAXwithInputInDSSI resb 2
|
---|
80 | .GetWordWithIoInDSSI resb 2
|
---|
81 | .GetStringWithIoInDSSI resb 2
|
---|
82 | .GetFileNameWithIoInDSSI resb 2
|
---|
83 | %endif
|
---|
84 | endstruc
|
---|
85 |
|
---|
86 |
|
---|
87 | ; Menu initialization parameters
|
---|
88 | struc MENUINIT
|
---|
89 | .wTimeoutTicks resb 2 ; Selection timeout in system timer ticks
|
---|
90 | .wItems resb 2 ; Number of items in menu
|
---|
91 |
|
---|
92 | .wTitleAndInfoLines:
|
---|
93 | .bTitleLines resb 1 ; Number of title lines
|
---|
94 | .bInfoLines resb 1 ; Number of information lines
|
---|
95 |
|
---|
96 | .wWidthAndHeight:
|
---|
97 | .bWidth resb 1 ; Menu width in characters
|
---|
98 | .bHeight resb 1 ; Menu height in characters
|
---|
99 | endstruc
|
---|
100 |
|
---|
101 |
|
---|
102 | ; All menu parameters
|
---|
103 | struc MENU
|
---|
104 | .menuInit resb MENUINIT_size ; Must be first
|
---|
105 | .fnEventHandler resb 2 ; Offset to Menu event handler
|
---|
106 | .dwUserData resb 4 ; User specified data
|
---|
107 |
|
---|
108 | .bFlags resb 1 ; Menu flags
|
---|
109 | .bLastSecondPrinted resb 1 ; To minimize CGA snow when using timeouts
|
---|
110 | .wTimeoutCounter resb 2
|
---|
111 |
|
---|
112 | .wHighlightedItem resb 2 ; Index for highlighted item
|
---|
113 | .wFirstVisibleItem resb 2 ; Index for first visible item on the menu
|
---|
114 | endstruc
|
---|
115 |
|
---|
116 | ; Flags for MENU.wFlags
|
---|
117 | FLG_MENU_EXIT EQU (1<<0) ; Close and exit menu
|
---|
118 | FLG_MENU_NOHIGHLIGHT EQU (1<<1) ; Never highlight items
|
---|
119 | FLG_MENU_USER_HANDLES_SCROLLING EQU (1<<2)
|
---|
120 |
|
---|
121 |
|
---|
122 | MENU_VERTICAL_BORDER_LINES EQU 5 ; Title top and bottom + Info top and bottom + bottom shadow
|
---|
123 | MENU_HORIZONTAL_BORDER_LINES EQU 3 ; Left + Right borders + Right shadow
|
---|
124 | MENU_TEXT_ROW_OFFSET EQU 1
|
---|
125 | MENU_TEXT_COLUMN_OFFSET EQU 2
|
---|
126 |
|
---|
127 | SCROLL_TRACK_CHARACTER EQU 176
|
---|
128 | SCROLL_THUMB_CHARACTER EQU 219
|
---|
129 |
|
---|
130 | NO_ITEM_SELECTED EQU -1
|
---|
131 | NO_ITEM_HIGHLIGHTED EQU -1
|
---|
132 |
|
---|
133 |
|
---|
134 | ; Keyboard keys (scan codes) used by menu library
|
---|
135 | MENU_KEY_ENTER EQU 1Ch
|
---|
136 | MENU_KEY_ESC EQU 01h
|
---|
137 | MENU_KEY_UP EQU 48h
|
---|
138 | MENU_KEY_DOWN EQU 50h
|
---|
139 | MENU_KEY_PGUP EQU 49h
|
---|
140 | MENU_KEY_PGDN EQU 51h
|
---|
141 | MENU_KEY_HOME EQU 47h
|
---|
142 | MENU_KEY_END EQU 4Fh
|
---|
143 |
|
---|
144 |
|
---|
145 | %endif ; MENU_INC
|
---|