DeviceWorkstation.st
changeset 1926 e0966ecc8766
parent 1906 6fa8e10f3a51
child 1957 631446af1f9d
equal deleted inserted replaced
1925:e4d67cc4f082 1926:e0966ecc8766
   795     "return the signal used for device I/O error reporting.
   795     "return the signal used for device I/O error reporting.
   796      The default here is the global DeviceIOErrorSignal (which is the
   796      The default here is the global DeviceIOErrorSignal (which is the
   797      parent of the per-instance signals)."
   797      parent of the per-instance signals)."
   798 
   798 
   799     ^ self class deviceIOErrorSignal
   799     ^ self class deviceIOErrorSignal
       
   800 ! !
       
   801 
       
   802 !DeviceWorkstation methodsFor:'Squeak compatibility'!
       
   803 
       
   804 border:aRectangle width:bw
       
   805     "draw a rectangular border on the display with black.
       
   806      Added to allow for some squeak examples to be evaluated ..."
       
   807 
       
   808     |r|
       
   809 
       
   810     rootView clippedByChildren:false.
       
   811     rootView paint:Color black.
       
   812     r := aRectangle.
       
   813     0 to:bw-1 do:[:i |
       
   814         rootView displayRectangle:r.
       
   815         r := r insetBy:1.
       
   816     ].
       
   817     rootView clippedByChildren:true.
       
   818 
       
   819     "
       
   820      Display restoreAfter:[
       
   821         Display border:(10@10 corner:100@100) width:2.
       
   822      ]
       
   823     "
       
   824 
       
   825     "Modified: 15.10.1997 / 19:23:28 / cg"
       
   826 !
       
   827 
       
   828 displayOpaqueString:s x:x y:y
       
   829     "draw a string on the display with black.
       
   830      Added to allow for some squeak examples to be evaluated ..."
       
   831 
       
   832     rootView clippedByChildren:false.
       
   833     rootView paint:Color black.
       
   834     rootView displayOpaqueString:s x:x y:y.
       
   835     rootView clippedByChildren:true.
       
   836 
       
   837     "
       
   838      Display restoreAfter:[
       
   839         Display displayOpaqueString:'hello' x:10 y:10.
       
   840      ]
       
   841     "
       
   842 
       
   843     "Created: 15.10.1997 / 19:25:09 / cg"
       
   844     "Modified: 15.10.1997 / 19:29:05 / cg"
       
   845 !
       
   846 
       
   847 displayString:s x:x y:y
       
   848     "draw a string on the display with black.
       
   849      Added to allow for some squeak examples to be evaluated ..."
       
   850 
       
   851     rootView clippedByChildren:false.
       
   852     rootView paint:Color black.
       
   853     rootView displayString:s x:x y:y.
       
   854     rootView clippedByChildren:true.
       
   855 
       
   856     "
       
   857      Display restoreAfter:[
       
   858         Display displayString:'hello' x:10 y:10.
       
   859      ]
       
   860     "
       
   861 
       
   862     "Modified: 15.10.1997 / 19:29:10 / cg"
       
   863 !
       
   864 
       
   865 fillWhite:aRectangle
       
   866     "fill a rectangular area on the display with white.
       
   867      Added to allow for some squeak examples to be evaluated ..."
       
   868 
       
   869     |oldPaint|
       
   870 
       
   871     oldPaint := rootView paint.
       
   872     rootView clippedByChildren:false.
       
   873     rootView paint:Color white.
       
   874     rootView fillRectangle:aRectangle.
       
   875     rootView clippedByChildren:true.
       
   876     rootView paint:oldPaint.
       
   877 
       
   878     "
       
   879      Display restoreAfter:[
       
   880          Display fillWhite:(10@10 corner:100@100)
       
   881      ]
       
   882     "
       
   883 
       
   884     "Modified: 15.10.1997 / 19:28:17 / cg"
       
   885 !
       
   886 
       
   887 restoreAfter:aBlock
       
   888     "evaluate aBlock, wait for a buttonPress, then restore the display.
       
   889      Added to allow for some squeak examples to be evaluated ..."
       
   890 
       
   891     aBlock value.
       
   892     [self anyButtonPressed] whileFalse:[].
       
   893     self restoreWindows.
       
   894 
       
   895     "
       
   896      Display restoreAfter:[Display fillWhite:(10@10 corner:100@100)]
       
   897     "
       
   898 
       
   899     "Modified: 15.10.1997 / 19:43:08 / cg"
   800 ! !
   900 ! !
   801 
   901 
   802 !DeviceWorkstation methodsFor:'accessing & queries'!
   902 !DeviceWorkstation methodsFor:'accessing & queries'!
   803 
   903 
   804 activeView
   904 activeView
  4760      for ST-80 compatibility."
  4860      for ST-80 compatibility."
  4761 
  4861 
  4762     ^ self
  4862     ^ self
  4763 !
  4863 !
  4764 
  4864 
       
  4865 restoreWindows
       
  4866     "restore the display.
       
  4867      Here, a view is popped over all of the screen temporarily"
       
  4868 
       
  4869     |v|
       
  4870 
       
  4871     v := PopUpView onDevice:self.
       
  4872     v origin:0@0 corner:(self bounds corner).
       
  4873     v map.
       
  4874     v unmap.
       
  4875 
       
  4876     "
       
  4877      Display restoreWindows
       
  4878     "
       
  4879 
       
  4880     "Modified: 15.10.1997 / 19:06:26 / cg"
       
  4881 !
       
  4882 
  4765 ringBell
  4883 ringBell
  4766     "{ Pragma: +optSpace }"
  4884     "{ Pragma: +optSpace }"
  4767 
  4885 
  4768     "alias for beep; for ST-80 compatibility"
  4886     "alias for beep; for ST-80 compatibility"
  4769 
  4887 
  4808 
  4926 
  4809     ^ self
  4927     ^ self
  4810 ! !
  4928 ! !
  4811 
  4929 
  4812 !DeviceWorkstation methodsFor:'pointer stuff'!
  4930 !DeviceWorkstation methodsFor:'pointer stuff'!
       
  4931 
       
  4932 anyButtonPressed
       
  4933     "return true, if the any button is currently pressed"
       
  4934 
       
  4935     ^ (self buttonStates bitAnd:self anyButtonStateMask) ~~ 0
       
  4936 
       
  4937     "Created: 15.10.1997 / 19:16:32 / cg"
       
  4938 !
       
  4939 
       
  4940 anyButtonStateMask
       
  4941     "return an integer for masking out any button from a
       
  4942      buttonStates value. This is very device specific and to
       
  4943      be redefined by concrete subclasses."
       
  4944 
       
  4945     ^ self subclassResponsibility
       
  4946 
       
  4947     "Created: 15.10.1997 / 19:17:00 / cg"
       
  4948 !
  4813 
  4949 
  4814 buttonStates
  4950 buttonStates
  4815     "return an integer representing the state of the pointer buttons;
  4951     "return an integer representing the state of the pointer buttons;
  4816      a one-bit represents a pressed button. The bit positions are device specific
  4952      a one-bit represents a pressed button. The bit positions are device specific
  4817      and to be returned by the *ButtonStateMask methods.
  4953      and to be returned by the *ButtonStateMask methods.
  5662 ! !
  5798 ! !
  5663 
  5799 
  5664 !DeviceWorkstation class methodsFor:'documentation'!
  5800 !DeviceWorkstation class methodsFor:'documentation'!
  5665 
  5801 
  5666 version
  5802 version
  5667     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.241 1997-09-24 03:19:45 cg Exp $'
  5803     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.242 1997-10-15 17:44:08 cg Exp $'
  5668 ! !
  5804 ! !
  5669 DeviceWorkstation initialize!
  5805 DeviceWorkstation initialize!