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