--- a/SimpleView.st Wed May 10 04:26:41 1995 +0200
+++ b/SimpleView.st Fri May 12 20:01:16 1995 +0200
@@ -14,15 +14,15 @@
PseudoView subclass:#SimpleView
instanceVariableNames:'superView subViews components style resources viewport
- borderColor borderWidth borderShape viewShape top left
- extentChanged originChanged cornerChanged relativeOrigin
- relativeExtent relativeCorner originRule extentRule cornerRule
- insets shown hidden name level margin innerClipRect shadowColor
- lightColor bitGravity viewGravity controller windowGroup'
+ borderColor borderWidth borderShape viewShape top left
+ extentChanged originChanged cornerChanged relativeOrigin
+ relativeExtent relativeCorner originRule extentRule cornerRule
+ insets shown hidden name level margin innerClipRect shadowColor
+ lightColor bitGravity viewGravity controller windowGroup'
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet
- DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
- DefaultShadowColor DefaultBorderWidth DefaultFont
- DefaultFocusColor DefaultFocusBorderWidth'
+ DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
+ DefaultShadowColor DefaultBorderWidth DefaultFont
+ DefaultFocusColor DefaultFocusBorderWidth'
poolDictionaries:''
category:'Views-Basic'
!
@@ -44,7 +44,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.5 1995-05-09 00:22:21 claus Exp $
+$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.6 1995-05-12 18:00:55 claus Exp $
'!
!SimpleView class methodsFor:'documentation'!
@@ -65,7 +65,7 @@
version
"
-$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.5 1995-05-09 00:22:21 claus Exp $
+$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.6 1995-05-12 18:00:55 claus Exp $
"
!
@@ -1373,8 +1373,16 @@
].
actionSelector := menu startUp.
+ "
+ mhmh - ST-80 seems to send some to the model and
+ others (copy/cut/paste) to the controller/view
+ Simulate this behavior, by looking ehat the model resonds to.
+ "
(actionSelector notNil
and:[actionSelector isSymbol]) ifTrue:[
+ (menuPerformer respondsTo:actionSelector) ifFalse:[
+ menuPerformer := self
+ ].
menuPerformer perform:actionSelector
].
^ self
@@ -3013,6 +3021,8 @@
|area|
+ shown ifFalse:[^ self].
+
area := Rectangle left:x top:y width:w height:h.
self clippedTo:area do:[
"/ controller notNil ifTrue:[
@@ -4003,14 +4013,14 @@
maxX := maxY := 0.
subViews notNil ifTrue:[
- subViews do:[:aSubView |
- |org corn|
-
- org := aSubView computeOrigin.
- corn := org + aSubView preferedExtent.
- maxX := maxX max:corn x.
- maxY := maxY max:corn y.
- ]
+ subViews do:[:aSubView |
+ |org corn|
+
+ org := aSubView computeOrigin.
+ corn := org + aSubView preferedExtent.
+ maxX := maxX max:corn x.
+ maxY := maxY max:corn y.
+ ]
].
^ maxX @ maxY.
!
@@ -4037,13 +4047,30 @@
!
hasFocus
- "return true, if the receiver got an explicit focus
- from the windowGroup"
-
- |group|
-
- ^ ((group := self windowGroup) notNil
- and:[group focusView == self])
+ "return true, if the receiver has the keyboard focus
+ (either via the focusView mechanism in the windowGroup,
+ or via delegation)"
+
+ |group focusView|
+
+ group := self windowGroup.
+ group isNil ifTrue:[^ false].
+ (focusView := group focusView) == self ifTrue:[^ true].
+ focusView notNil ifTrue:[
+ "mhmh - is there a delegation to me ?"
+ focusView delegate notNil ifTrue:[
+ focusView delegate == self ifTrue:[^ true].
+ ^ focusView delegate delegatesTo:self
+ ]
+ ].
+ ^ false
+!
+
+delegatesTo:someone
+ "return true, if I delegate events to someone"
+
+ delegate isNil ifTrue:[^ false].
+ ^ delegate delegatesTo:someone
!
isSubViewOf:aView
@@ -4099,14 +4126,25 @@
menuHolder := self menuHolder.
- (menuHolder notNil
- and:[(sym := self menuMessage) notNil
- and:[sym isSymbol]]) ifTrue:[
- "
- ask the menuHolder for the menu
- "
- ^ menuHolder perform:sym.
+ menuHolder notNil ifTrue:[
+ sym := self menuMessage.
+ sym notNil ifTrue:[
+ "
+ mhmh - for backward compatibility, try to ask
+ the model first, then use the views menu.
+ "
+ (menuHolder respondsTo:sym) ifFalse:[
+ (self respondsTo:sym) ifTrue:[
+ menuHolder := self
+ ]
+ ].
+ "
+ ask the menuHolder for the menu
+ "
+ ^ menuHolder perform:sym.
+ ].
].
+
^ nil
!