home *** CD-ROM | disk | FTP | other *** search
- /*
- MenuBar.prg
-
- Copyright (c) 1991 Chris Muller and Anton van Straaten
- */
-
- #include "class(y).ch"
-
- #define OPTION_SPACING 4
-
-
- create class MenuBar from BaseMenu
-
- export:
- method draw
- method addItem
- method newMenuPos
- endclass
-
-
- // this constructor does nothing but pass its parameter up to the superclass
- constructor new (aItems), (aItems)
- return
-
-
- method procedure addItem(cLabel, oAction, isActive)
- local nCol
-
- // establish screen column for new option
- if len(::items) == 0
- nCol := OPTION_SPACING
- else
- // atail() is a 5.01 function; for 5.0, use ::items[len(::items)]
- nCol := atail(::items):nextCol() + OPTION_SPACING
- end
-
- // invoke addItem in the superclass (BaseMenu)
- ::super:addItem(0, nCol, cLabel, oAction, isActive)
- return
-
-
- method procedure draw
- winCurrent(0) // selects main screen
- @ 0, 0 // draw the bar
- ::super:draw() // invoke superclass' draw method
- return
-
-
- method function newMenuPos
- // tells a child menu where to put itself
- return ::items[::currPos]:col
-
-
- // eof menubar.prg
-