-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed menubar autoOpen by changing mouseDownOutsideEvent managing
- Loading branch information
Showing
6 changed files
with
99 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Class { | ||
#name : #ToMenuBarEventFilter, | ||
#superclass : #BlCustomEventHandler, | ||
#instVars : [ | ||
'target' | ||
], | ||
#category : #'Toplo-Widget-Menu-Bar' | ||
} | ||
|
||
{ #category : #'api - accessing' } | ||
ToMenuBarEventFilter >> eventsToHandle [ | ||
|
||
^ { BlMouseDownEvent. BlMouseOverEvent } | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToMenuBarEventFilter >> mouseDownEvent: anEvent [ | ||
"switch auto=open filter " | ||
|
||
" mouse down on the menubar stops auto-open " | ||
|
||
(anEvent target = target or: [ | ||
target menus noneSatisfy: [ :m | | ||
anEvent target hasInParentChain: m ] ]) ifTrue: [ " stop auto open on mouse over " | ||
target autoOpen: false. | ||
^ self ]. | ||
|
||
" a mouse down on an opened menu stops auto-open" | ||
target autoOpen ifTrue: [ | ||
target menus do: [ :m | | ||
((anEvent target hasInParentChain: m) and: [ m menuWindow notNil ]) | ||
ifTrue: [ | ||
target autoOpen: false. | ||
^ self ] ] ]. | ||
|
||
" now auto open on mouse over " | ||
target autoOpen: true | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToMenuBarEventFilter >> mouseOverEvent: anEvent [ | ||
|
||
target autoOpen ifFalse: [ ^ self ]. | ||
|
||
" auto-open action " | ||
target menus do: [ :m | | ||
(anEvent target hasInParentChain: m) | ||
ifTrue: [ m menuWindow ifNil: [ m popupEvent: anEvent ] ] | ||
ifFalse: [ m closeWindow ] ] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
ToMenuBarEventFilter >> mouseUpOutsideEvent: anEvent [ | ||
|
||
target autoOpen ifFalse: [ ^ self ]. | ||
anEvent originalEvent target ifNil: [ ^ self ]. | ||
(anEvent originalEvent target hasInParentChain: target) | ||
ifTrue: [ ^ self ]. | ||
anEvent consume. | ||
target autoOpen: false | ||
] | ||
|
||
{ #category : #'api - hooks' } | ||
ToMenuBarEventFilter >> onInstalledIn: anElement [ | ||
|
||
super onInstalledIn: anElement. | ||
target := anElement | ||
] | ||
|
||
{ #category : #'api - hooks' } | ||
ToMenuBarEventFilter >> onUninstalledIn: anElement [ | ||
|
||
super onUninstalledIn: anElement. | ||
target := nil | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters