TopView.st
changeset 6500 a31591286e00
parent 6368 0482fa46f211
child 6589 348a13487224
equal deleted inserted replaced
6499:962fe142b15b 6500:a31591286e00
   183 ! !
   183 ! !
   184 
   184 
   185 !TopView class methodsFor:'accessing'!
   185 !TopView class methodsFor:'accessing'!
   186 
   186 
   187 currentWindowBeingMoved
   187 currentWindowBeingMoved
   188     "the current window move operation 
   188     "the current window move operation
   189      (only used with modeless popup windows; i.e. windows without decoration,
   189      (only used with modeless popup windows; i.e. windows without decoration,
   190       which want to be moved by click-motion on the background)"
   190       which want to be moved by click-motion on the background)"
   191 
   191 
   192     ^ CurrentWindowBeingMoved
   192     ^ CurrentWindowBeingMoved
   193 
   193 
   628 ! !
   628 ! !
   629 
   629 
   630 !TopView methodsFor:'event handling-window move'!
   630 !TopView methodsFor:'event handling-window move'!
   631 
   631 
   632 doWindowMove
   632 doWindowMove
   633     "a window move operation 
   633     "a window move operation
   634      (only used with modeless popup windows; i.e. windows without decoration,
   634      (only used with modeless popup windows; i.e. windows without decoration,
   635       which want to be moved by click-motion on the background)"
   635       which want to be moved by click-motion on the background)"
   636 
   636 
   637     |delta|
   637     |delta|
   638 
   638 
   639     CurrentWindowBeingMoved == self ifTrue:[
   639     CurrentWindowBeingMoved == self ifTrue:[
   640         delta := self graphicsDevice pointerPosition - CurrentWindowMoveStart.
   640 	delta := self graphicsDevice pointerPosition - CurrentWindowMoveStart.
   641         (CurrentWindowMoveState notNil
   641 	(CurrentWindowMoveState notNil
   642         or:[ delta r > 5 ]) ifTrue:[
   642 	or:[ delta r > 5 ]) ifTrue:[
   643             CurrentWindowMoveState := #inMove.
   643 	    CurrentWindowMoveState := #inMove.
   644             CurrentWindowMoveStart := self graphicsDevice pointerPosition.
   644 	    CurrentWindowMoveStart := self graphicsDevice pointerPosition.
   645             self origin:(self origin + delta).
   645 	    self origin:(self origin + delta).
   646         ].
   646 	].
   647     ].
   647     ].
   648 
   648 
   649     "Created: / 03-03-2011 / 19:13:08 / cg"
   649     "Created: / 03-03-2011 / 19:13:08 / cg"
   650 !
   650 !
   651 
   651 
   652 endWindowMove
   652 endWindowMove
   653     "a window move operation 
   653     "a window move operation
   654      (only used with modeless popup windows; i.e. windows without decoration,
   654      (only used with modeless popup windows; i.e. windows without decoration,
   655       which want to be moved by click-motion on the background)"
   655       which want to be moved by click-motion on the background)"
   656 
   656 
   657     CurrentWindowBeingMoved := nil.
   657     CurrentWindowBeingMoved := nil.
   658 
   658 
   659     "Created: / 03-03-2011 / 19:17:24 / cg"
   659     "Created: / 03-03-2011 / 19:17:24 / cg"
   660 !
   660 !
   661 
   661 
   662 startWindowMove
   662 startWindowMove
   663     "a window move operation 
   663     "a window move operation
   664      (only used with modeless popup windows; i.e. windows without decoration,
   664      (only used with modeless popup windows; i.e. windows without decoration,
   665       which want to be moved by click-motion on the background)"
   665       which want to be moved by click-motion on the background)"
   666 
   666 
   667     CurrentWindowBeingMoved := self.
   667     CurrentWindowBeingMoved := self.
   668     CurrentWindowMoveStart := self graphicsDevice pointerPosition.
   668     CurrentWindowMoveStart := self graphicsDevice pointerPosition.
   671     "Created: / 03-03-2011 / 19:09:39 / cg"
   671     "Created: / 03-03-2011 / 19:09:39 / cg"
   672 !
   672 !
   673 
   673 
   674 startWindowMoveOnButtonPress
   674 startWindowMoveOnButtonPress
   675     "this allows undecorated windows (i.e. modeless popups) to be moved by
   675     "this allows undecorated windows (i.e. modeless popups) to be moved by
   676      drag-moving in their window area 
   676      drag-moving in their window area
   677      (similar to how mac windows and realplayer are moved).
   677      (similar to how mac windows and realplayer are moved).
   678      Return true here, if a window move should be initiated"
   678      Return true here, if a window move should be initiated"
   679 
   679 
   680     ^ self windowGroup isModal not
   680     ^ self windowGroup isModal not
   681     and:[  self topView isPopUpView ]
   681     and:[  self topView isPopUpView ]
   787 
   787 
   788 postRealize
   788 postRealize
   789     super postRealize.
   789     super postRealize.
   790 
   790 
   791     keyboardProcessor isNil ifTrue:[
   791     keyboardProcessor isNil ifTrue:[
   792         keyboardProcessor := KeyboardProcessor new.
   792 	keyboardProcessor := KeyboardProcessor new.
   793     ].
   793     ].
   794 
   794 
   795     self graphicsDevice realizedTopViewHookFor:self
   795     self graphicsDevice realizedTopViewHookFor:self
   796 !
   796 !
   797 
   797 
   836      Can be used to synchronize multiple-window applications,
   836      Can be used to synchronize multiple-window applications,
   837      and (especially) to wait until an application session is finished
   837      and (especially) to wait until an application session is finished
   838      when invoking commands with the rDoit mechanism"
   838      when invoking commands with the rDoit mechanism"
   839 
   839 
   840     [self drawableId isNil] whileFalse:[
   840     [self drawableId isNil] whileFalse:[
   841         Delay waitForSeconds:0.1.
   841 	Delay waitForSeconds:0.1.
   842     ].
   842     ].
   843 
   843 
   844     "asynchronous:
   844     "asynchronous:
   845 
   845 
   846      EditTextView open
   846      EditTextView open
   937 isPopUpView
   937 isPopUpView
   938     "return true if I am a popup view.
   938     "return true if I am a popup view.
   939      (i.e. I want to come up without any decoration and popUp to top immediately)"
   939      (i.e. I want to come up without any decoration and popUp to top immediately)"
   940 
   940 
   941     type isInteger ifTrue:[
   941     type isInteger ifTrue:[
   942         ^ (type bitAnd:WindowTypeMask) == TypePopUp
   942 	^ (type bitAnd:WindowTypeMask) == TypePopUp
   943     ].
   943     ].
   944     "/ the nonInteger handling code is for backward compatibility only.
   944     "/ the nonInteger handling code is for backward compatibility only.
   945     ^ type == #popup
   945     ^ type == #popup
   946 
   946 
   947     "Created: / 28-02-1997 / 22:12:30 / cg"
   947     "Created: / 28-02-1997 / 22:12:30 / cg"
   951 isScreenDialog
   951 isScreenDialog
   952     "return true if I am a screen dialog view.
   952     "return true if I am a screen dialog view.
   953      (i.e. I want to come up above all other windows)"
   953      (i.e. I want to come up above all other windows)"
   954 
   954 
   955     type isInteger ifTrue:[
   955     type isInteger ifTrue:[
   956         ^ (type bitAnd:WindowTypeMask) == TypeScreenDialog
   956 	^ (type bitAnd:WindowTypeMask) == TypeScreenDialog
   957     ].
   957     ].
   958     "/ the nonInteger handling code is for backward compatibility only.
   958     "/ the nonInteger handling code is for backward compatibility only.
   959     ^ false
   959     ^ false
   960 
   960 
   961     "Modified: / 01-12-2010 / 12:15:59 / cg"
   961     "Modified: / 01-12-2010 / 12:15:59 / cg"
   974 isToolDialog
   974 isToolDialog
   975     "return true if I am a toolWindow dialog view.
   975     "return true if I am a toolWindow dialog view.
   976      (i.e. I want to come up with a smaller window-title area, without minimize and maximize buttons)"
   976      (i.e. I want to come up with a smaller window-title area, without minimize and maximize buttons)"
   977 
   977 
   978     type isInteger ifTrue:[
   978     type isInteger ifTrue:[
   979         ^ (type bitAnd:WindowTypeMask) == TypeToolDialog
   979 	^ (type bitAnd:WindowTypeMask) == TypeToolDialog
   980     ].
   980     ].
   981     "/ the nonInteger handling code is for backward compatibility only.
   981     "/ the nonInteger handling code is for backward compatibility only.
   982     ^ false
   982     ^ false
   983 
   983 
   984     "Modified: / 03-03-2011 / 14:59:42 / cg"
   984     "Modified: / 03-03-2011 / 14:59:42 / cg"
   987 isToolWindow
   987 isToolWindow
   988     "return true if I am a toolWindow view.
   988     "return true if I am a toolWindow view.
   989      (i.e. I want to come up with a smaller window-title area, without minimize and maximize buttons)"
   989      (i.e. I want to come up with a smaller window-title area, without minimize and maximize buttons)"
   990 
   990 
   991     type isInteger ifTrue:[
   991     type isInteger ifTrue:[
   992         ^ (type bitAnd:WindowTypeMask) == TypeToolWindow
   992 	^ (type bitAnd:WindowTypeMask) == TypeToolWindow
   993     ].
   993     ].
   994     "/ the nonInteger handling code is for backward compatibility only.
   994     "/ the nonInteger handling code is for backward compatibility only.
   995     ^ false
   995     ^ false
   996 
   996 
   997     "Modified: / 03-03-2011 / 14:59:38 / cg"
   997     "Modified: / 03-03-2011 / 14:59:38 / cg"
  1007 
  1007 
  1008 isUndecoratedView
  1008 isUndecoratedView
  1009     "return true if I am an undecorated view (no minimize, maximize and close buttons)."
  1009     "return true if I am an undecorated view (no minimize, maximize and close buttons)."
  1010 
  1010 
  1011     type isInteger ifTrue:[
  1011     type isInteger ifTrue:[
  1012         ^ (type bitAnd:WindowTypeMask) == TypeUndecorated
  1012 	^ (type bitAnd:WindowTypeMask) == TypeUndecorated
  1013     ].
  1013     ].
  1014     "/ the nonInteger handling code is for backward compatibility only.
  1014     "/ the nonInteger handling code is for backward compatibility only.
  1015     ^ false
  1015     ^ false
  1016 
  1016 
  1017     "Modified: / 03-03-2011 / 15:00:22 / cg"
  1017     "Modified: / 03-03-2011 / 15:00:22 / cg"
  1130 	myApplication := self application.
  1130 	myApplication := self application.
  1131 
  1131 
  1132 	(myApplication notNil
  1132 	(myApplication notNil
  1133 	and:[ masterGroup isNil or:[myApplication ~= masterGroup application]]) ifTrue:[
  1133 	and:[ masterGroup isNil or:[myApplication ~= masterGroup application]]) ifTrue:[
  1134 	    AbortOperationRequest handle:[:ex |
  1134 	    AbortOperationRequest handle:[:ex |
  1135 		"/ in case the close is cought by the application
  1135 		"/ in case the close is caught by the application
  1136 		^ self.
  1136 		^ self.
  1137 	    ] do:[
  1137 	    ] do:[
  1138 		myApplication closeRequest.
  1138 		myApplication closeRequest.
  1139 
  1139 
  1140 		"/ if myApp called closeDownViews, it wants me to hide.
  1140 		"/ if myApp called closeDownViews, it wants me to hide.
  1163 mapIconified
  1163 mapIconified
  1164     "make the view visible but iconified.
  1164     "make the view visible but iconified.
  1165      In contrast to map, which does it non-iconified"
  1165      In contrast to map, which does it non-iconified"
  1166 
  1166 
  1167     realized ifFalse:[
  1167     realized ifFalse:[
  1168         "
  1168 	"
  1169          now, make the view visible
  1169 	 now, make the view visible
  1170         "
  1170 	"
  1171         realized := true.
  1171 	realized := true.
  1172         self graphicsDevice
  1172 	self graphicsDevice
  1173             mapView:self id:self drawableId iconified:true
  1173 	    mapView:self id:self drawableId iconified:true
  1174             atX:left y:top width:width height:height
  1174 	    atX:left y:top width:width height:height
  1175             minExtent:(self minExtent) maxExtent:(self maxExtent)
  1175 	    minExtent:(self minExtent) maxExtent:(self maxExtent)
  1176     ]
  1176     ]
  1177 
  1177 
  1178     "Modified: 25.2.1997 / 22:44:33 / cg"
  1178     "Modified: 25.2.1997 / 22:44:33 / cg"
  1179     "Created: 24.7.1997 / 12:48:21 / cg"
  1179     "Created: 24.7.1997 / 12:48:21 / cg"
  1180 !
  1180 !
  1227 
  1227 
  1228     self obsoleteMethodWarning.
  1228     self obsoleteMethodWarning.
  1229 
  1229 
  1230     self drawableId isNil ifTrue:[self create].
  1230     self drawableId isNil ifTrue:[self create].
  1231     anotherView isNil ifTrue:[
  1231     anotherView isNil ifTrue:[
  1232         otherId := self drawableId.
  1232 	otherId := self drawableId.
  1233     ] ifFalse:[
  1233     ] ifFalse:[
  1234         anotherView create.
  1234 	anotherView create.
  1235         otherId := anotherView id.
  1235 	otherId := anotherView id.
  1236     ].
  1236     ].
  1237     self graphicsDevice setTransient:self drawableId for:otherId.
  1237     self graphicsDevice setTransient:self drawableId for:otherId.
  1238     self origin:aPosition.
  1238     self origin:aPosition.
  1239     self open
  1239     self open
  1240 
  1240 
  1359     "/ map slaves and partners
  1359     "/ map slaves and partners
  1360     "/
  1360     "/
  1361     self masterSlaveMessage:#remap inGroup:windowGroup.
  1361     self masterSlaveMessage:#remap inGroup:windowGroup.
  1362 
  1362 
  1363     self isModal ifTrue:[
  1363     self isModal ifTrue:[
  1364         "take it away from any popup menu possibly still active"
  1364 	"take it away from any popup menu possibly still active"
  1365 
  1365 
  1366         self forceUngrabKeyboard.
  1366 	self forceUngrabKeyboard.
  1367         self forceUngrabPointer.
  1367 	self forceUngrabPointer.
  1368         "
  1368 	"
  1369          get the focus
  1369 	 get the focus
  1370         "
  1370 	"
  1371         self getKeyboardFocus.
  1371 	self getKeyboardFocus.
  1372         self enableEnterLeaveEvents
  1372 	self enableEnterLeaveEvents
  1373     ] ifFalse:[
  1373     ] ifFalse:[
  1374         "
  1374 	"
  1375          ask for the focus - this avoids having to click on the
  1375 	 ask for the focus - this avoids having to click on the
  1376          view with WM's which need an explicit click.
  1376 	 view with WM's which need an explicit click.
  1377          Q: is this a good idea ?
  1377 	 Q: is this a good idea ?
  1378         "
  1378 	"
  1379         TakeFocusWhenMapped == true ifTrue:[
  1379 	TakeFocusWhenMapped == true ifTrue:[
  1380             self getKeyboardFocus.
  1380 	    self getKeyboardFocus.
  1381         ]
  1381 	]
  1382     ].
  1382     ].
  1383     self graphicsDevice isWindowsPlatform ifTrue:[
  1383     self graphicsDevice isWindowsPlatform ifTrue:[
  1384         self raise
  1384 	self raise
  1385     ].
  1385     ].
  1386     false "self isScreenDialog" ifTrue:[
  1386     false "self isScreenDialog" ifTrue:[
  1387         self setForegroundWindow.
  1387 	self setForegroundWindow.
  1388         self activate.
  1388 	self activate.
  1389     ].
  1389     ].
  1390     subViews notNil ifTrue:[
  1390     subViews notNil ifTrue:[
  1391         subViews do:[:eachSubView | eachSubView topViewWasMapped ].
  1391 	subViews do:[:eachSubView | eachSubView topViewWasMapped ].
  1392     ]
  1392     ]
  1393 
  1393 
  1394     "Modified: / 09-12-2010 / 18:13:20 / cg"
  1394     "Modified: / 09-12-2010 / 18:13:20 / cg"
  1395 !
  1395 !
  1396 
  1396 
  1441 ! !
  1441 ! !
  1442 
  1442 
  1443 !TopView class methodsFor:'documentation'!
  1443 !TopView class methodsFor:'documentation'!
  1444 
  1444 
  1445 version
  1445 version
  1446     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.149 2014-04-03 14:35:54 cg Exp $'
  1446     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.150 2014-06-10 10:23:46 cg Exp $'
  1447 !
  1447 !
  1448 
  1448 
  1449 version_CVS
  1449 version_CVS
  1450     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.149 2014-04-03 14:35:54 cg Exp $'
  1450     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.150 2014-06-10 10:23:46 cg Exp $'
  1451 ! !
  1451 ! !
  1452 
  1452 
  1453 
  1453 
  1454 TopView initialize!
  1454 TopView initialize!