3122 |
3122 |
3123 client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
3123 client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
3124 "release existing components and generate new components from |
3124 "release existing components and generate new components from |
3125 the given windowSpec, using the given builder." |
3125 the given windowSpec, using the given builder." |
3126 |
3126 |
3127 |builder subSpec| |
3127 |builder subSpec notAnAppModel| |
3128 |
3128 |
3129 aWindowSpecOrSpecSymbol isNil ifTrue:[^ self]. |
3129 aWindowSpecOrSpecSymbol isNil ifTrue:[^ self]. |
3130 |
3130 |
3131 (builder := aBuilder) isNil ifTrue:[ |
3131 (builder := aBuilder) isNil ifTrue:[ |
3132 builder := anApplication perform:#builder |
3132 "/ problem: anApplication could have no builder |
3133 ifNotUnderstood:[UIBuilder new] |
3133 "/ or anApplication could be a non-appModel (theoretically - only providing a spec) |
|
3134 notAnAppModel := false. |
|
3135 builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil]. |
|
3136 builder isNil ifTrue:[ |
|
3137 notAnAppModel ifTrue:[ |
|
3138 builder := UIBuilder new. |
|
3139 ] ifFalse:[ |
|
3140 anApplication createBuilder. |
|
3141 builder := anApplication builder |
|
3142 ] |
|
3143 ] |
3134 ]. |
3144 ]. |
3135 |
3145 |
3136 (subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[ |
3146 (subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[ |
3137 anApplication isNil ifTrue:[^ self]. |
3147 anApplication isNil ifTrue:[^ self]. |
3138 subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol. |
3148 subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol. |
5208 wantsFocusWithButtonPress |
5219 wantsFocusWithButtonPress |
5209 "views which do not like to take the keyboard focus |
5220 "views which do not like to take the keyboard focus |
5210 with buttonPress can do so by redefining this |
5221 with buttonPress can do so by redefining this |
5211 to return false" |
5222 to return false" |
5212 |
5223 |
|
5224 (self class == SimpleView) ifTrue:[ |
|
5225 "/ a pure filler/geometric layout view |
|
5226 ^ false |
|
5227 ]. |
5213 ^ true |
5228 ^ true |
5214 ! |
5229 ! |
5215 |
5230 |
5216 wantsFocusWithPointerEnter |
5231 wantsFocusWithPointerEnter |
5217 "views which like to take the keyboard focus |
5232 "views which like to take the keyboard focus |
5218 when the pointer enters can do so by redefining this |
5233 when the pointer enters can do so by redefining this |
5219 to return true" |
5234 to return true" |
5220 |
5235 |
5221 ^ false |
5236 ^ false |
|
5237 ! ! |
|
5238 |
|
5239 !SimpleView methodsFor:'grabbing'! |
|
5240 |
|
5241 forceUngrabKeyboard |
|
5242 "force a keyboard ungrab - even if was not the grabber" |
|
5243 |
|
5244 device ungrabKeyboard. |
|
5245 |
|
5246 ! |
|
5247 |
|
5248 forceUngrabPointer |
|
5249 "force a pointer ungrab - even if was not the grabber" |
|
5250 |
|
5251 device ungrabPointer |
|
5252 |
|
5253 ! |
|
5254 |
|
5255 grabKeyboard |
|
5256 "grab the keayboard - that is: report all keyboard events to myself, |
|
5257 even if the mouse moved out of myself. |
|
5258 Returns true, if the grab was sucessfull (could fail, if some other |
|
5259 application has a grab - but thats very unlikely)." |
|
5260 |
|
5261 ^ device grabKeyboardInView:self. |
|
5262 ! |
|
5263 |
|
5264 grabPointer |
|
5265 "grab the pointer - that is: report all motion events relative to |
|
5266 myself, even if moved out of myself. |
|
5267 Returns true, if the grab was sucessfull (could fail, if some other |
|
5268 application has a grab - but thats very unlikely)." |
|
5269 |
|
5270 ^ self grabPointerWithCursor:nil |
|
5271 ! |
|
5272 |
|
5273 grabPointerWithCursor:aCursorOrNil |
|
5274 "grab the pointer - that is: report all motion events relative to |
|
5275 myself, even if moved out of myself. |
|
5276 Show aCursor during the grab, if the cursor argument is not nil. |
|
5277 Returns true, if the grab was sucessfull (could fail, if some other |
|
5278 application has a grab - but thats very unlikely)." |
|
5279 |
|
5280 |sensor cursorId| |
|
5281 |
|
5282 "/ (sensor := self sensor) notNil ifTrue:[ |
|
5283 "/ "/ make certain all X events have been received |
|
5284 "/ device sync. |
|
5285 "/ "/ now all events have been received. |
|
5286 "/ "/ now, flush all pointer events |
|
5287 "/ sensor flushMotionEventsFor:nil |
|
5288 "/ ]. |
|
5289 |
|
5290 aCursorOrNil notNil ifTrue:[ |
|
5291 cursor := (aCursorOrNil onDevice:device). |
|
5292 ^ device grabPointerInView:self withCursor:cursor |
|
5293 ]. |
|
5294 ^ device grabPointerInView:self |
|
5295 ! |
|
5296 |
|
5297 ungrabKeyboard |
|
5298 "ungrab the keyboard - but only if I was the grabber" |
|
5299 |
|
5300 |sensor| |
|
5301 |
|
5302 device activeKeyboardGrab == self ifTrue:[ |
|
5303 (sensor := self sensor) notNil ifTrue:[ |
|
5304 "/ make certain all X events have been received |
|
5305 device sync. |
|
5306 "/ now all events have been received. |
|
5307 "/ now, flush all pointer events |
|
5308 sensor flushKeyboardFor:self |
|
5309 ]. |
|
5310 device ungrabKeyboard. |
|
5311 ]. |
|
5312 |
|
5313 ! |
|
5314 |
|
5315 ungrabPointer |
|
5316 "ungrab the pointer - but only if I was the grabber" |
|
5317 |
|
5318 |sensor| |
|
5319 |
|
5320 device activePointerGrab == self ifTrue:[ |
|
5321 (sensor := self sensor) notNil ifTrue:[ |
|
5322 "/ make certain all X events have been received |
|
5323 device sync. |
|
5324 "/ now all events have been received. |
|
5325 "/ now, flush all pointer events |
|
5326 sensor flushMotionEventsFor:self |
|
5327 ]. |
|
5328 device ungrabPointer. |
|
5329 ] |
5222 ! ! |
5330 ! ! |
5223 |
5331 |
5224 !SimpleView methodsFor:'informing others of changes'! |
5332 !SimpleView methodsFor:'informing others of changes'! |
5225 |
5333 |
5226 contentsChanged |
5334 contentsChanged |
5643 ] |
5751 ] |
5644 ]. |
5752 ]. |
5645 |
5753 |
5646 "Created: / 20.6.1997 / 11:47:42 / cg" |
5754 "Created: / 20.6.1997 / 11:47:42 / cg" |
5647 "Modified: / 1.11.1997 / 13:45:23 / cg" |
5755 "Modified: / 1.11.1997 / 13:45:23 / cg" |
5648 ! ! |
|
5649 |
|
5650 !SimpleView methodsFor:'misc'! |
|
5651 |
|
5652 grabPointer |
|
5653 "grab the pointer - that is: report all motion events relative to |
|
5654 myself, even if moved out of myself." |
|
5655 |
|
5656 self grabPointerWithCursor:nil |
|
5657 ! |
|
5658 |
|
5659 grabPointerWithCursor:aCursorOrNil |
|
5660 "grab the pointer - that is: report all motion events relative to |
|
5661 myself, even if moved out of myself. |
|
5662 Show aCursor if the aargument is not nil." |
|
5663 |
|
5664 |sensor cursorId| |
|
5665 |
|
5666 "/ (sensor := self sensor) notNil ifTrue:[ |
|
5667 "/ "/ make certain all X events have been received |
|
5668 "/ device sync. |
|
5669 "/ "/ now all events have been received. |
|
5670 "/ "/ now, flush all pointer events |
|
5671 "/ sensor flushMotionEventsFor:nil |
|
5672 "/ ]. |
|
5673 |
|
5674 aCursorOrNil notNil ifTrue:[ |
|
5675 cursorId := (aCursorOrNil onDevice:device) id. |
|
5676 ]. |
|
5677 device grabPointerIn:drawableId withCursor:cursorId |
|
5678 ! |
|
5679 |
|
5680 ungrabPointer |
|
5681 "ungrab the pointer" |
|
5682 |
|
5683 |sensor| |
|
5684 |
|
5685 (sensor := self sensor) notNil ifTrue:[ |
|
5686 "/ make certain all X events have been received |
|
5687 device sync. |
|
5688 "/ now all events have been received. |
|
5689 "/ now, flush all pointer events |
|
5690 sensor flushMotionEventsFor:self |
|
5691 ]. |
|
5692 |
|
5693 device ungrabPointer. |
|
5694 |
|
5695 ! ! |
5756 ! ! |
5696 |
5757 |
5697 !SimpleView methodsFor:'private'! |
5758 !SimpleView methodsFor:'private'! |
5698 |
5759 |
5699 componentsContainingX:x y:y do:aBlock |
5760 componentsContainingX:x y:y do:aBlock |