'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 12 September 2008 at 11:26:39 am'!

!ButtonLW methodsFor: 'focus handling' stamp: 'jmv 9/12/2008 11:26'!
seizesNavigationFocus
	^self isInWorld! !


!ImageLW methodsFor: 'initialization' stamp: 'jmv 9/12/2008 10:29'!
initialize
	super initialize.
"	form _ Form makeStar."
	bounds _ 10@10 extent: "form extent"10@10.
"	self generateStretchedForm"! !

!ImageLW methodsFor: 'drawing' stamp: 'jmv 9/12/2008 10:30'!
generateStretchedForm
	| scale smoothPix pair |
	form isNil ifTrue: [
		self formToDraw: nil.
		^self ].
	scale _ 1.0 * bounds extent / form extent.
	smoothPix _ (scale x < 1.0 or: [scale y < 1.0]) 
		ifTrue: [2]
		ifFalse: [1].
	self formToDraw: (scale = (1 @ 1) 
				ifTrue: [form]
				ifFalse: [
					pair := WarpBlt current 
								rotate: form
								degrees: 0
								center: form boundingBox center
								scaleBy: scale
								smoothing: smoothPix.
					pair first])! !


!MenuItemLW methodsFor: 'focus handling' stamp: 'jmv 9/12/2008 11:26'!
seizesNavigationFocus
	^false! !


!OldHandMorph methodsFor: 'events-processing' stamp: 'jmv 9/12/2008 10:49'!
handleEvent: anEvent
	| evt ofs k |
	owner ifNil:[^self].
	evt _ anEvent.

	EventStats ifNil:[EventStats _ IdentityDictionary new].
	EventStats at: #count put: (EventStats at: #count ifAbsent:[0]) + 1.
	EventStats at: evt type put: (EventStats at: evt type ifAbsent:[0]) + 1.

	evt isMouseOver ifTrue:[^self sendMouseEvent: evt].

ShowEvents == true ifTrue:[
	Display fill: (0@0 extent: 450@120) rule: Form over fillColor: Color white.
	ofs _ (owner hands indexOf: self) - 1 * 60.
	evt printString displayAt: (0@ofs) + (evt isKeyboard ifTrue:[0@30] ifFalse:[0@0]).
	(self keyboardFocus printString,
		'    ', self navigationFocus printString) displayAt: (0@ofs)+(0@45).
].
	"Notify listeners"
	self sendListenEvent: evt to: self eventListeners.

	evt isKeyboard ifTrue:[
		(evt commandKeyPressed and: [evt isKeystroke]) ifTrue: [
"			(navigationFocus notNil and: [ navigationFocus seizesNavigationFocus ]) ifFalse: ["
				k _ evt keyValue.
				k = 28 ifTrue: [
					self navigationFocusOut.
					^self mouseOverHandler processMouseOver: lastMouseEvent].
				k = 29 ifTrue: [
					self navigationFocusIn.
					^self mouseOverHandler processMouseOver: lastMouseEvent].
				k = 30 ifTrue: [
					self navigationFocusPrevious.
					^self mouseOverHandler processMouseOver: lastMouseEvent].
				k = 31 ifTrue: [
					self navigationFocusNext.
					^self mouseOverHandler processMouseOver: lastMouseEvent].
"			]."
		].
		self sendListenEvent: evt to: self keyboardListeners.
		self sendKeyboardEvent: evt.
		^self mouseOverHandler processMouseOver: lastMouseEvent].

	evt isDropEvent ifTrue:[
		self sendEvent: evt focus: nil.
		^self mouseOverHandler processMouseOver: lastMouseEvent].

	evt isMouse ifTrue:[
		self sendListenEvent: evt to: self mouseListeners.
		lastMouseEvent _ evt].

	"Check for pending drag or double click operations."
	mouseClickState ifNotNil:[
		(mouseClickState handleEvent: evt from: self) ifFalse:[
			"Possibly dispatched #click: or something and will not re-establish otherwise"
			^self mouseOverHandler processMouseOver: lastMouseEvent]].

	evt isMove ifTrue:[
		self position: evt position.
		self sendMouseEvent: evt.
	] ifFalse:[
		"Issue a synthetic move event if we're not at the position of the event"
		(evt position = self position) ifFalse:[self moveToEvent: evt].
		"Drop submorphs on button events"
		(self hasSubmorphs) 
			ifTrue:[self dropMorphs: evt]
			ifFalse:[self sendMouseEvent: evt].
	].
	ShowEvents == true ifTrue:[self mouseFocus printString displayAt: (0@ofs) + (0@15)].
	self mouseOverHandler processMouseOver: lastMouseEvent.
! !


!MenuItemLW reorganize!
('accessing' actionArgument backColor backColor: foreColor foreColor: selectedBackColor: selectedForeColor:)
('initialization' initialize)
('drawing' drawHighlightOn: drawOn:)
('event handling' mouseUp:)
('focus handling' seizesNavigationFocus)
!

