source: xtideuniversalbios/trunk/Assembly_Library/Inc/Menu.inc@ 190

Last change on this file since 190 was 178, checked in by krille_n_@…, 13 years ago
  • Removed an %ifdef in RomVars.inc that prevented XTIDECFG from building.
  • Size optimizations in MenuLoop.asm.
File size: 4.1 KB
Line 
1; Project name : Assembly Library
2; Description : Defines for Menu library.
3%ifndef MENU_INC
4%define MENU_INC
5
6;--------------------------------------------------------------------
7; Menu Library users need to use this macro since it will provide
8; compatibility with future library versions.
9;
10; CALL_MENU_LIBRARY
11; Parameters:
12; %1: Function to call (functionName from MENU_LIB)
13; BP: Menu handle
14; Registers: Depends on function to call
15; Returns:
16; Depends on function to call
17; Corrupts registers:
18; AX (unless used as a return register), DI
19;--------------------------------------------------------------------
20%macro CALL_MENU_LIBRARY 1
21 %ifidn %1, Close
22 call MenuInit_CloseMenuWindow
23
24 %elifidn %1, SetUserDataFromDSSI
25 call MenuInit_SetUserDataFromDSSI
26
27 %elifidn %1, GetUserDataToDSSI
28 call MenuInit_GetUserDataToDSSI
29
30 %elifidn %1, SetTitleHeightFromAL
31 call MenuInit_SetTitleHeightFromAL
32
33 %elifidn %1, GetHighlightedItemToAX
34 call MenuInit_GetHighlightedItemToAX
35
36 %elifidn %1, SetTotalItemsFromAX
37 call MenuInit_SetTotalItemsFromAX
38
39 %elifidn %1, SetInformationHeightFromAL
40 call MenuInit_SetInformationHeightFromAL
41
42 %elifidn %1, SetTimeoutValueFromAX
43 call MenuTime_SetSelectionTimeoutValueFromAX
44
45 %else
46 mov di, %1
47 call Menu_FunctionFromDI
48 %endif
49%endmacro
50
51%if 0
52;;;
53;;; struc no longer needed with direct call to function
54;;;
55
56; Menu library functions
57struc MENU_LIB
58 .DisplayWithHandlerInBXandUserDataInDXAX resb 2
59 .Close:
60 .RefreshWindow resb 2
61
62 .SetUserDataFromDSSI:
63 .GetUserDataToDSSI:
64
65 .SetTitleHeightFromAL:
66 .ClearTitleArea resb 2
67 .RefreshTitle resb 2
68
69 .GetHighlightedItemToAX:
70 .HighlightItemFromAX resb 2
71 .SetTotalItemsFromAX:
72 .RefreshItemFromAX resb 2
73
74 .SetInformationHeightFromAL:
75 .ClearInformationArea resb 2
76 .RefreshInformation resb 2
77
78 .StartSelectionTimeoutWithTicksInAX resb 2
79
80%ifdef INCLUDE_MENU_DIALOGS
81 .StartProgressTaskWithIoInDSSIandParamInDXAX resb 2
82 .SetProgressValueFromAX resb 2
83
84 .DisplayMessageWithInputInDSSI resb 2
85 .GetSelectionToAXwithInputInDSSI resb 2
86 .GetWordWithIoInDSSI resb 2
87 .GetStringWithIoInDSSI resb 2
88 .GetFileNameWithIoInDSSI resb 2
89 .GetDriveWithIoInDSSI resb 2
90%endif
91endstruc
92%endif
93
94; Menu initialization parameters
95struc MENUINIT
96 .wItems resb 2 ; Number of items in menu
97 .wHighlightedItem resb 2 ; Index for highlighted item
98
99 .wTitleAndInfoLines:
100 .bTitleLines resb 1 ; Number of title lines
101 .bInfoLines resb 1 ; Number of information lines
102
103 .wWidthAndHeight:
104 .bWidth resb 1 ; Menu width in characters
105 .bHeight resb 1 ; Menu height in characters
106endstruc
107
108
109; All menu parameters
110struc MENU
111 .menuInit resb MENUINIT_size ; Must be first
112 .fnEventHandler resb 2 ; Offset to Menu event handler
113 .dwUserData resb 4 ; User specified data
114
115 .bFlags resb 1 ; Menu flags
116 resb 1
117 .wTimeoutCounter resb 2
118 .wFirstVisibleItem resb 2 ; Index for first visible item on the menu
119endstruc
120
121; Flags for MENU.wFlags
122FLG_MENU_EXIT EQU (1<<0) ; Close and exit menu
123FLG_MENU_NOHIGHLIGHT EQU (1<<1) ; Never highlight items
124FLG_MENU_USER_HANDLES_SCROLLING EQU (1<<2)
125FLG_MENU_TIMEOUT_COUNTDOWN EQU (1<<3) ; Timeout countdown in progress
126
127
128MENU_VERTICAL_BORDER_LINES EQU 5 ; Title top and bottom + Info top and bottom + bottom shadow
129MENU_HORIZONTAL_BORDER_LINES EQU 3 ; Left + Right borders + Right shadow
130MENU_TEXT_ROW_OFFSET EQU 1
131MENU_TEXT_COLUMN_OFFSET EQU 2
132MENU_TIMEOUT_STRING_CHARACTERS EQU 19
133MENU_TIMEOUT_SECONDS_FOR_HURRY EQU 3
134
135SCROLL_TRACK_CHARACTER EQU BLOCK_EVEN_BACKGROUND_AND_FOREGROUND
136SCROLL_THUMB_CHARACTER EQU BLOCK_FULL_FOREGROUND
137
138NO_ITEM_SELECTED EQU -1
139NO_ITEM_HIGHLIGHTED EQU -1
140NO_TIMEOUT_USED EQU 0
141
142
143; Keyboard keys (scan codes) used by menu library
144;MENU_KEY_ENTER EQU 1Ch
145;MENU_KEY_ESC EQU 01h
146MENU_KEY_UP EQU 48h
147MENU_KEY_DOWN EQU 50h
148MENU_KEY_PGUP EQU 49h
149MENU_KEY_PGDN EQU 51h
150MENU_KEY_HOME EQU 47h
151MENU_KEY_END EQU 4Fh
152
153
154%endif ; MENU_INC
Note: See TracBrowser for help on using the repository browser.