--- a/SimpleView.st Tue Dec 07 16:32:20 1999 +0100
+++ b/SimpleView.st Wed Dec 08 21:31:48 1999 +0100
@@ -3124,13 +3124,23 @@
"release existing components and generate new components from
the given windowSpec, using the given builder."
- |builder subSpec|
+ |builder subSpec notAnAppModel|
aWindowSpecOrSpecSymbol isNil ifTrue:[^ self].
(builder := aBuilder) isNil ifTrue:[
- builder := anApplication perform:#builder
- ifNotUnderstood:[UIBuilder new]
+ "/ problem: anApplication could have no builder
+ "/ or anApplication could be a non-appModel (theoretically - only providing a spec)
+ notAnAppModel := false.
+ builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil].
+ builder isNil ifTrue:[
+ notAnAppModel ifTrue:[
+ builder := UIBuilder new.
+ ] ifFalse:[
+ anApplication createBuilder.
+ builder := anApplication builder
+ ]
+ ]
].
(subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[
@@ -4905,10 +4915,11 @@
!
pointerEnter:state x:x y:y
- "got mouse pointer.
- Nothing done here"
-
- "Modified: 25.2.1997 / 23:43:21 / cg"
+ "mouse pointer entered - request the keyboard focus (sometimes)"
+
+ self wantsFocusWithPointerEnter ifTrue:[
+ self requestFocus.
+ ].
!
pointerLeave:state
@@ -5210,6 +5221,10 @@
with buttonPress can do so by redefining this
to return false"
+ (self class == SimpleView) ifTrue:[
+ "/ a pure filler/geometric layout view
+ ^ false
+ ].
^ true
!
@@ -5221,6 +5236,99 @@
^ false
! !
+!SimpleView methodsFor:'grabbing'!
+
+forceUngrabKeyboard
+ "force a keyboard ungrab - even if was not the grabber"
+
+ device ungrabKeyboard.
+
+!
+
+forceUngrabPointer
+ "force a pointer ungrab - even if was not the grabber"
+
+ device ungrabPointer
+
+!
+
+grabKeyboard
+ "grab the keayboard - that is: report all keyboard events to myself,
+ even if the mouse moved out of myself.
+ Returns true, if the grab was sucessfull (could fail, if some other
+ application has a grab - but thats very unlikely)."
+
+ ^ device grabKeyboardInView:self.
+!
+
+grabPointer
+ "grab the pointer - that is: report all motion events relative to
+ myself, even if moved out of myself.
+ Returns true, if the grab was sucessfull (could fail, if some other
+ application has a grab - but thats very unlikely)."
+
+ ^ self grabPointerWithCursor:nil
+!
+
+grabPointerWithCursor:aCursorOrNil
+ "grab the pointer - that is: report all motion events relative to
+ myself, even if moved out of myself.
+ Show aCursor during the grab, if the cursor argument is not nil.
+ Returns true, if the grab was sucessfull (could fail, if some other
+ application has a grab - but thats very unlikely)."
+
+ |sensor cursorId|
+
+"/ (sensor := self sensor) notNil ifTrue:[
+"/ "/ make certain all X events have been received
+"/ device sync.
+"/ "/ now all events have been received.
+"/ "/ now, flush all pointer events
+"/ sensor flushMotionEventsFor:nil
+"/ ].
+
+ aCursorOrNil notNil ifTrue:[
+ cursor := (aCursorOrNil onDevice:device).
+ ^ device grabPointerInView:self withCursor:cursor
+ ].
+ ^ device grabPointerInView:self
+!
+
+ungrabKeyboard
+ "ungrab the keyboard - but only if I was the grabber"
+
+ |sensor|
+
+ device activeKeyboardGrab == self ifTrue:[
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushKeyboardFor:self
+ ].
+ device ungrabKeyboard.
+ ].
+
+!
+
+ungrabPointer
+ "ungrab the pointer - but only if I was the grabber"
+
+ |sensor|
+
+ device activePointerGrab == self ifTrue:[
+ (sensor := self sensor) notNil ifTrue:[
+ "/ make certain all X events have been received
+ device sync.
+ "/ now all events have been received.
+ "/ now, flush all pointer events
+ sensor flushMotionEventsFor:self
+ ].
+ device ungrabPointer.
+ ]
+! !
+
!SimpleView methodsFor:'informing others of changes'!
contentsChanged
@@ -5647,53 +5755,6 @@
"Modified: / 1.11.1997 / 13:45:23 / cg"
! !
-!SimpleView methodsFor:'misc'!
-
-grabPointer
- "grab the pointer - that is: report all motion events relative to
- myself, even if moved out of myself."
-
- self grabPointerWithCursor:nil
-!
-
-grabPointerWithCursor:aCursorOrNil
- "grab the pointer - that is: report all motion events relative to
- myself, even if moved out of myself.
- Show aCursor if the aargument is not nil."
-
- |sensor cursorId|
-
-"/ (sensor := self sensor) notNil ifTrue:[
-"/ "/ make certain all X events have been received
-"/ device sync.
-"/ "/ now all events have been received.
-"/ "/ now, flush all pointer events
-"/ sensor flushMotionEventsFor:nil
-"/ ].
-
- aCursorOrNil notNil ifTrue:[
- cursorId := (aCursorOrNil onDevice:device) id.
- ].
- device grabPointerIn:drawableId withCursor:cursorId
-!
-
-ungrabPointer
- "ungrab the pointer"
-
- |sensor|
-
- (sensor := self sensor) notNil ifTrue:[
- "/ make certain all X events have been received
- device sync.
- "/ now all events have been received.
- "/ now, flush all pointer events
- sensor flushMotionEventsFor:self
- ].
-
- device ungrabPointer.
-
-! !
-
!SimpleView methodsFor:'private'!
componentsContainingX:x y:y do:aBlock
@@ -6688,6 +6749,14 @@
"/ ^ self
!
+hideForAction
+ "for popUpMenu compatibility;
+ this is invoked to hide a when it is going to perform its action
+ (in contrast to the generic hide)."
+
+ ^ self hide
+!
+
hideRequest
"for protocol compatibility with modal dialogs;
ignored here."
@@ -8383,6 +8452,6 @@
!SimpleView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.354 1999-12-01 20:32:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.355 1999-12-08 20:31:48 ca Exp $'
! !
SimpleView initialize!