--- a/PullDMenu.st Sat Apr 24 14:43:55 1999 +0200
+++ b/PullDMenu.st Sat Apr 24 14:46:56 1999 +0200
@@ -43,6 +43,10 @@
documentation
"
+ Notice: this class is obsolete now - please use a MenuPanel
+ in new applications, which provides all of this functionality,
+ plus more.
+
PullDown menu provides the top (always visible) part of these menus.
It controls display of its menus, which become visible when one of the
PullDownMenus entries is pressed.
@@ -60,9 +64,9 @@
titles <Collection> the strings in the menu
selectors <Collection> the selectors to send to the menu-
- receiver (for empty pull-menus)
- if nil (the default), title entries
- do not send anything.
+ receiver (for empty pull-menus)
+ if nil (the default), title entries
+ do not send anything.
activeMenuNumber <Number> the index of the currently active menu
@@ -82,8 +86,8 @@
edgeStyle <Symbol> how to draw edges
toggleMode <Symbol> if #toggle, press pulls menu,
- another press hides it.
- if other, its hidden on release.
+ another press hides it.
+ if other, its hidden on release.
except menus, titles and selectors, instvars are usually defined from
defaults in the styleSheet; you should not care for them.
@@ -92,47 +96,47 @@
[StyleSheet values:]
pullDownMenuViewBackground view background Color for the menu bar
- default: menuViewBackground
+ default: menuViewBackground
pullDownMenuForegroundColor foreground drawing color for the menu bar
- default: menuForegroundColor
+ default: menuForegroundColor
pullDownMenuBackgroundColor background drawing color for the menu bar
- default: menuBackgroundColor
+ default: menuBackgroundColor
pullDownMenuHilightForegroundColor active foreground drawing color for the menu bar
- default: menuHilightForegroundColor
+ default: menuHilightForegroundColor
pullDownMenuHilightBackgroundColor active background drawing color for the menu bar
- default: menuHilightBackgroundColor
+ default: menuHilightBackgroundColor
pullDownMenuHilightLevel level (3D only) when active
- default: menuHilightLevel
+ default: menuHilightLevel
pullDownMenuEdgeStyle edge style (nil or #soft)
pullDownMenuKeepMenu if true, pulled menu stays open until button
- is pressed again outside of the item-area (motif behavior)
- if false, menu closes on release (default)
+ is pressed again outside of the item-area (motif behavior)
+ if false, menu closes on release (default)
pullDownMenuToggleKeep if true, pulled menu closes when an entry is pressed
- again. Otherwise, only press outside of the items area
- hides it. default is false
+ again. Otherwise, only press outside of the items area
+ hides it. default is false
pullDownMenuLevel level (3D only)
pullDownMenuFont font to use for the menu bar
- default: menuFont
+ default: menuFont
pullDownMenuShowSeparatingLines if true, lines are drawn between items.
- default: false
+ default: false
pullDownMenuRaiseTop if true, topview is raised whenever an entry
- is activated.
- default: true
+ is activated.
+ default: true
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!
@@ -364,55 +368,55 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'pullDownMenu.viewBackground' #'menuView.background'
- #'pullDownMenu.foregroundColor' #'menu.foregroundColor'
- #'pullDownMenu.backgroundColor' #'menu.backgroundColor'
- #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor'
- #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor'
- #'pullDownMenu.hilightLevel' #'menu.hilightLevel'
- #'pullDownMenu.edgeStyle'
- #'pullDownMenu.toggleMode'
- #'pullDownMenu.level'
- #'pullDownMenu.font' #'menu.font'
- #'pullDownMenu.separatingLines')>
+ #'pullDownMenu.foregroundColor' #'menu.foregroundColor'
+ #'pullDownMenu.backgroundColor' #'menu.backgroundColor'
+ #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor'
+ #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor'
+ #'pullDownMenu.hilightLevel' #'menu.hilightLevel'
+ #'pullDownMenu.edgeStyle'
+ #'pullDownMenu.toggleMode'
+ #'pullDownMenu.level'
+ #'pullDownMenu.font' #'menu.font'
+ #'pullDownMenu.separatingLines')>
|styleSheet|
styleSheet := StyleSheet.
- DefaultViewBackground := styleSheet colorAt:'pullDownMenu.viewBackground'.
+ DefaultViewBackground := styleSheet colorAt:#'pullDownMenu.viewBackground'.
DefaultViewBackground isNil ifTrue:[
- DefaultViewBackground := styleSheet colorAt:'menuView.background'.
+ DefaultViewBackground := styleSheet colorAt:#'menuView.background'.
].
- DefaultForegroundColor := styleSheet colorAt:'pullDownMenu.foregroundColor'.
+ DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'.
DefaultForegroundColor isNil ifTrue:[
- DefaultForegroundColor := styleSheet colorAt:'menu.foregroundColor'.
+ DefaultForegroundColor := styleSheet colorAt:#'menu.foregroundColor'.
].
- DefaultBackgroundColor := styleSheet colorAt:'pullDownMenu.backgroundColor'.
+ DefaultBackgroundColor := styleSheet colorAt:#'pullDownMenu.backgroundColor'.
DefaultBackgroundColor isNil ifTrue:[
- DefaultViewBackground notNil ifTrue:[
- DefaultBackgroundColor := DefaultViewBackground
- ] ifFalse:[
- DefaultBackgroundColor := styleSheet colorAt:'menu.backgroundColor'.
- ]
+ DefaultViewBackground notNil ifTrue:[
+ DefaultBackgroundColor := DefaultViewBackground
+ ] ifFalse:[
+ DefaultBackgroundColor := styleSheet colorAt:#'menu.backgroundColor'.
+ ]
].
- DefaultHilightForegroundColor := styleSheet colorAt:'pullDownMenu.hilightForegroundColor'.
+ DefaultHilightForegroundColor := styleSheet colorAt:#'pullDownMenu.hilightForegroundColor'.
DefaultHilightForegroundColor isNil ifTrue:[
- DefaultHilightForegroundColor := styleSheet colorAt:'menu.hilightForegroundColor'.
+ DefaultHilightForegroundColor := styleSheet colorAt:#'menu.hilightForegroundColor'.
].
- DefaultHilightBackgroundColor := styleSheet colorAt:'pullDownMenu.hilightBackgroundColor'.
+ DefaultHilightBackgroundColor := styleSheet colorAt:#'pullDownMenu.hilightBackgroundColor'.
DefaultHilightBackgroundColor isNil ifTrue:[
- DefaultHilightBackgroundColor := styleSheet colorAt:'menu.hilightBackgroundColor'.
+ DefaultHilightBackgroundColor := styleSheet colorAt:#'menu.hilightBackgroundColor'.
].
- DefaultHilightLevel := styleSheet at:'pullDownMenu.hilightLevel'.
+ DefaultHilightLevel := styleSheet at:#'pullDownMenu.hilightLevel'.
DefaultHilightLevel isNil ifTrue:[
- DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0.
+ DefaultHilightLevel := styleSheet at:#'menu.hilightLevel' default:0.
].
- DefaultEdgeStyle := styleSheet at:'pullDownMenu.edgeStyle'.
- DefaultToggleMode := styleSheet at:'pullDownMenu.toggleMode' default:#toggle.
- DefaultLevel := styleSheet at:'pullDownMenu.level' default:1.
- DefaultFont := styleSheet fontAt:'pullDownMenu.font'.
- DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:'menu.font'].
- DefaultSeparatingLines := styleSheet at:'pullDownMenu.separatingLines' default:false.
+ DefaultEdgeStyle := styleSheet at:#'pullDownMenu.edgeStyle'.
+ DefaultToggleMode := styleSheet at:#'pullDownMenu.toggleMode' default:#toggle.
+ DefaultLevel := styleSheet at:#'pullDownMenu.level' default:1.
+ DefaultFont := styleSheet fontAt:#'pullDownMenu.font'.
+ DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:#'menu.font'].
+ DefaultSeparatingLines := styleSheet at:#'pullDownMenu.separatingLines' default:false.
"
PullDownMenu updateStyleCache
@@ -1064,52 +1068,53 @@
device ungrabKeyboard.
(y between:0 and:height) ifTrue:[
- titleIndex := self titleIndexForX:x.
+ titleIndex := self titleIndexForX:x.
].
"
now, titleIndex is non-nil if pressed within myself
"
(titleIndex notNil and:[titleIndex ~~ activeMenuNumber]) ifTrue:[
- "/ pressed on another item
- m := self pullMenu:titleIndex.
- (toggleMode == #toggle) ifTrue:[
- device grabPointerInView:self.
- device grabKeyboardInView:self.
+ "/ pressed on another item
+ m := self pullMenu:titleIndex.
+ (toggleMode == #toggle) ifTrue:[
+ device grabPointerInView:self.
+ device grabKeyboardInView:self.
"/ self cursor:Cursor upRightArrow
- ]
+ ]
] ifFalse:[
- titleIndex == activeMenuNumber ifTrue:[
- "/ pressed on same item
- (toggleMode ~~ #toggle) ifTrue:[
- "same pressed again ... stay"
- titleIndex notNil ifTrue:[
- device grabPointerInView:self.
- device grabKeyboardInView:self.
- ].
- ] ifFalse:[
- self hideActiveMenu.
- ].
- ^ self
- ].
+ titleIndex == activeMenuNumber ifTrue:[
+ "/ pressed on same item
+ (toggleMode ~~ #toggle) ifTrue:[
+ "same pressed again ... stay"
+ titleIndex notNil ifTrue:[
+ device grabPointerInView:self.
+ device grabKeyboardInView:self.
+ ].
+ ] ifFalse:[
+ self hideActiveMenu.
+ ].
+ ^ self
+ ].
- "/ pressed outside
+ "/ pressed outside
- activeMenuNumber isNil ifTrue:[^self].
+ activeMenuNumber isNil ifTrue:[^self].
+
+ activeMenu := menus at:activeMenuNumber.
+ activeLeft := activeMenu left.
+ (x between:activeLeft and:(activeMenu right)) ifTrue:[
+ activeTop := activeMenu top.
+ (y between:activeTop and:(activeMenu bottom)) ifTrue:[
- activeMenu := menus at:activeMenuNumber.
- activeLeft := activeMenu left.
- (x between:activeLeft and:(activeMenu right)) ifTrue:[
- activeTop := activeMenu top.
- (y between:activeTop and:(activeMenu bottom)) ifTrue:[
- "/ pressed inside currently pulled menu
- activeMenu buttonPress:button x:(x - activeLeft) y:(y - activeTop).
- ^ self
- ].
- ].
+ "/ pressed inside currently pulled menu
+ activeMenu buttonPress:button x:(x - activeLeft) y:(y - activeTop).
+ ^ self
+ ].
+ ].
- "/ somewhere else
- self hideActiveMenu
+ "/ somewhere else
+ self hideActiveMenu.
]
"Modified: 6.3.1996 / 17:14:16 / cg"
@@ -1293,15 +1298,15 @@
|m|
activeMenuNumber notNil ifTrue:[
- (m := menus at:activeMenuNumber) notNil ifTrue:[
- m beInvisible.
- ].
- self unHighlightActiveTitle.
- activeMenuNumber := nil
+ (m := menus at:activeMenuNumber) notNil ifTrue:[
+ m beInvisible.
+ ].
+ self unHighlightActiveTitle.
+ activeMenuNumber := nil
].
aBoolean ifTrue:[
- device ungrabKeyboard.
- device ungrabPointer.
+ device ungrabKeyboard.
+ device ungrabPointer.
"/ self cursor:Cursor normal
].
@@ -1320,34 +1325,34 @@
subMenu := menus at:aNumber.
raiseTopWhenActivated ifTrue:[
- self topView raise.
+ self topView raise.
].
(activeMenuNumber notNil
and:[
- subMenu notNil
- or:[selectors notNil and:[(selectors at:activeMenuNumber) notNil]]]) ifTrue:[
- self highlightActiveTitle.
- ].
+ subMenu notNil
+ or:[selectors notNil and:[(selectors at:activeMenuNumber) notNil]]]) ifTrue:[
+ self highlightActiveTitle.
+ ].
subMenu notNil ifTrue:[
- subMenu origin:((left + (self titleLenUpTo:aNumber))
- @
- (posY := height + subMenu borderWidth)).
- subMenu hiddenOnRealize:false.
- subMenu setSelection:nil.
- subMenu create.
- subMenu saveUnder:true.
- subMenu superMenu:self.
+ subMenu origin:((left + (self titleLenUpTo:aNumber))
+ @
+ (posY := height + subMenu borderWidth)).
+ subMenu hiddenOnRealize:false.
+ subMenu setSelection:nil.
+ subMenu create.
+ subMenu saveUnder:true.
+ subMenu superMenu:self.
- subMenu right > (r := self right) ifTrue:[
- subMenu origin:((r - subMenu width) @ posY).
- ].
- subMenu raise show.
+ subMenu right > (r := self right) ifTrue:[
+ subMenu origin:((r - subMenu width) @ posY).
+ ].
+ subMenu raise show.
- (styleSheet at:#'pullDownMenu.autoselectFirst') == true ifTrue:[
- subMenu setSelection:1
- ]
+ (styleSheet at:#'pullDownMenu.autoselectFirst') == true ifTrue:[
+ subMenu setSelection:1
+ ]
].
^ subMenu
@@ -1426,7 +1431,7 @@
initStyle
"initialize style specifics"
- <resource: #style (#name)>
+ <resource: #style (#name #'pullDownMenu.raiseTop')>
|style|
@@ -1498,7 +1503,7 @@
lightColor := DefaultLightColor
].
- raiseTopWhenActivated := styleSheet at:'pullDownMenuRaiseTop' default:true.
+ raiseTopWhenActivated := styleSheet at:#'pullDownMenu.raiseTop' default:true.
"Modified: / 15.9.1998 / 22:58:42 / cg"
!
@@ -1786,5 +1791,5 @@
!PullDownMenu class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.84 1998-09-18 15:27:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.85 1999-04-24 12:46:56 cg Exp $'
! !
--- a/PullDownMenu.st Sat Apr 24 14:43:55 1999 +0200
+++ b/PullDownMenu.st Sat Apr 24 14:46:56 1999 +0200
@@ -43,6 +43,10 @@
documentation
"
+ Notice: this class is obsolete now - please use a MenuPanel
+ in new applications, which provides all of this functionality,
+ plus more.
+
PullDown menu provides the top (always visible) part of these menus.
It controls display of its menus, which become visible when one of the
PullDownMenus entries is pressed.
@@ -60,9 +64,9 @@
titles <Collection> the strings in the menu
selectors <Collection> the selectors to send to the menu-
- receiver (for empty pull-menus)
- if nil (the default), title entries
- do not send anything.
+ receiver (for empty pull-menus)
+ if nil (the default), title entries
+ do not send anything.
activeMenuNumber <Number> the index of the currently active menu
@@ -82,8 +86,8 @@
edgeStyle <Symbol> how to draw edges
toggleMode <Symbol> if #toggle, press pulls menu,
- another press hides it.
- if other, its hidden on release.
+ another press hides it.
+ if other, its hidden on release.
except menus, titles and selectors, instvars are usually defined from
defaults in the styleSheet; you should not care for them.
@@ -92,47 +96,47 @@
[StyleSheet values:]
pullDownMenuViewBackground view background Color for the menu bar
- default: menuViewBackground
+ default: menuViewBackground
pullDownMenuForegroundColor foreground drawing color for the menu bar
- default: menuForegroundColor
+ default: menuForegroundColor
pullDownMenuBackgroundColor background drawing color for the menu bar
- default: menuBackgroundColor
+ default: menuBackgroundColor
pullDownMenuHilightForegroundColor active foreground drawing color for the menu bar
- default: menuHilightForegroundColor
+ default: menuHilightForegroundColor
pullDownMenuHilightBackgroundColor active background drawing color for the menu bar
- default: menuHilightBackgroundColor
+ default: menuHilightBackgroundColor
pullDownMenuHilightLevel level (3D only) when active
- default: menuHilightLevel
+ default: menuHilightLevel
pullDownMenuEdgeStyle edge style (nil or #soft)
pullDownMenuKeepMenu if true, pulled menu stays open until button
- is pressed again outside of the item-area (motif behavior)
- if false, menu closes on release (default)
+ is pressed again outside of the item-area (motif behavior)
+ if false, menu closes on release (default)
pullDownMenuToggleKeep if true, pulled menu closes when an entry is pressed
- again. Otherwise, only press outside of the items area
- hides it. default is false
+ again. Otherwise, only press outside of the items area
+ hides it. default is false
pullDownMenuLevel level (3D only)
pullDownMenuFont font to use for the menu bar
- default: menuFont
+ default: menuFont
pullDownMenuShowSeparatingLines if true, lines are drawn between items.
- default: false
+ default: false
pullDownMenuRaiseTop if true, topview is raised whenever an entry
- is activated.
- default: true
+ is activated.
+ default: true
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!
@@ -364,55 +368,55 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'pullDownMenu.viewBackground' #'menuView.background'
- #'pullDownMenu.foregroundColor' #'menu.foregroundColor'
- #'pullDownMenu.backgroundColor' #'menu.backgroundColor'
- #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor'
- #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor'
- #'pullDownMenu.hilightLevel' #'menu.hilightLevel'
- #'pullDownMenu.edgeStyle'
- #'pullDownMenu.toggleMode'
- #'pullDownMenu.level'
- #'pullDownMenu.font' #'menu.font'
- #'pullDownMenu.separatingLines')>
+ #'pullDownMenu.foregroundColor' #'menu.foregroundColor'
+ #'pullDownMenu.backgroundColor' #'menu.backgroundColor'
+ #'pullDownMenu.hilightForegroundColor' #'menu.hilightForegroundColor'
+ #'pullDownMenu.hilightBackgroundColor' #'menu.hilightBackgroundColor'
+ #'pullDownMenu.hilightLevel' #'menu.hilightLevel'
+ #'pullDownMenu.edgeStyle'
+ #'pullDownMenu.toggleMode'
+ #'pullDownMenu.level'
+ #'pullDownMenu.font' #'menu.font'
+ #'pullDownMenu.separatingLines')>
|styleSheet|
styleSheet := StyleSheet.
- DefaultViewBackground := styleSheet colorAt:'pullDownMenu.viewBackground'.
+ DefaultViewBackground := styleSheet colorAt:#'pullDownMenu.viewBackground'.
DefaultViewBackground isNil ifTrue:[
- DefaultViewBackground := styleSheet colorAt:'menuView.background'.
+ DefaultViewBackground := styleSheet colorAt:#'menuView.background'.
].
- DefaultForegroundColor := styleSheet colorAt:'pullDownMenu.foregroundColor'.
+ DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'.
DefaultForegroundColor isNil ifTrue:[
- DefaultForegroundColor := styleSheet colorAt:'menu.foregroundColor'.
+ DefaultForegroundColor := styleSheet colorAt:#'menu.foregroundColor'.
].
- DefaultBackgroundColor := styleSheet colorAt:'pullDownMenu.backgroundColor'.
+ DefaultBackgroundColor := styleSheet colorAt:#'pullDownMenu.backgroundColor'.
DefaultBackgroundColor isNil ifTrue:[
- DefaultViewBackground notNil ifTrue:[
- DefaultBackgroundColor := DefaultViewBackground
- ] ifFalse:[
- DefaultBackgroundColor := styleSheet colorAt:'menu.backgroundColor'.
- ]
+ DefaultViewBackground notNil ifTrue:[
+ DefaultBackgroundColor := DefaultViewBackground
+ ] ifFalse:[
+ DefaultBackgroundColor := styleSheet colorAt:#'menu.backgroundColor'.
+ ]
].
- DefaultHilightForegroundColor := styleSheet colorAt:'pullDownMenu.hilightForegroundColor'.
+ DefaultHilightForegroundColor := styleSheet colorAt:#'pullDownMenu.hilightForegroundColor'.
DefaultHilightForegroundColor isNil ifTrue:[
- DefaultHilightForegroundColor := styleSheet colorAt:'menu.hilightForegroundColor'.
+ DefaultHilightForegroundColor := styleSheet colorAt:#'menu.hilightForegroundColor'.
].
- DefaultHilightBackgroundColor := styleSheet colorAt:'pullDownMenu.hilightBackgroundColor'.
+ DefaultHilightBackgroundColor := styleSheet colorAt:#'pullDownMenu.hilightBackgroundColor'.
DefaultHilightBackgroundColor isNil ifTrue:[
- DefaultHilightBackgroundColor := styleSheet colorAt:'menu.hilightBackgroundColor'.
+ DefaultHilightBackgroundColor := styleSheet colorAt:#'menu.hilightBackgroundColor'.
].
- DefaultHilightLevel := styleSheet at:'pullDownMenu.hilightLevel'.
+ DefaultHilightLevel := styleSheet at:#'pullDownMenu.hilightLevel'.
DefaultHilightLevel isNil ifTrue:[
- DefaultHilightLevel := styleSheet at:'menu.hilightLevel' default:0.
+ DefaultHilightLevel := styleSheet at:#'menu.hilightLevel' default:0.
].
- DefaultEdgeStyle := styleSheet at:'pullDownMenu.edgeStyle'.
- DefaultToggleMode := styleSheet at:'pullDownMenu.toggleMode' default:#toggle.
- DefaultLevel := styleSheet at:'pullDownMenu.level' default:1.
- DefaultFont := styleSheet fontAt:'pullDownMenu.font'.
- DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:'menu.font'].
- DefaultSeparatingLines := styleSheet at:'pullDownMenu.separatingLines' default:false.
+ DefaultEdgeStyle := styleSheet at:#'pullDownMenu.edgeStyle'.
+ DefaultToggleMode := styleSheet at:#'pullDownMenu.toggleMode' default:#toggle.
+ DefaultLevel := styleSheet at:#'pullDownMenu.level' default:1.
+ DefaultFont := styleSheet fontAt:#'pullDownMenu.font'.
+ DefaultFont isNil ifTrue:[DefaultFont := styleSheet fontAt:#'menu.font'].
+ DefaultSeparatingLines := styleSheet at:#'pullDownMenu.separatingLines' default:false.
"
PullDownMenu updateStyleCache
@@ -1064,52 +1068,53 @@
device ungrabKeyboard.
(y between:0 and:height) ifTrue:[
- titleIndex := self titleIndexForX:x.
+ titleIndex := self titleIndexForX:x.
].
"
now, titleIndex is non-nil if pressed within myself
"
(titleIndex notNil and:[titleIndex ~~ activeMenuNumber]) ifTrue:[
- "/ pressed on another item
- m := self pullMenu:titleIndex.
- (toggleMode == #toggle) ifTrue:[
- device grabPointerInView:self.
- device grabKeyboardInView:self.
+ "/ pressed on another item
+ m := self pullMenu:titleIndex.
+ (toggleMode == #toggle) ifTrue:[
+ device grabPointerInView:self.
+ device grabKeyboardInView:self.
"/ self cursor:Cursor upRightArrow
- ]
+ ]
] ifFalse:[
- titleIndex == activeMenuNumber ifTrue:[
- "/ pressed on same item
- (toggleMode ~~ #toggle) ifTrue:[
- "same pressed again ... stay"
- titleIndex notNil ifTrue:[
- device grabPointerInView:self.
- device grabKeyboardInView:self.
- ].
- ] ifFalse:[
- self hideActiveMenu.
- ].
- ^ self
- ].
+ titleIndex == activeMenuNumber ifTrue:[
+ "/ pressed on same item
+ (toggleMode ~~ #toggle) ifTrue:[
+ "same pressed again ... stay"
+ titleIndex notNil ifTrue:[
+ device grabPointerInView:self.
+ device grabKeyboardInView:self.
+ ].
+ ] ifFalse:[
+ self hideActiveMenu.
+ ].
+ ^ self
+ ].
- "/ pressed outside
+ "/ pressed outside
- activeMenuNumber isNil ifTrue:[^self].
+ activeMenuNumber isNil ifTrue:[^self].
+
+ activeMenu := menus at:activeMenuNumber.
+ activeLeft := activeMenu left.
+ (x between:activeLeft and:(activeMenu right)) ifTrue:[
+ activeTop := activeMenu top.
+ (y between:activeTop and:(activeMenu bottom)) ifTrue:[
- activeMenu := menus at:activeMenuNumber.
- activeLeft := activeMenu left.
- (x between:activeLeft and:(activeMenu right)) ifTrue:[
- activeTop := activeMenu top.
- (y between:activeTop and:(activeMenu bottom)) ifTrue:[
- "/ pressed inside currently pulled menu
- activeMenu buttonPress:button x:(x - activeLeft) y:(y - activeTop).
- ^ self
- ].
- ].
+ "/ pressed inside currently pulled menu
+ activeMenu buttonPress:button x:(x - activeLeft) y:(y - activeTop).
+ ^ self
+ ].
+ ].
- "/ somewhere else
- self hideActiveMenu
+ "/ somewhere else
+ self hideActiveMenu.
]
"Modified: 6.3.1996 / 17:14:16 / cg"
@@ -1293,15 +1298,15 @@
|m|
activeMenuNumber notNil ifTrue:[
- (m := menus at:activeMenuNumber) notNil ifTrue:[
- m beInvisible.
- ].
- self unHighlightActiveTitle.
- activeMenuNumber := nil
+ (m := menus at:activeMenuNumber) notNil ifTrue:[
+ m beInvisible.
+ ].
+ self unHighlightActiveTitle.
+ activeMenuNumber := nil
].
aBoolean ifTrue:[
- device ungrabKeyboard.
- device ungrabPointer.
+ device ungrabKeyboard.
+ device ungrabPointer.
"/ self cursor:Cursor normal
].
@@ -1320,34 +1325,34 @@
subMenu := menus at:aNumber.
raiseTopWhenActivated ifTrue:[
- self topView raise.
+ self topView raise.
].
(activeMenuNumber notNil
and:[
- subMenu notNil
- or:[selectors notNil and:[(selectors at:activeMenuNumber) notNil]]]) ifTrue:[
- self highlightActiveTitle.
- ].
+ subMenu notNil
+ or:[selectors notNil and:[(selectors at:activeMenuNumber) notNil]]]) ifTrue:[
+ self highlightActiveTitle.
+ ].
subMenu notNil ifTrue:[
- subMenu origin:((left + (self titleLenUpTo:aNumber))
- @
- (posY := height + subMenu borderWidth)).
- subMenu hiddenOnRealize:false.
- subMenu setSelection:nil.
- subMenu create.
- subMenu saveUnder:true.
- subMenu superMenu:self.
+ subMenu origin:((left + (self titleLenUpTo:aNumber))
+ @
+ (posY := height + subMenu borderWidth)).
+ subMenu hiddenOnRealize:false.
+ subMenu setSelection:nil.
+ subMenu create.
+ subMenu saveUnder:true.
+ subMenu superMenu:self.
- subMenu right > (r := self right) ifTrue:[
- subMenu origin:((r - subMenu width) @ posY).
- ].
- subMenu raise show.
+ subMenu right > (r := self right) ifTrue:[
+ subMenu origin:((r - subMenu width) @ posY).
+ ].
+ subMenu raise show.
- (styleSheet at:#'pullDownMenu.autoselectFirst') == true ifTrue:[
- subMenu setSelection:1
- ]
+ (styleSheet at:#'pullDownMenu.autoselectFirst') == true ifTrue:[
+ subMenu setSelection:1
+ ]
].
^ subMenu
@@ -1426,7 +1431,7 @@
initStyle
"initialize style specifics"
- <resource: #style (#name)>
+ <resource: #style (#name #'pullDownMenu.raiseTop')>
|style|
@@ -1498,7 +1503,7 @@
lightColor := DefaultLightColor
].
- raiseTopWhenActivated := styleSheet at:'pullDownMenuRaiseTop' default:true.
+ raiseTopWhenActivated := styleSheet at:#'pullDownMenu.raiseTop' default:true.
"Modified: / 15.9.1998 / 22:58:42 / cg"
!
@@ -1786,5 +1791,5 @@
!PullDownMenu class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.84 1998-09-18 15:27:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.85 1999-04-24 12:46:56 cg Exp $'
! !