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

Last change on this file since 177 was 177, checked in by gregli@…, 13 years ago

Optimiztion, replaced the jump tables for MENU_LIB and DISPLAY_LIB with direct jump offsets

File size: 4.2 KB
Line 
1; File name : Menu.inc
2; Project name : Assembly Library
3; Created date : 13.7.2010
4; Last update : 22.11.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, GetHighlightedItemToAX
38 call MenuInit_GetHighlightedItemToAX
39
40 %elifidn %1, SetTotalItemsFromAX
41 call MenuInit_SetTotalItemsFromAX
42
43 %elifidn %1, SetInformationHeightFromAL
44 call MenuInit_SetInformationHeightFromAL
45
46 %elifidn %1, SetTimeoutValueFromAX
47 call MenuTime_SetSelectionTimeoutValueFromAX
48
49 %else
50 mov di, %1
51 call Menu_FunctionFromDI
52 %endif
53%endmacro
54
55%if 0
56;;;
57;;; struc no longer needed with direct call to function
58;;;
59
60; Menu library functions
61struc MENU_LIB
62 .DisplayWithHandlerInBXandUserDataInDXAX resb 2
63 .Close:
64 .RefreshWindow resb 2
65
66 .SetUserDataFromDSSI:
67 .GetUserDataToDSSI:
68
69 .SetTitleHeightFromAL:
70 .ClearTitleArea resb 2
71 .RefreshTitle resb 2
72
73 .GetHighlightedItemToAX:
74 .HighlightItemFromAX resb 2
75 .SetTotalItemsFromAX:
76 .RefreshItemFromAX resb 2
77
78 .SetInformationHeightFromAL:
79 .ClearInformationArea resb 2
80 .RefreshInformation resb 2
81
82 .StartSelectionTimeoutWithTicksInAX resb 2
83
84%ifdef INCLUDE_MENU_DIALOGS
85 .StartProgressTaskWithIoInDSSIandParamInDXAX resb 2
86 .SetProgressValueFromAX resb 2
87
88 .DisplayMessageWithInputInDSSI resb 2
89 .GetSelectionToAXwithInputInDSSI resb 2
90 .GetWordWithIoInDSSI resb 2
91 .GetStringWithIoInDSSI resb 2
92 .GetFileNameWithIoInDSSI resb 2
93 .GetDriveWithIoInDSSI resb 2
94%endif
95endstruc
96%endif
97
98; Menu initialization parameters
99struc MENUINIT
100 .wItems resb 2 ; Number of items in menu
101 .wHighlightedItem resb 2 ; Index for highlighted item
102
103 .wTitleAndInfoLines:
104 .bTitleLines resb 1 ; Number of title lines
105 .bInfoLines resb 1 ; Number of information lines
106
107 .wWidthAndHeight:
108 .bWidth resb 1 ; Menu width in characters
109 .bHeight resb 1 ; Menu height in characters
110endstruc
111
112
113; All menu parameters
114struc MENU
115 .menuInit resb MENUINIT_size ; Must be first
116 .fnEventHandler resb 2 ; Offset to Menu event handler
117 .dwUserData resb 4 ; User specified data
118
119 .bFlags resb 1 ; Menu flags
120 resb 1
121 .wTimeoutCounter resb 2
122 .wFirstVisibleItem resb 2 ; Index for first visible item on the menu
123endstruc
124
125; Flags for MENU.wFlags
126FLG_MENU_EXIT EQU (1<<0) ; Close and exit menu
127FLG_MENU_NOHIGHLIGHT EQU (1<<1) ; Never highlight items
128FLG_MENU_USER_HANDLES_SCROLLING EQU (1<<2)
129FLG_MENU_TIMEOUT_COUNTDOWN EQU (1<<3) ; Timeout countdown in progress
130
131
132MENU_VERTICAL_BORDER_LINES EQU 5 ; Title top and bottom + Info top and bottom + bottom shadow
133MENU_HORIZONTAL_BORDER_LINES EQU 3 ; Left + Right borders + Right shadow
134MENU_TEXT_ROW_OFFSET EQU 1
135MENU_TEXT_COLUMN_OFFSET EQU 2
136MENU_TIMEOUT_STRING_CHARACTERS EQU 19
137MENU_TIMEOUT_SECONDS_FOR_HURRY EQU 3
138
139SCROLL_TRACK_CHARACTER EQU BLOCK_EVEN_BACKGROUND_AND_FOREGROUND
140SCROLL_THUMB_CHARACTER EQU BLOCK_FULL_FOREGROUND
141
142NO_ITEM_SELECTED EQU -1
143NO_ITEM_HIGHLIGHTED EQU -1
144NO_TIMEOUT_USED EQU 0
145
146
147; Keyboard keys (scan codes) used by menu library
148MENU_KEY_ENTER EQU 1Ch
149MENU_KEY_ESC EQU 01h
150MENU_KEY_UP EQU 48h
151MENU_KEY_DOWN EQU 50h
152MENU_KEY_PGUP EQU 49h
153MENU_KEY_PGDN EQU 51h
154MENU_KEY_HOME EQU 47h
155MENU_KEY_END EQU 4Fh
156
157
158%endif ; MENU_INC
Note: See TracBrowser for help on using the repository browser.