TopView.st
changeset 6275 69088e349c8f
parent 6135 e304eed84588
child 6368 0482fa46f211
equal deleted inserted replaced
6274:e37dc412eb6a 6275:69088e349c8f
   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 := device 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 := device 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"
   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 := device pointerPosition.
   668     CurrentWindowMoveStart := self graphicsDevice pointerPosition.
   669     CurrentWindowMoveState := nil.
   669     CurrentWindowMoveState := nil.
   670 
   670 
   671     "Created: / 03-03-2011 / 19:09:39 / cg"
   671     "Created: / 03-03-2011 / 19:09:39 / cg"
   672 !
   672 !
   673 
   673 
   750     "the receiver is to be destroyed - look for partners and slaves"
   750     "the receiver is to be destroyed - look for partners and slaves"
   751 
   751 
   752     |wg dev|
   752     |wg dev|
   753 
   753 
   754     wg := windowGroup.                  "/ have to fetch windowGroup before;
   754     wg := windowGroup.                  "/ have to fetch windowGroup before;
   755     dev := device.                      "/ and device ...
   755     dev := self graphicsDevice.         "/ and device ...
   756     super destroy.                      "/ ... since destroy nils em
   756     super destroy.                      "/ ... since destroy nils em
   757 
   757 
   758 "/    dev notNil ifTrue:[
   758 "/    dev notNil ifTrue:[
   759 "/        dev flush
   759 "/        dev flush
   760 "/    ].
   760 "/    ].
   765     self masterSlaveMessage:#destroy inGroup:wg
   765     self masterSlaveMessage:#destroy inGroup:wg
   766 
   766 
   767     "Modified: 20.3.1997 / 22:14:16 / cg"
   767     "Modified: 20.3.1997 / 22:14:16 / cg"
   768 !
   768 !
   769 
   769 
   770 release
       
   771     keyboardProcessor notNil ifTrue:[
       
   772 	keyboardProcessor release.
       
   773 	keyboardProcessor := nil.
       
   774     ].
       
   775     super release
       
   776 !
       
   777 
       
   778 initialize
   770 initialize
   779     "initialize the topViews position for the screens center"
   771     "initialize the topViews position for the screens center"
   780 
   772 
   781     |screenCenter|
   773     |screenCenter|
   782 
   774 
   783     super initialize.
   775     super initialize.
   784     device initializeTopViewHookFor:self.
   776     self graphicsDevice initializeTopViewHookFor:self.
   785 
   777 
   786     "/ MULTI SCREEN
   778     "/ MULTI SCREEN
   787     screenCenter := device centerOfMonitorHavingPointer rounded.
   779     screenCenter := self graphicsDevice centerOfMonitorHavingPointer rounded.
   788 
   780 
   789     left := screenCenter x - (width // 2).
   781     left := screenCenter x - (width // 2).
   790     top := screenCenter y - (height // 2).
   782     top := screenCenter y - (height // 2).
   791     type := 0
   783     type := 0
   792 
   784 
   795 
   787 
   796 postRealize
   788 postRealize
   797     super postRealize.
   789     super postRealize.
   798 
   790 
   799     keyboardProcessor isNil ifTrue:[
   791     keyboardProcessor isNil ifTrue:[
   800 	keyboardProcessor := KeyboardProcessor new.
   792         keyboardProcessor := KeyboardProcessor new.
   801     ].
   793     ].
   802 
   794 
   803     device realizedTopViewHookFor:self
   795     self graphicsDevice realizedTopViewHookFor:self
   804 !
   796 !
   805 
   797 
   806 realize
   798 realize
   807     self isMarkedAsUnmappedModalBox ifTrue:[
   799     self isMarkedAsUnmappedModalBox ifTrue:[
   808 	"/ must clear this flag
   800 	"/ must clear this flag
   809 	"/ - otherwise realize thinks it is already realized.
   801 	"/ - otherwise realize thinks it is already realized.
   810 	realized := false.
   802 	realized := false.
   811 	self unmarkAsUnmappedModalBox.
   803 	self unmarkAsUnmappedModalBox.
   812     ].
   804     ].
   813     super realize.
   805     super realize.
       
   806 !
       
   807 
       
   808 release
       
   809     keyboardProcessor notNil ifTrue:[
       
   810 	keyboardProcessor release.
       
   811 	keyboardProcessor := nil.
       
   812     ].
       
   813     super release
   814 ! !
   814 ! !
   815 
   815 
   816 !TopView methodsFor:'misc'!
   816 !TopView methodsFor:'misc'!
   817 
   817 
   818 raiseDeiconified
   818 raiseDeiconified
   835     "wait until the receiver has been closed.
   835     "wait until the receiver has been closed.
   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     [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
  1091      Raise/Activate seem to work only within my own (ST/X)-windows;
  1091      Raise/Activate seem to work only within my own (ST/X)-windows;
  1092      they do not raise one of my views above another (for example: command.com)-window.
  1092      they do not raise one of my views above another (for example: command.com)-window.
  1093      Can anyone tell me what the difference between raise, activate and setForeground
  1093      Can anyone tell me what the difference between raise, activate and setForeground
  1094      really is (I mean really - not what is written in the crappy documentation)"
  1094      really is (I mean really - not what is written in the crappy documentation)"
  1095 
  1095 
  1096     drawableId isNil ifTrue:[self create].
  1096     self drawableId isNil ifTrue:[self create].
  1097     device activateWindow:drawableId
  1097     self graphicsDevice activateWindow:self drawableId
  1098 
  1098 
  1099     "
  1099     "
  1100      Transcript topView activate
  1100      Transcript topView activate
  1101     "
  1101     "
  1102 !
  1102 !
  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 	device
  1172         self graphicsDevice
  1173 	    mapView:self id: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 !
  1197      a different process is currently active - in this case the title bar/icon is flashed.
  1197      a different process is currently active - in this case the title bar/icon is flashed.
  1198      this also raises the priority of the sending thread slightly.
  1198      this also raises the priority of the sending thread slightly.
  1199 
  1199 
  1200      Mark a TopView as #beScreenDialog, to send this on open."
  1200      Mark a TopView as #beScreenDialog, to send this on open."
  1201 
  1201 
  1202     drawableId isNil ifTrue:[self create].
  1202     self drawableId isNil ifTrue:[self create].
  1203     device setForegroundWindow:drawableId
  1203     self graphicsDevice setForegroundWindow:self drawableId
  1204 
  1204 
  1205     "
  1205     "
  1206      Transcript topView raise
  1206      Transcript topView raise
  1207      Transcript topView setForegroundWindow
  1207      Transcript topView setForegroundWindow
  1208     "
  1208     "
  1225 
  1225 
  1226     |otherId|
  1226     |otherId|
  1227 
  1227 
  1228     self obsoleteMethodWarning.
  1228     self obsoleteMethodWarning.
  1229 
  1229 
  1230     drawableId isNil ifTrue:[self create].
  1230     self drawableId isNil ifTrue:[self create].
  1231     anotherView isNil ifTrue:[
  1231     anotherView isNil ifTrue:[
  1232         otherId := 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     device setTransient: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 
  1241     "
  1241     "
  1242      |v1 v2|
  1242      |v1 v2|
  1378         "
  1378         "
  1379         TakeFocusWhenMapped == true ifTrue:[
  1379         TakeFocusWhenMapped == true ifTrue:[
  1380             self getKeyboardFocus.
  1380             self getKeyboardFocus.
  1381         ]
  1381         ]
  1382     ].
  1382     ].
  1383     device platformName = #WIN32 ifTrue:[
  1383     self graphicsDevice platformName = #WIN32 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.
  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.147 2013-09-12 08:51:15 cg Exp $'
  1446     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.148 2014-02-18 17:12:37 stefan Exp $'
  1447 !
  1447 !
  1448 
  1448 
  1449 version_CVS
  1449 version_CVS
  1450     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.147 2013-09-12 08:51:15 cg Exp $'
  1450     ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.148 2014-02-18 17:12:37 stefan Exp $'
  1451 ! !
  1451 ! !
  1452 
  1452 
  1453 
  1453 
  1454 TopView initialize!
  1454 TopView initialize!