--- a/SimpleView.st Sat Oct 24 12:07:55 2009 +0200
+++ b/SimpleView.st Sat Oct 24 12:31:07 2009 +0200
@@ -12,13 +12,13 @@
"{ Package: 'stx:libview' }"
DisplaySurface subclass:#SimpleView
- instanceVariableNames:'superView subViews components styleSheet resources borderColor
- borderWidth viewShape top left flagBits relativeOrigin
- relativeExtent relativeCorner originRule extentRule cornerRule
- insets layout shown hiddenOnRealize name level margin
- innerClipRect shadowColor lightColor bitGravity viewGravity
- controller windowGroup preferredExtent explicitExtent dependents
- layoutManager visibilityChannel helpKey dropTarget'
+ instanceVariableNames:'superView subViews components styleSheet resources border unused
+ viewShape top left flagBits relativeOrigin relativeExtent
+ relativeCorner originRule extentRule cornerRule insets layout
+ shown hiddenOnRealize name level margin innerClipRect shadowColor
+ lightColor bitGravity viewGravity controller windowGroup
+ preferredExtent explicitExtent dependents layoutManager
+ visibilityChannel helpKey dropTarget'
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
DefaultShadowColor DefaultBorderWidth DefaultFocusColor
@@ -100,158 +100,158 @@
[Instance variables:]
- superView <View> my superview i.e. the view I am in
-
- subViews <Collection> the collection of subviews
- These are the views proper.
-
- components <Collection> collection of gadgets (will be merged with subViews, soon)
- These are lightweight gadgets (not seen by windows/x11).
-
- styleSheet <ResourcePack> contains widget attributes (see libview/styles/*.style)
-
- resources <ResourcePack> contains national language translations (see lib*/resources/*.rs)
-
- borderColor <Color> color of border
-
- borderWidth <Number> borderWidth in pixels (device dep.)
-
- viewShape <Form> shape of view & border (if device supports it)
-
- top <Number> actual top coordinate (pixels) in superview
-
- left <Number> actual left coordinate (pixels) in superview
-
- flagBits <Integer> flag bits (used to be individual booleans)
- extendChanged true if extend changed during setup
- originChanged true if origin changed during setup
-
- relativeOrigin <Number> relative origin in percent within superview
-
- relativeExtent <Number> relative extent in percent within superview
-
- relativeCorner <Number> relative corner in percent within superview
-
- originRule <Block> rule to compute origin if superview changes size
-
- extentRule <Block> rule to compute extent if superview changes size
-
- cornerRule <Block> rule to compute corner if superview changes size
-
- insets <Array> array with top, left, bottom & right insets (or nil)
-
- layout <LayoutObject> not yet implemented - will replace the above layout
- variables.
-
- shown <Boolean> true if visible (false if iconified, unmapped or covered)
-
- hiddenOnRealize <Boolean> dont show automatically when superview is realized
-
- name <String> my name (future use for resources)
-
- level <Number> 3D level relative to superview
-
- margin <Number> convenient margin
-
- innerClipRect <Rectangle> convenient inner clip (minus margin)
-
- shadowColor <Color> color used to draw 3D shadowed edges
-
- lightColor <Color> color used to draw 3D lighted edges
-
- bitGravity <nil | Symbol> gravity of contents (if device supports it)
-
- viewGravity <nil | Symbol> gravity of view (if device supports it)
-
- controller <nil | Controller> the controller (if any)
-
- windowGroup <WindowGroup> the windowGroup
-
- preferredExtent(*) <nil | Point> preferredExtent overWrite
- if nonNil, the widget will not compute
- its pref-extent, but use that value.
-
- explicitExtent(*) <nil | Point> preferredExtent overWrite
- if nonNil, the widget will not compute
- its pref-extent, but use that value.
-
- dependents <nil | Collection> who depends on me
-
- layoutManager
-
- visibilityChannel
-
- helpKey
-
- dropTarget
+ superView <View> my superview i.e. the view I am in
+
+ subViews <Collection> the collection of subviews
+ These are the views proper.
+
+ components <Collection> collection of gadgets (will be merged with subViews, soon)
+ These are lightweight gadgets (not seen by windows/x11).
+
+ styleSheet <ResourcePack> contains widget attributes (see libview/styles/*.style)
+
+ resources <ResourcePack> contains national language translations (see lib*/resources/*.rs)
+
+ border <Border> color and width of border
+
+ unused <nil> to keep the instVar size constant
+
+ viewShape <Form> shape of view & border (if device supports it)
+
+ top <Number> actual top coordinate (pixels) in superview
+
+ left <Number> actual left coordinate (pixels) in superview
+
+ flagBits <Integer> flag bits (used to be individual booleans)
+ extendChanged true if extend changed during setup
+ originChanged true if origin changed during setup
+
+ relativeOrigin <Number> relative origin in percent within superview
+
+ relativeExtent <Number> relative extent in percent within superview
+
+ relativeCorner <Number> relative corner in percent within superview
+
+ originRule <Block> rule to compute origin if superview changes size
+
+ extentRule <Block> rule to compute extent if superview changes size
+
+ cornerRule <Block> rule to compute corner if superview changes size
+
+ insets <Array> array with top, left, bottom & right insets (or nil)
+
+ layout <LayoutObject> not yet implemented - will replace the above layout
+ variables.
+
+ shown <Boolean> true if visible (false if iconified, unmapped or covered)
+
+ hiddenOnRealize <Boolean> dont show automatically when superview is realized
+
+ name <String> my name (future use for resources)
+
+ level <Number> 3D level relative to superview
+
+ margin <Number> convenient margin
+
+ innerClipRect <Rectangle> convenient inner clip (minus margin)
+
+ shadowColor <Color> color used to draw 3D shadowed edges
+
+ lightColor <Color> color used to draw 3D lighted edges
+
+ bitGravity <nil | Symbol> gravity of contents (if device supports it)
+
+ viewGravity <nil | Symbol> gravity of view (if device supports it)
+
+ controller <nil | Controller> the controller (if any)
+
+ windowGroup <WindowGroup> the windowGroup
+
+ preferredExtent(*) <nil | Point> preferredExtent overWrite
+ if nonNil, the widget will not compute
+ its pref-extent, but use that value.
+
+ explicitExtent(*) <nil | Point> preferredExtent overWrite
+ if nonNil, the widget will not compute
+ its pref-extent, but use that value.
+
+ dependents <nil | Collection> who depends on me
+
+ layoutManager
+
+ visibilityChannel
+
+ helpKey
+
+ dropTarget
(*) about to be changed to use preferredExtent as a cache and explicitExtent as
- an overwrite value.
+ an overwrite value.
[Class variables:]
- Grey <Color> the color grey - its used so often
-
- ViewSpacing <Number> preferred spacing between views; 1mm
-
- CentPoint <Point> 100 @ 100 - its used so often
-
- StyleSheet <ResourcePack> contains all view-style specifics
-
- ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns
- <Boolean> the keyboard focus to the view which was
- active when the box was opened.
- If false (the default), it is left to
- window manager to assign a new focus.
- If running on olwm/olvwm (which requires an
- explicit click to reassign a focus), it is
- better to turn this on in a private.rc file.
+ Grey <Color> the color grey - its used so often
+
+ ViewSpacing <Number> preferred spacing between views; 1mm
+
+ CentPoint <Point> 100 @ 100 - its used so often
+
+ StyleSheet <ResourcePack> contains all view-style specifics
+
+ ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns
+ <Boolean> the keyboard focus to the view which was
+ active when the box was opened.
+ If false (the default), it is left to
+ window manager to assign a new focus.
+ If running on olwm/olvwm (which requires an
+ explicit click to reassign a focus), it is
+ better to turn this on in a private.rc file.
[styleSheet parameters:]
- popupShadow <Boolean> if true, popupViews show a shadow below
-
- popupLevel <nil | Integer> 3D level
-
- borderWidth <nil | Integer> borderWidth (ignored in 3D styles)
-
- borderColor <nil | Color> borderColor (ignored in 3D styles)
-
- viewBackground <nil | Color> views background
-
- shadowColor <nil | Color> color for shadow edges (ignored in 2D styles)
-
- lightColor <nil | Color> color for light edges (ignored in 2D styles)
-
- font <nil | Font> font to use
+ popupShadow <Boolean> if true, popupViews show a shadow below
+
+ popupLevel <nil | Integer> 3D level
+
+ borderWidth <nil | Integer> borderWidth (ignored in 3D styles)
+
+ borderColor <nil | Color> borderColor (ignored in 3D styles)
+
+ viewBackground <nil | Color> views background
+
+ shadowColor <nil | Color> color for shadow edges (ignored in 2D styles)
+
+ lightColor <nil | Color> color for light edges (ignored in 2D styles)
+
+ font <nil | Font> font to use
TODO:
- get rid of relativeOrigin, relativeCorner, originRule, extentRule,
- and insets; replace by a single object which defines the size
- (mhmh - ST-80 seems to call this LayoutFrame ?)
- -> be prepared for a change here in the near future and ONLY use
- access methods to get those instance variables' values
-
- get rid of 3D level & margin, move it to extra wrappers
- (although this will make view setup more complicated, it will remove
- complexity from the internals of view. Also, it will allow for more
- varieties of borders.)
-
- add components (could also call them gadgets or lightweight views)
- - views are expensive in terms of X resources. This would make all
- framing/edge and panel helper views become cheap ST objects, instead
- of views.
+ get rid of relativeOrigin, relativeCorner, originRule, extentRule,
+ and insets; replace by a single object which defines the size
+ (mhmh - ST-80 seems to call this LayoutFrame ?)
+ -> be prepared for a change here in the near future and ONLY use
+ access methods to get those instance variables' values
+
+ get rid of 3D level & margin, move it to extra wrappers
+ (although this will make view setup more complicated, it will remove
+ complexity from the internals of view. Also, it will allow for more
+ varieties of borders.)
+
+ add components (could also call them gadgets or lightweight views)
+ - views are expensive in terms of X resources. This would make all
+ framing/edge and panel helper views become cheap ST objects, instead
+ of views.
[see also:]
- StandardSystemView DialogBox
- WindowGroup WindowEvent
- Layout
- ( introduction to view programming :html: programming/viewintro.html )
+ StandardSystemView DialogBox
+ WindowGroup WindowEvent
+ Layout
+ ( introduction to view programming :html: programming/viewintro.html )
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!
@@ -261,50 +261,50 @@
to make the individual subviews visible)
a subView in a topView:
- [exBegin]
- |top v|
-
- top := StandardSystemView new.
- v := View new.
- v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
- top addSubView:v.
- top open
- [exEnd]
+ [exBegin]
+ |top v|
+
+ top := StandardSystemView new.
+ v := View new.
+ v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
+ top addSubView:v.
+ top open
+ [exEnd]
the same, a bit more compact:
- [exBegin]
- |top v|
-
- top := StandardSystemView new.
- v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
- top open
- [exEnd]
+ [exBegin]
+ |top v|
+
+ top := StandardSystemView new.
+ v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
+ top open
+ [exEnd]
fixed position/size:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
top extent:300@300.
v1 := View origin:10@10
- corner:50@50
- in:top.
+ corner:50@50
+ in:top.
v2 := View origin:60@10
- corner:150@100
- in:top.
+ corner:150@100
+ in:top.
v1 viewBackground:(Color red).
v2 viewBackground:(Color yellow).
top open
- [exEnd]
+ [exEnd]
same, using ST-80 way of bulding up view hierarchies
(recommended, if you plan to port applications later)
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -326,10 +326,10 @@
v2 viewBackground:(Color yellow).
top open
- [exEnd]
+ [exEnd]
fixed origin, variable size:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -348,11 +348,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
fixed origin, variable size,
bottomInset for constant distance from bottom:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -373,10 +373,10 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
variable origin, variable size,
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -395,11 +395,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
variable origin, variable size,
insets for some constant distance
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -420,11 +420,11 @@
top add:v2.
top open
- [exEnd]
+ [exEnd]
using layout objects (ST-80 style):
fully specifying the frame
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -437,21 +437,21 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutFrame new
- leftFraction:0.25;
- rightFraction:0.75;
- topFraction:0.0;
- bottomFraction:0.5).
+ leftFraction:0.25;
+ rightFraction:0.75;
+ topFraction:0.0;
+ bottomFraction:0.5).
top add:v2 in:(LayoutFrame new
- leftFraction:0.5;
- rightFraction:1.0;
- topFraction:0.5;
- bottomFraction:0.75).
+ leftFraction:0.5;
+ rightFraction:1.0;
+ topFraction:0.5;
+ bottomFraction:0.75).
top open
- [exEnd]
+ [exEnd]
another one, with offsets:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -464,22 +464,22 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutFrame new
- leftFraction:0.0 offset:10;
- rightFraction:1.0 offset:-10;
- topFraction:0.0 offset:10;
- bottomFraction:0.5).
+ leftFraction:0.0 offset:10;
+ rightFraction:1.0 offset:-10;
+ topFraction:0.0 offset:10;
+ bottomFraction:0.5).
top add:v2 in:(LayoutFrame new
- leftFraction:0.0 offset:30;
- rightFraction:1.0 offset:-30;
- topFraction:0.5 offset:10;
- bottomFraction:0.75).
+ leftFraction:0.0 offset:30;
+ rightFraction:1.0 offset:-30;
+ topFraction:0.5 offset:10;
+ bottomFraction:0.75).
top open
- [exEnd]
+ [exEnd]
specifying origin only. Extent is views preferred
(notice, that plain views have some defaultExtent of 100@100)
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -492,17 +492,17 @@
v2 viewBackground:(Color yellow).
top add:v1 in:(LayoutOrigin new
- leftFraction:0.25;
- topFraction:0.0).
+ leftFraction:0.25;
+ topFraction:0.0).
top add:v2 in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ leftFraction:0.5;
+ topFraction:0.5).
top open
- [exEnd]
+ [exEnd]
same example, using buttons which compute their preferredBounds:
- [exBegin]
+ [exBegin]
|top v1 v2|
top := StandardSystemView new.
@@ -515,14 +515,31 @@
v2 backgroundColor:(Color yellow).
top add:v1 in:(LayoutOrigin new
- leftFraction:0.25;
- topFraction:0.0).
+ leftFraction:0.25;
+ topFraction:0.0).
top add:v2 in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ leftFraction:0.5;
+ topFraction:0.5).
top open
- [exEnd]
+ [exEnd]
+
+ border:
+ [exBegin]
+ |top v1 v2|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ v1 := View new.
+ top add:v1 in:(10@10 corner: 30@30).
+ v2 := View new.
+ top add:v2 in:(30@30 corner: 50@50).
+
+ v1 border:(SimpleBorder width:1 color:Color red).
+ v2 border:(SimpleBorder width:1 color:Color blue).
+ top open
+ [exEnd]
"
!
@@ -1017,11 +1034,11 @@
update:something with:aParameter from:changedObject
changedObject == Smalltalk ifTrue:[
- (something == #Language or:[something == #LanguageTerritory]) ifTrue:[
- "flush resources on language changes"
- self flushAllClassResources.
- self allSubInstancesDo:[:eachView | eachView languageChanged].
- ].
+ (something == #Language or:[something == #LanguageTerritory]) ifTrue:[
+ "flush resources on language changes"
+ self flushAllClassResources.
+ self allSubInstancesDo:[:eachView | eachView languageChanged].
+ ].
]
"Created: 15.6.1996 / 15:23:04 / cg"
@@ -1415,7 +1432,7 @@
!
resources
- "return the views resources -
+ "return the views resources -
that's a ResourcePack containing national language strings"
^ self classResources
@@ -1840,14 +1857,33 @@
"Modified: 3.5.1997 / 10:28:04 / cg"
!
+border
+ "return my border"
+
+ (superView notNil and:[superView isBorderedWrapper]) ifTrue:[
+ ^ superView border
+ ].
+
+ ^ border
+!
+
+border:aBorder
+ "set my border"
+
+ border := aBorder.
+ self computeMargin.
+!
+
borderColor
"return my borderColor"
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderColor
- ].
-
- ^ borderColor
+ ^ superView borderColor
+ ].
+
+ "/ ^ borderColor
+ border isNil ifTrue:[ ^ nil ].
+ ^ border color.
"Modified: 5.6.1996 / 14:11:44 / cg"
!
@@ -1862,14 +1898,24 @@
^ self
].
- (aColor ~~ borderColor) ifTrue:[
- borderColor := aColor.
- drawableId notNil ifTrue:[
- self setBorderColor
- ]
- ]
+ aColor isNil ifTrue:[
+ border isNil ifTrue:[^ self].
+ border := nil.
+ ] ifFalse:[
+ aColor = (self borderColor) ifTrue:[^ self].
+ border := SimpleBorder new width:(self borderWidth) color:aColor
+ ].
+ self invalidate.
+
+"/ (aColor ~~ borderColor) ifTrue:[
+"/ borderColor := aColor.
+"/ drawableId notNil ifTrue:[
+"/ self setBorderColor
+"/ ]
+"/ ]
"Modified: 5.6.1996 / 14:11:50 / cg"
+ "Modified: 23.10.2009 / 14:11:50 / cg"
!
borderShape:aForm
@@ -1893,18 +1939,6 @@
"Modified: 18.9.1997 / 11:09:40 / cg"
!
-borderWidth
- "return my borderWidth"
-
- (superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView borderWidth
- ].
-
- ^ borderWidth
-
- "Modified: 5.6.1996 / 14:11:57 / cg"
-!
-
borderWidth:aNumber
"set my borderWidth"
@@ -1914,16 +1948,36 @@
^ superView borderWidth:aNumber
].
- (aNumber ~~ borderWidth) ifTrue:[
- borderWidth := aNumber.
- drawableId notNil ifTrue:[
- self setBorderWidth.
+ self assert:(aNumber notNil).
+ aNumber == 0 ifTrue:[
+ border isNil ifTrue:[^ self].
+ self border:nil.
+ ] ifFalse:[
+ border notNil ifTrue:[
+ self border:(border copy width:aNumber)
+ ] ifFalse:[
+ self border:(SimpleBorder new width:aNumber color:(self borderColor)).
]
- ]
+ ].
+
+"/ (aNumber ~~ borderWidth) ifTrue:[
+"/ borderWidth := aNumber.
+"/ drawableId notNil ifTrue:[
+"/ self setBorderWidth.
+"/ ]
+"/ ]
"Modified: 5.6.1996 / 14:12:05 / cg"
!
+computeMargin
+ border isNil ifTrue:[
+ margin := level abs.
+ ^ self.
+ ].
+ margin := border width.
+!
+
fillFormWithBorderShape:aForm
"fill aForm with my borderShape"
@@ -1957,9 +2011,9 @@
"return my level relative to superView (3D)"
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[
- ^ superView level
- ].
-
+ ^ superView level
+ ].
+ border notNil ifTrue:[^ border level].
^ level
"Modified: 5.6.1996 / 14:12:10 / cg"
@@ -2033,26 +2087,26 @@
setBorderWidth
"set my borderWidth in the devices physical view"
- |bw|
-
- bw := borderWidth.
- (device supportsWindowBorder:bw) ifFalse:[
- bw > 1 ifTrue:[
- (device supportsWindowBorder:(bw := 1)) ifFalse:[
- ^ self
- ].
- ]
- ].
-
- drawableId notNil ifTrue:[
- device setWindowBorderWidth:bw in:drawableId
- ]
+"/ |bw|
+"/
+"/ bw := borderWidth.
+"/ (device supportsWindowBorder:bw) ifFalse:[
+"/ bw > 1 ifTrue:[
+"/ (device supportsWindowBorder:(bw := 1)) ifFalse:[
+"/ ^ self
+"/ ].
+"/ ]
+"/ ].
+"/
+"/ drawableId notNil ifTrue:[
+"/ device setWindowBorderWidth:bw in:drawableId
+"/ ]
!
setBorderWidth:aNumber
"set my borderWidth without affecting the real view (private only)"
- borderWidth := aNumber
+ "/ borderWidth := aNumber
!
shadowColor
@@ -3210,7 +3264,7 @@
"return the inside area of the superView."
superView isNil ifTrue:[
- ^ Rectangle left:0 top:0 right:0 bottom:0.
+ ^ Rectangle left:0 top:0 right:0 bottom:0.
].
^ superView viewRectangle.
@@ -3414,7 +3468,7 @@
myName := self uuidStringOrName.
viewsWithSameName := aViewCollection select:[:v | v uuidStringOrName = myName].
viewsWithSameName size = 1 ifTrue:[
- ^ nil "/ no conflict
+ ^ nil "/ no conflict
].
^ viewsWithSameName indexOf:self
!
@@ -3432,21 +3486,21 @@
superV := self superView.
[superV isNil] whileFalse:[
- hierarchicalViews addFirst: superV.
- superV := superV superView.
- ].
-
- hierarchicalViews doWithIndex:[:aView :index |
- uuidOrName := aView uuidStringOrName.
- indexString := nil.
- index > 1 ifTrue:[
- indexOrNil := aView hierarchicalIndex.
- (indexOrNil notNil and:[indexOrNil ~= 1]) ifTrue:[
- indexString := '[',indexOrNil printString,']'
- ]
- ].
- separator := index == 1 ifTrue:[''] ifFalse:['.'].
- hierarchicalUUID := hierarchicalUUID,separator,uuidOrName,(indexString?'').
+ hierarchicalViews addFirst: superV.
+ superV := superV superView.
+ ].
+
+ hierarchicalViews doWithIndex:[:aView :index |
+ uuidOrName := aView uuidStringOrName.
+ indexString := nil.
+ index > 1 ifTrue:[
+ indexOrNil := aView hierarchicalIndex.
+ (indexOrNil notNil and:[indexOrNil ~= 1]) ifTrue:[
+ indexString := '[',indexOrNil printString,']'
+ ]
+ ].
+ separator := index == 1 ifTrue:[''] ifFalse:['.'].
+ hierarchicalUUID := hierarchicalUUID,separator,uuidOrName,(indexString?'').
].
^ hierarchicalUUID
!
@@ -3612,14 +3666,14 @@
the model first, then use the views menu.
"
(menuHolder respondsTo:sym) ifFalse:[
- (self respondsTo:sym) ifTrue:[
- menuHolder := self
- ]
+ (self respondsTo:sym) ifTrue:[
+ menuHolder := self
+ ]
].
sym numArgs > 0 ifTrue:[
- "/ squeak compatibility (with args): create the empty menu here, let model add items
- ^ menuHolder perform:sym withOptionalArgument:(Menu new) and:(device shiftDown).
+ "/ squeak compatibility (with args): create the empty menu here, let model add items
+ ^ menuHolder perform:sym withOptionalArgument:(Menu new) and:(device shiftDown).
].
"
@@ -3717,7 +3771,7 @@
"return my full name to be used for resource-access"
superView notNil ifTrue:[
- ^ superView fullName , '.' , self name
+ ^ superView fullName , '.' , self name
].
^ self name
!
@@ -3726,7 +3780,7 @@
"return my name component to be used for resource-access"
name isNil ifTrue:[
- name := self class name "asString" asLowercaseFirst
+ name := self class name "asString" asLowercaseFirst
].
^ name
!
@@ -4399,22 +4453,22 @@
"remove all subviews"
subViews notNil ifTrue:[
- subViews copy do:[:aSubView |
- aSubView destroy.
- ].
-
- "/ paranoia ;-)
- subViews size ~~ 0 ifTrue:[
- (self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR.
- subViews := nil
- ].
+ subViews copy do:[:aSubView |
+ aSubView destroy.
+ ].
+
+ "/ paranoia ;-)
+ subViews size ~~ 0 ifTrue:[
+ (self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR.
+ subViews := nil
+ ].
].
components notNil ifTrue:[
- components copy do:[:aComponent |
- aComponent destroy.
- ].
- components := nil.
+ components copy do:[:aComponent |
+ aComponent destroy.
+ ].
+ components := nil.
]
!
@@ -5110,7 +5164,7 @@
unless they overlap. In that case, the later view is placed above the earlier."
aSubViewOrComponent isView ifFalse:[
- ^ self changeSequenceOrderForComponent:aSubViewOrComponent to:anIndex
+ ^ self changeSequenceOrderForComponent:aSubViewOrComponent to:anIndex
].
^ self changeSequenceOrderForView:aSubViewOrComponent to:anIndex
!
@@ -5122,11 +5176,11 @@
|removedComponent|
(components notNil and:[components size >= anIndex]) ifTrue:[
- removedComponent := components remove:aComponent ifAbsent:nil.
- removedComponent notNil ifTrue:[
- components add:removedComponent beforeIndex:anIndex.
- ^ true
- ]
+ removedComponent := components remove:aComponent ifAbsent:nil.
+ removedComponent notNil ifTrue:[
+ components add:removedComponent beforeIndex:anIndex.
+ ^ true
+ ]
].
^ false
!
@@ -5139,11 +5193,11 @@
|removedView|
(subViews notNil and:[subViews size >= anIndex]) ifTrue:[
- removedView := subViews remove:aSubView ifAbsent:nil.
- removedView notNil ifTrue:[
- subViews add:removedView beforeIndex:anIndex.
- ^ true
- ]
+ removedView := subViews remove:aSubView ifAbsent:nil.
+ removedView notNil ifTrue:[
+ subViews add:removedView beforeIndex:anIndex.
+ ^ true
+ ]
].
^ false
!
@@ -5168,35 +5222,35 @@
"/ how comes ? And what should be done to avoid this ?
checkForAnyNonExisting :=
- [
- anyNonExisting := false.
- aCollectionOfDropObjects do:[:eachDropObject |
- eachDropObject isFileObject ifTrue:[
- eachDropObject isDirectory ifFalse:[
- eachDropObject theObject asFilename exists ifFalse:[
- anyNonExisting := true.
- whichNonExisting := eachDropObject theObject asFilename.
- ]
- ]
- ].
- ].
- anyNonExisting
- ].
+ [
+ anyNonExisting := false.
+ aCollectionOfDropObjects do:[:eachDropObject |
+ eachDropObject isFileObject ifTrue:[
+ eachDropObject isDirectory ifFalse:[
+ eachDropObject theObject asFilename exists ifFalse:[
+ anyNonExisting := true.
+ whichNonExisting := eachDropObject theObject asFilename.
+ ]
+ ]
+ ].
+ ].
+ anyNonExisting
+ ].
self withWaitCursorDo:[
- tDelayed := 0.
- checkForAnyNonExisting doWhile:[
- anyNonExisting ifTrue:[
- Delay waitForSeconds:0.3.
- tDelayed := tDelayed + 0.3.
- ].
- anyNonExisting and:[ tDelayed <= 3].
- ].
+ tDelayed := 0.
+ checkForAnyNonExisting doWhile:[
+ anyNonExisting ifTrue:[
+ Delay waitForSeconds:0.3.
+ tDelayed := tDelayed + 0.3.
+ ].
+ anyNonExisting and:[ tDelayed <= 3].
+ ].
].
(anyNonExisting and:[checkForAnyNonExisting value]) ifTrue:[
- Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName).
- ^ self
+ Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName).
+ ^ self
].
view := self.
@@ -5204,32 +5258,32 @@
app := view application.
app notNil ifTrue:[
- (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[
- app dropObjects:aCollectionOfDropObjects in:view at:positionInView.
- ^ self.
- ].
+ (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[
+ app dropObjects:aCollectionOfDropObjects in:view at:positionInView.
+ ^ self.
+ ].
].
[view notNil] whileTrue:[
- "new mechanism to get a dropTarget"
- target := view dropTarget.
- target notNil ifTrue:[
- dropContext := DropContext new.
- dropContext dropObjects:aCollectionOfDropObjects.
- dropContext dropTarget:target.
-
- (target canDrop:dropContext) ifTrue:[
- target drop:dropContext.
- ^ self.
- ].
- ].
-
- (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[
- view dropObjects:aCollectionOfDropObjects at:positionInView.
- ^ self.
- ].
- view := view superView.
- positionInView := nil.
+ "new mechanism to get a dropTarget"
+ target := view dropTarget.
+ target notNil ifTrue:[
+ dropContext := DropContext new.
+ dropContext dropObjects:aCollectionOfDropObjects.
+ dropContext dropTarget:target.
+
+ (target canDrop:dropContext) ifTrue:[
+ target drop:dropContext.
+ ^ self.
+ ].
+ ].
+
+ (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[
+ view dropObjects:aCollectionOfDropObjects at:positionInView.
+ ^ self.
+ ].
+ view := view superView.
+ positionInView := nil.
]
"Modified: / 17-10-2006 / 18:00:46 / cg"
@@ -5289,9 +5343,9 @@
|oldScale newScale factor|
amount > 0 ifTrue:[
- factor := 1.2.
+ factor := 1.2.
] ifFalse:[
- factor := 0.8.
+ factor := 0.8.
].
oldScale := self scale.
newScale := (oldScale * factor) max:0.1.
@@ -5511,7 +5565,7 @@
|app|
(app := self application) notNil ifTrue:[
- app copyDataEvent:parameter eventData:msgData
+ app copyDataEvent:parameter eventData:msgData
].
!
@@ -5519,8 +5573,8 @@
"view has been destroyed by someone else (usually window system)"
shown ifTrue:[
- shown := false.
- self changed:#visibility.
+ shown := false.
+ self changed:#visibility.
].
super destroyed
@@ -5665,21 +5719,25 @@
anyEdge ifTrue:[
self deviceClippingRectangle:nil.
oldPaint := paint.
- (topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
- self drawEdges
+ border notNil ifTrue:[
+ border displayOn:self forDisplayBox:innerClipRect.
] ifFalse:[
- topEdge ifTrue:[
- self drawTopEdge
+ (topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
+ self drawEdges
+ ] ifFalse:[
+ topEdge ifTrue:[
+ self drawTopEdge
+ ].
+ leftEdge ifTrue:[
+ self drawLeftEdge
+ ].
+ botEdge ifTrue:[
+ self drawBottomEdge
+ ].
+ rightEdge ifTrue:[
+ self drawRightEdge
+ ]
].
- leftEdge ifTrue:[
- self drawLeftEdge
- ].
- botEdge ifTrue:[
- self drawBottomEdge
- ].
- rightEdge ifTrue:[
- self drawRightEdge
- ]
].
self paint:oldPaint.
].
@@ -5790,9 +5848,9 @@
"
the old code was:
- realized := true.
- shown := true.
- ...
+ realized := true.
+ shown := true.
+ ...
this created a race condition, if the view was
realized and shortly after unrealized - before the mapped event
@@ -5802,35 +5860,35 @@
"
realized ifTrue:[
- shownBefore := shown.
-
- "/ currently, the 'shown ifFalse:' optimization is
- "/ not ok, since 'shown' is also modified by visibilityChanges.
- "/ Also, when remapped, X11 only sends a mapped event for the topView.
- "/ Therefore, synthetically generate those #superViewMapped messages
- "/ in any case.
-
- shown := true.
- "
- backed views will not get expose events - have
- to force a redraw here to get things drawn into
- backing store.
- "
- backed ifTrue:[
- self redrawX:0 y:0 width:width height:height
- ].
-
- "/ tell my subViews ...
- subViews notNil ifTrue:[
- subViews do:[:v | v mapped
+ shownBefore := shown.
+
+ "/ currently, the 'shown ifFalse:' optimization is
+ "/ not ok, since 'shown' is also modified by visibilityChanges.
+ "/ Also, when remapped, X11 only sends a mapped event for the topView.
+ "/ Therefore, synthetically generate those #superViewMapped messages
+ "/ in any case.
+
+ shown := true.
+ "
+ backed views will not get expose events - have
+ to force a redraw here to get things drawn into
+ backing store.
+ "
+ backed ifTrue:[
+ self redrawX:0 y:0 width:width height:height
+ ].
+
+ "/ tell my subViews ...
+ subViews notNil ifTrue:[
+ subViews do:[:v | v mapped
"/ v shown ifFalse:[
"/ v mapped
"/ ]
- ]
- ].
- shownBefore ~~ true ifTrue:[
- self changed:#visibility.
- ]
+ ]
+ ].
+ shownBefore ~~ true ifTrue:[
+ self changed:#visibility.
+ ]
]
"Modified: 25.2.1997 / 22:41:34 / cg"
@@ -5850,34 +5908,34 @@
sensor := self sensor.
UserPreferences current allowMouseWheelZoom ifTrue:[
- zoomInOrOut := sensor ctrlDown.
- zoomInOrOut ifTrue:[
- self mouseWheelZoom:amount.
- ^ self.
- ].
+ zoomInOrOut := sensor ctrlDown.
+ zoomInOrOut ifTrue:[
+ self mouseWheelZoom:amount.
+ ^ self.
+ ].
].
pageScroll := sensor shiftDown.
pageScroll ifFalse:[
- amountToScroll := self verticalScrollStep.
- sensor shiftDown ifFalse:[
- amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll.
- ]
+ amountToScroll := self verticalScrollStep.
+ sensor shiftDown ifFalse:[
+ amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll.
+ ]
].
amount > 0 ifTrue:[
- pageScroll ifTrue:[
- self pageUp
- ] ifFalse:[
- self scrollUp:amountToScroll
- ]
+ pageScroll ifTrue:[
+ self pageUp
+ ] ifFalse:[
+ self scrollUp:amountToScroll
+ ]
] ifFalse:[
- pageScroll ifTrue:[
- self pageDown
- ] ifFalse:[
- self scrollDown:amountToScroll
- ]
+ pageScroll ifTrue:[
+ self pageDown
+ ] ifFalse:[
+ self scrollDown:amountToScroll
+ ]
].
"Modified: / 21.5.1999 / 19:58:42 / cg"
@@ -6042,20 +6100,20 @@
|wdgr|
shown ifTrue:[
- shown := false.
- self changed:#visibility.
+ shown := false.
+ self changed:#visibility.
].
(wdgr := self windowGroup) notNil ifTrue:[
- wdgr focusView == self ifTrue:[
- wdgr focusViewUnmapped.
- ].
+ wdgr focusView == self ifTrue:[
+ wdgr focusViewUnmapped.
+ ].
].
subViews notNil ifTrue:[
- subViews do:[:v |
- v containerUnmapped
- ].
- self changed:#visibility.
+ subViews do:[:v |
+ v containerUnmapped
+ ].
+ self changed:#visibility.
]
"Modified: 25.2.1997 / 22:40:52 / cg"
@@ -6071,12 +6129,12 @@
shownBefore := shown.
how == #fullyObscured ifTrue:[
- shown := false
+ shown := false
] ifFalse:[
- shown := true.
+ shown := true.
].
shownBefore ~~ shown ifTrue:[
- self changed:#visibility.
+ self changed:#visibility.
].
!
@@ -6452,32 +6510,32 @@
|delta clrId bd|
explicit ifTrue:[
- (drawableId notNil
- and:[superView notNil
- and:[styleSheet notNil]]) ifTrue:[
- (styleSheet at:#'focus.showBorder' default:true) ifTrue:[
- (device supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[
- (device supportsWindowBorder:(bd := 1)) ifFalse:[
- bd := 0.
- ]
- ].
- delta := bd - self borderWidth.
- delta ~~ 0 ifTrue:[
- (left == 0 or:[top == 0]) ifTrue:[
- device resizeWindow:drawableId width:width-delta-delta height:height-delta-delta.
- ] ifFalse:[
- device moveWindow:drawableId x:left-delta y:top-delta.
- ].
- device setWindowBorderWidth:bd in:drawableId.
- ].
-
- clrId := (DefaultFocusColor onDevice:device) colorId.
- clrId isNil ifTrue:[
- clrId := device blackpixel
- ].
- device setWindowBorderColor:clrId in:drawableId.
- ]
- ]
+ (drawableId notNil
+ and:[superView notNil
+ and:[styleSheet notNil]]) ifTrue:[
+ (styleSheet at:#'focus.showBorder' default:true) ifTrue:[
+ (device supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[
+ (device supportsWindowBorder:(bd := 1)) ifFalse:[
+ bd := 0.
+ ]
+ ].
+ delta := bd - self borderWidth.
+ delta ~~ 0 ifTrue:[
+ (left == 0 or:[top == 0]) ifTrue:[
+ device resizeWindow:drawableId width:width-delta-delta height:height-delta-delta.
+ ] ifFalse:[
+ device moveWindow:drawableId x:left-delta y:top-delta.
+ ].
+ device setWindowBorderWidth:bd in:drawableId.
+ ].
+
+ clrId := (DefaultFocusColor onDevice:device) colorId.
+ clrId isNil ifTrue:[
+ clrId := device blackpixel
+ ].
+ device setWindowBorderColor:clrId in:drawableId.
+ ]
+ ]
] ifFalse:[
"/ superView notNil ifTrue:[
"/ superView showFocus:explicit
@@ -6496,22 +6554,22 @@
|delta bd|
explicit ifTrue:[
- (drawableId notNil and:[superView notNil]) ifTrue:[
- (styleSheet at:#'focus.showBorder' default:true) ifTrue:[
- (device supportsWindowBorder:(bd := self borderWidth)) ifFalse:[
- (device supportsWindowBorder:(bd := 1)) ifFalse:[
- bd := 0.
- ]
- ].
- delta := DefaultFocusBorderWidth - bd.
- delta ~~ 0 ifTrue:[
- device setWindowBorderWidth:bd in:drawableId.
- device moveWindow:drawableId x:left y:top.
- device resizeWindow:drawableId width:width height:height.
- ].
- self setBorderColor.
- ]
- ]
+ (drawableId notNil and:[superView notNil]) ifTrue:[
+ (styleSheet at:#'focus.showBorder' default:true) ifTrue:[
+ (device supportsWindowBorder:(bd := self borderWidth)) ifFalse:[
+ (device supportsWindowBorder:(bd := 1)) ifFalse:[
+ bd := 0.
+ ]
+ ].
+ delta := DefaultFocusBorderWidth - bd.
+ delta ~~ 0 ifTrue:[
+ device setWindowBorderWidth:bd in:drawableId.
+ device moveWindow:drawableId x:left y:top.
+ device resizeWindow:drawableId width:width height:height.
+ ].
+ self setBorderColor.
+ ]
+ ]
]
"Modified: / 17.9.1998 / 15:08:02 / cg"
@@ -6711,11 +6769,11 @@
make me unknown to the device"
realized ifTrue:[
- self unmap.
+ self unmap.
].
shown ifTrue:[
- shown := false.
- self changed:#visibility.
+ shown := false.
+ self changed:#visibility.
].
"/ controller notNil ifTrue:[
@@ -6724,11 +6782,11 @@
"/ ].
subViews notNil ifTrue:[
- self destroySubViews.
+ self destroySubViews.
].
superView notNil ifTrue:[
- superView removeSubView:self.
- superView := nil
+ superView removeSubView:self.
+ superView := nil
].
super destroy.
@@ -6739,13 +6797,13 @@
"/ ].
controller notNil ifTrue:[
- controller release.
- controller := nil.
+ controller release.
+ controller := nil.
].
windowGroup notNil ifTrue:[
- windowGroup removeView:self.
- windowGroup := nil
+ windowGroup removeView:self.
+ windowGroup := nil
].
self noticeOfWindowClose.
@@ -6763,35 +6821,37 @@
self initStyleSheet.
- self setBorderWidth:(DefaultBorderWidth ? 1).
viewBackground := DefaultViewBackgroundColor.
DefaultLightColor notNil ifTrue:[
- lightColor := DefaultLightColor.
+ lightColor := DefaultLightColor.
] ifFalse:[
- device hasGrayscales ifTrue:[
- (viewBackground isImageOrForm and:[viewBackground colorMap isNil]) ifTrue:[
- lightColor := viewBackground averageColor lightened.
- ] ifFalse:[
- lightColor := viewBackground lightened.
- ].
- DefaultLightColor := lightColor.
- ] ifFalse:[
- "
- this seems strange: on B&W screens, we create the light color
- darker than normal viewBackground (White) -
- to make the boundary of the view visible
- "
- lightColor := Color gray:50
- ]
+ device hasGrayscales ifTrue:[
+ (viewBackground isImageOrForm and:[viewBackground colorMap isNil]) ifTrue:[
+ lightColor := viewBackground averageColor lightened.
+ ] ifFalse:[
+ lightColor := viewBackground lightened.
+ ].
+ DefaultLightColor := lightColor.
+ ] ifFalse:[
+ "
+ this seems strange: on B&W screens, we create the light color
+ darker than normal viewBackground (White) -
+ to make the boundary of the view visible
+ "
+ lightColor := Color gray:50
+ ]
].
DefaultShadowColor notNil ifTrue:[
- shadowColor := DefaultShadowColor.
+ shadowColor := DefaultShadowColor.
] ifFalse:[
- shadowColor := Black
- ].
-
- self borderColor:DefaultBorderColor.
+ shadowColor := Black
+ ].
+
+ ((DefaultBorderWidth ? 1) ~= 0 and:[DefaultBorderColor notNil]) ifTrue:[
+ self setBorder:(SimpleBorder width:(DefaultBorderWidth ? 1) color:DefaultBorderColor)
+ ].
+
"/ font := self defaultFont. -- already done in #initialize
font := font onDevice:device.
@@ -6867,8 +6927,8 @@
controllerClass := self defaultControllerClass.
controllerClass notNil ifTrue:[
- controller := controllerClass new.
- controller view:self.
+ controller := controllerClass new.
+ controller view:self.
].
self initializeMiddleButtonMenu.
@@ -6899,11 +6959,11 @@
self initStyle.
(drawableId notNil and:[gcId notNil]) ifTrue:[
- "force a change"
- t := self borderWidth. self setBorderWidth:nil. self borderWidth:t.
- t := viewBackground. viewBackground := nil. self viewBackground:t.
- self clearView.
- self invalidate.
+ "force a change"
+ t := self borderWidth. self setBorderWidth:nil. self borderWidth:t.
+ t := viewBackground. viewBackground := nil. self viewBackground:t.
+ self clearView.
+ self invalidate.
].
"Modified: / 18.9.1998 / 21:15:33 / cg"
@@ -7302,6 +7362,22 @@
^ aMenu startUpFor:self
! !
+!SimpleView methodsFor:'others'!
+
+borderWidth
+ "return my borderWidth"
+
+ (superView notNil and:[superView isBorderedWrapper]) ifTrue:[
+ ^ superView borderWidth
+ ].
+
+ border isNil ifTrue:[^ 0].
+ ^ border width ? 0
+
+ "Modified: 5.6.1996 / 14:11:57 / cg"
+ "Modified: 23.10.2009 / 14:11:50 / cg"
+! !
+
!SimpleView methodsFor:'private'!
componentsContainingX:x y:y do:aBlock
@@ -7376,10 +7452,10 @@
bw := self borderWidth ? 0.
insets isNil ifTrue:[
- bw == 0 ifTrue:[
- ^ p
- ].
- ^ (p x - bw) @ (p y - bw)
+ bw == 0 ifTrue:[
+ ^ p
+ ].
+ ^ (p x - bw) @ (p y - bw)
].
r := (insets at:3) + bw.
b := (insets at:4) + bw.
@@ -7392,7 +7468,7 @@
"/ b := bottomInset + bw
"/ ].
((r ~~ 0) or:[b ~~ 0]) ifTrue:[
- ^ (p x - r) @ (p y - b)
+ ^ (p x - r) @ (p y - b)
].
^ p
@@ -7436,9 +7512,9 @@
"set the exeplicit extent flag to aBoolean."
aBoolean ifTrue:[
- flagBits := flagBits bitOr:FlagHasExplicitExtent
+ flagBits := flagBits bitOr:FlagHasExplicitExtent
] ifFalse:[
- flagBits := flagBits bitClear:FlagHasExplicitExtent
+ flagBits := flagBits bitClear:FlagHasExplicitExtent
].
!
@@ -7456,50 +7532,50 @@
bw := self borderWidth ? 0.
superView isNil ifTrue:[
- inRect := 0@0 extent:device extent
+ inRect := 0@0 extent:device extent
] ifFalse:[
- inRect := superView viewRectangle.
+ inRect := superView viewRectangle.
].
bw2 := bw * 2.
rel := aPoint x.
rel isInteger ifFalse:[
- newX := (rel * (inRect width + bw2)) asInteger + inRect left.
- (bw ~~ 0) ifTrue:[
- newX := newX - bw
- ].
+ newX := (rel * (inRect width + bw2)) asInteger + inRect left.
+ (bw ~~ 0) ifTrue:[
+ newX := newX - bw
+ ].
] ifTrue:[
- newX := rel
+ newX := rel
].
rel := aPoint y.
rel isInteger ifFalse:[
- newY := (rel * (inRect height + bw2)) asInteger + inRect top.
- (bw ~~ 0) ifTrue:[
- newY := newY - bw
- ].
+ newY := (rel * (inRect height + bw2)) asInteger + inRect top.
+ (bw ~~ 0) ifTrue:[
+ newY := newY - bw
+ ].
] ifTrue:[
- newY := rel
+ newY := rel
].
insets notNil ifTrue:[
- i := insets at:1. "top"
- (i ~~ 0) ifTrue:[
- newX := newX - i
- ].
- i := insets at:3. "left"
- (i ~~ 0) ifTrue:[
- newX := newX - i
- ].
- i := insets at:2. "right"
- (i ~~ 0) ifTrue:[
- newY := newY - i
- ].
- i := insets at:4. "bottom"
- (i ~~ 0) ifTrue:[
- newY := newY - i
- ].
+ i := insets at:1. "top"
+ (i ~~ 0) ifTrue:[
+ newX := newX - i
+ ].
+ i := insets at:3. "left"
+ (i ~~ 0) ifTrue:[
+ newX := newX - i
+ ].
+ i := insets at:2. "right"
+ (i ~~ 0) ifTrue:[
+ newY := newY - i
+ ].
+ i := insets at:4. "bottom"
+ (i ~~ 0) ifTrue:[
+ newY := newY - i
+ ].
].
^ newX @ newY
!
@@ -7780,39 +7856,39 @@
bw := self borderWidth ? 0.
superView isNil ifTrue:[
- superWidth := device width + bw.
- superHeight := device height + bw.
- superLeft := superTop := 0.
+ superWidth := device width + bw.
+ superHeight := device height + bw.
+ superLeft := superTop := 0.
] ifFalse:[
- inRect := superView viewRectangle.
- superWidth := inRect width.
- superHeight := inRect height.
- superLeft := inRect left.
- superTop := inRect top.
+ inRect := superView viewRectangle.
+ superWidth := inRect width.
+ superHeight := inRect height.
+ superLeft := inRect left.
+ superTop := inRect top.
].
rel := p x.
rel isInteger ifTrue:[
- newX := rel
+ newX := rel
] ifFalse:[
- newX := (rel * superWidth) asInteger + superLeft.
- (bw ~~ 0) ifTrue:[
- rel ~= 1.0 ifTrue:[
- newX := newX - bw
- ]
- ]
+ newX := (rel * superWidth) asInteger + superLeft.
+ (bw ~~ 0) ifTrue:[
+ rel ~= 1.0 ifTrue:[
+ newX := newX - bw
+ ]
+ ]
].
rel := p y.
rel isInteger ifTrue:[
- newY := rel
+ newY := rel
] ifFalse:[
- newY := (rel * superHeight) asInteger + superTop.
- (bw ~~ 0) ifTrue:[
- rel ~= 1.0 ifTrue:[
- newY := newY - bw
- ]
- ]
+ newY := (rel * superHeight) asInteger + superTop.
+ (bw ~~ 0) ifTrue:[
+ rel ~= 1.0 ifTrue:[
+ newY := newY - bw
+ ]
+ ]
].
^ newX @ newY
@@ -7822,22 +7898,22 @@
setBorderColor
"set my borderColor in the physical view (if supported by the device)"
- |id dither|
-
- drawableId notNil ifTrue:[
- borderColor := borderColor onDevice:device.
- id := borderColor colorId.
- id notNil ifTrue:[
- device setWindowBorderColor:id in:drawableId
- ] ifFalse:[
- dither := borderColor ditherForm.
- dither notNil ifTrue:[
- device setWindowBorderPixmap:(dither id) in:drawableId
- ] ifFalse:[
- 'SimpleView [warning]: bad borderColor' errorPrintCR
- ]
- ]
- ]
+"/ |id dither|
+"/
+"/ drawableId notNil ifTrue:[
+"/ borderColor := borderColor onDevice:device.
+"/ id := borderColor colorId.
+"/ id notNil ifTrue:[
+"/ device setWindowBorderColor:id in:drawableId
+"/ ] ifFalse:[
+"/ dither := borderColor ditherForm.
+"/ dither notNil ifTrue:[
+"/ device setWindowBorderPixmap:(dither id) in:drawableId
+"/ ] ifFalse:[
+"/ 'SimpleView [warning]: bad borderColor' errorPrintCR
+"/ ]
+"/ ]
+"/ ]
"Modified: 10.1.1997 / 18:06:34 / cg"
!
@@ -7901,11 +7977,11 @@
savedPref := preferredExtent.
savedExplicit := explicitExtent.
[
- preferredExtent := explicitExtent := nil.
- computedPref := self preferredExtent.
+ preferredExtent := explicitExtent := nil.
+ computedPref := self preferredExtent.
] ensure:[
- preferredExtent := savedPref.
- explicitExtent := savedExplicit.
+ preferredExtent := savedPref.
+ explicitExtent := savedExplicit.
].
^ computedPref
!
@@ -7988,15 +8064,15 @@
focusViewToCheck := focusViewOnDisplay.
focusViewToCheck == self ifTrue:[
- ^ true
+ ^ true
].
focusViewToCheck notNil ifTrue:[
- "mhmh - is there a delegation to me ?"
- (delegate := focusViewToCheck delegate) notNil ifTrue:[
- delegate == self ifTrue:[^ true].
- ^ delegate askFor:#delegatesTo: with:self
- ]
+ "mhmh - is there a delegation to me ?"
+ (delegate := focusViewToCheck delegate) notNil ifTrue:[
+ delegate == self ifTrue:[^ true].
+ ^ delegate askFor:#delegatesTo: with:self
+ ]
].
^ false
@@ -8189,48 +8265,48 @@
"/ If I have an explicit preferredExtent..
explicitExtent notNil ifTrue:[
- ^ explicitExtent
+ ^ explicitExtent
].
"/ If I have a cached preferredExtent value..
preferredExtent notNil ifTrue:[
- ^ preferredExtent
+ ^ preferredExtent
].
"/ mhmh - if I have subViews, collect their
"/ preferred bounds ...
subViews notNil ifTrue:[
- maxX := maxY := 0.
- subViews do:[:aSubView |
- |org corn|
-
- org := aSubView computeOrigin.
- corn := org + aSubView preferredExtent.
- maxX := maxX max:corn x.
- maxY := maxY max:corn y.
- ]
+ maxX := maxY := 0.
+ subViews do:[:aSubView |
+ |org corn|
+
+ org := aSubView computeOrigin.
+ corn := org + aSubView preferredExtent.
+ maxX := maxX max:corn x.
+ maxY := maxY max:corn y.
+ ]
].
"/ mhmh - if I have components, collect their preferred bounds ...
components notNil ifTrue:[
- maxX isNil ifTrue:[
- maxX := maxY := 0.
- ].
- components do:[:aComponent |
- |bounds org corn|
-
- bounds := aComponent preferredBounds.
- corn := bounds corner.
- maxX := maxX max:corn x.
- maxY := maxY max:corn y.
- ]
+ maxX isNil ifTrue:[
+ maxX := maxY := 0.
+ ].
+ components do:[:aComponent |
+ |bounds org corn|
+
+ bounds := aComponent preferredBounds.
+ corn := bounds corner.
+ maxX := maxX max:corn x.
+ maxY := maxY max:corn y.
+ ]
].
"/ nothing found - return the actual size
maxX isNil ifTrue:[
- ^ self extent.
+ ^ self extent.
].
^ maxX @ maxY.
@@ -8258,7 +8334,7 @@
!
resources
- "return the views resources -
+ "return the views resources -
that's a ResourcePack containing national language strings"
^ resources
@@ -8552,24 +8628,24 @@
realized ifFalse:[^ self].
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[
- masterGroup := windowGroup previousGroup.
- windowGroup focusView:nil.
+ masterGroup := windowGroup previousGroup.
+ windowGroup focusView:nil.
].
self unmap.
device flush.
masterGroup notNil ifTrue:[
- "
- this is a kludge for IRIS and others which do not provide backingstore:
- when we hide a modalbox (such as a searchbox) which covered
- a scrollbar, the scrollbars bitblt-method will copy from the
- not-yet redrawn area - effectively clearing the scroller.
- We need a short delay here, since at this time, the expose event has
- not yet arrived.
- "
- Delay waitForSeconds:0.05.
- masterGroup processExposeEvents
+ "
+ this is a kludge for IRIS and others which do not provide backingstore:
+ when we hide a modalbox (such as a searchbox) which covered
+ a scrollbar, the scrollbars bitblt-method will copy from the
+ not-yet redrawn area - effectively clearing the scroller.
+ We need a short delay here, since at this time, the expose event has
+ not yet arrived.
+ "
+ Delay waitForSeconds:0.05.
+ masterGroup processExposeEvents
].
"/ WindowGroup leaveSignal raise.
@@ -8627,61 +8703,61 @@
(unless you have a dictator as windowManager ;-).
If the iconified argument is true, the window is created as icon initially.
Notice:
- Actually, this method is only valid for topViews;
- however, it is defined here to allow things like 'Button new realize'"
+ Actually, this method is only valid for topViews;
+ however, it is defined here to allow things like 'Button new realize'"
|subs|
realized ifFalse:[
- drawableId isNil ifTrue:[
- "
- first time ?
- yes, realize (implies a map)
- "
- self realizeKeepingGroup:false at:aPoint iconified:iconified
- ] ifFalse:[
- "
- no, map only
- "
- realized := true.
- aPoint isNil ifTrue:[
- iconified ifTrue:[
- device
- mapView:self id:drawableId iconified:iconified
- atX:0 y:0
- width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent).
- ] ifFalse:[
- device mapWindow:drawableId.
- ]
- ] ifFalse:[
- left := aPoint x.
- top := aPoint y.
- device
- mapView:self id:drawableId iconified:iconified
- atX:left y:top
- width:width height:height
- minExtent:(self minExtent) maxExtent:(self maxExtent).
- ].
-
- "/
- "/ implies that all realized subviews
- "/ are now also mapped
- "/
- "/ not needed for topViews - the mapped event does exactly the same
- "/ however, X does not generate mapped events for non-topViews
- "/ when a view gets deiconified.
-
- superView notNil ifTrue:[
- (subs := self subViews) notNil ifTrue:[
- subs do:[:v |
- v realized "shown" ifFalse:[
- v mapped
- ]
- ]
- ]
- ]
- ].
+ drawableId isNil ifTrue:[
+ "
+ first time ?
+ yes, realize (implies a map)
+ "
+ self realizeKeepingGroup:false at:aPoint iconified:iconified
+ ] ifFalse:[
+ "
+ no, map only
+ "
+ realized := true.
+ aPoint isNil ifTrue:[
+ iconified ifTrue:[
+ device
+ mapView:self id:drawableId iconified:iconified
+ atX:0 y:0
+ width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent).
+ ] ifFalse:[
+ device mapWindow:drawableId.
+ ]
+ ] ifFalse:[
+ left := aPoint x.
+ top := aPoint y.
+ device
+ mapView:self id:drawableId iconified:iconified
+ atX:left y:top
+ width:width height:height
+ minExtent:(self minExtent) maxExtent:(self maxExtent).
+ ].
+
+ "/
+ "/ implies that all realized subviews
+ "/ are now also mapped
+ "/
+ "/ not needed for topViews - the mapped event does exactly the same
+ "/ however, X does not generate mapped events for non-topViews
+ "/ when a view gets deiconified.
+
+ superView notNil ifTrue:[
+ (subs := self subViews) notNil ifTrue:[
+ subs do:[:v |
+ v realized "shown" ifFalse:[
+ v mapped
+ ]
+ ]
+ ]
+ ]
+ ].
]
"Modified: 23.8.1996 / 14:53:55 / stefan"
@@ -8714,20 +8790,20 @@
isInputOnly := self isInputOnly.
drawableId := device
- createWindowFor:self
- type:(self windowType)
- origin:(left @ top)
- extent:(width @ height)
- minExtent:nil
- maxExtent:nil
- borderWidth:self borderWidth
- subViewOf:sv
- style:(self windowStyle)
- inputOnly:isInputOnly
- label:nil
- owner:nil
- icon:nil iconMask:nil
- iconView:nil.
+ createWindowFor:self
+ type:(self windowType)
+ origin:(left @ top)
+ extent:(width @ height)
+ minExtent:nil
+ maxExtent:nil
+ borderWidth:self borderWidth
+ subViewOf:sv
+ style:(self windowStyle)
+ inputOnly:isInputOnly
+ label:nil
+ owner:nil
+ icon:nil iconMask:nil
+ iconView:nil.
Lobby registerChange:self.
@@ -8746,24 +8822,24 @@
"/ ]
"/ ].
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
- device setWindowGravity:viewGravity in:drawableId
+ device setWindowGravity:viewGravity in:drawableId
].
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
- isInputOnly ifFalse:[
- device setBitGravity:bitGravity in:drawableId
- ]
+ isInputOnly ifFalse:[
+ device setBitGravity:bitGravity in:drawableId
+ ]
].
viewShape notNil ifTrue:[
- self setViewShape
+ self setViewShape
].
(backed notNil and:[backed ~~ false]) ifTrue:[
- device setBackingStore:backed in:drawableId
+ device setBackingStore:backed in:drawableId
].
self saveUnder ifTrue:[
- device setSaveUnder:true in:drawableId
+ device setSaveUnder:true in:drawableId
].
cursor notNil ifTrue:[
- self setCursor
+ self setCursor
].
"Modified: / 9.4.1998 / 20:18:12 / cg"
@@ -8851,11 +8927,11 @@
self fetchDeviceResources.
drawableId isNil ifTrue:[
- self create.
- drawableId isNil ifTrue:[
- ('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR.
- ^ self
- ]
+ self create.
+ drawableId isNil ifTrue:[
+ ('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR.
+ ^ self
+ ]
].
groupChange := false.
@@ -8863,85 +8939,85 @@
(windowGroup notNil
and:[superView isNil
and:[windowGroup isForModalSubview]]) ifTrue:[
- keep := true.
+ keep := true.
] ifFalse:[
- keep := keepGroupAsIs
+ keep := keepGroupAsIs
].
keep ifFalse:[
- "
- put myself into superviews windowgroup if there is a superview
- This is the default behavior, which may be suppressed by
- passing true as keepGroupAsIs-argument.
- (it may be useful to assign a separate windowGroup to
- a childView to have it execute independent of the parent
- -> an example is found in the fileBrowsers kill-button)
- "
- superView notNil ifTrue:[
- superGroup := superView windowGroup.
- (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[
- "
- mhmh - seems that the windowgroup has changed ....
- "
+ "
+ put myself into superviews windowgroup if there is a superview
+ This is the default behavior, which may be suppressed by
+ passing true as keepGroupAsIs-argument.
+ (it may be useful to assign a separate windowGroup to
+ a childView to have it execute independent of the parent
+ -> an example is found in the fileBrowsers kill-button)
+ "
+ superView notNil ifTrue:[
+ superGroup := superView windowGroup.
+ (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[
+ "
+ mhmh - seems that the windowgroup has changed ....
+ "
"/ 'oops - wgroup change on realize' printNL.
- groupChange := true.
-
- "/
- "/ recursively change the windowGroup of
- "/ myself and all of my children
- "/
- self windowGroup:superGroup.
- ] ifFalse:[
- windowGroup isNil ifTrue:[
- "/
- "/ only change the group of myself -
- "/ subviews will fetch it when realized.
- "/
- windowGroup := superGroup.
- superGroup notNil ifTrue:[superGroup addView:self].
- ]
- ].
- ].
+ groupChange := true.
+
+ "/
+ "/ recursively change the windowGroup of
+ "/ myself and all of my children
+ "/
+ self windowGroup:superGroup.
+ ] ifFalse:[
+ windowGroup isNil ifTrue:[
+ "/
+ "/ only change the group of myself -
+ "/ subviews will fetch it when realized.
+ "/
+ windowGroup := superGroup.
+ superGroup notNil ifTrue:[superGroup addView:self].
+ ]
+ ].
+ ].
].
(self originOrExtentChanged) ifTrue:[
- self fixSize.
- self sizeChanged:nil.
+ self fixSize.
+ self sizeChanged:nil.
].
position notNil ifTrue:[
- self origin:position.
+ self origin:position.
].
(subViews notNil or:[components notNil]) ifTrue:[
- (realized not or:[groupChange]) ifTrue:[
+ (realized not or:[groupChange]) ifTrue:[
self isHiddenOnRealize ifFalse:[
- self realizeAllSubViews.
+ self realizeAllSubViews.
].
- ].
+ ].
].
self preRealize.
iconified ifTrue:[
- realized ifFalse:[
- self mapIconified
- ]
+ realized ifFalse:[
+ self mapIconified
+ ]
] ifFalse:[
- (self isHiddenOnRealize not
- and:[visibilityChannel isNil or:[visibilityChannel value]]) ifTrue:[
- self setInnerClip.
-
- realized ifFalse:[
- "
- now, make the view visible
- "
- self mapAt:position
- ]
- ]
+ (self isHiddenOnRealize not
+ and:[visibilityChannel isNil or:[visibilityChannel value]]) ifTrue:[
+ self setInnerClip.
+
+ realized ifFalse:[
+ "
+ now, make the view visible
+ "
+ self mapAt:position
+ ]
+ ]
].
controller notNil ifTrue:[
- controller startUp
+ controller startUp
].
self postRealize
@@ -9064,24 +9140,24 @@
"unmap the view - the view stays created (but invisible), and can be remapped again later."
realized ifTrue:[
- realized := false.
- drawableId notNil ifTrue:[
- device unmapWindow:drawableId.
-
- "/ make it go away immediately
- "/ (this hides the subview killing)
- device flush.
- ].
-
- "/ Normally, this is not correct with X, where the
- "/ unmap is an asynchronous operation.
- "/ (shown is cleared also in unmapped event)
- "/ Do it anyway, to avoid synchronisation problems.
-
- shown ifTrue:[
- shown := false.
- self changed:#visibility.
- ]
+ realized := false.
+ drawableId notNil ifTrue:[
+ device unmapWindow:drawableId.
+
+ "/ make it go away immediately
+ "/ (this hides the subview killing)
+ device flush.
+ ].
+
+ "/ Normally, this is not correct with X, where the
+ "/ unmap is an asynchronous operation.
+ "/ (shown is cleared also in unmapped event)
+ "/ Do it anyway, to avoid synchronisation problems.
+
+ shown ifTrue:[
+ shown := false.
+ self changed:#visibility.
+ ]
].
"
@@ -9091,9 +9167,9 @@
top extent:200@200.
sub := View
- origin:0.2@0.2
- corner:0.8@0.8
- in:top.
+ origin:0.2@0.2
+ corner:0.8@0.8
+ in:top.
sub viewBackground:Color red.
sub hiddenOnRealize:true.
@@ -9307,14 +9383,14 @@
redrawComponentsIn:aRectangle
components notNil ifTrue:[
- components do:[:aComponent |
- |thisFrame is|
-
- thisFrame := aComponent bounds.
- (thisFrame notNil and:[thisFrame intersects:aRectangle]) ifTrue:[
- aComponent displayOn:self
- ]
- ]
+ components do:[:aComponent |
+ |thisFrame is|
+
+ thisFrame := aComponent bounds.
+ (thisFrame notNil and:[thisFrame intersects:aRectangle]) ifTrue:[
+ aComponent displayOn:self
+ ]
+ ]
].
!
@@ -9355,12 +9431,12 @@
self clippingRectangle:area.
self clearExposedAreaInRedraw ifTrue:[
- "/ win95 workaround: non-existing bg-pixmap support (obsolete)
- (viewBackground isImageOrForm and:[ device supportsAnyViewBackgroundPixmaps not ]) ifTrue:[
- self fillRectangleWithViewBackgroundX:x y:y width:w height:h
- ] ifFalse:[
- self clearRectangleX:x y:y width:w height:h.
- ]
+ "/ win95 workaround: non-existing bg-pixmap support (obsolete)
+ (viewBackground isImageOrForm and:[ device supportsAnyViewBackgroundPixmaps not ]) ifTrue:[
+ self fillRectangleWithViewBackgroundX:x y:y width:w height:h
+ ] ifFalse:[
+ self clearRectangleX:x y:y width:w height:h.
+ ]
].
"/ redraw everything - a fallBack for lazy views.
self redraw.
@@ -10006,7 +10082,7 @@
activeGroup := WindowGroup activeGroup.
- "/ cg - because we raise that window, we should avoid to raise the main-non-modal view,
+ "/ cg - because we raise that window, we should avoid to raise the main-non-modal view,
"/ if a dialog is opend from another modal view (confirmation in a modal-box)
"/ mainGroup := activeGroup.
@@ -10034,140 +10110,140 @@
|tops mainView mainViewID previousGroup |
self isPopUpView ifFalse:[
- "/ the following allows for knowledgable programmers to suppress dialog boxes,
- "/ or to patch common controls right before opening...
- (Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
- ^ self
- ].
-
- mainGroup notNil ifTrue:[
- (tops := mainGroup topViews) notNil ifTrue:[
- tops notEmpty ifTrue:[
- mainView := tops detect:[:v| v shown] ifNone:nil.
- mainView notNil ifTrue:[
- mainViewID := mainView id.
- ]
- ]
- ].
- ].
-
- mainView notNil ifTrue:[
- mainView activate; setForegroundWindow.
- ].
-
- ModalBox usingTransientViews ifTrue:[
- "make view only transient, if there is a visible topView.
- If none of them is visible, we do want an icon for ourself"
-
- mainViewID isNil ifTrue:[
- self origin:(device center - (self extent//2))
- ].
-
- drawableId isNil ifTrue:[self create].
- mainView notNil ifTrue:[
- device setTransient:drawableId for:mainViewID.
- ].
- ].
+ "/ the following allows for knowledgable programmers to suppress dialog boxes,
+ "/ or to patch common controls right before opening...
+ (Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:self) == #abort ifTrue:[
+ ^ self
+ ].
+
+ mainGroup notNil ifTrue:[
+ (tops := mainGroup topViews) notNil ifTrue:[
+ tops notEmpty ifTrue:[
+ mainView := tops detect:[:v| v shown] ifNone:nil.
+ mainView notNil ifTrue:[
+ mainViewID := mainView id.
+ ]
+ ]
+ ].
+ ].
+
+ mainView notNil ifTrue:[
+ mainView activate; setForegroundWindow.
+ ].
+
+ ModalBox usingTransientViews ifTrue:[
+ "make view only transient, if there is a visible topView.
+ If none of them is visible, we do want an icon for ourself"
+
+ mainViewID isNil ifTrue:[
+ self origin:(device center - (self extent//2))
+ ].
+
+ drawableId isNil ifTrue:[self create].
+ mainView notNil ifTrue:[
+ device setTransient:drawableId for:mainViewID.
+ ].
+ ].
].
self raise.
Processor activeProcessIsSystemProcess ifTrue:[
- "
- put myself into the modal group, let it handle events for
- me as well. This is only a half way solution, since the view
- is not modal at all ... however, the only situation
- where this happens is with modal boxes popped while in a
- modal browser. You will forgive me for that inconvenience.
- "
- windowGroup := mainGroup.
- mainGroup notNil ifTrue:[mainGroup addTopView:self].
- self realize
+ "
+ put myself into the modal group, let it handle events for
+ me as well. This is only a half way solution, since the view
+ is not modal at all ... however, the only situation
+ where this happens is with modal boxes popped while in a
+ modal browser. You will forgive me for that inconvenience.
+ "
+ windowGroup := mainGroup.
+ mainGroup notNil ifTrue:[mainGroup addTopView:self].
+ self realize
] ifFalse:[
- previousGroup := WindowGroup activeGroup.
-
- "
- show a stop-cursor in the main group
- "
- mainGroup notNil ifTrue:[
- self isPopUpView ifFalse:[
- mainGroup showCursor:(Cursor stop).
- (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
- previousGroup showCursor:(Cursor stop).
- ].
- ]
- ].
-
- "
- create a new window group and put myself into it
- "
- windowGroup := self windowGroupClass new.
- windowGroup addTopView:self.
- windowGroup setPreviousGroup:previousGroup.
-
- superView notNil ifTrue:[
- "/
- "/ special: this is a modal subview,
- "/ prevent the view from reassigning its windowGroup when realized
- "/ (subviews normally place themself into the superviews group)
- "/
- windowGroup isForModalSubview:true.
- ].
-
- "
- go dispatch events in this new group
- (thus current windowgroup is blocked from interaction)
- "
- AbortOperationRequest handle:[:ex |
- AbortOperationRequest handle:[:ex2 |
- "/ an aborted hide (user confirmation ?)
- self breakPoint:#cg.
- ex proceed
- ] do:[
- self hide.
- self realized ifTrue:[
- "/ self halt. "/ hide handled and closeRequest not wanted:
- ex proceed
- ].
+ previousGroup := WindowGroup activeGroup.
+
+ "
+ show a stop-cursor in the main group
+ "
+ mainGroup notNil ifTrue:[
+ self isPopUpView ifFalse:[
+ mainGroup showCursor:(Cursor stop).
+ (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
+ previousGroup showCursor:(Cursor stop).
+ ].
+ ]
+ ].
+
+ "
+ create a new window group and put myself into it
+ "
+ windowGroup := self windowGroupClass new.
+ windowGroup addTopView:self.
+ windowGroup setPreviousGroup:previousGroup.
+
+ superView notNil ifTrue:[
+ "/
+ "/ special: this is a modal subview,
+ "/ prevent the view from reassigning its windowGroup when realized
+ "/ (subviews normally place themself into the superviews group)
+ "/
+ windowGroup isForModalSubview:true.
+ ].
+
+ "
+ go dispatch events in this new group
+ (thus current windowgroup is blocked from interaction)
+ "
+ AbortOperationRequest handle:[:ex |
+ AbortOperationRequest handle:[:ex2 |
+ "/ an aborted hide (user confirmation ?)
+ self breakPoint:#cg.
+ ex proceed
+ ] do:[
+ self hide.
+ self realized ifTrue:[
+ "/ self halt. "/ hide handled and closeRequest not wanted:
+ ex proceed
+ ].
"/ ex return
- ].
- ex return.
- ] do:[
- [
- [
- windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
- ] ifCurtailed:[
- self hide.
- ]
- ] ensure:[
- mainGroup notNil ifTrue:[
- mainGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed"
- "/ ensure that eventListener runs here ...
- Delay waitForSeconds:0.05.
- mainGroup processExposeEvents.
-
- ReturnFocusWhenClosingModalBoxes ifTrue:[
- "
- return the input focus to the previously active group's top.
- This helps with windowmanagers which need an explicit click
- on the view for the focus.
- "
- tops := mainGroup topViews.
- (tops notEmptyOrNil) ifTrue:[
- tops first getKeyboardFocus
- ].
- ].
-
- "
- restore cursors in the main group
- "
- mainGroup restoreCursors.
- (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
- previousGroup restoreCursors.
- ].
- ]
- ]
- ].
+ ].
+ ex return.
+ ] do:[
+ [
+ [
+ windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
+ ] ifCurtailed:[
+ self hide.
+ ]
+ ] ensure:[
+ mainGroup notNil ifTrue:[
+ mainGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed"
+ "/ ensure that eventListener runs here ...
+ Delay waitForSeconds:0.05.
+ mainGroup processExposeEvents.
+
+ ReturnFocusWhenClosingModalBoxes ifTrue:[
+ "
+ return the input focus to the previously active group's top.
+ This helps with windowmanagers which need an explicit click
+ on the view for the focus.
+ "
+ tops := mainGroup topViews.
+ (tops notEmptyOrNil) ifTrue:[
+ tops first getKeyboardFocus
+ ].
+ ].
+
+ "
+ restore cursors in the main group
+ "
+ mainGroup restoreCursors.
+ (previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[
+ previousGroup restoreCursors.
+ ].
+ ]
+ ]
+ ].
]
"Created: / 10-12-1995 / 14:06:14 / cg"
@@ -10456,11 +10532,11 @@
!SimpleView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.643 2009-10-23 15:52:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.644 2009-10-24 10:31:07 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.643 2009-10-23 15:52:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.644 2009-10-24 10:31:07 cg Exp $'
! !
SimpleView initialize!