home *** CD-ROM | disk | FTP | other *** search
- .MODEL SMALL
-
- INCLUDE equates.inc
- INCLUDE instance.inc
- INCLUDE messages.inc
- INCLUDE objects.inc
-
- UR EQU 0 ;Upper row
- LC EQU 0 ;Left column
- LR EQU 0 ;Lower row
- RC EQU 79 ;Right column
-
- IF1
- INCLUDE macros.mac
- INCLUDE objects.mac
- ENDIF
-
- EXTRN readEvent:NEAR
- EXTRN sendMsg:NEAR
-
- EXTRN Dispatch:WORD
- EXTRN Hardware:WORD
- EXTRN Help:WORD
- EXTRN HorzMenu:WORD
- EXTRN Mouse:WORD
- EXTRN Self:WORD
- EXTRN System:WORD
- EXTRN VertMenu0:WORD
- EXTRN VertMenu1:WORD
- EXTRN VertMenu2:WORD
- EXTRN VertMenu3:WORD
-
- .CODE
-
- IF Dbug
- PUBLIC initExecLoop
- ENDIF
- COMMENT %
- ==============================================================================
- If no other context is active starts-up executive loop.
-
- =============================================================================%
- initExecLoop PROC NEAR
- getInst ax,NextContext,Dispatch ;Get next read context
- identity ax,iel1 ;Is there one? - Exit
- send MenuBar,Read ;Enter executive loop
- iel1: ret
- initExecLoop ENDP
-
-
-
- PUBLIC clrNextContext
- COMMENT %
- ==============================================================================
- Makes the next dispatcher object the top-level executive.
-
- =============================================================================%
- clrNextContext PROC NEAR
- lea ax,MenuBar ;Get top-level object
- setInst NextContext,ax,Dispatch ;Set it as next context
- ret
- clrNextContext ENDP
-
-
-
- COMMENT %
- ==============================================================================
- Selects the appropriate menu item based on mouse location.
-
- =============================================================================%
- selectItem PROC NEAR
- getInst bl,Col1,Mouse ;Get mouse column
- moreThan bl,LC+45,sli2 ;Exit if > MC+35
- xor ax,ax ;Select 1st item
- lessThan bl,LC+9,sli1 ;Done if < MC+9
- mov ax,1*MenuEntrySize ;Select 2nd item
- lessThan bl,LC+17,sli1 ;Done if < MC+17
- mov ax,2*MenuEntrySize ;Select 3rd item
- lessThan bl,LC+25,sli1 ;Done if < MC+25
- mov ax,3*MenuEntrySize ;Select 4th item
-
- sli1: send Self,Hilite,ax ;Hilite menubar item
- send Self,Select ;Select menu item
- sli2: ret
- selectItem ENDP
-
-
-
- .DATA
-
- defMenu MenuBar,\
- <" File "," Edit "," View "," Special ">
-
- defMenuTbl MenuBar,\
- <VertMenu0,Refresh,VertMenu0,Read>,\
- <VertMenu1,Refresh,VertMenu1,Read>,\
- <VertMenu2,Refresh,VertMenu2,Read>,\
- <VertMenu3,Refresh,VertMenu3,Read>
-
- defDispTbl MenuBar,\
- <0,0,3,0,0,0,0,System,Reset>,\
- <0,75,3,0,0,0,0,Self,Prev>,\
- <0,77,3,0,0,0,0,Self,Next>,\
- <13,28,3,0,0,0,0,Self,Select>,\
- <27,1,3,0,0,0,0,System,Refresh,System,Read>,\
- <0,68,3,0,0,0,0,System,Refresh,System,Read>,\
- <0,Nil,1,UR,LC+1,UR,LC+45,Self,Drag>,\
- <0,Nil,1,2,70,22,79,Help,Click>,\
- <Nil,Nil,Nil,0,0,24,79,Hardware,Refresh>
-
- defMsg MenuBar,\
- Init,\
- <,,initExecLoop>
-
- defMsg MenuBar,\
- Read,\
- <,,readEvent>
-
- defMsg MenuBar,\
- Drag,\
- <,,selectItem>
-
- defObj MenuBar,\
- <HorzMenu>,\
- <Row1,1,UR,\
- Col1,1,LC,\
- Row2,1,LR,\
- Col2,1,RC,\
- Color,1,30h,\
- Unused,1,Nil,\
- TxtPtr,2,Nil,\
- InxPtr,2,0,\
- MasterObj,2,Nil,\
- DispTbl,2,MenuBarDispTbl,\
- MenuPtr,2,MenuBarMenu,\
- MenuTbl,2,MenuBarMenuTbl>,\
- <Refresh,Read,Next,Prev,Select,Init,Hilite,Drag,SelectNext,SelectPrev>
-
-
-
- END
-