SimpleView.st
author Claus Gittinger <cg@exept.de>
Sat, 24 Feb 1996 17:29:06 +0100
changeset 452 f38d70ba97a2
parent 450 9eb6198de8f6
child 467 badc7ab65a2d
permissions -rw-r--r--
made DefaultFont a classINSTvariable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
135
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
claus
parents:
diff changeset
    12
claus
parents:
diff changeset
    13
PseudoView subclass:#SimpleView
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    14
	instanceVariableNames:'superView subViews components styleSheet resources borderColor
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    15
		borderWidth borderShape viewShape top left extentChanged
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    16
		originChanged cornerChanged relativeOrigin relativeExtent
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    17
		relativeCorner originRule extentRule cornerRule insets viewport
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    18
		layout shown hiddenOnRealize name level margin innerClipRect
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    19
		shadowColor lightColor bitGravity viewGravity controller
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    20
		windowGroup'
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    21
	classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    22
		DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    23
		DefaultShadowColor DefaultBorderWidth DefaultFont
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
    24
		DefaultFocusColor DefaultFocusBorderWidth
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
    25
		ReturnFocusWhenClosingModalBoxes'
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    26
	poolDictionaries:''
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
    27
	category:'Views-Basic'
135
claus
parents:
diff changeset
    28
!
claus
parents:
diff changeset
    29
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
    30
SimpleView class instanceVariableNames:'ClassResources DefaultFont'
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    31
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    32
"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    33
 The following class instance variables are inherited by this class:
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    34
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    35
	PseudoView - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    36
	DeviceDrawable - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    37
	DisplayMedium - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    38
	GraphicsContext - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    39
	Object - 
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
    40
"
140
claus
parents: 138
diff changeset
    41
!
135
claus
parents:
diff changeset
    42
claus
parents:
diff changeset
    43
!SimpleView class methodsFor:'documentation'!
claus
parents:
diff changeset
    44
claus
parents:
diff changeset
    45
copyright
claus
parents:
diff changeset
    46
"
claus
parents:
diff changeset
    47
 COPYRIGHT (c) 1989 by Claus Gittinger
claus
parents:
diff changeset
    48
	      All Rights Reserved
claus
parents:
diff changeset
    49
claus
parents:
diff changeset
    50
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    51
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    52
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    53
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    54
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    55
 hereby transferred.
claus
parents:
diff changeset
    56
"
claus
parents:
diff changeset
    57
!
claus
parents:
diff changeset
    58
claus
parents:
diff changeset
    59
documentation
claus
parents:
diff changeset
    60
"
claus
parents:
diff changeset
    61
    this class implements functions common to all Views which do not work on / show a model. 
claus
parents:
diff changeset
    62
    Previously, all of this functionality used to be in the old View class, but has been
claus
parents:
diff changeset
    63
    separated into this new SimpleView (which does not know about models) and the new View, which
claus
parents:
diff changeset
    64
    does so.
claus
parents:
diff changeset
    65
    Instances of SimpleView are seldom used, most views in the system inherit 
claus
parents:
diff changeset
    66
    from this class. 
claus
parents:
diff changeset
    67
    However, sometimes a view is used to create a dummy view for framing 
claus
parents:
diff changeset
    68
    or layout purposes.
claus
parents:
diff changeset
    69
claus
parents:
diff changeset
    70
    Instance variables:
claus
parents:
diff changeset
    71
claus
parents:
diff changeset
    72
	superView               <View>                  my superview i.e. the view I am in
claus
parents:
diff changeset
    73
	subViews                <Collection>            the collection of subviews
151
claus
parents: 145
diff changeset
    74
	components              <Collection>            collection of gadgets (will be merged with subViews, soon)
claus
parents: 145
diff changeset
    75
135
claus
parents:
diff changeset
    76
	borderColor             <Color>                 color of border
claus
parents:
diff changeset
    77
	borderWidth             <Number>                borderWidth in pixels (device dep.)
claus
parents:
diff changeset
    78
	borderShape             <Form>                  shape of border (if device supports it)
claus
parents:
diff changeset
    79
	viewShape               <Form>                  shape of view (if device supports it)
151
claus
parents: 145
diff changeset
    80
	top                     <Number>                actual top coordinate (pixels) in superview
claus
parents: 145
diff changeset
    81
	left                    <Number>                actual left coordinate (pixels) in superview
135
claus
parents:
diff changeset
    82
	extendChanged           <Boolean>               true if extend changed during setup
claus
parents:
diff changeset
    83
	originChanged           <Boolean>               true if origin changed during setup
151
claus
parents: 145
diff changeset
    84
claus
parents: 145
diff changeset
    85
	viewport                <Rectangle>             my Rectangle in superviews coordinates
135
claus
parents:
diff changeset
    86
	relativeOrigin          <Number>                relative origin in percent within superview
claus
parents:
diff changeset
    87
	relativeExtent          <Number>                relative extent in percent within superview
151
claus
parents: 145
diff changeset
    88
	relativeCorner          <Number>                relative corner in percent within superview
135
claus
parents:
diff changeset
    89
	originRule              <Block>                 rule to compute origin if superview changes size
claus
parents:
diff changeset
    90
	extentRule              <Block>                 rule to compute extent if superview changes size
151
claus
parents: 145
diff changeset
    91
	cornerRule              <Block>                 rule to compute corner if superview changes size
claus
parents: 145
diff changeset
    92
	insets                  <Array>                 array with top, left, bottom & right insets (or nil)
claus
parents: 145
diff changeset
    93
claus
parents: 145
diff changeset
    94
	layout                  <LayoutObject>          not yet implemented - will replace the above layout
claus
parents: 145
diff changeset
    95
							variables.
claus
parents: 145
diff changeset
    96
135
claus
parents:
diff changeset
    97
	shown                   <Boolean>               true if visible (false if iconified, unmapped or covered)
151
claus
parents: 145
diff changeset
    98
	hiddenOnRealize         <Boolean>               dont show automatically when superview is realized
135
claus
parents:
diff changeset
    99
	name                    <String>                my name (future use for resources)
claus
parents:
diff changeset
   100
	level                   <Number>                3D level relative to superview
claus
parents:
diff changeset
   101
	margin                  <Number>                convenient margin
claus
parents:
diff changeset
   102
	innerClipRect           <Rectangle>             convenient inner clip (minus margin)
claus
parents:
diff changeset
   103
	shadowColor             <Color>                 color used to draw 3D shadowed edges
claus
parents:
diff changeset
   104
	lightColor              <Color>                 color used to draw 3D lighted edges
claus
parents:
diff changeset
   105
	bitGravity              <nil | Symbol>          gravity of contents (if device supports it)
claus
parents:
diff changeset
   106
	viewGravity             <nil | Symbol>          gravity of view (if device supports it)
claus
parents:
diff changeset
   107
	controller              <nil | Controller>      the controller (if any)
151
claus
parents: 145
diff changeset
   108
	windowGroup             <WindowGroup>           the windowGroup
135
claus
parents:
diff changeset
   109
claus
parents:
diff changeset
   110
claus
parents:
diff changeset
   111
    Class variables:
claus
parents:
diff changeset
   112
claus
parents:
diff changeset
   113
	Grey                    <Color>                 the color grey - its used so often
151
claus
parents: 145
diff changeset
   114
	ViewSpacing             <Number>                preferred spacing between views; 1mm
135
claus
parents:
diff changeset
   115
claus
parents:
diff changeset
   116
	CentPoint               <Point>                 100 @ 100 - its used so often
claus
parents:
diff changeset
   117
claus
parents:
diff changeset
   118
	StyleSheet              <ResourcePack>          contains all view-style specifics
claus
parents:
diff changeset
   119
369
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   120
	ReturnFocusWhenClosingModalBoxes                if true, a closing modalBox returns
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   121
				<Boolean>               the keyboard focus to the view which was
365
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   122
							active when the box was opened.
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   123
							If false (the default), it is left to
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   124
							window manager to assign a new focus.
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   125
							If running on olwm/olvwm (which requires an
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   126
							explicit click to reassign a focus), it is
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   127
							better to turn this on in a private.rc file.
135
claus
parents:
diff changeset
   128
claus
parents:
diff changeset
   129
    styleSheet parameters:
claus
parents:
diff changeset
   130
claus
parents:
diff changeset
   131
	popupShadow             <Boolean>               if true, popupViews show a shadow below
claus
parents:
diff changeset
   132
	popupLevel              <nil | Integer>         3D level
claus
parents:
diff changeset
   133
	borderWidth             <nil | Integer>         borderWidth (ignored in 3D styles)
claus
parents:
diff changeset
   134
	borderColor             <nil | Color>           borderColor (ignored in 3D styles)
claus
parents:
diff changeset
   135
	viewBackground          <nil | Color>           views background
claus
parents:
diff changeset
   136
	shadowColor             <nil | Color>           color for shadow edges (ignored in 2D styles)
claus
parents:
diff changeset
   137
	lightColor              <nil | Color>           color for light edges (ignored in 2D styles)
claus
parents:
diff changeset
   138
	font                    <nil | Font>            font to use
claus
parents:
diff changeset
   139
claus
parents:
diff changeset
   140
claus
parents:
diff changeset
   141
    TODO:
claus
parents:
diff changeset
   142
	get rid of relativeOrigin, relativeCorner, originRule, extentRule,
claus
parents:
diff changeset
   143
	and insets; replace by a single object which defines the size
claus
parents:
diff changeset
   144
	(mhmh - ST-80 seems to call this LayoutFrame ?)
claus
parents:
diff changeset
   145
	-> be prepared for a change here in the near future and ONLY use
151
claus
parents: 145
diff changeset
   146
	   access methods to get those instance variables' values
claus
parents: 145
diff changeset
   147
claus
parents: 145
diff changeset
   148
	get rid of 3D level & margin, move it to extra wrappers
claus
parents: 145
diff changeset
   149
	(although this will make view setup more complicated, it will remove
claus
parents: 145
diff changeset
   150
	 complexity from the internals of view. Also, it will allow for more
claus
parents: 145
diff changeset
   151
	 varieties of borders.)
claus
parents: 145
diff changeset
   152
        
135
claus
parents:
diff changeset
   153
	add components (could also call them gadgets or lightweight views)
claus
parents:
diff changeset
   154
	- views are expensive in terms of X resources. This would make all
claus
parents:
diff changeset
   155
	framing/edge and panel helper views become cheap ST objects, instead
claus
parents:
diff changeset
   156
	of views.
claus
parents:
diff changeset
   157
"
151
claus
parents: 145
diff changeset
   158
!
claus
parents: 145
diff changeset
   159
claus
parents: 145
diff changeset
   160
examples 
claus
parents: 145
diff changeset
   161
"
claus
parents: 145
diff changeset
   162
    (all examples below use different viewBackgrounds, 
claus
parents: 145
diff changeset
   163
     to make the individual subviews visible)
claus
parents: 145
diff changeset
   164
claus
parents: 145
diff changeset
   165
    fixed position/size:
claus
parents: 145
diff changeset
   166
claus
parents: 145
diff changeset
   167
       |top v1 v2|
claus
parents: 145
diff changeset
   168
claus
parents: 145
diff changeset
   169
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   170
       top extent:300@300.
claus
parents: 145
diff changeset
   171
claus
parents: 145
diff changeset
   172
       v1 := View origin:10@10
claus
parents: 145
diff changeset
   173
		  corner:50@50
claus
parents: 145
diff changeset
   174
		      in:top.
claus
parents: 145
diff changeset
   175
       v2 := View origin:60@10
claus
parents: 145
diff changeset
   176
		  corner:150@100
claus
parents: 145
diff changeset
   177
		      in:top.
claus
parents: 145
diff changeset
   178
claus
parents: 145
diff changeset
   179
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   180
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   181
claus
parents: 145
diff changeset
   182
       top open
claus
parents: 145
diff changeset
   183
claus
parents: 145
diff changeset
   184
claus
parents: 145
diff changeset
   185
    same, using ST-80 way of bulding up view hierarchies
claus
parents: 145
diff changeset
   186
    (recommended, if you plan to port applications later)
claus
parents: 145
diff changeset
   187
claus
parents: 145
diff changeset
   188
       |top v1 v2|
claus
parents: 145
diff changeset
   189
claus
parents: 145
diff changeset
   190
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   191
       top extent:300@300.
claus
parents: 145
diff changeset
   192
claus
parents: 145
diff changeset
   193
       v1 := View new.
claus
parents: 145
diff changeset
   194
       v1 origin:10@10 corner:50@50.
claus
parents: 145
diff changeset
   195
claus
parents: 145
diff changeset
   196
       v2 := View new.
claus
parents: 145
diff changeset
   197
       v2 origin:60@10 corner:150@100.
claus
parents: 145
diff changeset
   198
claus
parents: 145
diff changeset
   199
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   200
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   201
claus
parents: 145
diff changeset
   202
       top add:v1.
claus
parents: 145
diff changeset
   203
       top add:v2.
claus
parents: 145
diff changeset
   204
claus
parents: 145
diff changeset
   205
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   206
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   207
claus
parents: 145
diff changeset
   208
       top open
claus
parents: 145
diff changeset
   209
claus
parents: 145
diff changeset
   210
claus
parents: 145
diff changeset
   211
    fixed origin, variable size:
claus
parents: 145
diff changeset
   212
claus
parents: 145
diff changeset
   213
       |top v1 v2|
claus
parents: 145
diff changeset
   214
claus
parents: 145
diff changeset
   215
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   216
       top extent:300@300.
claus
parents: 145
diff changeset
   217
claus
parents: 145
diff changeset
   218
       v1 := View new.
claus
parents: 145
diff changeset
   219
       v1 origin:10@10 corner:50@0.5.
claus
parents: 145
diff changeset
   220
claus
parents: 145
diff changeset
   221
       v2 := View new.
claus
parents: 145
diff changeset
   222
       v2 origin:60@10 corner:150@0.5.
claus
parents: 145
diff changeset
   223
claus
parents: 145
diff changeset
   224
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   225
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   226
claus
parents: 145
diff changeset
   227
       top add:v1.
claus
parents: 145
diff changeset
   228
       top add:v2.
claus
parents: 145
diff changeset
   229
claus
parents: 145
diff changeset
   230
       top open
claus
parents: 145
diff changeset
   231
claus
parents: 145
diff changeset
   232
claus
parents: 145
diff changeset
   233
    fixed origin, variable size, 
claus
parents: 145
diff changeset
   234
    bottomInset for constant distance from bottom:
claus
parents: 145
diff changeset
   235
claus
parents: 145
diff changeset
   236
       |top v1 v2|
claus
parents: 145
diff changeset
   237
claus
parents: 145
diff changeset
   238
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   239
       top extent:300@300.
claus
parents: 145
diff changeset
   240
claus
parents: 145
diff changeset
   241
       v1 := View new.
claus
parents: 145
diff changeset
   242
       v1 origin:10@10 corner:50@1.0.
claus
parents: 145
diff changeset
   243
       v1 bottomInset:10.
claus
parents: 145
diff changeset
   244
claus
parents: 145
diff changeset
   245
       v2 := View new.
claus
parents: 145
diff changeset
   246
       v2 origin:60@10 corner:150@1.0.
claus
parents: 145
diff changeset
   247
       v2 bottomInset:10.
claus
parents: 145
diff changeset
   248
claus
parents: 145
diff changeset
   249
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   250
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   251
claus
parents: 145
diff changeset
   252
       top add:v1.
claus
parents: 145
diff changeset
   253
       top add:v2.
claus
parents: 145
diff changeset
   254
claus
parents: 145
diff changeset
   255
       top open
claus
parents: 145
diff changeset
   256
claus
parents: 145
diff changeset
   257
claus
parents: 145
diff changeset
   258
    variable origin, variable size, 
claus
parents: 145
diff changeset
   259
claus
parents: 145
diff changeset
   260
       |top v1 v2|
claus
parents: 145
diff changeset
   261
claus
parents: 145
diff changeset
   262
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   263
       top extent:300@300.
claus
parents: 145
diff changeset
   264
claus
parents: 145
diff changeset
   265
       v1 := View new.
claus
parents: 145
diff changeset
   266
       v1 origin:0.0@0.0 corner:0.5@0.5.
claus
parents: 145
diff changeset
   267
claus
parents: 145
diff changeset
   268
       v2 := View new.
claus
parents: 145
diff changeset
   269
       v2 origin:0.5@0.0 corner:1.0@0.5.
claus
parents: 145
diff changeset
   270
claus
parents: 145
diff changeset
   271
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   272
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   273
claus
parents: 145
diff changeset
   274
       top add:v1.
claus
parents: 145
diff changeset
   275
       top add:v2.
claus
parents: 145
diff changeset
   276
claus
parents: 145
diff changeset
   277
       top open
claus
parents: 145
diff changeset
   278
claus
parents: 145
diff changeset
   279
claus
parents: 145
diff changeset
   280
    variable origin, variable size, 
claus
parents: 145
diff changeset
   281
    insets for some constant distance
claus
parents: 145
diff changeset
   282
claus
parents: 145
diff changeset
   283
       |top v1 v2|
claus
parents: 145
diff changeset
   284
claus
parents: 145
diff changeset
   285
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   286
       top extent:300@300.
claus
parents: 145
diff changeset
   287
claus
parents: 145
diff changeset
   288
       v1 := View new.
claus
parents: 145
diff changeset
   289
       v1 origin:0.0@0.0 corner:0.5@0.5.
claus
parents: 145
diff changeset
   290
       v1 rightInset:5.
claus
parents: 145
diff changeset
   291
claus
parents: 145
diff changeset
   292
       v2 := View new.
claus
parents: 145
diff changeset
   293
       v2 origin:0.5@0.0 corner:1.0@0.5.
claus
parents: 145
diff changeset
   294
       v2 leftInset:5.
claus
parents: 145
diff changeset
   295
claus
parents: 145
diff changeset
   296
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   297
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   298
claus
parents: 145
diff changeset
   299
       top add:v1.
claus
parents: 145
diff changeset
   300
       top add:v2.
claus
parents: 145
diff changeset
   301
claus
parents: 145
diff changeset
   302
       top open
claus
parents: 145
diff changeset
   303
claus
parents: 145
diff changeset
   304
claus
parents: 145
diff changeset
   305
    using layout objects (ST-80 style):
claus
parents: 145
diff changeset
   306
    fully specifying the frame
claus
parents: 145
diff changeset
   307
claus
parents: 145
diff changeset
   308
       |top v1 v2|
claus
parents: 145
diff changeset
   309
claus
parents: 145
diff changeset
   310
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   311
       top extent:300@300.
claus
parents: 145
diff changeset
   312
claus
parents: 145
diff changeset
   313
       v1 := View new.
claus
parents: 145
diff changeset
   314
       v2 := View new.
claus
parents: 145
diff changeset
   315
claus
parents: 145
diff changeset
   316
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   317
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   318
claus
parents: 145
diff changeset
   319
       top add:v1 in:(LayoutFrame new
claus
parents: 145
diff changeset
   320
			leftFraction:0.25;
claus
parents: 145
diff changeset
   321
			rightFraction:0.75;
claus
parents: 145
diff changeset
   322
			topFraction:0.0;
claus
parents: 145
diff changeset
   323
			bottomFraction:0.5).
claus
parents: 145
diff changeset
   324
       top add:v2 in:(LayoutFrame new
claus
parents: 145
diff changeset
   325
			leftFraction:0.5;
claus
parents: 145
diff changeset
   326
			rightFraction:1.0;
claus
parents: 145
diff changeset
   327
			topFraction:0.5;
claus
parents: 145
diff changeset
   328
			bottomFraction:0.75).
claus
parents: 145
diff changeset
   329
claus
parents: 145
diff changeset
   330
       top open
claus
parents: 145
diff changeset
   331
claus
parents: 145
diff changeset
   332
claus
parents: 145
diff changeset
   333
    another one, with offsets:
claus
parents: 145
diff changeset
   334
claus
parents: 145
diff changeset
   335
       |top v1 v2|
claus
parents: 145
diff changeset
   336
claus
parents: 145
diff changeset
   337
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   338
       top extent:300@300.
claus
parents: 145
diff changeset
   339
claus
parents: 145
diff changeset
   340
       v1 := View new.
claus
parents: 145
diff changeset
   341
       v2 := View new.
claus
parents: 145
diff changeset
   342
claus
parents: 145
diff changeset
   343
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   344
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   345
claus
parents: 145
diff changeset
   346
       top add:v1 in:(LayoutFrame new
claus
parents: 145
diff changeset
   347
			leftFraction:0.0 offset:10;
claus
parents: 145
diff changeset
   348
			rightFraction:1.0 offset:-10;
claus
parents: 145
diff changeset
   349
			topFraction:0.0 offset:10;
claus
parents: 145
diff changeset
   350
			bottomFraction:0.5).
claus
parents: 145
diff changeset
   351
       top add:v2 in:(LayoutFrame new
claus
parents: 145
diff changeset
   352
			leftFraction:0.0 offset:30;
claus
parents: 145
diff changeset
   353
			rightFraction:1.0 offset:-30;
claus
parents: 145
diff changeset
   354
			topFraction:0.5 offset:10;
claus
parents: 145
diff changeset
   355
			bottomFraction:0.75).
claus
parents: 145
diff changeset
   356
claus
parents: 145
diff changeset
   357
       top open
claus
parents: 145
diff changeset
   358
claus
parents: 145
diff changeset
   359
claus
parents: 145
diff changeset
   360
    specifying origin only. Extent is views preferred
claus
parents: 145
diff changeset
   361
    (notice, that plain views have some defaultExtent of 100@100)
claus
parents: 145
diff changeset
   362
claus
parents: 145
diff changeset
   363
       |top v1 v2|
claus
parents: 145
diff changeset
   364
claus
parents: 145
diff changeset
   365
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   366
       top extent:300@300.
claus
parents: 145
diff changeset
   367
claus
parents: 145
diff changeset
   368
       v1 := View new.
claus
parents: 145
diff changeset
   369
       v2 := View new.
claus
parents: 145
diff changeset
   370
claus
parents: 145
diff changeset
   371
       v1 viewBackground:(Color red).
claus
parents: 145
diff changeset
   372
       v2 viewBackground:(Color yellow).
claus
parents: 145
diff changeset
   373
claus
parents: 145
diff changeset
   374
       top add:v1 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   375
			leftFraction:0.25;
claus
parents: 145
diff changeset
   376
			topFraction:0.0).
claus
parents: 145
diff changeset
   377
       top add:v2 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   378
			leftFraction:0.5;
claus
parents: 145
diff changeset
   379
			topFraction:0.5).
claus
parents: 145
diff changeset
   380
claus
parents: 145
diff changeset
   381
       top open
claus
parents: 145
diff changeset
   382
claus
parents: 145
diff changeset
   383
    same example, using buttons which compute their preferredBounds:
claus
parents: 145
diff changeset
   384
claus
parents: 145
diff changeset
   385
       |top v1 v2|
claus
parents: 145
diff changeset
   386
claus
parents: 145
diff changeset
   387
       top := StandardSystemView new.
claus
parents: 145
diff changeset
   388
       top extent:300@300.
claus
parents: 145
diff changeset
   389
claus
parents: 145
diff changeset
   390
       v1 := Button label:'foo'.
claus
parents: 145
diff changeset
   391
       v2 := Button label:'a very long buttonLabel'.
claus
parents: 145
diff changeset
   392
claus
parents: 145
diff changeset
   393
       v1 backgroundColor:(Color red).
claus
parents: 145
diff changeset
   394
       v2 backgroundColor:(Color yellow).
claus
parents: 145
diff changeset
   395
claus
parents: 145
diff changeset
   396
       top add:v1 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   397
			leftFraction:0.25;
claus
parents: 145
diff changeset
   398
			topFraction:0.0).
claus
parents: 145
diff changeset
   399
       top add:v2 in:(LayoutOrigin new
claus
parents: 145
diff changeset
   400
			leftFraction:0.5;
claus
parents: 145
diff changeset
   401
			topFraction:0.5).
claus
parents: 145
diff changeset
   402
claus
parents: 145
diff changeset
   403
       top open
claus
parents: 145
diff changeset
   404
claus
parents: 145
diff changeset
   405
"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   406
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   407
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   408
layoutComputation 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   409
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   410
    Due to historic reasons, there are 2 mechanisms to resize a view:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   411
	- (old, to be eliminated mechanism)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   412
	    based upon info found in 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   413
		relativeOrigin / relativeCorner / relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   414
		originRule / cornerRule / extentRule
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   415
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   416
	- (new, will migrate to that one)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   417
	    letting a layoutObject compute things
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   418
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   419
    Actually, the old mechanism is just as powerful, as the new (layoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   420
    based) mechanism; with the help of block=rules, you can compute whatever
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   421
    geometry is desired.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   422
    However, having 6 instance variables in every view creates some overhead,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   423
    which can be avoided in most cases (most views are either fixed-size or
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   424
    relative-sized).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   425
    Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   426
    to use layoutObjects.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   427
    You will not see a difference at the views protocol level, since
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   428
    existing interfaces will (silently) create layoutObjects as appropriate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   429
    However, you should remove all direct accesses to the above mentioned
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   430
    instance variables, to be prepared for that change.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   431
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   432
    Notice, that a view recomputes its size whenever its superview
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   433
    changes size. This is done via:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   434
	sizeChanged
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   435
	    -> allSubviews: superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   436
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   437
    If the geometry computation as performed in superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   438
    is not powerful enough for your application, you can either:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   439
	- redefine superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   440
	- create a special layoutObject which computes a new layout.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   441
"
135
claus
parents:
diff changeset
   442
! !
claus
parents:
diff changeset
   443
claus
parents:
diff changeset
   444
!SimpleView class methodsFor:'initialization'!
claus
parents:
diff changeset
   445
claus
parents:
diff changeset
   446
initialize
claus
parents:
diff changeset
   447
    DefaultStyle isNil ifTrue:[
claus
parents:
diff changeset
   448
	Font initialize.
claus
parents:
diff changeset
   449
	Form initialize.
claus
parents:
diff changeset
   450
	Color initialize.
claus
parents:
diff changeset
   451
claus
parents:
diff changeset
   452
	Display notNil ifTrue:[
claus
parents:
diff changeset
   453
	    self defaultStyle:#normal.
claus
parents:
diff changeset
   454
	].
claus
parents:
diff changeset
   455
claus
parents:
diff changeset
   456
"/    self updateStyleCache.
claus
parents:
diff changeset
   457
	self == SimpleView ifTrue:[
claus
parents:
diff changeset
   458
	    Smalltalk addDependent:self   "/ to get language changes
claus
parents:
diff changeset
   459
	]
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   460
    ].
365
347a478d8cf5 default returnFocus to false
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
   461
    ReturnFocusWhenClosingModalBoxes := false.
135
claus
parents:
diff changeset
   462
!
claus
parents:
diff changeset
   463
claus
parents:
diff changeset
   464
postAutoload
claus
parents:
diff changeset
   465
    self updateStyleCache.
claus
parents:
diff changeset
   466
! !
claus
parents:
diff changeset
   467
claus
parents:
diff changeset
   468
!SimpleView class methodsFor:'instance creation'!
claus
parents:
diff changeset
   469
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   470
extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   471
    "create a new view with given extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   472
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   473
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   474
		      font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   475
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   476
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   477
extent:extent in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   478
    "create a new view as a subview of aView with given extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   479
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   480
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   481
		      font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   482
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   483
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   484
extent:extent label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   485
    "create a new view with given extent and label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   486
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   487
    ^ self origin:nil extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   488
		      font:nil label:label in:nil
135
claus
parents:
diff changeset
   489
!
claus
parents:
diff changeset
   490
claus
parents:
diff changeset
   491
in:aView
claus
parents:
diff changeset
   492
    "return a new view as a subview of aView.
claus
parents:
diff changeset
   493
     If aView is nil, it is left unspecified, in which superview
claus
parents:
diff changeset
   494
     the new view will be placed. The view can later be assigned
claus
parents:
diff changeset
   495
     by adding it to the superview via #addSubView:.
claus
parents:
diff changeset
   496
     If realized and no superview has ever been set, it will come
claus
parents:
diff changeset
   497
     up as a topview."
claus
parents:
diff changeset
   498
claus
parents:
diff changeset
   499
    |newView|
claus
parents:
diff changeset
   500
claus
parents:
diff changeset
   501
    newView := self basicNew.
claus
parents:
diff changeset
   502
    aView notNil ifTrue:[
claus
parents:
diff changeset
   503
	newView device:(aView device).
claus
parents:
diff changeset
   504
	newView superView:aView.
claus
parents:
diff changeset
   505
    ] ifFalse:[
151
claus
parents: 145
diff changeset
   506
	newView device:Screen current "Display"
135
claus
parents:
diff changeset
   507
    ].
claus
parents:
diff changeset
   508
    newView initialize.
claus
parents:
diff changeset
   509
    aView notNil ifTrue:[aView addSubView:newView].
claus
parents:
diff changeset
   510
    ^ newView
claus
parents:
diff changeset
   511
!
claus
parents:
diff changeset
   512
140
claus
parents: 138
diff changeset
   513
label:label
claus
parents: 138
diff changeset
   514
    "create a new view with given label"
135
claus
parents:
diff changeset
   515
claus
parents:
diff changeset
   516
    ^ self origin:nil extent:nil borderWidth:nil
140
claus
parents: 138
diff changeset
   517
		      font:nil label:label in:nil
claus
parents: 138
diff changeset
   518
!
claus
parents: 138
diff changeset
   519
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   520
label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   521
    "create a new view as subview of aView with given label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   522
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   523
    ^ self origin:nil extent:nil borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   524
		      font:nil label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   525
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   526
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   527
on:aModel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   528
    "create a new drawable on aModel"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   529
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   530
    "although this one does not know about models,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   531
     it can still send the model-assign message. This was done
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   532
     to catch obsolete calls to on:aDevice.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   533
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   534
    ^ self new model:aModel.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   535
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   536
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   537
onSameDeviceAs:anotherView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   538
    "create a view on the same device as anotherView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   539
     Used with popUpMenus, which should be created on the device of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   540
     its masterView."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   541
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   542
    |device|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   543
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   544
    anotherView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   545
	device := anotherView device.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   546
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   547
	device := Screen current "Display".
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   548
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   549
    ^ self onDevice:device
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   550
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   551
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   552
origin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   553
    "create a new view with given origin and extent"
135
claus
parents:
diff changeset
   554
140
claus
parents: 138
diff changeset
   555
    ^ self origin:origin corner:corner borderWidth:nil
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   556
			 font:nil label:nil in:nil
135
claus
parents:
diff changeset
   557
!
claus
parents:
diff changeset
   558
claus
parents:
diff changeset
   559
origin:anOrigin corner:aCorner borderWidth:bw font:aFont label:aLabel in:aView
claus
parents:
diff changeset
   560
    |newView|
claus
parents:
diff changeset
   561
claus
parents:
diff changeset
   562
    aView notNil ifTrue:[
claus
parents:
diff changeset
   563
	newView := self basicNew.
claus
parents:
diff changeset
   564
	newView device:(aView device).
376
2c81dc024e73 initialize views BEFORE sending addSubView to superview
ah
parents: 372
diff changeset
   565
	newView initialize.
135
claus
parents:
diff changeset
   566
	aView addSubView:newView.
claus
parents:
diff changeset
   567
    ] ifFalse:[
151
claus
parents: 145
diff changeset
   568
	newView := self onDevice:Screen current "Display"
135
claus
parents:
diff changeset
   569
    ].
claus
parents:
diff changeset
   570
    bw notNil ifTrue:[newView borderWidth:bw].
claus
parents:
diff changeset
   571
    anOrigin notNil ifTrue:[newView origin:anOrigin].
claus
parents:
diff changeset
   572
    aCorner notNil ifTrue:[newView corner:aCorner].
claus
parents:
diff changeset
   573
    aFont notNil ifTrue:[newView font:aFont].
claus
parents:
diff changeset
   574
    aLabel notNil ifTrue:[newView label:aLabel].
claus
parents:
diff changeset
   575
    ^ newView
claus
parents:
diff changeset
   576
!
claus
parents:
diff changeset
   577
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   578
origin:origin corner:corner borderWidth:bw in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   579
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   580
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   581
    ^ self origin:origin corner:corner borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   582
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   583
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   584
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   585
origin:origin corner:corner in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   586
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   587
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   588
    ^ self origin:origin corner:corner borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   589
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   590
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   591
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   592
origin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   593
    "create a new view with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   594
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   595
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   596
			 font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   597
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   598
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   599
origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   600
    "create a new view with given origin, extent and borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   601
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   602
    ^ self origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   603
			 font:nil label:nil in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   604
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   605
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   606
origin:anOrigin extent:anExtent borderWidth:bw font:aFont label:aLabel in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   607
    |newView|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   608
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   609
    aView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   610
	newView := self basicNew.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   611
	newView device:(aView device).
376
2c81dc024e73 initialize views BEFORE sending addSubView to superview
ah
parents: 372
diff changeset
   612
	newView initialize.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   613
	aView addSubView:newView.
140
claus
parents: 138
diff changeset
   614
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   615
	newView := self onDevice:Screen current "Display"
140
claus
parents: 138
diff changeset
   616
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   617
    bw notNil ifTrue:[newView borderWidth:bw].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   618
    anExtent notNil ifTrue:[newView extent:anExtent].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   619
    anOrigin notNil ifTrue:[newView origin:anOrigin].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   620
    aFont notNil ifTrue:[newView font:aFont].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   621
    aLabel notNil ifTrue:[newView label:aLabel].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   622
    ^ newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   623
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   624
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   625
origin:origin extent:extent borderWidth:bw in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   626
    "create a new view as a subview of aView with given origin, extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   627
     and borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   628
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   629
    ^ self origin:origin extent:extent borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   630
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   631
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   632
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   633
origin:origin extent:extent font:aFont label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   634
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   635
			 font:nil label:label in:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   636
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   637
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   638
origin:origin extent:extent font:aFont label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   639
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   640
			 font:aFont label:label in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   641
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   642
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   643
origin:origin extent:extent in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   644
    "create a new view as a subview of aView with given origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   645
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   646
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   647
			 font:nil label:nil in:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   648
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   649
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   650
origin:origin extent:extent label:label
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   651
    "create a new view with given origin, extent and label"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   652
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   653
    ^ self origin:origin extent:extent borderWidth:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   654
			 font:nil label:label in:nil
135
claus
parents:
diff changeset
   655
!
claus
parents:
diff changeset
   656
claus
parents:
diff changeset
   657
origin:anOrigin extent:anExtent
claus
parents:
diff changeset
   658
		label:aLabel icon:aForm
claus
parents:
diff changeset
   659
		minExtent:minExtent maxExtent:maxExtent
claus
parents:
diff changeset
   660
    |newView|
claus
parents:
diff changeset
   661
151
claus
parents: 145
diff changeset
   662
    newView := self onDevice:Screen current "Display".
135
claus
parents:
diff changeset
   663
    anOrigin notNil ifTrue:[newView origin:anOrigin].
claus
parents:
diff changeset
   664
    anExtent notNil ifTrue:[newView extent:anExtent].
claus
parents:
diff changeset
   665
    aLabel notNil ifTrue:[newView label:aLabel].
claus
parents:
diff changeset
   666
    aForm notNil ifTrue:[newView icon:aForm].
claus
parents:
diff changeset
   667
    minExtent notNil ifTrue:[newView minExtent:minExtent].
claus
parents:
diff changeset
   668
    maxExtent notNil ifTrue:[newView maxExtent:maxExtent].
claus
parents:
diff changeset
   669
    ^ newView
claus
parents:
diff changeset
   670
!
claus
parents:
diff changeset
   671
140
claus
parents: 138
diff changeset
   672
origin:origin in:aView
claus
parents: 138
diff changeset
   673
    "create a new view as a subview of aView with given origin"
claus
parents: 138
diff changeset
   674
claus
parents: 138
diff changeset
   675
    ^ self origin:origin extent:nil borderWidth:nil
claus
parents: 138
diff changeset
   676
			 font:nil label:nil in:aView
135
claus
parents:
diff changeset
   677
! !
claus
parents:
diff changeset
   678
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   679
!SimpleView class methodsFor:'change & update'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   680
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   681
update:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   682
    something == #Language ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   683
	"flush resources on language changes"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   684
	self flushAllClassResources
135
claus
parents:
diff changeset
   685
    ]
claus
parents:
diff changeset
   686
! !
claus
parents:
diff changeset
   687
claus
parents:
diff changeset
   688
!SimpleView class methodsFor:'defaults'!
claus
parents:
diff changeset
   689
140
claus
parents: 138
diff changeset
   690
defaultExtent
claus
parents: 138
diff changeset
   691
    "define the default extent"
claus
parents: 138
diff changeset
   692
claus
parents: 138
diff changeset
   693
    CentPoint isNil ifTrue:[CentPoint := 100 @ 100].
claus
parents: 138
diff changeset
   694
    ^ CentPoint
claus
parents: 138
diff changeset
   695
!
claus
parents: 138
diff changeset
   696
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   697
defaultFont
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   698
    DefaultFont notNil ifTrue:[^ DefaultFont].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   699
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   700
    DefaultFont isNil ifTrue:[
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   701
	self == SimpleView ifFalse:[
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   702
	    DefaultFont := self superclass defaultFont.
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   703
	] ifTrue:[
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   704
	    DefaultFont := super defaultFont
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   705
	].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   706
    ].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   707
    DefaultFont notNil ifTrue:[DefaultFont := DefaultFont on:Display].
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   708
    ^ DefaultFont
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   709
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   710
450
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   711
defaultFont:aFont
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   712
    "set the default font used for drawing"
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   713
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   714
    DefaultFont := aFont on:Display
450
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   715
!
9eb6198de8f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 433
diff changeset
   716
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   717
defaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   718
    "return the default view style"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   719
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   720
    ^ DefaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   721
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   722
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   723
     View defaultStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   724
    "
135
claus
parents:
diff changeset
   725
!
claus
parents:
diff changeset
   726
claus
parents:
diff changeset
   727
defaultStyle:aStyle
claus
parents:
diff changeset
   728
    "set the view style for new views"
claus
parents:
diff changeset
   729
180
claus
parents: 176
diff changeset
   730
"/    aStyle ~~ DefaultStyle ifTrue:[
135
claus
parents:
diff changeset
   731
	DefaultStyle := aStyle.
claus
parents:
diff changeset
   732
	self updateAllStyleCaches.
180
claus
parents: 176
diff changeset
   733
"/    ]
135
claus
parents:
diff changeset
   734
claus
parents:
diff changeset
   735
    "
claus
parents:
diff changeset
   736
     View defaultStyle:#next. SystemBrowser start
claus
parents:
diff changeset
   737
     View defaultStyle:#motif. SystemBrowser start
claus
parents:
diff changeset
   738
     View defaultStyle:#iris. SystemBrowser start
claus
parents:
diff changeset
   739
     View defaultStyle:#st80. SystemBrowser start
claus
parents:
diff changeset
   740
     View defaultStyle:#normal. SystemBrowser start
claus
parents:
diff changeset
   741
    "
claus
parents:
diff changeset
   742
!
claus
parents:
diff changeset
   743
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   744
returnFocusWhenClosingModalBoxes
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   745
    "return the current focus-return behavior.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   746
     See #returnFocusWhenClosingModalBoxes: for a description."
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   747
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   748
    ^ ReturnFocusWhenClosingModalBoxes
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   749
!
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   750
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   751
returnFocusWhenClosingModalBoxes:aBoolean
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   752
    "control the keyboard-focus behavior when a modal dialog
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   753
     is closed. The default (true) is to return the focus to the view
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   754
     which was active when the dialog was opened.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   755
     If false, it is left up to the display to set the focus.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   756
     For owm / ovwm (which requires an explicit click for the focus),
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   757
     it is better to return the focus automatically.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   758
     For managers which assign the focus according the pointer position,
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   759
     it may be better to turn the focus-return off.
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   760
     You should add a corresponding expression into your private.rc or 
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   761
     display.rc file."
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   762
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   763
    ReturnFocusWhenClosingModalBoxes := aBoolean
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   764
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   765
    "
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   766
     Dialog returnFocusWhenClosingModalBoxes:false
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   767
     Dialog returnFocusWhenClosingModalBoxes:true
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   768
    "
362
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   769
!
0fa4bc6ad8d1 allow setting of dialog-focus behavior
ca
parents: 358
diff changeset
   770
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   771
styleSheet:aViewStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   772
    "set the view style from a style-sheet"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   773
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   774
    StyleSheet := aViewStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   775
    DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   776
    self updateAllStyleCaches.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   777
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   778
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   779
updateAllStyleCaches
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   780
    "reload all style caches in all view classes.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   781
     Needed after a style change or when a style file has been changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   782
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   783
    StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   784
    StyleSheet fileReadFailed ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   785
	('***** WARNING: no styleSheet for ' , DefaultStyle , '-style.') errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   786
	DefaultStyle ~~ #normal ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   787
	    DefaultStyle := #normal.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   788
	    StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   789
        
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   790
	    StyleSheet fileReadFailed ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   791
		'***** WARNING: not even a styleSheet for normal-style (using defaults).' errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   792
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   793
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   794
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   795
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   796
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   797
     tell all view classes to flush any
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   798
     cached style-data
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   799
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   800
    self changed:#style.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   801
    SimpleView updateStyleCache.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   802
    SimpleView allSubclassesDo:[:aClass |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   803
	(aClass class implements:#updateStyleCache) ifTrue:[aClass updateStyleCache].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   804
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   805
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   806
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   807
     View updateAllStyleCaches
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   808
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   809
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   810
135
claus
parents:
diff changeset
   811
updateStyleCache
claus
parents:
diff changeset
   812
    "this method gets some heavily used style stuff and keeps
claus
parents:
diff changeset
   813
     it in class-variables for faster access.
claus
parents:
diff changeset
   814
     Subclasses should redefine this to load any cached style-values
claus
parents:
diff changeset
   815
     into faster class variables as well. These should NOT do a 
claus
parents:
diff changeset
   816
     super updateStyleCache, since this method is called for all view-classes
claus
parents:
diff changeset
   817
     anyway."
claus
parents:
diff changeset
   818
claus
parents:
diff changeset
   819
    |bgGrey|
claus
parents:
diff changeset
   820
claus
parents:
diff changeset
   821
    "
claus
parents:
diff changeset
   822
     when coming here the first time, we read the styleSheet
claus
parents:
diff changeset
   823
     and keep the values in fast class variables
claus
parents:
diff changeset
   824
    "
claus
parents:
diff changeset
   825
    StyleSheet isNil ifTrue:[
claus
parents:
diff changeset
   826
	DefaultStyle := #normal.
claus
parents:
diff changeset
   827
	StyleSheet := ViewStyle fromFile:'normal.style'.
claus
parents:
diff changeset
   828
    ].
claus
parents:
diff changeset
   829
claus
parents:
diff changeset
   830
    Grey := StyleSheet viewGrey.
claus
parents:
diff changeset
   831
    Grey isNil ifTrue:[
claus
parents:
diff changeset
   832
	Grey := Color grey
claus
parents:
diff changeset
   833
    ].
claus
parents:
diff changeset
   834
    Grey := Grey on:Display.
claus
parents:
diff changeset
   835
151
claus
parents: 145
diff changeset
   836
    StyleSheet fileReadFailed ifTrue:[
claus
parents: 145
diff changeset
   837
	bgGrey := White
135
claus
parents:
diff changeset
   838
    ] ifFalse:[
151
claus
parents: 145
diff changeset
   839
	Display hasGreyscales ifTrue:[
claus
parents: 145
diff changeset
   840
	    bgGrey := Grey
claus
parents: 145
diff changeset
   841
	] ifFalse:[
claus
parents: 145
diff changeset
   842
	    bgGrey := White 
claus
parents: 145
diff changeset
   843
	]
135
claus
parents:
diff changeset
   844
    ].
151
claus
parents: 145
diff changeset
   845
    bgGrey := bgGrey on:Display.
135
claus
parents:
diff changeset
   846
claus
parents:
diff changeset
   847
    ViewSpacing := StyleSheet at:'viewSpacing'.
claus
parents:
diff changeset
   848
    ViewSpacing isNil ifTrue:[
claus
parents:
diff changeset
   849
	ViewSpacing := Display verticalPixelPerMillimeter rounded.
claus
parents:
diff changeset
   850
    ].
claus
parents:
diff changeset
   851
claus
parents:
diff changeset
   852
    DefaultBorderColor := StyleSheet colorAt:'borderColor' default:Black.
151
claus
parents: 145
diff changeset
   853
claus
parents: 145
diff changeset
   854
    StyleSheet fileReadFailed ifTrue:[
claus
parents: 145
diff changeset
   855
	DefaultBorderWidth := 1.
claus
parents: 145
diff changeset
   856
	DefaultShadowColor := Black.
claus
parents: 145
diff changeset
   857
	DefaultLightColor :=  White.
claus
parents: 145
diff changeset
   858
	DefaultFocusColor := Black.
claus
parents: 145
diff changeset
   859
	DefaultFocusBorderWidth := 2.
claus
parents: 145
diff changeset
   860
	DefaultViewBackgroundColor := bgGrey.
claus
parents: 145
diff changeset
   861
    ] ifFalse:[
claus
parents: 145
diff changeset
   862
	DefaultBorderWidth := StyleSheet at:'borderWidth' default:0.
claus
parents: 145
diff changeset
   863
	DefaultViewBackgroundColor := StyleSheet colorAt:'viewBackground' default:bgGrey.
claus
parents: 145
diff changeset
   864
	DefaultShadowColor := StyleSheet colorAt:'shadowColor'.
claus
parents: 145
diff changeset
   865
	DefaultLightColor := StyleSheet colorAt:'lightColor'.
claus
parents: 145
diff changeset
   866
	DefaultFocusColor := StyleSheet colorAt:'focusColor' default:Color red.
claus
parents: 145
diff changeset
   867
	DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
claus
parents: 145
diff changeset
   868
    ].
135
claus
parents:
diff changeset
   869
claus
parents:
diff changeset
   870
    DefaultFont := StyleSheet at:'font'.
claus
parents:
diff changeset
   871
    DefaultFont isNil ifTrue:[
claus
parents:
diff changeset
   872
	DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
claus
parents:
diff changeset
   873
    ].
claus
parents:
diff changeset
   874
claus
parents:
diff changeset
   875
    DefaultFont := DefaultFont on:Display.
claus
parents:
diff changeset
   876
claus
parents:
diff changeset
   877
    DefaultViewBackgroundColor isNil ifTrue:[
claus
parents:
diff changeset
   878
	'bad viewBackground in style - using white' errorPrintNL.
claus
parents:
diff changeset
   879
	DefaultViewBackgroundColor := White
claus
parents:
diff changeset
   880
    ].
claus
parents:
diff changeset
   881
!
claus
parents:
diff changeset
   882
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   883
viewSpacing
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   884
    "return a convenient number of pixels used to separate views (usually 1mm).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   885
     Having this value here at a common place makes certain that all views
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   886
     get a common look"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   887
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   888
    ^ ViewSpacing
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   889
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   890
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   891
!SimpleView class methodsFor:'resources'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   892
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   893
classResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   894
    "if not already loaded, get the classes resourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   895
     and return it"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   896
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   897
    ClassResources isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   898
	ClassResources := ResourcePack for:self.
140
claus
parents: 138
diff changeset
   899
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   900
    ^ ClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   901
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   902
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   903
classResources:aResourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   904
    "allow setting of the classResources"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   905
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   906
    ClassResources := aResourcePack
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   907
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   908
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   909
flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   910
    "flush all classes resource translations.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   911
     Needed after a resource file has changed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   912
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   913
    ResourcePack flushCachedResourcePacks.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   914
    SimpleView flushClassResources.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   915
    SimpleView allSubclasses do:[:aClass |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   916
	aClass flushClassResources.
140
claus
parents: 138
diff changeset
   917
    ]
claus
parents: 138
diff changeset
   918
claus
parents: 138
diff changeset
   919
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   920
     View flushAllClassResources
140
claus
parents: 138
diff changeset
   921
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   922
    "to change the language:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   923
	Language := #english.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   924
	Smalltalk changed:#Language.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   925
	View flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   926
     or:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   927
	Language := #german.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   928
	Smalltalk changed:#Language.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   929
	View flushAllClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   930
    "     
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   931
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   932
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   933
flushClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   934
    "flush classes resource string translations.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   935
     Needed whenever a resource file or language has changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   937
    ClassResources := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   938
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   939
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   940
updateClassResources
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   941
    "flush classes resource string translations and reload them.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   942
     Needed whenever a resource file or language has changed"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   943
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   944
    ClassResources := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   945
    self classResources
135
claus
parents:
diff changeset
   946
! !
claus
parents:
diff changeset
   947
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   948
!SimpleView methodsFor:'ST-80 compatibility'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   949
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   950
checkForEvents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   951
    (shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   952
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   953
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   954
sensor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   955
    "return the views sensor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   956
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   957
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   958
	^ windowGroup sensor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   959
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
   960
    ^ nil
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   961
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   962
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   963
viewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   964
    "return my viewport.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   965
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   966
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   967
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   968
    ^ viewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   969
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   970
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   971
viewport:aRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   972
    "define my extend in my superviews coordinate-system.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   973
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   974
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   975
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   976
    viewport := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   977
    self dimensionFromViewport
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   978
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   979
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   980
window
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   981
    "return my window (i.e. logical coordinate space).
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   982
     If there is no window, return the extent.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   983
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   984
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   985
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   986
    window isNil ifTrue:[^ width @ height].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   987
    ^ window
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   988
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   989
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   990
window:aRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   991
    "define my window (i.e. logical coordinate space).
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   992
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   993
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   994
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   995
    window := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   996
    subViews notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   997
	subViews do:[:s |
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   998
	    s superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   999
	]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1000
    ]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1001
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1002
"/    viewport isNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1003
"/        viewport := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1004
"/    ].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1005
"/    superView notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1006
"/        self superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1007
"/    ] ifFalse:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1008
"/        originChanged := true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1009
"/        extentChanged := true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1010
"/    ]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1011
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1012
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1013
window:aRectangle viewport:vRect
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1014
    "set the window and viewport.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1015
     WARNING: this is for backward compatibility with ST-80 rel2.x.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1016
	      dont use viewports and windows (use a transformation instead)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1017
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1018
    window := aRectangle.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1019
    self viewport:vRect.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1020
    subViews notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1021
	subViews do:[:s |
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1022
	    s superViewChangedSize
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1023
	]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1024
    ]
151
claus
parents: 145
diff changeset
  1025
! !
claus
parents: 145
diff changeset
  1026
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1027
!SimpleView methodsFor:'accessing-bg & border'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1028
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1029
borderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1030
    "return my borderColor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1031
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1032
    ^ borderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1033
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1034
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1035
borderColor:aColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1036
    "set my borderColor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1037
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1038
    (aColor ~~ borderColor) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1039
	borderColor := aColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1040
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1041
	    self setBorderColor
135
claus
parents:
diff changeset
  1042
	]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1043
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1044
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1045
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1046
borderShape:aForm
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1047
    "set the borderShape to aForm"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1048
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1049
    borderShape := aForm.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1050
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1051
	device setWindowBorderShape:(aForm id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1052
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1053
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1054
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1055
borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1056
    "return my borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1057
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1058
    ^ borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1059
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1060
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1061
borderWidth:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1062
    "set my borderWidth"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1063
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1064
    (aNumber ~~ borderWidth) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1065
	borderWidth := aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1066
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1067
	    device setWindowBorderWidth:aNumber in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1068
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1069
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1070
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1071
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1072
level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1073
    "return my level relative to superView (3D)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1074
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1075
    ^ level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1076
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1077
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1078
level:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1079
    "set my level relative to superView (3D)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1080
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1081
    |oldMargin how|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1082
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1083
    (aNumber ~~ level and:[aNumber notNil]) ifTrue:[
433
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1084
        self is3D ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1085
            level := aNumber.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1086
            oldMargin := margin.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1087
            margin := level abs.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1088
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1089
            realized ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1090
                margin ~~ oldMargin ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1091
                    (margin > oldMargin) ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1092
                        how := #smaller
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1093
                    ] ifFalse:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1094
                        how := #larger
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1095
                    ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1096
                    self sizeChanged:how.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1097
                    self setInnerClip.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1098
                ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1099
                shown ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1100
                    margin ~~ oldMargin ifTrue:[
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1101
                        self clear.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1102
                        self redrawX:margin y:margin
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1103
                               width:width-(margin*2) 
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1104
                              height:height-(margin*2)
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1105
                    ].
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1106
                    self redrawEdges.
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1107
               ]
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1108
            ]
d61b4ce6f578 correctly handle level changes if abs(lvl) changes
ca
parents: 426
diff changeset
  1109
        ]
135
claus
parents:
diff changeset
  1110
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1111
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1112
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1113
lightColor:aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1114
    "set the color to be used for lighted edges (3D only)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1115
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1116
    lightColor := aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1117
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1118
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1119
margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1120
    "return my margin - this is usually the level,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1121
     but can be more for some views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1122
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1123
    ^ margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1124
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1125
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1126
shadowColor:aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1127
    "set the color to be used for shadowed edges (3D only)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1128
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1129
    shadowColor := aColorOrImage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1130
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1131
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1132
viewBackground:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1133
    "set the viewBackground to something, a color, image or form.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1134
     If its a color and we run on a color display, also set shadow and light
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1135
     colors - this means, that a red view will get light-red and dark-red
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1136
     edges."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1137
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1138
    something isColor ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1139
	device hasGreyscales ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1140
	    shadowColor := something darkened.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1141
	    lightColor := something lightened
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1142
	]
135
claus
parents:
diff changeset
  1143
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1144
    super viewBackground:something
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1145
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1146
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1147
viewShape:aForm
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1148
    "set the viewShape to aForm"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1149
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1150
    viewShape := aForm.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1151
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1152
	device setWindowShape:(aForm id) in:drawableId
135
claus
parents:
diff changeset
  1153
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1154
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1155
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1156
!SimpleView methodsFor:'accessing-contents'!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1157
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1158
heightOfContents
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1159
    "return the height of the contents in logical units 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1160
     - defaults to views visible area here.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1161
    This method MUST be redefined in all view classess which are
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1162
    going to be scrolled AND show data which has different size than
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1163
    the view. For example, a view showing A4-size documents should return
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1164
    the number of vertical pixels such a document has on this device.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1165
    A view showing a bitmap of height 1000 should return 1000.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1166
    If not redefined, scrollbars have no way of knowing the actual size
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1167
    of the contents being shown. This is called by scrollBars to compute
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1168
    the relative height of the document vs. the views actual size.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1169
    The value returned here must be based on a scale of 1, since users
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1170
    of this will scale as appropriate."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1171
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1172
    ^ self innerHeight max:(self maxSubViewBottom)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1173
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1174
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1175
widthOfContents
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1176
    "return the width of the contents in logical units 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1177
     - defaults to views visible area here.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1178
    This method MUST be redefined in all view classess which are
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1179
    going to be scrolled AND show data which has different size than
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1180
    the view. For example, a view showing A4-size documents should return
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1181
    the number of horizontal pixels such a document has on this device.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1182
    A view showing a bitmap of width 500 should return 500.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1183
    If not redefined, scrollbars have no way of knowing the actual size
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1184
    of the contents being shown. This is called by scrollBars to compute
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1185
    the relative width of the document vs. the views actual width.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1186
    The value returned here must be based on a scale of 1, since users
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1187
    of this will scale as appropriate."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1188
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1189
    ^ self innerWidth max:(self maxSubViewRight)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1190
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1191
    "Modified: 8.2.1996 / 20:01:50 / cg"
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  1192
! !
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1193
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1194
!SimpleView methodsFor:'accessing-dimensions'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1195
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1196
allInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1197
    "set all insets; positive makes the view smaller,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1198
     negative makes it larger."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1199
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1200
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1201
	insets := Array new:4.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1202
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1203
    insets atAllPut:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1204
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1205
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1206
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1207
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1208
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1209
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1210
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1211
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1212
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1213
bottom
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1214
    "return the y position of the actual bottom edge (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1215
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1216
    ^ top + height - 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1217
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1218
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1219
bottom:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1220
    "set the corners y position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1221
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1222
    self corner:(self corner x @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1223
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1224
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1225
bottomInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1226
    "return the inset of the bottom edge; positive is to the top,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1227
     negative to the bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1228
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1229
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1230
    ^ insets at:4
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1231
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1232
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1233
bottomInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1234
    "set the inset of the bottom edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1235
     positive is to the top (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1236
     negative to the bottom (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1237
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1238
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1239
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1240
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1241
    insets at:4 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1242
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1243
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1244
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1245
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1246
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1247
	self superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1248
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1249
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1250
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1251
center
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1252
    "return the point at the center of the receiver (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1253
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1254
    ^ (left + (width // 2)) @ (top + (height // 2))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1255
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1256
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1257
center:newCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1258
    "move the receiver so that newCenter, aPoint becomes the center point"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1259
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1260
    self origin:(newCenter - ((width // 2) @ (height // 2)))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1261
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1262
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1263
computeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1264
    "compute my corner; if I have a layoutObject,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1265
     relative origins or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1266
     Blocks may return relative values or nil; nil means: take current value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1267
     Returns the corner point in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1268
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1269
    |org newCorner newExt x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1270
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1271
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1272
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1273
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1274
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1275
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1276
			    preferred:(self preferredBounds)) corner rounded
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1277
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1278
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1279
    (cornerRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1280
	newCorner := cornerRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1281
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1282
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1283
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1284
	x := newCorner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1285
	y := newCorner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1286
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1287
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1288
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1289
	    newCorner := self cornerFromRelativeCorner:x@y 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1290
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1291
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1292
	(relativeCorner notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1293
	    newCorner := self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1294
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1295
	    org := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1296
	    (extentRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1297
		newExt := extentRule value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1298
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1299
		(relativeExtent notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1300
		    newExt := self extentFromRelativeExtent:relativeExtent 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1301
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1302
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1303
	    newCorner := org + newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1304
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1305
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1306
    ^ newCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1307
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1308
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1309
computeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1310
    "compute my extent; if I have a layoutObject, a relative extent 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1311
     or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1312
     There is one catch here, if the dimension was defined
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1313
     by origin/corner, compute them here and take that value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1314
     I.e. origin/corner definition has precedence over extent definition.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1315
     Returns the extent in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1316
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1317
    |newOrg newExt newCorner x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1318
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1319
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1320
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1321
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1322
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1323
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1324
			    preferred:(self preferredBounds)) extent rounded
135
claus
parents:
diff changeset
  1325
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1326
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1327
    (cornerRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1328
	newCorner := cornerRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1329
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1330
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1331
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1332
	x := newCorner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1333
	y := newCorner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1334
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1335
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1336
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1337
	    newCorner := self cornerFromRelativeCorner:x@y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1338
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1339
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1340
	(relativeCorner notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1341
	    newCorner := self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1342
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1343
	    (extentRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1344
		newExt := extentRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1345
		"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1346
		 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1347
		"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1348
		x := newExt x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1349
		y := newExt y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1350
		x isNil ifTrue:[x := width].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1351
		y isNil ifTrue:[y := height].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1352
		((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1353
		    newExt := self extentFromRelativeExtent:x@y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1354
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1355
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1356
		(relativeExtent notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1357
		    newExt := self extentFromRelativeExtent:relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1358
		] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1359
		    newExt := (width @ height).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1360
		].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1361
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1362
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1363
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1364
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1365
    newCorner notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1366
	newOrg := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1367
	^ newCorner - newOrg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1368
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1369
    ^ newExt.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1370
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1371
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1372
computeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1373
    "compute my origin; if I have a layoutObject, a relative origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1374
     or blocks to evaluate, compute it now ..
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1375
     Blocks may return relative values or nil; nil means: take current value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1376
     Returns the origin point in device coordinates (pixels)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1377
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1378
    |newOrg x y|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1379
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1380
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1381
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1382
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1383
    layout notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1384
	^ (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1385
			    preferred:(self preferredBounds)) origin rounded
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1386
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1387
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1388
    (originRule notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1389
	newOrg := originRule value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1390
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1391
	 allow return of relative values ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1392
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1393
	x := newOrg x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1394
	y := newOrg y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1395
	x isNil ifTrue:[x := self origin x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1396
	y isNil ifTrue:[y := self origin y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1397
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1398
	    newOrg := self originFromRelativeOrigin:x@y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1399
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1400
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1401
	(relativeOrigin notNil) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1402
	    newOrg := self originFromRelativeOrigin:relativeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1403
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1404
	    ^ (left @ top).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1405
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1406
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1407
    ^ newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1408
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1409
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1410
corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1411
    "return the lower right corner-point (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1412
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1413
"/    ^ (left + width "- 1") @ (top + height "- 1")
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1414
    ^ (left + width - 1) @ (top + height - 1)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1415
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1416
    "Modified: 31.8.1995 / 16:51:40 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1417
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1418
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1419
corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1420
    "set the views corner; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1421
     the corner argument may be:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1422
	 a point 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1423
	    where integer fields mean 'pixel-values'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1424
	    and float values mean 'relative-to-superview'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1425
	    and nil means 'take current value';
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1426
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1427
     Please migrate to use layoutObjects, if possible."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1428
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1429
    |x y pixelCorner c|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1430
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1431
    corner isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1432
	cornerRule := corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1433
	drawableId notNil ifTrue:[    
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1434
	    pixelCorner := corner value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1435
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1436
	    extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1437
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1438
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1439
	x := corner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1440
	y := corner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1441
	x isNil ifTrue:[x := self corner x].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1442
	y isNil ifTrue:[y := self corner y].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1443
	c := x @ y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1444
	((x isInteger not) or:[y isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1445
	    relativeCorner := c.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1446
	    pixelCorner := self cornerFromRelativeCorner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1447
	    pixelCorner isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1448
		extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1449
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1450
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1451
	    pixelCorner := c
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1452
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1453
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1454
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1455
    pixelCorner notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1456
	self pixelCorner:pixelCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1457
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1458
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1459
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1460
extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1461
    "set the views extent; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1462
     extent may be:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1463
	a point 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1464
	    where integer fields mean 'pixel-values'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1465
	    and float values mean 'relative-to-superview'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1466
	    and nil means 'leave current value';
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1467
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1468
     Be careful when using relative extents: rounding errors may
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1469
     accumulate. Better use origin/corner. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1470
     Best: migrate to use layour objects."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1471
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1472
    |w h pixelExtent e|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1473
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1474
    extent isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1475
	extentRule := extent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1476
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1477
	    pixelExtent := extent value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1478
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1479
	    extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1480
	]
135
claus
parents:
diff changeset
  1481
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1482
	w := extent x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1483
	h := extent y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1484
	w isNil ifTrue:[w := width].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1485
	h isNil ifTrue:[h := height].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1486
	e := w@h.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1487
	((w isInteger not) or:[h isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1488
	    relativeExtent := e.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1489
	    pixelExtent := self extentFromRelativeExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1490
	    pixelExtent isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1491
		extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1492
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1493
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1494
	    pixelExtent := e
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1495
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1496
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1497
    pixelExtent notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1498
	self pixelExtent:pixelExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1499
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1500
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1501
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1502
geometryLayout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1503
    "this method will vanish, as soon as all implementations of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1504
     #layout: are removed ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1505
     (conflict for example in label>>layout:).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1506
     DO NOT USE #geometryLayout: in your code; it will be removed without
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1507
     notice."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1508
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1509
    ^ here layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1510
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1511
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1512
geometryLayout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1513
    "this method will vanish, as soon as all implementations of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1514
     #layout: are removed ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1515
     (conflict for example in label>>layout:).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1516
     DO NOT USE #geometryLayout: in your code; it will be removed without
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1517
     notice."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1518
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1519
    here layout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1520
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1521
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1522
height:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1523
    "set the views height in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1524
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1525
    self extent:(width @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1526
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1527
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1528
heightIncludingBorder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1529
    "return my height including border 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1530
     (this is my height as seen from the outside view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1531
      while #height returns the height as seen by myself)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1532
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1533
    ^ height + (2*borderWidth)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1534
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1535
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1536
horizontalInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1537
    "set the insets of the left/right edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1538
     positive makes it smaller, negative makes it larger"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1539
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1540
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1541
	insets := Array with:0 with:0 with:0 with:0
135
claus
parents:
diff changeset
  1542
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1543
    insets at:1 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1544
    insets at:3 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1545
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1546
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1547
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1548
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1549
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1550
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1551
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1552
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1553
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1554
innerHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1555
    "return the height of the view minus any 3D-shadow-borders"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1556
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1557
    (margin == 0) ifTrue:[^ height].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1558
    ^ height - (2 * margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1559
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1560
369
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1561
innerHeight:pixels
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1562
    "set the height of the view plus any 3D-shadow-borders.
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1563
     This does not work with a relative size."
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1564
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1565
    ^ self height:( pixels + (margin + self innerVerticalMargin * 2) ).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1566
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1567
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1568
innerHorizontalMargin
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1569
    "return any additional inner margin (i.e. contents margin).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1570
     This should be redefined by views which do add margins
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1571
     (for example: textViews do this)"
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1572
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1573
    ^ 0
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1574
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1575
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1576
innerVerticalMargin
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1577
    "return any additional inner margin (i.e. contents margin).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1578
     This should be redefined by views which do add margins
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1579
     (for example: textViews do this)"
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1580
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1581
    ^ 0
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1582
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1583
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1584
innerWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1585
    "return the width of the view minus any 3D-shadow-borders"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1586
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1587
    (level == 0) ifTrue:[^ width].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1588
    ^ width - (2 * margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1589
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1590
369
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1591
innerWidth:pixels
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1592
    "set the width of the view plus any 3D-shadow-borders.
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1593
     This does not work with a relative size."
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1594
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1595
    ^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ).
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1596
!
4a909fb26d3f innerWidth: / innerHeight:
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
  1597
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1598
inset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1599
    "set all insets; positive makes the view smaller,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1600
     negative makes it larger."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1601
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1602
    self allInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1603
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1604
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1605
layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1606
    "return the layout object which controls my geometry.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1607
     Currently, this is nil in most cases, and my geometry is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1608
     defined by relativeOrigin/relativeCorner/relativeExtent,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1609
     originRule/extentRule/cornerRule and inset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1610
     Applications should be changed to use layoutObjects,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1611
     since the above listed instance variables will vanish."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1612
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1613
    ^ layout
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1614
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1615
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1616
layout:aLayoutObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1617
    "set the layout object which controls my geometry.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1618
     Currently, this is almost nowhere used but views will be
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1619
     incrementally changed to use this new geometry management."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1620
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1621
    layout := aLayoutObject.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1622
    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1623
	originChanged := cornerChanged := extentChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1624
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1625
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1626
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1627
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1628
    "Modified: 19.9.1995 / 16:17:25 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1629
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1630
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1631
left
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1632
    "return the x position of the left border (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1633
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1634
    ^ left
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1635
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1636
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1637
left:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1638
    "set the x position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1639
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1640
    self origin:(aNumber @ top)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1641
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1642
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1643
left:newLeft top:newTop width:newWidth height:newHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1644
    "another way of specifying origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1645
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1646
    self origin:(newLeft @ newTop) extent:(newWidth @ newHeight)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1647
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1648
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1649
leftInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1650
    "return the inset of the left edge; positive is to the right,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1651
     negative to the left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1652
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1653
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1654
    ^ insets at:1 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1655
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1656
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1657
leftInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1658
    "set the inset of the left edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1659
     positive is to the right (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1660
     negative to the left (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1661
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1662
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1663
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1664
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1665
    insets at:1 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1666
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1667
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1668
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1669
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1670
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1671
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1672
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1673
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1674
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1675
makeFullyVisible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1676
    "make sure, that the view is fully visible by shifting it
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1677
     into the visible screen area if nescessary.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1678
     This method will be moved to StandardSystemView ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1679
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1680
    |devBot devRight newTop newLeft|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1681
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1682
    newTop := top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1683
    newLeft := left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1684
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1685
    ((top + height) > (devBot := device height)) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1686
	newTop := devBot - height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1687
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1688
    ((left + width) > (devRight := device width)) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1689
	newLeft := devRight - width
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1690
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1691
    (newTop < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1692
	newTop := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1693
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1694
    (newLeft < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1695
	newLeft := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1696
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1697
    ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1698
	self origin:newLeft @ newTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1699
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1700
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1701
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1702
origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1703
    "return the origin (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1704
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1705
    ^ left@top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1706
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1707
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1708
origin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1709
    "set the views origin; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1710
     origin may be:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1711
	a point 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1712
	    where integer fields mean 'pixel-values'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1713
	    and float values mean 'relative-to-superview'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1714
	    and nil means 'take current value';
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1715
     or a block returning a point which is interpreted as above.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1716
     Please migrate to use layout objects."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1717
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1718
    |newLeft newTop pixelOrigin o|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1719
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1720
    origin isBlock ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1721
	originRule := origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1722
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1723
	    pixelOrigin := origin value
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1724
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1725
	    originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1726
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1727
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1728
	o := origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1729
	newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1730
	newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1731
	newLeft isNil ifTrue:[newLeft := left].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1732
	newTop isNil ifTrue:[newTop := top].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1733
	o := newLeft @ newTop.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1734
	((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1735
	    relativeOrigin := o.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1736
	    pixelOrigin := self originFromRelativeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1737
	    pixelOrigin isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1738
		originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1739
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1740
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1741
	    pixelOrigin := o
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1742
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1743
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1744
    pixelOrigin notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1745
	self pixelOrigin:pixelOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1746
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1747
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1748
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1749
origin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1750
    "set both origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1751
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1752
    |newLeft newTop newRight newBot|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1753
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1754
    "do it as one operation if possible"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1755
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1756
    origin isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1757
	corner isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1758
	    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1759
	    newLeft isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1760
		newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1761
		newTop isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1762
		    newRight := corner x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1763
		    newRight isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1764
			newBot := corner y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1765
			newBot isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1766
			    self pixelOrigin:origin corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1767
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1768
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1769
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1770
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1771
	]
135
claus
parents:
diff changeset
  1772
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1773
    self origin:origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1774
    self corner:corner 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1775
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1776
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1777
origin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1778
    "set both origin and extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1779
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1780
    |newLeft newTop newWidth newHeight|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1781
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1782
    "do it as one operation if possible"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1783
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1784
    origin isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1785
	extent isBlock ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1786
	    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1787
	    newLeft isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1788
		newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1789
		newTop isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1790
		    newWidth := extent x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1791
		    newWidth isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1792
			newHeight := extent y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1793
			newHeight isInteger ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1794
			    self pixelOrigin:origin extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1795
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1796
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1797
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1798
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1799
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1800
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1801
    self extent:extent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1802
    self origin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1803
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1804
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1805
originRelativeTo:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1806
    "return the origin (in pixels) relative to a superView,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1807
     or relative to the rootView (if the aView argument is nil).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1808
     If the receiver is nonNil and not a subview of aView, return nil."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1809
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1810
    |currentView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1811
     org  "{ Class: Point }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1812
     sumX "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1813
     sumY "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1814
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1815
    currentView := self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1816
    sumX := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1817
    sumY := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1818
    [currentView notNil] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1819
	(currentView == aView) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1820
	    ^ (sumX @ sumY)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1821
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1822
	org := currentView origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1823
	sumX := sumX + org x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1824
	sumY := sumY + org y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1825
	currentView := currentView superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1826
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1827
    (aView isNil or:[aView == RootView]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1828
	"return relative to screen ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1829
	^ (sumX @ sumY)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1830
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1831
    ^ nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1832
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1833
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1834
     |top sub1 sub2|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1835
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1836
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1837
     top extent:200@200.   
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1838
     sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1839
     sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1840
     top openAndWait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1841
     Transcript show:'button in top:'; showCr:(sub2 originRelativeTo:top).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1842
     Transcript show:'button on screen:'; showCr:(sub2 originRelativeTo:nil).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1843
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1844
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1845
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1846
relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1847
    "return the relative corner or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1848
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1849
    ^ relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1850
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1851
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1852
relativeCorner:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1853
    "set the relative corner"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1854
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1855
    relativeCorner := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1856
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1857
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1858
relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1859
    "return the relative extent or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1860
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1861
    ^ relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1862
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1863
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1864
relativeExtent:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1865
    "set the relative extent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1866
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1867
    relativeExtent := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1868
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1869
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1870
relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1871
    "return the relative origin or nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1872
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1873
    ^ relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1874
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1875
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1876
relativeOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1877
    "set the relative origin"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1878
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1879
    relativeOrigin := aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1880
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1881
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1882
right
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1883
    "return the x position of the right edge  (in pixels)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1884
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1885
    ^ left + width - 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1886
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1887
    "Modified: 31.8.1995 / 19:31:10 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1888
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1889
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1890
right:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1891
    "set the corners x position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1892
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1893
    self corner:(aNumber @ self corner y)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1894
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1895
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1896
rightInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1897
    "return the inset of the right edge; positive is to the left,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1898
     negative to the right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1899
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1900
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1901
    ^ insets at:3 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1902
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1903
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1904
rightInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1905
    "set the inset of the right edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1906
     positive is to the left (view becomes smaller), 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1907
     negative to the right (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1908
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1909
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1910
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1911
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1912
    insets at:3 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1913
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1914
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1915
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1916
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1917
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1918
	self superViewChangedSize.
135
claus
parents:
diff changeset
  1919
"/    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1920
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1921
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1922
sizeFixed:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1923
    "set/clear the fix-size attribute, if supported by concrete subclasses.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1924
     Views which want to resize themselfes as appropriate to their contents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1925
     should cease to do so and take their current size if sizeFixed is set to
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1926
     true. Currently, only supported by Labels.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1927
     This does NOT prevent the window manager from resizing the view, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1928
     instead it tell the view to NOT resize ITSELF.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1929
     Added here to provide a common protocol for all views."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1930
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1931
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1932
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1933
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1934
top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1935
    "return the y position of the top border"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1937
    ^ top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1938
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1939
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1940
top:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1941
    "set the y position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1942
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1943
    self origin:(left @ aNumber)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1944
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1945
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1946
topInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1947
    "return the inset of the top edge; positive is to the bottom,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1948
     negative to the top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1949
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1950
    insets isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1951
    ^ insets at:2 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1952
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1953
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1954
topInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1955
    "set the inset of the top edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1956
     positive is to the bottom (view becomes smaller),
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1957
     negative to the top (becomes larger)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1958
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1959
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1960
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1961
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1962
    insets at:2 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1963
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1964
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1965
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1966
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1967
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1968
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1969
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1970
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1971
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1972
verticalInset:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1973
    "set the insets of the top/bottom edge; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1974
     positive makes it smaller, negative makes it larger"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1975
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1976
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1977
	insets := Array with:0 with:0 with:0 with:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1978
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1979
    insets at:2 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1980
    insets at:4 put:aNumber.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1981
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1982
    "force recomputation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1983
"/    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1984
"/        originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1985
"/    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1986
	self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1987
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1988
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  1989
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1990
viewRectangle
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1991
    "return the inside area.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1992
     This is used by relative sized subviews and layout-computations
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1993
     to base relative coordinates on.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1994
     For most views, the value returned here (actual extent minus any
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1995
     margins required for 3D levels) is ok.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1996
     However, views which want some extra area around (for example: FramedBox)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1997
     may redefine this method to return a rectangle without this area
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1998
     (thus, a relative sized subviews coordinates will be based on this net area) "
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  1999
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2000
    |m2|
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2001
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2002
    m2 := margin + margin.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2003
    ^ (margin @ margin) extent:((width - m2) @ (height - m2))
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2004
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2005
    "Modified: 8.2.1996 / 20:05:00 / cg"
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2006
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2007
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2008
width:aNumber
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2009
    "set the views width in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2010
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2011
    self extent:(aNumber @ height)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2012
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2013
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2014
widthIncludingBorder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2015
    "return my width including border
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2016
     (this is my width as seen from the outside view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2017
      while #width returns the width as seen by myself)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2018
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2019
    ^ width + (2*borderWidth)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2020
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2021
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2022
!SimpleView methodsFor:'accessing-hierarchy'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2023
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2024
lower
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2025
    "bring to back"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2026
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2027
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2028
    device lowerWindow:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2029
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2030
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2031
     Transcript topView lower
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2032
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2033
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2034
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2035
raise
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2036
    "bring to front"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2037
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2038
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2039
    device raiseWindow:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2040
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2041
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2042
     Transcript topView raise
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2043
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2044
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2045
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2046
subViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2047
    "return the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2048
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2049
    ^ subViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2050
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2051
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2052
subViews:aListOfViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2053
    "set the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2054
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2055
    subViews := aListOfViews.
135
claus
parents:
diff changeset
  2056
    subViews notNil ifTrue:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2057
	subViews do:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2058
	    view superView:self
135
claus
parents:
diff changeset
  2059
	]
claus
parents:
diff changeset
  2060
    ]
claus
parents:
diff changeset
  2061
!
claus
parents:
diff changeset
  2062
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2063
superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2064
    "return my superView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2065
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2066
    ^ superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2067
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2068
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2069
superView:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2070
    "set my superView to be aView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2071
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2072
    superView := aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2073
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2074
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2075
topView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2076
    "return the topView - thats the one with no superview"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2077
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2078
    |v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2079
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2080
    v := self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2081
    [v notNil] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2082
	v superView isNil ifTrue:[^ v].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2083
	v := v superView
135
claus
parents:
diff changeset
  2084
    ].
claus
parents:
diff changeset
  2085
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2086
    ^ nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2087
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2088
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2089
!SimpleView methodsFor:'accessing-menus'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2090
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2091
menuHolder
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2092
    "who has the menu ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2093
     By default, I have it."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2094
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2095
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2096
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2097
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2098
menuMessage
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2099
    "Return the symbol sent to myself to aquire the menu"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2101
    ^ #middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2102
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2103
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2104
menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2105
    "who should perform the menu actions ? 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2106
     By default, I do it."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2107
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2108
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2109
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2110
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2111
yellowButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2112
    "actually, this should be called 'middleButtonMenu'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2113
     But for ST-80 compatibility ....
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2114
     This method will vanish, once all views have controllers
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2115
     associated with them; for now, duplicate some code also found in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2116
     controller."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2117
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2118
    |sym menuHolder|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2120
"/    middleButtonMenu notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2121
"/        "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2122
"/        "/ has been assigned a static middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2123
"/        "/ (or a cached menu)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2124
"/        "/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2125
"/        ^ middleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2126
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2127
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2128
    menuHolder := self menuHolder.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2129
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2130
    menuHolder notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2131
	sym := self menuMessage.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2132
	sym notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2133
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2134
	     mhmh - for backward compatibility, try to ask
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2135
	     the model first, then use the views menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2136
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2137
	    (menuHolder respondsTo:sym) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2138
		(self respondsTo:sym) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2139
		    menuHolder := self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2140
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2141
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2142
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2143
	     ask the menuHolder for the menu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2144
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2145
	    ^ menuHolder perform:sym.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2146
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2147
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2148
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2149
    ^ nil
135
claus
parents:
diff changeset
  2150
! !
claus
parents:
diff changeset
  2151
claus
parents:
diff changeset
  2152
!SimpleView methodsFor:'accessing-misc'!
claus
parents:
diff changeset
  2153
claus
parents:
diff changeset
  2154
bitGravity
claus
parents:
diff changeset
  2155
    "return the bitGravity - thats the direction where the contents will move
claus
parents:
diff changeset
  2156
     when the the view is resized."
claus
parents:
diff changeset
  2157
claus
parents:
diff changeset
  2158
    ^ bitGravity
claus
parents:
diff changeset
  2159
!
claus
parents:
diff changeset
  2160
claus
parents:
diff changeset
  2161
bitGravity:gravity
claus
parents:
diff changeset
  2162
    "set the bitGravity - thats the direction where the contents will move
claus
parents:
diff changeset
  2163
     when the view is resized."
claus
parents:
diff changeset
  2164
claus
parents:
diff changeset
  2165
    bitGravity ~~ gravity ifTrue:[
claus
parents:
diff changeset
  2166
	bitGravity := gravity.
claus
parents:
diff changeset
  2167
	drawableId notNil ifTrue:[
claus
parents:
diff changeset
  2168
	    device setBitGravity:gravity in:drawableId
claus
parents:
diff changeset
  2169
	]
claus
parents:
diff changeset
  2170
    ]
claus
parents:
diff changeset
  2171
!
claus
parents:
diff changeset
  2172
153
claus
parents: 151
diff changeset
  2173
clipRect:aRectangle
claus
parents: 151
diff changeset
  2174
    "set the clipping rectangle for drawing (in logical coordinates);
claus
parents: 151
diff changeset
  2175
     a nil argument turn off clipping (i.e. whole view is drawable).
claus
parents: 151
diff changeset
  2176
     Redefined to care for any margin."
claus
parents: 151
diff changeset
  2177
claus
parents: 151
diff changeset
  2178
    |x y w h|
claus
parents: 151
diff changeset
  2179
claus
parents: 151
diff changeset
  2180
    aRectangle isNil ifTrue:[
claus
parents: 151
diff changeset
  2181
	clipRect isNil ifTrue:[^ self].
claus
parents: 151
diff changeset
  2182
	gcId notNil ifTrue:[
claus
parents: 151
diff changeset
  2183
	    device noClipIn:gcId
claus
parents: 151
diff changeset
  2184
	]
claus
parents: 151
diff changeset
  2185
    ] ifFalse:[
claus
parents: 151
diff changeset
  2186
	clipRect notNil ifTrue:[
claus
parents: 151
diff changeset
  2187
	    (clipRect = aRectangle) ifTrue:[^ self]
claus
parents: 151
diff changeset
  2188
	].
claus
parents: 151
diff changeset
  2189
	gcId notNil ifTrue:[
claus
parents: 151
diff changeset
  2190
	    x := aRectangle left.
claus
parents: 151
diff changeset
  2191
	    y := aRectangle top.
claus
parents: 151
diff changeset
  2192
	    w := aRectangle width.
claus
parents: 151
diff changeset
  2193
	    h := aRectangle height.
claus
parents: 151
diff changeset
  2194
	    transformation notNil ifTrue:[
claus
parents: 151
diff changeset
  2195
		x := transformation applyToX:x.
claus
parents: 151
diff changeset
  2196
		y := transformation applyToY:y.
claus
parents: 151
diff changeset
  2197
		w := transformation applyScaleX:w.
claus
parents: 151
diff changeset
  2198
		h := transformation applyScaleY:h.
claus
parents: 151
diff changeset
  2199
	    ].
claus
parents: 151
diff changeset
  2200
	    (x isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2201
		w := w + (x - x truncated).
claus
parents: 151
diff changeset
  2202
		x := x truncated
claus
parents: 151
diff changeset
  2203
	    ].
claus
parents: 151
diff changeset
  2204
	    (y isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2205
		h := h + (y - y truncated).
claus
parents: 151
diff changeset
  2206
		y := y truncated
claus
parents: 151
diff changeset
  2207
	    ].
claus
parents: 151
diff changeset
  2208
	    (w isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2209
		w := w truncated + 1
claus
parents: 151
diff changeset
  2210
	    ].
claus
parents: 151
diff changeset
  2211
	    (h isMemberOf:SmallInteger) ifFalse:[
claus
parents: 151
diff changeset
  2212
		h := h truncated + 1
claus
parents: 151
diff changeset
  2213
	    ].
claus
parents: 151
diff changeset
  2214
	    x < margin ifTrue:[
claus
parents: 151
diff changeset
  2215
		x := margin.
claus
parents: 151
diff changeset
  2216
	    ].
claus
parents: 151
diff changeset
  2217
	    y < margin ifTrue:[
claus
parents: 151
diff changeset
  2218
		y := margin.
claus
parents: 151
diff changeset
  2219
	    ].
claus
parents: 151
diff changeset
  2220
	    x + w - 1 >= (width-margin) ifTrue:[
claus
parents: 151
diff changeset
  2221
		w := width - margin - x
claus
parents: 151
diff changeset
  2222
	    ].
claus
parents: 151
diff changeset
  2223
	    y + h - 1 >= (height-margin) ifTrue:[
claus
parents: 151
diff changeset
  2224
		h := height - margin - y
claus
parents: 151
diff changeset
  2225
	    ].
claus
parents: 151
diff changeset
  2226
	    device setClipX:x y:y width:w height:h in:gcId
claus
parents: 151
diff changeset
  2227
	]
claus
parents: 151
diff changeset
  2228
    ].
claus
parents: 151
diff changeset
  2229
    clipRect := aRectangle
claus
parents: 151
diff changeset
  2230
!
claus
parents: 151
diff changeset
  2231
claus
parents: 151
diff changeset
  2232
fullName
claus
parents: 151
diff changeset
  2233
    "return my full name to be used for resource-access"
claus
parents: 151
diff changeset
  2234
claus
parents: 151
diff changeset
  2235
    superView notNil ifTrue:[
claus
parents: 151
diff changeset
  2236
	^ superView fullName , '.' , name
claus
parents: 151
diff changeset
  2237
    ].
claus
parents: 151
diff changeset
  2238
    ^ name
claus
parents: 151
diff changeset
  2239
!
claus
parents: 151
diff changeset
  2240
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2241
inputOnly
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2242
    "return true, if this view is an input-only view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2243
     input only views are transparent and can be layed on top of a view to
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2244
     catch its input"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2245
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2246
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2247
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2248
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2249
name
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2250
    "return my name component to be used for resource-access"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2251
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2252
    ^ name
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2253
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2254
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2255
name:aString
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2256
    "set my name component to be used for resource-access"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2257
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2258
    name := aString
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2259
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2260
153
claus
parents: 151
diff changeset
  2261
processName
claus
parents: 151
diff changeset
  2262
    "return a string to be shown in the process monitor"
claus
parents: 151
diff changeset
  2263
claus
parents: 151
diff changeset
  2264
    ^ self name
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2265
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2266
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2267
styleSheet 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2268
    "return the styleSheet. This is set at early view-creation time,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2269
     from the defaultStyleSheet which is valid at that time.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2270
     It is not affected by later defaultStyle changes"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2271
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2272
    ^ styleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2273
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2274
    "Created: 10.9.1995 / 11:02:20 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2275
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2276
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2277
viewGravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2278
    "return the viewGravity - thats the direction where the view will move
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2279
     when the superView is resized."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2280
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2281
    ^ viewGravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2282
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2283
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2284
viewGravity:gravity
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2285
    "set the viewGravity - thats the direction where the view will move
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2286
     when the superView is resized."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2287
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2288
    viewGravity ~~ gravity ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2289
	viewGravity := gravity.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2290
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2291
	    device setWindowGravity:gravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2292
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2293
    ]
140
claus
parents: 138
diff changeset
  2294
! !
claus
parents: 138
diff changeset
  2295
claus
parents: 138
diff changeset
  2296
!SimpleView methodsFor:'accessing-mvc'!
claus
parents: 138
diff changeset
  2297
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2298
aspect:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2299
    "ST-80 style updating: If a views aspectSymbol is nonNil, 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2300
     it will respond to changes of this aspect from the model.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2301
     Alias for aspectMessage: for ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2302
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2303
    self aspectMessage:aspectSymbol
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2304
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2305
140
claus
parents: 138
diff changeset
  2306
controller
claus
parents: 138
diff changeset
  2307
    "return the controller. For non MVC views, return nil"
claus
parents: 138
diff changeset
  2308
claus
parents: 138
diff changeset
  2309
    ^ controller
claus
parents: 138
diff changeset
  2310
!
claus
parents: 138
diff changeset
  2311
claus
parents: 138
diff changeset
  2312
controller:aController
claus
parents: 138
diff changeset
  2313
    "set the controller"
claus
parents: 138
diff changeset
  2314
claus
parents: 138
diff changeset
  2315
    controller := aController.
claus
parents: 138
diff changeset
  2316
    controller notNil ifTrue:[
claus
parents: 138
diff changeset
  2317
	controller view:self.
135
claus
parents:
diff changeset
  2318
    ]
claus
parents:
diff changeset
  2319
!
claus
parents:
diff changeset
  2320
140
claus
parents: 138
diff changeset
  2321
model
135
claus
parents:
diff changeset
  2322
    ^ nil
claus
parents:
diff changeset
  2323
!
claus
parents:
diff changeset
  2324
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2325
windowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2326
    "return the window group. For old style views, return nil"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2327
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2328
    ^ windowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2329
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2330
140
claus
parents: 138
diff changeset
  2331
windowGroup:aGroup
claus
parents: 138
diff changeset
  2332
    "set the window group."
claus
parents: 138
diff changeset
  2333
claus
parents: 138
diff changeset
  2334
    windowGroup := aGroup
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2335
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2336
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2337
!SimpleView methodsFor:'accessing-transformation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2338
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2339
maxSubViewBottom 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2340
"/    subViews isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2341
"/    ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2342
      ^ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2343
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2344
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2345
maxSubViewRight 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2346
"/    subViews isNil ifTrue:[^ 0].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2347
"/    ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2348
    ^ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2349
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2350
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2351
scale:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2352
    "set the scale factor of the transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2353
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  2354
    super scale:aPoint.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2355
    self computeInnerClip
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2356
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2357
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2358
setViewOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2359
    "set the viewOrigin - i.e. virtually scroll without redrawing"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2360
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2361
    |p|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2362
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2363
    p := aPoint negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2364
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2365
	transformation := WindowingTransformation scale:1 translation:p 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2366
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2367
	transformation translation:p 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2368
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2369
    clipRect notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2370
	self setInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2371
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2372
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2373
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2374
transformation 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2375
    "return the transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2376
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2377
    |vP org|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2378
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2379
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2380
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2381
	 fake a transformation, if I have a non-nil window
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2382
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2383
	window notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2384
	    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2385
		org := 0 @ 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2386
	    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2387
		org := self origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2388
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2389
	    vP := org extent:(self extent).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2390
	    ^ WindowingTransformation window:window viewport:vP
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2391
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2392
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2393
    ^ transformation
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2394
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2395
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2396
viewOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2397
    "return the viewOrigin; thats the coordinate of the contents 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2398
     which is shown topLeft in the view 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2399
     (i.e. the origin of the visible part of the contents)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2400
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2401
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2402
	^ 0@0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2403
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2404
    ^ transformation translation negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2405
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2406
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2407
xOriginOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2408
    "return the x coordinate of the viewOrigin in pixels; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2409
     used by scrollBars to compute thumb position within the document."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2410
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2411
    ^ self viewOrigin x
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2412
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2413
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2414
yOriginOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2415
    "return the y coordinate of the viewOrigin in pixels; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2416
     used by scrollBars to compute thumb position within the document."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2417
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2418
    ^ self viewOrigin y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2419
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2420
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2421
!SimpleView methodsFor:'accessing-visibility'!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2422
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2423
beInvisible
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2424
    self hiddenOnRealize:true.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2425
    realized ifTrue:[
372
78e5b6e96649 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
  2426
	self unrealize
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2427
    ]
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2428
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2429
    "Created: 22.9.1995 / 15:29:01 / claus"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2430
    "Modified: 17.1.1996 / 11:41:25 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2431
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2432
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2433
beVisible
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2434
    self hiddenOnRealize:false.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2435
    realized ifFalse:[
372
78e5b6e96649 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
  2436
	self realize
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2437
    ]
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2438
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2439
    "
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2440
     |top topFrame check list|
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2441
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2442
     top := StandardSystemView new.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2443
     top extent:150@400.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2444
     topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2445
     topFrame horizontalLayout:#leftSpace.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2446
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2447
     topFrame add:(check := CheckBox label:'hidden').
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2448
     check pressAction:[list beInvisible].
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2449
     check releaseAction:[list beVisible].
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2450
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2451
     list := ScrollableView for:SelectionInListView.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2452
     list origin:0.0@0.4 corner:1.0@1.0.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2453
     list list:#('foo' 'bar' 'baz').
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2454
     top add:list.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2455
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2456
     check turnOn.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2457
     list beInvisible.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2458
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2459
     top open
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2460
    "
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2461
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2462
    "Created: 22.9.1995 / 15:50:33 / claus"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2463
    "Modified: 17.1.1996 / 11:41:16 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2464
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2465
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2466
hidden
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2467
    "return true, if the view does not want to be realized
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2468
     automatically when superview is realized"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2469
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2470
    self obsoleteMethodWarning:'use #isHiddenOnRealize'.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2471
    ^ hiddenOnRealize
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2472
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2473
    "Modified: 17.1.1996 / 11:44:47 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2474
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2475
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2476
hidden:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2477
    "if the argument is true, the receiver view will not
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2478
     be realized automatically when superview is realized"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2479
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2480
    self obsoleteMethodWarning:'use #beVisible / #beInvisible'.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2481
    hiddenOnRealize := aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2482
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2483
    "Modified: 17.1.1996 / 11:45:06 / cg"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2484
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2485
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2486
hiddenOnRealize:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2487
    "if the argument is true, the receiver view will not
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2488
     be mapped automatically when the superview is realized.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2489
     The hiddenOnRealize flag is useful to create views which are
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2490
     to be made visible conditionally or later."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2491
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2492
    hiddenOnRealize := aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2493
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2494
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2495
isHiddenOnRealize:aBoolean
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2496
    "return true, if the receiver will NOT be mapped when
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2497
     realized. False otherwise.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2498
     The hiddenOnRealize flag is useful to create views which are
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2499
     to be made visible conditionally or later."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2500
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2501
    ^ hiddenOnRealize
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2502
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2503
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2504
shown
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2505
    "return true if the view is shown; false if not.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2506
     Shown means: the view is mapped and is not completely covered."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2507
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2508
    ^ shown
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2509
! !
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  2510
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2511
!SimpleView methodsFor:'adding & removing components'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2512
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2513
add:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2514
    "add a component (either a view or gadget) to the collection of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2515
     subComponents."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2516
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2517
    self addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2518
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2519
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2520
add:aComponent in:aRectangleOrLayoutFrame 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2521
    "for ST-80 compatibility.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2522
     add a component in some frame; the argument may be either a rectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2523
     with relative coordinates, or an instance of LayoutFrame, specifying
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2524
     both relative coordinates and the insets."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2525
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2526
"/ old code:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2527
"/    |origin corner l|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2528
"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2529
"/    origin := aRectangleOrLayoutFrame origin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2530
"/    origin := origin x asFloat @ origin y asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2531
"/    corner := aRectangleOrLayoutFrame corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2532
"/    corner := corner x asFloat @ corner y asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2533
"/    aComponent origin:origin corner:corner.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2534
"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2535
"/    (aRectangleOrLayoutFrame isMemberOf:Rectangle) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2536
"/        aComponent leftInset:aRectangleOrLayoutFrame leftOffset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2537
"/        aComponent rightInset:aRectangleOrLayoutFrame rightOffset negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2538
"/        aComponent topInset:aRectangleOrLayoutFrame topOffset.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2539
"/        aComponent bottomInset:aRectangleOrLayoutFrame bottomOffset negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2540
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2541
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2542
"/ new (being validated):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2543
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2544
    |l|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2545
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2546
    (aRectangleOrLayoutFrame isMemberOf:Rectangle) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2547
	l := aRectangleOrLayoutFrame asLayout.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2548
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2549
	l := aRectangleOrLayoutFrame
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2550
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2551
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2552
"/  will soon be replaced by:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2553
"/    aComponent layout:l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2554
    aComponent geometryLayout:l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2555
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2556
    self addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2557
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2558
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2559
addComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2560
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2561
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2562
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2563
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2564
	self addSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2565
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2566
	components isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2567
	    components := OrderedCollection new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2568
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2569
	components add:aComponent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2570
	aComponent setParentViewIn:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2571
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2572
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2573
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2574
addSubView:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2575
    "add a view to the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2576
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2577
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2578
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2579
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2580
	subViews add:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2581
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2582
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2583
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2584
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2585
addSubView:newView after:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2586
    "add a view to the collection of subviews after another view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2587
     This makes sense, in Panels and other layout views, to enter a new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2588
     element at some defined place."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2589
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2590
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2591
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2592
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2593
	aView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2594
	    subViews add:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2595
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2596
	    subViews add:newView after:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2597
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2598
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2599
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2600
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2601
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2602
addSubView:newView before:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2603
    "add a view to the collection of subviews before another view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2604
     This makes sense, in Panels and other layout views, to enter a new
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2605
     element at some defined place."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2606
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2607
    subViews isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2608
	subViews := OrderedCollection with:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2609
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2610
	aView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2611
	    subViews addFirst:newView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2612
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2613
	    subViews add:newView before:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2614
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2615
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2616
    self setParentViewIn:newView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2617
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2618
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2619
addSubView:aView in:bounds borderWidth:bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2620
    "for ST-80 V2.x compatibility"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2621
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2622
    aView borderWidth:bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2623
    self add:aView in:bounds.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2624
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2625
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2626
addSubView:aView viewport:aRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2627
    "ST-80 V2.x compatibility:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2628
     Adds aView to the views list of subviews and uses the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2629
     existing subviews window and the new viewport to position it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2630
     This method may be removed in future versions."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2631
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2632
    self addSubView:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2633
    aView viewport:aRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2634
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2635
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2636
addSubView:aView window:aWindowRectangle viewport:aViewportRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2637
    "ST-80 V2.x compatibility:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2638
     Adds aView to the views list of subviews and uses 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2639
     aWindowRectangle and aViewportRectangle to position it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2640
     This method may be removed in future versions."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2641
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2642
    self addSubView:aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2643
    aView window:aWindowRectangle viewport:aViewportRectangle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2644
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2645
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2646
component:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2647
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2648
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2649
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2650
    aComponent origin:0.0@0.0 corner:1.0@1.0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2651
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2652
	self addSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2653
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2654
	components := OrderedCollection with:aComponent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2655
	aComponent setParentViewIn:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2656
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2657
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2658
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2659
destroySubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2660
    "remove all subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2661
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2662
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2663
	subViews copy do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2664
	    aSubView destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2665
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2666
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2667
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2668
    "Modified: 5.9.1995 / 22:35:36 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2669
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2670
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2671
removeComponent:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2672
    "components (i.e. gadgets or lightweight views) are being prepared. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2673
     Dont use this right now for non-views"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2674
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2675
    aComponent isView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2676
	self removeSubView:aComponent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2677
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2678
	components isNil ifTrue:[^self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2679
	components remove:aComponent ifAbsent:[].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2680
	aComponent parent:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2681
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2682
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2683
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2684
removeSubView:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2685
    "remove a view from the collection of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2686
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2687
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2688
	subViews remove:aView ifAbsent:[nil].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2689
	(subViews size == 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2690
	    subViews := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2691
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2692
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2693
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2694
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2695
setParentViewIn:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2696
    "common code for addSubView* methods"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2697
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2698
    aView superView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2699
    (aView device ~~ device) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2700
	'VIEW: warning subview (' errorPrint. aView class name errorPrint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2701
	') has different device than me (' errorPrint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2702
	self class name errorPrint. ').' errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2703
	aView device:device
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2704
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2705
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2706
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2707
!SimpleView methodsFor:'change & update'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2708
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2709
update:aspect with:aParameter from:changedObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2710
    "an update request"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2711
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2712
    aspect == #sizeOfView ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2713
	"one of the views we depend on changed its size"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2714
	^ self superViewChangedSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2715
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2716
    ^super update:aspect with:aParameter from:changedObject
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2717
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2718
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2719
!SimpleView methodsFor:'copying'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2720
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2721
shallowCopyForFinalization
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2722
    "redefined for faster creation of finalization copies
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2723
     (only device, gcId and drawableId are needed)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2724
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2725
    |aCopy|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2726
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2727
    aCopy := DeviceViewHandle basicNew.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2728
    aCopy setDevice:device id:drawableId gcId:gcId.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2729
    ^ aCopy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2730
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2731
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2732
!SimpleView methodsFor:'cursor animation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2733
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2734
showBusyWhile:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2735
    "evaluate some time consuming block, while doing this,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2736
     show a spinning wheel cursor"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2737
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2738
    |ok bitmaps cursors mask process oldCursor|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2739
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2740
    oldCursor := cursor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2741
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2742
    ok := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2743
    bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2744
	       collect:[:name |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2745
		   |f|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2746
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2747
		   f := Form fromFile:(name , '.xbm').
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2748
		   f isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2749
			('no bitmap file: ' , name , '.xbm') errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2750
			ok := false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2751
		   ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2752
		   f
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2753
	       ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2754
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2755
    mask := Form fromFile:'wheelm.xbm'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2756
    mask isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2757
	('no bitmap file: ' , mask , '.xbm') errorPrintNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2758
	ok := false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2759
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2760
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2761
    ok ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2762
	self cursor:Cursor wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2763
	aBlock valueNowOrOnUnwindDo:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2764
	    self cursor:oldCursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2765
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2766
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2767
	cursors := bitmaps collect:[:form | (Cursor sourceForm:form
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2768
						      maskForm:mask
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2769
							  hotX:8
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2770
							  hotY:8) on:device].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2771
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2772
	process := [
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  2773
		    Delay waitForSeconds:0.25.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2774
		    [true] whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2775
			cursors do:[:curs |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2776
			    self cursor:curs.
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  2777
			    Delay waitForSeconds:0.05
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2778
			]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2779
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2780
		   ] fork.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2781
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2782
	Processor activeProcess priority:7.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2783
	aBlock valueNowOrOnUnwindDo:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2784
	    Processor activeProcess priority:8.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2785
	    process terminate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2786
	    self cursor:oldCursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2787
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2788
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2789
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2790
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2791
     View new realize showBusyWhile:[10 timesRepeat:[3000 factorial]]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2792
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2793
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2794
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2795
!SimpleView methodsFor:'edge drawing'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2796
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2797
drawBottomEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2798
    "draw bottom 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2799
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2800
    self drawBottomEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2801
		      shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2802
		      light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2803
		      halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2804
		      halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2805
		      style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2806
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2807
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2808
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2809
    |botFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2810
     count "{ Class: SmallInteger }" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2811
     b r|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2812
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2813
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2814
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2815
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2816
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2817
	botFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2818
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2819
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2820
	((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2821
	    botFg := halfShadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2822
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2823
	    botFg := shadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2824
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2825
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2826
    super paint:botFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2827
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2828
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2829
    r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2830
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2831
	b := height - 1 - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2832
	super displayDeviceLineFromX:i y:b toX:(r - i) y:b
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2833
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2834
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2835
    ((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2836
	b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2837
	super paint:shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2838
	super displayDeviceLineFromX:1 y:b toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2839
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2840
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2841
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2842
drawEdges
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2843
    "draw all of my 3D edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2844
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2845
    self drawEdgesForX:0 y:0 width:width height:height level:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2846
		shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2847
		light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2848
		halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2849
		halfLight:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2850
		style:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2851
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2852
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2853
drawEdgesForX:x y:y width:w height:h level:l
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2854
    "draw 3D edges into a rectangle"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2855
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2856
    self drawEdgesForX:x y:y width:w height:h level:l 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2857
		shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2858
		light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2859
		halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2860
		halfLight:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2861
		style:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2862
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2863
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2864
drawEdgesForX:x y:y width:w height:h level:l 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2865
		shadow:shadowColor light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2866
		halfShadow:halfShadowColor halfLight:halfLightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2867
		style:edgeStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2868
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2869
    "draw 3D edges into a rectangle"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2870
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2871
    |topLeftFg botRightFg topLeftHalfFg botRightHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2872
     count "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2873
     r     "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2874
     b     "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2875
     xi    "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2876
     yi    "{ Class: SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2877
     run paint|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2878
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2879
    count := l.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2880
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2881
	topLeftFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2882
	botRightFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2883
	topLeftHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2884
	botRightHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2885
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2886
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2887
	topLeftFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2888
	botRightFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2889
	topLeftHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2890
	botRightHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2891
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2892
    topLeftHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2893
	topLeftHalfFg := topLeftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2894
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2895
    botRightHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2896
	botRightHalfFg := botRightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2897
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2898
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2899
    r := x + w - 1. "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2900
    b := y + h - 1. "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2901
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2902
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2903
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2904
    "top and left edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2905
    ((edgeStyle == #soft) and:["l" count > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2906
	paint := topLeftHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2907
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2908
	paint := topLeftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2909
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2910
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2911
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2912
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2913
	run := y + i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2914
	super displayDeviceLineFromX:x y:run toX:r y:run. "top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2915
	run := x + i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2916
	super displayDeviceLineFromX:run y:y toX:run y:b  "left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2917
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2918
    (edgeStyle == #soft) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2919
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2920
	super paint:topLeftFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2921
	super displayDeviceLineFromX:x y:y toX:r y:y. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2922
	super displayDeviceLineFromX:x y:y toX:x y:b        
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2923
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2924
	(l > 2) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2925
	    super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2926
	    super displayDeviceLineFromX:x y:y toX:r y:y. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2927
	    super displayDeviceLineFromX:x y:y toX:x y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2928
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2929
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2930
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2931
    xi := x + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2932
    yi := y + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2933
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2934
"/ does not look good
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2935
"/ style == #st80 iftrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2936
"/  yi := yi + 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2937
"/ ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2938
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2939
    "bottom and right edges"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2940
    (edgeStyle == #soft "new:" and:[count > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2941
	paint := botRightHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2942
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2943
	paint := botRightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2944
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2945
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2946
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2947
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2948
	run := b - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2949
	super displayDeviceLineFromX:xi-1 y:run toX:r y:run. "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2950
	run := r - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2951
	super displayDeviceLineFromX:run y:yi-1 toX:run y:b.  "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2952
	xi := xi + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2953
	yi := yi + 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2954
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2955
    ((edgeStyle == #soft) and:[l > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2956
	super paint:Black "shadowColor".
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2957
	super displayDeviceLineFromX:(x + (1 - 1)) y:b toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2958
	super displayDeviceLineFromX:r y:(y + (1 - 1)) toX:r y:b        
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2959
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2960
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2961
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2962
drawLeftEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2963
    "draw left 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2964
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2965
    self drawLeftEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2966
		    shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2967
		     light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2968
		     halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2969
		     halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2970
		     style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2971
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2972
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2973
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2974
    |leftFg leftHalfFg paint b
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2975
     count "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2976
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2977
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2978
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2979
    
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2980
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2981
	leftFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2982
	leftHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2983
	count := count negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2984
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2985
	leftFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2986
	leftHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2987
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2988
    leftHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2989
	leftHalfFg := leftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2990
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2991
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2992
    ((edgeStyle == #soft) and:[level > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2993
	paint := leftHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2994
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2995
	paint := leftFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2996
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2997
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2998
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2999
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3000
    b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3001
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3002
	super displayDeviceLineFromX:i y:i toX:i y:(b - i)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3003
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3004
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3005
    ((edgeStyle == #soft) and:[level > 2]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3006
	super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3007
	super displayDeviceLineFromX:0 y:0 toX:0 y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3008
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3009
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3010
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3011
drawRightEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3012
    "draw right 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3013
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3014
    self drawRightEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3015
		     shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3016
		      light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3017
		      halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3018
		      halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3019
		      style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3020
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3021
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3022
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3023
    |rightFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3024
     count "{ Class: SmallInteger }" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3025
     r b|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3026
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3027
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3028
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3029
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3030
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3031
	rightFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3032
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3033
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3034
	((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3035
	    rightFg := halfShadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3036
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3037
	    rightFg := shadowColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3038
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3039
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3040
    super paint:rightFg.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3041
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3042
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3043
    b := height - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3044
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3045
	r := width - 1 - i.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3046
	super displayDeviceLineFromX:r y:i toX:r y:(b - i)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3047
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3048
    ((edgeStyle == #soft) and:[level > 1]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3049
	r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3050
	super paint:shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3051
	super displayDeviceLineFromX:r y:1 toX:r y:b. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3052
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3053
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3054
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3055
drawTopEdge
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3056
    "draw top 3D edge into window frame"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3057
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3058
    self drawTopEdgeLevel:level
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3059
		   shadow:shadowColor 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3060
		    light:lightColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3061
		    halfShadow:nil 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3062
		    halfLight:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3063
		    style:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3064
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3065
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3066
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3067
    |topFg topHalfFg paint r
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3068
     count "{ Class: SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3069
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3070
    count := level.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3071
    count == 0 ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3072
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3073
    (count < 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3074
	topFg := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3075
	topHalfFg := halfShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3076
	count := count negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3077
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3078
	topFg := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3079
	topHalfFg := halfLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3080
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3081
    topHalfFg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3082
	topHalfFg := topFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3083
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3084
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3085
    ((edgeStyle == #soft) and:[level > 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3086
	paint := topHalfFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3087
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3088
	paint := topFg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3089
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3090
    super paint:paint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3091
    super lineWidth:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3092
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3093
    r := width - 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3094
    0 to:(count - 1) do:[:i |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3095
	super displayDeviceLineFromX:i y:i toX:(r - i) y:i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3096
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3097
    ((edgeStyle == #soft) and:[level > 2]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3098
	super paint:Black.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3099
	super displayDeviceLineFromX:0 y:0 toX:r y:0. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3100
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3101
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3102
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3103
redrawEdges
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3104
    "redraw my edges (if any)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3105
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3106
    (level ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3107
	shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3108
	    self clipRect:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3109
	    self drawEdges.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3110
	    self clipRect:innerClipRect
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3111
	]                  
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3112
    ]                  
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3113
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3114
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3115
!SimpleView methodsFor:'enumerating subviews'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3116
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3117
allSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3118
    "evaluate aBlock for all subviews (recursively)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3120
    (subViews isNil or:[subViews isEmpty]) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3121
	subViews do:[:aSubview |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3122
	    aSubview withAllSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3123
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3124
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3125
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3126
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3127
withAllSubViewsDo:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3128
    "evaluate aBlock for the receiver and all subviews (recursively)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3129
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3130
    aBlock value:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3131
    self allSubViewsDo:aBlock
135
claus
parents:
diff changeset
  3132
! !
claus
parents:
diff changeset
  3133
claus
parents:
diff changeset
  3134
!SimpleView methodsFor:'event handling'!
claus
parents:
diff changeset
  3135
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3136
buttonPress:button x:x y:y
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3137
    "button was pressed - if its the middle button 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3138
     and there is a middleButtonMenu, show it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3139
     If both a model and a menuSelector is is defined, ask the model for
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3140
     the menu and launch it. The menu is supposed to return an actionSelector
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3141
     which in turn is sent to the model."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3142
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3143
    |menu menuPerformer actionSelector actionArg haveArg|
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3144
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3145
    components notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3146
	components do:[:aComponent |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3147
	    |thisFrame|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3148
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3149
	    thisFrame := aComponent frame.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3150
	    (thisFrame containsPointX:x y:y) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3151
		aComponent buttonPress:button x:x - thisFrame left
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3152
					      y:y - thisFrame top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3153
		^ self
140
claus
parents: 138
diff changeset
  3154
	    ]
claus
parents: 138
diff changeset
  3155
	]
claus
parents: 138
diff changeset
  3156
    ].
claus
parents: 138
diff changeset
  3157
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3158
    ((button == 2) or:[button == #menu]) ifTrue:[
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3159
	haveArg := false.
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3160
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3161
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3162
	 try ST-80 style menus first:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3163
	 if there is a model, and a menuMessage is defined,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3164
	 ask model for the menu and launch that if non-nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3165
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3166
	menu := self yellowButtonMenu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3167
	menu notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3168
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3169
	     got one, launch the menu. It is supposed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3170
	     to return an actionSelector.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3171
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3172
	    menuPerformer := self menuPerformer.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3173
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3174
	     a temporary kludge: subMenus dont know about 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3175
	     actionSelectors yet ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3176
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3177
	    menu receiver isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3178
		menu receiver:menuPerformer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3179
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3180
	    actionSelector := menu startUp.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3181
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3182
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3183
	     mhmh - kludge for selectors with argument
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3184
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3185
	    (actionSelector isMemberOf:Array) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3186
		actionArg := actionSelector at:2.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3187
		actionSelector := actionSelector at:1.
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3188
		haveArg := true.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3189
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3190
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3191
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3192
	     mhmh - ST-80 seems to send some to the model and
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3193
	     others (copy/cut/paste) to the controller/view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3194
	     Simulate this behavior, by looking what the model responds to.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3195
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3196
	    (actionSelector notNil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3197
	    and:[actionSelector isSymbol]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3198
		(menuPerformer respondsTo:actionSelector) ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3199
		    (self respondsTo:actionSelector) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3200
			menuPerformer := self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3201
		    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3202
		].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3203
		actionSelector numArgs ~~ 0 ifTrue:[
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3204
		    haveArg ifFalse:[
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3205
			"/ for checkToggle entries, pass its value
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3206
			actionArg := menu checkToggleAt:actionSelector
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3207
		    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3208
		    menuPerformer perform:actionSelector with:actionArg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3209
		] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3210
		    menuPerformer perform:actionSelector
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3211
		]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3212
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3213
	    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3214
	].
140
claus
parents: 138
diff changeset
  3215
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3216
    super buttonPress:button x:x y:y
271
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3217
88d9e485a5da menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
  3218
    "Modified: 3.12.1995 / 14:20:02 / cg"
193
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
  3219
!
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
  3220
140
claus
parents: 138
diff changeset
  3221
configureX:x y:y width:newWidth height:newHeight
claus
parents: 138
diff changeset
  3222
    "my size has changed by window manager action"
claus
parents: 138
diff changeset
  3223
180
claus
parents: 176
diff changeset
  3224
    |how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p|
claus
parents: 176
diff changeset
  3225
claus
parents: 176
diff changeset
  3226
    (superView isNil 
claus
parents: 176
diff changeset
  3227
    and:[drawableId notNil]) ifTrue:[
claus
parents: 176
diff changeset
  3228
	"/ have to be careful - some window managers (motif) wrap another
claus
parents: 176
diff changeset
  3229
	"/ view around and the reported origin is relative to that.
claus
parents: 176
diff changeset
  3230
	"/ not relative to the screen.
claus
parents: 176
diff changeset
  3231
	p := device translatePoint:0@0 from:drawableId to:device rootWindowId.
claus
parents: 176
diff changeset
  3232
	left := p x.
claus
parents: 176
diff changeset
  3233
	top := p y.
claus
parents: 176
diff changeset
  3234
    ] ifFalse:[
claus
parents: 176
diff changeset
  3235
	left := x.
claus
parents: 176
diff changeset
  3236
	top := y.
claus
parents: 176
diff changeset
  3237
    ].
140
claus
parents: 138
diff changeset
  3238
    ((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[
claus
parents: 138
diff changeset
  3239
	realized ifFalse:[
claus
parents: 138
diff changeset
  3240
	    width := newWidth.
claus
parents: 138
diff changeset
  3241
	    height := newHeight.
claus
parents: 138
diff changeset
  3242
	    extentChanged := true.
claus
parents: 138
diff changeset
  3243
	    ^ self
claus
parents: 138
diff changeset
  3244
	].
claus
parents: 138
diff changeset
  3245
claus
parents: 138
diff changeset
  3246
	((newWidth <= width) and:[newHeight <= height]) ifTrue:[
claus
parents: 138
diff changeset
  3247
	    how := #smaller
claus
parents: 138
diff changeset
  3248
	].
claus
parents: 138
diff changeset
  3249
claus
parents: 138
diff changeset
  3250
	level ~~ 0 ifTrue:[
claus
parents: 138
diff changeset
  3251
	    mustRedrawBottomEdge := newHeight < height.
claus
parents: 138
diff changeset
  3252
	    mustRedrawRightEdge := newWidth < width.
claus
parents: 138
diff changeset
  3253
	    anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge]
claus
parents: 138
diff changeset
  3254
	] ifFalse:[
claus
parents: 138
diff changeset
  3255
	    anyEdge := false
claus
parents: 138
diff changeset
  3256
	].
claus
parents: 138
diff changeset
  3257
claus
parents: 138
diff changeset
  3258
	width := newWidth.
claus
parents: 138
diff changeset
  3259
	height := newHeight.
claus
parents: 138
diff changeset
  3260
claus
parents: 138
diff changeset
  3261
	"recompute inner-clip if needed"
claus
parents: 138
diff changeset
  3262
	self setInnerClip.
claus
parents: 138
diff changeset
  3263
claus
parents: 138
diff changeset
  3264
	"
claus
parents: 138
diff changeset
  3265
	 must first process pending exposes;
claus
parents: 138
diff changeset
  3266
	 otherwise, those may be drawn at a wrong position
claus
parents: 138
diff changeset
  3267
	"
claus
parents: 138
diff changeset
  3268
	windowGroup notNil ifTrue:[
claus
parents: 138
diff changeset
  3269
	    windowGroup processExposeEvents
claus
parents: 138
diff changeset
  3270
	].
claus
parents: 138
diff changeset
  3271
	self sizeChanged:how.
claus
parents: 138
diff changeset
  3272
claus
parents: 138
diff changeset
  3273
	(anyEdge and:[shown]) ifTrue:[
claus
parents: 138
diff changeset
  3274
	    self clipRect:nil.
claus
parents: 138
diff changeset
  3275
	    mustRedrawBottomEdge ifTrue:[
claus
parents: 138
diff changeset
  3276
		self drawBottomEdge
claus
parents: 138
diff changeset
  3277
	    ].
claus
parents: 138
diff changeset
  3278
	    mustRedrawRightEdge ifTrue:[
claus
parents: 138
diff changeset
  3279
		self drawRightEdge
claus
parents: 138
diff changeset
  3280
	    ].
claus
parents: 138
diff changeset
  3281
	    self clipRect:innerClipRect
claus
parents: 138
diff changeset
  3282
	]
claus
parents: 138
diff changeset
  3283
    ]
138
claus
parents: 137
diff changeset
  3284
!
claus
parents: 137
diff changeset
  3285
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3286
coveredBy:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3287
    "the receiver has been covered by another view;
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3288
     we are not interested in that here (but see modalBox for more)."
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3289
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3290
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3291
destroyed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3292
    "view has been destroyed by someone else (usually window system)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3293
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3294
    shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3295
    super destroyed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3296
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3297
135
claus
parents:
diff changeset
  3298
exposeX:x y:y width:w height:h
claus
parents:
diff changeset
  3299
    "a low level redraw event from device
claus
parents:
diff changeset
  3300
      - let subclass handle the redraw and take care of edges here"
claus
parents:
diff changeset
  3301
claus
parents:
diff changeset
  3302
    |leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh old|
claus
parents:
diff changeset
  3303
claus
parents:
diff changeset
  3304
    nw := w.
claus
parents:
diff changeset
  3305
    nh := h.
claus
parents:
diff changeset
  3306
    nx := x.
claus
parents:
diff changeset
  3307
    ny := y.
claus
parents:
diff changeset
  3308
claus
parents:
diff changeset
  3309
    anyEdge := false.
claus
parents:
diff changeset
  3310
claus
parents:
diff changeset
  3311
    "
claus
parents:
diff changeset
  3312
     check if there is a need to draw an edge (i.e. if margin is hit)
claus
parents:
diff changeset
  3313
    "
claus
parents:
diff changeset
  3314
    (margin ~~ 0) ifTrue:[
claus
parents:
diff changeset
  3315
	leftEdge := false.
claus
parents:
diff changeset
  3316
	topEdge := false.
claus
parents:
diff changeset
  3317
	rightEdge := false.
claus
parents:
diff changeset
  3318
	botEdge := false.
claus
parents:
diff changeset
  3319
	transformation notNil ifTrue:[
claus
parents:
diff changeset
  3320
	    "
claus
parents:
diff changeset
  3321
	     need device coordinates for this test
claus
parents:
diff changeset
  3322
	    "
claus
parents:
diff changeset
  3323
	    nx := transformation applyToX:nx.
claus
parents:
diff changeset
  3324
	    ny := transformation applyToY:ny.
claus
parents:
diff changeset
  3325
	    nw := transformation applyScaleX:nw.
claus
parents:
diff changeset
  3326
	    nh := transformation applyScaleY:nh.
claus
parents:
diff changeset
  3327
	].
claus
parents:
diff changeset
  3328
	"
claus
parents:
diff changeset
  3329
	 adjust expose rectangle, to exclude the margin.
claus
parents:
diff changeset
  3330
	 Care for rounding errors ...
claus
parents:
diff changeset
  3331
	"
claus
parents:
diff changeset
  3332
	(nx isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3333
	    old := nx.
claus
parents:
diff changeset
  3334
	    nx := nx truncated.
claus
parents:
diff changeset
  3335
	    nw := nw + (nx - old).
claus
parents:
diff changeset
  3336
	].
claus
parents:
diff changeset
  3337
	(ny isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3338
	    old := ny.
claus
parents:
diff changeset
  3339
	    ny := ny truncated.
claus
parents:
diff changeset
  3340
	    nh := nh + (ny - old).
claus
parents:
diff changeset
  3341
	].
claus
parents:
diff changeset
  3342
	(nw isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3343
	    nw := nw truncated + 1
claus
parents:
diff changeset
  3344
	].
claus
parents:
diff changeset
  3345
	(nh isMemberOf:SmallInteger) ifFalse:[
claus
parents:
diff changeset
  3346
	    nh := nh truncated + 1
claus
parents:
diff changeset
  3347
	].
claus
parents:
diff changeset
  3348
	(nx < margin) ifTrue:[
claus
parents:
diff changeset
  3349
	    old := nx.
claus
parents:
diff changeset
  3350
	    nx := margin.
claus
parents:
diff changeset
  3351
	    nw := nw - (nx - old).
claus
parents:
diff changeset
  3352
	    leftEdge := anyEdge := true.
claus
parents:
diff changeset
  3353
	].
claus
parents:
diff changeset
  3354
	((nx + nw - 1) >= (width - margin)) ifTrue:[
claus
parents:
diff changeset
  3355
	    nw := (width - margin - nx).
claus
parents:
diff changeset
  3356
	    rightEdge := anyEdge := true.
claus
parents:
diff changeset
  3357
	].
claus
parents:
diff changeset
  3358
	(ny < margin) ifTrue:[
claus
parents:
diff changeset
  3359
	    old := ny.
claus
parents:
diff changeset
  3360
	    ny := margin.
claus
parents:
diff changeset
  3361
	    nh := nh - (ny - old).
claus
parents:
diff changeset
  3362
	    topEdge := anyEdge := true.
claus
parents:
diff changeset
  3363
	].
claus
parents:
diff changeset
  3364
	((ny + nh - 1) >= (height - margin)) ifTrue:[
claus
parents:
diff changeset
  3365
	    nh := (height - margin - ny).
claus
parents:
diff changeset
  3366
	    botEdge := anyEdge := true.
claus
parents:
diff changeset
  3367
	].
claus
parents:
diff changeset
  3368
	transformation notNil ifTrue:[
claus
parents:
diff changeset
  3369
	    "
claus
parents:
diff changeset
  3370
	     need logical coordinates for redraw
claus
parents:
diff changeset
  3371
	    "
claus
parents:
diff changeset
  3372
	    nx := transformation applyInverseToX:nx.
claus
parents:
diff changeset
  3373
	    ny := transformation applyInverseToY:ny.
claus
parents:
diff changeset
  3374
	    nw := transformation applyInverseScaleX:nw.
claus
parents:
diff changeset
  3375
	    nh := transformation applyInverseScaleY:nh.
claus
parents:
diff changeset
  3376
	].
claus
parents:
diff changeset
  3377
    ].
claus
parents:
diff changeset
  3378
claus
parents:
diff changeset
  3379
    "
claus
parents:
diff changeset
  3380
     redraw inside area
claus
parents:
diff changeset
  3381
    "
claus
parents:
diff changeset
  3382
    self redrawX:nx y:ny width:nw height:nh.
claus
parents:
diff changeset
  3383
claus
parents:
diff changeset
  3384
    "
claus
parents:
diff changeset
  3385
     redraw edge(s)
claus
parents:
diff changeset
  3386
    "
claus
parents:
diff changeset
  3387
    anyEdge ifTrue:[
claus
parents:
diff changeset
  3388
	self clipRect:nil.
claus
parents:
diff changeset
  3389
	(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[
claus
parents:
diff changeset
  3390
	    self drawEdges
claus
parents:
diff changeset
  3391
	] ifFalse:[
claus
parents:
diff changeset
  3392
	    topEdge ifTrue:[
claus
parents:
diff changeset
  3393
		self drawTopEdge
claus
parents:
diff changeset
  3394
	    ].
claus
parents:
diff changeset
  3395
	    leftEdge ifTrue:[
claus
parents:
diff changeset
  3396
		self drawLeftEdge
claus
parents:
diff changeset
  3397
	    ].
claus
parents:
diff changeset
  3398
	    botEdge ifTrue:[
claus
parents:
diff changeset
  3399
		self drawBottomEdge
claus
parents:
diff changeset
  3400
	    ].
claus
parents:
diff changeset
  3401
	    rightEdge ifTrue:[
claus
parents:
diff changeset
  3402
		self drawRightEdge
claus
parents:
diff changeset
  3403
	    ]
claus
parents:
diff changeset
  3404
	].
claus
parents:
diff changeset
  3405
	self clipRect:innerClipRect
claus
parents:
diff changeset
  3406
    ]
claus
parents:
diff changeset
  3407
!
claus
parents:
diff changeset
  3408
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3409
focusIn
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3410
    "got keyboard focus (via the window manager)"
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3411
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3412
    self showFocus:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3413
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3414
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3415
focusOut
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3416
    "lost keyboard focus (via the window manager)"
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3417
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  3418
    self showNoFocus:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3419
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3420
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3421
hasKeyboardFocus:aBoolean
140
claus
parents: 138
diff changeset
  3422
    ^ self
claus
parents: 138
diff changeset
  3423
!
claus
parents: 138
diff changeset
  3424
claus
parents: 138
diff changeset
  3425
keyPress:key x:x y:y
claus
parents: 138
diff changeset
  3426
    "a key has been pressed. If there are components,
claus
parents: 138
diff changeset
  3427
     pass it to the corresponding one. 
claus
parents: 138
diff changeset
  3428
     Otherwise, forward it to the superview, if there is any."
claus
parents: 138
diff changeset
  3429
claus
parents: 138
diff changeset
  3430
    components notNil ifTrue:[
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3431
	components do:[:aComponent |
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3432
	    |thisFrame|
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3433
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3434
	    thisFrame := aComponent frame.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3435
	    (thisFrame containsPointX:x y:y) ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3436
		aComponent keyPress:key x:x - thisFrame left
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3437
					y:y - thisFrame top.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3438
		^ self
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3439
	    ]
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3440
	]
135
claus
parents:
diff changeset
  3441
    ].
claus
parents:
diff changeset
  3442
140
claus
parents: 138
diff changeset
  3443
    x >= 0 ifTrue:[
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3444
	superView notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3445
	    WindowEvent
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3446
		sendEvent:#keyPress:x:y:
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3447
		arguments:(Array with:key with:0 with:0)
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3448
		view:superView
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3449
	] ifFalse:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3450
	    super keyPress:key x:x y:y
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3451
	]
411
2d5deb02d8f8 if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
  3452
    ] ifFalse:[
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3453
	"/ already redelegated, but nowhere handled
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3454
	superView notNil ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3455
	    superView keyPress:key x:-1 y:-1
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  3456
	]
135
claus
parents:
diff changeset
  3457
    ]
411
2d5deb02d8f8 if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
  3458
2d5deb02d8f8 if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
  3459
    "Modified: 1.2.1996 / 22:40:16 / cg"
135
claus
parents:
diff changeset
  3460
!
claus
parents:
diff changeset
  3461
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3462
mapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3463
    "the view has been mapped (by some outside
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3464
     action - i.e. window manager de-iconified me)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3465
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3466
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3467
     the old code was:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3468
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3469
	realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3470
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3471
	...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3472
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3473
     this created a race condition, if the view was
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3474
     realized and shortly after unrealized - before the mapped event
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3475
     arrived. This lead to shown being set to true even thought the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3476
     view was not. Boy - that was a bad one (hard to reproduce and hard to find).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3477
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3478
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3479
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3480
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3481
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3482
	 backed views will not get expose events - have
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3483
	 to force a redraw here to get things drawn into
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3484
	 backing store.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3485
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3486
	backed ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3487
	    self redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3488
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3489
	subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3490
	    subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3491
		v superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3492
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3493
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3494
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3495
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3496
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3497
reparented
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3498
    "the view has changed its parent by some outside
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3499
     action - i.e. window manager has added a frame.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3500
     nothing done here"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3501
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3502
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3503
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3504
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3505
saveAndTerminate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3506
    "window manager wants me to save and go away; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3507
     - notice, that not all window managers are nice enough to 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3508
       send this event, but simply destroy the view instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3509
     Can be redefined in subclasses to do whatever is required
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3510
     to prepare for restart."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3511
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3512
    ^ self destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3513
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3514
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3515
sizeChanged:how
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3516
    "tell subviews if I change size.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3517
     How is either #smaller, #larger or nil, and is used to control the order,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3518
     in which subviews are notified (possibly reducing redraw activity)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3519
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3520
    window notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3521
	"compute new transformation"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3522
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3523
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3524
	(how isNil "false" 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3525
	or:[how == #smaller]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3526
	    subViews do:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3527
		view superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3528
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3529
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3530
	    "doing it reverse speeds up resizing - usually subviews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3531
	     are created from top-left to bottom-right; therefore
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3532
	     bottom-right views will be moved/resized first, then top-left ones;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3533
	     this avoids multiple redraws of subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3534
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3535
	    subViews reverseDo:[:view |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3536
		view superViewChangedSize
135
claus
parents:
diff changeset
  3537
	    ]
claus
parents:
diff changeset
  3538
	]
claus
parents:
diff changeset
  3539
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3540
    self changed:#sizeOfView with:how.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3541
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3542
	superView subViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3543
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3544
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3545
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3546
subViewChangedSize
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 312
diff changeset
  3547
    "some subview has changed its size; we are not interested
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3548
     in that here, but some geometry managers redefine this, to reorganize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3549
     components if that happens."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3550
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3551
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3552
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3553
    "Created: 22.9.1995 / 14:44:59 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3554
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3555
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3556
superViewChangedSize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3557
    "my superView has changed size; if I have relative
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3558
     origin/extent or blocks to evaluate, do it now .."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3559
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3560
    |oldWidth oldHeight oldTop oldLeft newExt newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3561
     winSuper newWidth newHeight newLeft newTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3562
     superWidth superHeight superWinWidth superWinHeight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3563
     r|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3564
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3565
    oldWidth := width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3566
    oldHeight := height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3567
    oldTop := top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3568
    oldLeft := left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3569
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3570
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3571
     if this view has a viewPort, resize a la ST-80 V2.x
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3572
     this will vanish - dont use it.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3573
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3574
    viewport notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3575
	superView isNil ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3576
	winSuper := superView window.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3577
	winSuper isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3578
	    "take pixel size as window"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3579
	    winSuper := 0@0 extent:(superView width@superView height)
135
claus
parents:
diff changeset
  3580
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3581
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3582
	superWidth := superView width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3583
	superHeight := superView height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3584
	superWinWidth := winSuper width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3585
	superWinHeight := winSuper height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3586
	newLeft := (viewport left - winSuper left) * superWidth // superWinWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3587
	newTop := (viewport top - winSuper top) * superHeight // superWinHeight.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3588
	newWidth := superWidth * viewport width // superWinWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3589
	newHeight := superHeight * viewport height // superWinHeight.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3590
	self pixelOrigin:(newLeft @ newTop).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3591
	self pixelExtent:(newWidth @ newHeight).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3592
	^ self
135
claus
parents:
diff changeset
  3593
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3594
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3595
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3596
     slowly migrating to use layoutObjects ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3597
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3598
    layout isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3599
	newOrg := self computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3600
	newExt := self computeExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3601
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3602
	r := (layout rectangleRelativeTo:(superView viewRectangle)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3603
			       preferred:(self preferredBounds)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3604
	newOrg := r origin rounded.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3605
	newExt := r extent rounded.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3606
"/ newOrg printNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3607
"/ newExt printNL.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3608
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3609
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3610
    newOrg notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3611
	((newOrg x == oldLeft) and:[newOrg y == oldTop]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3612
	    newOrg := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3613
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3614
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3615
    newExt notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3616
	((newExt x == width) and:[newExt y == height]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3617
	    newExt := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3618
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3619
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3620
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3621
    newExt isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3622
	newOrg notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3623
	    self pixelOrigin:newOrg
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3624
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3625
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3626
	newOrg isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3627
	    self pixelExtent:newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3628
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3629
	    self pixelOrigin:newOrg extent:newExt
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3630
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3631
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3632
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3633
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3634
superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3635
    "my superview was mapped (became visible)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3636
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3637
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3638
	shown := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3639
	subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3640
	    subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3641
		v superViewMapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3642
	    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3643
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3644
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3645
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3646
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3647
superViewUnmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3648
    "my superView was unmapped"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3649
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3650
    self unmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3651
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3652
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3653
terminate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3654
    "window manager wants me to go away;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3655
     - notice, that not all window managers are nice enough to 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3656
       send this event, but simply destroy the view instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3657
     Can be redefined in subclasses to do whatever cleanup is 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3658
     required."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3659
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3660
    ^ self destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3661
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3662
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3663
unmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3664
    "the view has been unmapped 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3665
     (either by some outside action - i.e. window manager iconified me,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3666
     or due to unmapping of my parentView)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3667
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3668
    shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3669
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3670
	subViews do:[:v |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3671
	    v superViewUnmapped
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3672
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3673
    ]
135
claus
parents:
diff changeset
  3674
!
claus
parents:
diff changeset
  3675
claus
parents:
diff changeset
  3676
visibilityChange:how
claus
parents:
diff changeset
  3677
    "the visibility of the view has changed (by some outside
claus
parents:
diff changeset
  3678
     action - i.e. window manager rearranged things).
claus
parents:
diff changeset
  3679
     Using this knowledge avoids useless redraw in obsucred views."
claus
parents:
diff changeset
  3680
claus
parents:
diff changeset
  3681
    how == #fullyObscured ifTrue:[
claus
parents:
diff changeset
  3682
	shown := false
claus
parents:
diff changeset
  3683
    ] ifFalse:[
claus
parents:
diff changeset
  3684
	shown := true.
claus
parents:
diff changeset
  3685
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3686
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3687
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3688
!SimpleView methodsFor:'informing others of changes'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3689
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3690
contentsChanged
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3691
    "this one is sent, whenever contents changes size -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3692
     tell dependents about the change (i.e. scrollers)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3693
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3694
    self changed:#sizeOfContents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3695
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3696
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3697
originChanged:delta
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3698
    "this one is sent, after the origin of my contents has changed -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3699
     tell dependents (i.e. scrollers) about this"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3700
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3701
    self changed:#originOfContents with:delta.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3702
"/   subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3703
"/        subViews do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3704
"/            aSubView pixelOrigin:((aSubView left @ aSubView top) - delta)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3705
"/        ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3706
"/    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3707
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3708
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3709
originWillChange
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3710
    "this one is sent, just before viewOrigin changes -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3711
     gives subclasses a chance to catch scrolls easily
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3712
     (for example to hide cursor before scroll)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3713
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3714
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3715
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3716
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3717
!SimpleView methodsFor:'initialization'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3718
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3719
defaultControllerClass
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3720
    ^ nil "/ Controller
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3721
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3722
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3723
initEvents
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3724
    "will be sent by create - can be redefined by subclasses to enable
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3725
     view events"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3726
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3727
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3728
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3729
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3730
initStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3731
    "this method sets up all style dependent things"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3732
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3733
    self initStyleSheet.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3734
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3735
    borderWidth := DefaultBorderWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3736
    borderWidth isNil ifTrue:[borderWidth := 1].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3737
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3738
    viewBackground := DefaultViewBackgroundColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3739
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3740
    DefaultLightColor notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3741
	lightColor := DefaultLightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3742
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3743
	device hasGreyscales ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3744
	    DefaultLightColor := lightColor := viewBackground lightened.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3745
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3746
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3747
	     this seems strange: on B&W screens, we create the light color 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3748
	     darker than normal viewBackground (White) -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3749
	     to make the boundary of the view visible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3750
	    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3751
	    lightColor := Color grey:50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3752
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3753
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3754
    DefaultShadowColor notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3755
	shadowColor := DefaultShadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3756
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3757
	shadowColor := Black
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3758
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3759
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3760
    lightColor := lightColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3761
    shadowColor := shadowColor.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3762
    borderColor := DefaultBorderColor.
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  3763
    font := self class defaultFont.
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  3764
    font := font on:device.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3765
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3766
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3767
initStyleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3768
    "this method gets the styleSheet"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3769
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3770
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3771
     when coming here the first time, we read the styleSheet
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3772
     and keep the values in fast class variables
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3773
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3774
    StyleSheet isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3775
	self class updateStyleCache
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3776
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3777
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3778
    styleSheet := StyleSheet.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3779
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3780
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3781
initialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3782
    "initialize all state of the view - usually redefined in subclasses,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3783
     but always doing a 'super initialize'. Each class should setup its
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3784
     locals - and not forget the others.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3785
     View setup is separated into two parts, the general setup done here
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3786
     and the style specific setup in initStyle. Each view should be prepared
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3787
     for a stylechange by being sent another initStyle with a new style value.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3788
     (in this case, it should set all of its style-dependent things, but
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3789
      leave the state and contents as-is)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3790
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3791
    |ext myClass controllerClass|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3792
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3793
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3794
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  3795
    font := self class defaultFont.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3796
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3797
    shown := hiddenOnRealize := realized := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3798
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3799
    "fill in some defaults - some of them are usually redefined in subclasses
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3800
     initialize methods"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3801
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3802
    myClass := self class.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3803
    name := myClass name "asString" asLowercaseFirst.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3804
    ext := myClass defaultExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3805
    resources := myClass classResources.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3806
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3807
    level := margin := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3808
    margin := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3809
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3810
    self initStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3811
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3812
    left := top := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3813
    width := ext x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3814
    height := ext y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3815
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3816
    originChanged := extentChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3817
    bitGravity := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3818
    viewGravity := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3819
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3820
    controllerClass := self defaultControllerClass.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3821
    controllerClass notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3822
	controller := controllerClass new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3823
	controller view:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3824
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3825
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3826
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3827
initializeMiddleButtonMenu
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3828
    "a place to initialize menu - this one is sent once when the view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3829
     first created; usually redefined in subclasses; default here is no menu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3830
     Notice, that static middleButtonmenus are a historic thing in ST/X;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3831
     you may prefer to create the menu dynamically (i.e. the ST-80 way)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3832
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3833
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3834
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3835
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3836
prepareForReinit
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3837
    super prepareForReinit.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3838
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3839
	windowGroup reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3840
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3841
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3842
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3843
reinitStyle
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3844
    "this method is called for a style change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3845
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3846
    |t|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3847
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3848
    self initStyle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3849
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3850
	"force a change"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3851
	t := borderWidth. borderWidth := nil. self borderWidth:t.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3852
	t := viewBackground. viewBackground := nil. self viewBackground:t.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3853
	self clear.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3854
	self redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3855
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3856
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3857
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3858
reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3859
    "this is called right snapIn"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3860
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3861
    |myController|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3862
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3863
    "if I have already been reinited - return"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3864
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3865
	^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3866
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3867
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3868
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3869
     superView must be there, first
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3870
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3871
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3872
	superView id isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3873
	    superView reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3874
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3875
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3876
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3877
    myController := controller.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3878
    controller := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3879
    self recreate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3880
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3881
    "if I was mapped, do it again"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3882
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3883
	"only remap if I have a superview - otherwise, I might be
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3884
	 a hidden iconView or menu ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3885
	superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3886
"/            shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3887
		device mapView:self id:drawableId iconified:false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3888
			   atX:left y:top width:width height:height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3889
"/            ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3890
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3891
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3892
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3893
    "restore controller"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3894
    controller := myController
135
claus
parents:
diff changeset
  3895
! !
claus
parents:
diff changeset
  3896
140
claus
parents: 138
diff changeset
  3897
!SimpleView methodsFor:'private'!
claus
parents: 138
diff changeset
  3898
claus
parents: 138
diff changeset
  3899
computeInnerClip
claus
parents: 138
diff changeset
  3900
    "compute, but do not set the inside clip-area"
claus
parents: 138
diff changeset
  3901
claus
parents: 138
diff changeset
  3902
    |m2 nX nY nW nH|
claus
parents: 138
diff changeset
  3903
claus
parents: 138
diff changeset
  3904
    (margin ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  3905
	m2 := margin + margin.
claus
parents: 138
diff changeset
  3906
	nX := nY := margin.
claus
parents: 138
diff changeset
  3907
	nW := width - m2.
claus
parents: 138
diff changeset
  3908
	nH := height - m2.
claus
parents: 138
diff changeset
  3909
	transformation notNil ifTrue:[
claus
parents: 138
diff changeset
  3910
	    nX := transformation applyInverseToX:nX.
claus
parents: 138
diff changeset
  3911
	    nY := transformation applyInverseToY:nY.
claus
parents: 138
diff changeset
  3912
	    nW := transformation applyInverseScaleX:nW.
claus
parents: 138
diff changeset
  3913
	    nH := transformation applyInverseScaleY:nH.
claus
parents: 138
diff changeset
  3914
	].
claus
parents: 138
diff changeset
  3915
	innerClipRect := Rectangle 
claus
parents: 138
diff changeset
  3916
				 left:nX 
claus
parents: 138
diff changeset
  3917
				 top:nY 
claus
parents: 138
diff changeset
  3918
				 width:nW 
claus
parents: 138
diff changeset
  3919
				 height:nH
claus
parents: 138
diff changeset
  3920
    ] ifFalse:[
claus
parents: 138
diff changeset
  3921
	"no clipping"
claus
parents: 138
diff changeset
  3922
	innerClipRect := nil
claus
parents: 138
diff changeset
  3923
    ]
claus
parents: 138
diff changeset
  3924
!
claus
parents: 138
diff changeset
  3925
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3926
cornerFromRelativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3927
    "compute & return pixel corner from relativeCorner"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3928
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3929
    ^ self cornerFromRelativeCorner:relativeCorner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3930
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3931
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3932
cornerFromRelativeCorner:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3933
    "compute & return pixel corner from a relativeCorner, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3934
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3935
    |p r b bw|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3937
    p := self pointFromRelative:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3938
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3939
    bw := borderWidth.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3940
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3941
	bw == 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3942
	    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3943
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3944
	^ (p x - bw) @ (p y - bw)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3945
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3946
    r := (insets at:3) + bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3947
    b := (insets at:4) + bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3948
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3949
"/    r := b := bw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3950
"/    rightInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3951
"/        r := rightInset + bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3952
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3953
"/    bottomInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3954
"/        b := bottomInset + bw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3955
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3956
    ((r ~~ 0) or:[b ~~ 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3957
	^ (p x - r) @ (p y - b)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3958
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3959
    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3960
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3961
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3962
dimensionFromViewport
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3963
    "define my origin/extend from viewport"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3964
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3965
    |relW relH relX relY winW winH org ext|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3966
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3967
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3968
	superView window isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3969
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3970
	    v := superView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3971
	    (v notNil and:[v window isNil]) whileTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3972
		v := v superview
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3973
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3974
	    v notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3975
		w := v window
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3976
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3977
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3978
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3979
	    winW := 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3980
	    winH := 1
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3981
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3982
	    winW := superView width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3983
	    winH := superView height.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3984
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3985
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3986
	    winW := superView window width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3987
	    winH := superView window height
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3988
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3989
	relW := (viewport width / winW) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3990
	relH := (viewport height / winH) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3991
	relX := (viewport left / winW) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3992
	relY := (viewport top / winH) asFloat.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3993
	"bad coding style ... misuse other method"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3994
	relativeOrigin := (relX @ relY).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3995
	org := self originFromRelativeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3996
	relativeOrigin := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3997
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3998
	"bad coding style ...misuse other method"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  3999
	relativeExtent := (relW @ relH).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4000
	ext := self extentFromRelativeExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4001
	relativeExtent := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4002
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4003
	self pixelOrigin:org extent:ext.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4004
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4005
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4006
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4007
extentFromRelativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4008
    "compute & return pixel extent from relativeExtent"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4009
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4010
    ^ self extentFromRelativeExtent:relativeExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4011
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4012
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4013
extentFromRelativeExtent:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4014
    "compute & return pixel extent from relativeExtent, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4015
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4016
    |rel newX newY inRect bw2 i|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4017
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4018
    superView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4019
	inRect := 0@0 extent:device extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4020
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4021
	inRect := superView viewRectangle.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4022
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4023
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4024
    bw2 := borderWidth * 2.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4025
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4026
    rel := aPoint x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4027
    rel isInteger ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4028
	newX := (rel * (inRect width + bw2)) asInteger + inRect left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4029
	(borderWidth ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4030
	    newX := newX - borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4031
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4032
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4033
	newX := rel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4034
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4035
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4036
    rel := aPoint y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4037
    rel isInteger ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4038
	newY := (rel * (inRect height + bw2)) asInteger + inRect top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4039
	(borderWidth ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4040
	    newY := newY - borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4041
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4042
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4043
	newY := rel
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4044
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4045
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4046
    insets notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4047
	i := insets at:1.   "top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4048
	(i  ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4049
	    newX := newX - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4050
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4051
	i := insets at:3.   "left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4052
	(i  ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4053
	    newX := newX - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4054
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4055
	i := insets at:2.   "right"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4056
	(i ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4057
	    newY := newY - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4058
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4059
	i := insets at:4.   "bottom"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4060
	(i ~~ 0) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4061
	    newY := newY - i
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4062
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4063
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4064
    ^ newX @ newY
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4065
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4066
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4067
originFromRelativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4068
    "compute & return pixel origin from relativeOrigin"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4069
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4070
    ^ self originFromRelativeOrigin:relativeOrigin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4071
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4072
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4073
originFromRelativeOrigin:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4074
    "compute & return pixel origin from relativeOrigin, aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4075
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4076
    |p l t|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4077
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4078
    p := self pointFromRelative:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4079
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4080
    insets isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4081
	^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4082
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4083
    l := insets at:1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4084
    t := insets at:2.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4085
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4086
"/  l := t := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4087
"/    leftInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4088
"/        l := leftInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4089
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4090
"/    topInset notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4091
"/        t := topInset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4092
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4093
    ((l ~~ 0) or:[t ~~ 0]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4094
	^ (p x + l) @ (p y + t)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4095
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4096
    ^ p
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4097
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4098
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4099
pixelCorner:corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4100
    "set the views corner in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4101
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4102
    |w h|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4103
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4104
    w := corner x - left + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4105
    h := corner y - top + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4106
    self pixelOrigin:(left @ top) extent:(w @ h)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4107
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4108
    "Modified: 31.8.1995 / 18:20:22 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4109
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4110
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4111
pixelExtent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4112
    "set the views extent in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4113
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4114
    self pixelOrigin:(left @ top) extent:extent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4115
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4116
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4117
pixelOrigin:origin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4118
    "set the views origin in pixels. For subviews. the origin is relative
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4119
     to the superviews top-left. For topViews, its the screen origin."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4120
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4121
    |newLeft newTop|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4122
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4123
    newLeft := origin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4124
    newTop := origin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4125
    ((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4126
	top := newTop.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4127
	left := newLeft.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4128
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4129
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4130
	 if the receiver is visible, or is a topView, perform the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4131
	 operation right away - otherwise, simply remember that the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4132
	 origin has changed - will tell the display once we get realized
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4133
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4134
"/        (shown 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4135
"/        or:[superView isNil and:[drawableId notNil]]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4136
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4137
	"/ no, have to do it if drawableId is there
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4138
	"/ (otherwise, we could not move unmapped views around ...
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4139
	"/
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4140
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4141
	    device moveWindow:drawableId x:left y:top
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4142
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4143
	    originChanged := true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4144
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4145
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4146
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4147
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4148
pixelOrigin:origin corner:corner
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4149
    "set the views origin and corner in pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4150
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4151
    |w h|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4152
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4153
    w := corner x - origin x + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4154
    h := corner y - origin y + 1.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4155
    self pixelOrigin:origin extent:(w @ h)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4156
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4157
    "Modified: 31.8.1995 / 18:24:16 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4158
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4159
140
claus
parents: 138
diff changeset
  4160
pixelOrigin:origin extent:extent
claus
parents: 138
diff changeset
  4161
    "set the views origin and extent in pixels"
claus
parents: 138
diff changeset
  4162
claus
parents: 138
diff changeset
  4163
    |newLeft newTop newWidth newHeight how 
claus
parents: 138
diff changeset
  4164
     mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom
claus
parents: 138
diff changeset
  4165
     mustRepaintRight sameOrigin oldWidth oldHeight|
claus
parents: 138
diff changeset
  4166
claus
parents: 138
diff changeset
  4167
    newLeft := origin x.
claus
parents: 138
diff changeset
  4168
    newTop := origin y.
claus
parents: 138
diff changeset
  4169
    sameOrigin := ((newTop == top) and:[newLeft == left]).
claus
parents: 138
diff changeset
  4170
claus
parents: 138
diff changeset
  4171
    newWidth := extent x.
claus
parents: 138
diff changeset
  4172
    newHeight := extent y.
claus
parents: 138
diff changeset
  4173
claus
parents: 138
diff changeset
  4174
    "
claus
parents: 138
diff changeset
  4175
     X complains badly if you try to create/resize a view with
claus
parents: 138
diff changeset
  4176
     a dimension <= 0 ... (although I think that 0 maks sense ...)
claus
parents: 138
diff changeset
  4177
    "
claus
parents: 138
diff changeset
  4178
    newWidth < 1 ifTrue:[
claus
parents: 138
diff changeset
  4179
	newWidth := 1.
claus
parents: 138
diff changeset
  4180
    ].
claus
parents: 138
diff changeset
  4181
    newHeight < 1 ifTrue:[
claus
parents: 138
diff changeset
  4182
	newHeight := 1
claus
parents: 138
diff changeset
  4183
    ].
claus
parents: 138
diff changeset
  4184
claus
parents: 138
diff changeset
  4185
    ((newWidth == width) and:[newHeight == height]) ifTrue:[
claus
parents: 138
diff changeset
  4186
	sameOrigin ifTrue:[^ self].
claus
parents: 138
diff changeset
  4187
	^ self pixelOrigin:origin
claus
parents: 138
diff changeset
  4188
    ].
claus
parents: 138
diff changeset
  4189
    top := newTop.
claus
parents: 138
diff changeset
  4190
    left := newLeft.
claus
parents: 138
diff changeset
  4191
claus
parents: 138
diff changeset
  4192
"/    shown ifTrue:[                  "4-nov-94 actually correct,"
claus
parents: 138
diff changeset
  4193
    drawableId notNil ifTrue:[        "but theres a bug in menus when resized while hidden"
151
claus
parents: 145
diff changeset
  4194
	mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height].
claus
parents: 145
diff changeset
  4195
	mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width].
claus
parents: 145
diff changeset
  4196
claus
parents: 145
diff changeset
  4197
	((newHeight <= height) and:[newWidth <= width]) ifTrue:[
claus
parents: 145
diff changeset
  4198
	    how := #smaller
claus
parents: 145
diff changeset
  4199
	].
claus
parents: 145
diff changeset
  4200
140
claus
parents: 138
diff changeset
  4201
	mustRepaintRight := false.
claus
parents: 138
diff changeset
  4202
	mustRepaintBottom := false.
claus
parents: 138
diff changeset
  4203
	(level ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4204
	    "clear the old edges"
claus
parents: 138
diff changeset
  4205
claus
parents: 138
diff changeset
  4206
	    newWidth > width ifTrue:[
claus
parents: 138
diff changeset
  4207
		self clipRect:nil.
claus
parents: 138
diff changeset
  4208
		self paint:viewBackground.
claus
parents: 138
diff changeset
  4209
		self fillDeviceRectangleX:(width - margin)
claus
parents: 138
diff changeset
  4210
					y:0
claus
parents: 138
diff changeset
  4211
				    width:margin
claus
parents: 138
diff changeset
  4212
				   height:height.
claus
parents: 138
diff changeset
  4213
		mustRepaintRight := true.
claus
parents: 138
diff changeset
  4214
		oldWidth := width
claus
parents: 138
diff changeset
  4215
	    ].
claus
parents: 138
diff changeset
  4216
	    newHeight > height ifTrue:[
claus
parents: 138
diff changeset
  4217
		self clipRect:nil.
claus
parents: 138
diff changeset
  4218
		self paint:viewBackground.
claus
parents: 138
diff changeset
  4219
		self fillDeviceRectangleX:0
claus
parents: 138
diff changeset
  4220
					y:(height - margin)
claus
parents: 138
diff changeset
  4221
				    width:width
claus
parents: 138
diff changeset
  4222
				   height:margin.
claus
parents: 138
diff changeset
  4223
		mustRepaintBottom := true.
claus
parents: 138
diff changeset
  4224
		oldHeight := height
claus
parents: 138
diff changeset
  4225
	    ]
claus
parents: 138
diff changeset
  4226
	].
claus
parents: 138
diff changeset
  4227
claus
parents: 138
diff changeset
  4228
	width := newWidth.
claus
parents: 138
diff changeset
  4229
	height := newHeight.
claus
parents: 138
diff changeset
  4230
claus
parents: 138
diff changeset
  4231
	self setInnerClip.
claus
parents: 138
diff changeset
  4232
claus
parents: 138
diff changeset
  4233
	"if view becomes smaller, send sizeChanged first"
claus
parents: 138
diff changeset
  4234
	(how == #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4235
	    self sizeChanged:how
claus
parents: 138
diff changeset
  4236
	].
claus
parents: 138
diff changeset
  4237
claus
parents: 138
diff changeset
  4238
	"have to tell X, when extent of view is changed"
claus
parents: 138
diff changeset
  4239
	sameOrigin ifTrue:[
claus
parents: 138
diff changeset
  4240
	    device resizeWindow:drawableId width:width height:height.
claus
parents: 138
diff changeset
  4241
	] ifFalse:[
claus
parents: 138
diff changeset
  4242
	    "claus: some xservers seem to do better when resizing
claus
parents: 138
diff changeset
  4243
	     first ...."
claus
parents: 138
diff changeset
  4244
" 
claus
parents: 138
diff changeset
  4245
	    (how == #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4246
		device resizeWindow:drawableId width:width height:height.
claus
parents: 138
diff changeset
  4247
		device moveWindow:drawableId x:left y:top
claus
parents: 138
diff changeset
  4248
	    ] ifFalse:[
claus
parents: 138
diff changeset
  4249
		device moveResizeWindow:drawableId x:left y:top width:width height:height
claus
parents: 138
diff changeset
  4250
	    ].
claus
parents: 138
diff changeset
  4251
" 
claus
parents: 138
diff changeset
  4252
	    device moveResizeWindow:drawableId x:left y:top
claus
parents: 138
diff changeset
  4253
					   width:width height:height.
claus
parents: 138
diff changeset
  4254
" "
claus
parents: 138
diff changeset
  4255
	].
claus
parents: 138
diff changeset
  4256
claus
parents: 138
diff changeset
  4257
	"if view becomes bigger, send sizeChanged after"
claus
parents: 138
diff changeset
  4258
	(how ~~ #smaller) ifTrue:[
claus
parents: 138
diff changeset
  4259
	    self sizeChanged:how
claus
parents: 138
diff changeset
  4260
	].
claus
parents: 138
diff changeset
  4261
claus
parents: 138
diff changeset
  4262
	(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[
claus
parents: 138
diff changeset
  4263
	    self clipRect:nil.
claus
parents: 138
diff changeset
  4264
	    mustRedrawBottomEdge ifTrue:[
claus
parents: 138
diff changeset
  4265
		self drawBottomEdge
claus
parents: 138
diff changeset
  4266
	    ].
claus
parents: 138
diff changeset
  4267
	    mustRedrawRightEdge ifTrue:[
claus
parents: 138
diff changeset
  4268
		self drawRightEdge
claus
parents: 138
diff changeset
  4269
	    ].
claus
parents: 138
diff changeset
  4270
	    self clipRect:innerClipRect
claus
parents: 138
diff changeset
  4271
	].
claus
parents: 138
diff changeset
  4272
claus
parents: 138
diff changeset
  4273
	mustRepaintRight ifTrue:[
claus
parents: 138
diff changeset
  4274
	    self redrawDeviceX:(oldWidth - margin)
claus
parents: 138
diff changeset
  4275
			     y:0
claus
parents: 138
diff changeset
  4276
			 width:margin
claus
parents: 138
diff changeset
  4277
			height:height.
claus
parents: 138
diff changeset
  4278
	].
claus
parents: 138
diff changeset
  4279
	mustRepaintBottom ifTrue:[
claus
parents: 138
diff changeset
  4280
	    self redrawDeviceX:0
claus
parents: 138
diff changeset
  4281
			     y:(oldHeight - margin)
claus
parents: 138
diff changeset
  4282
			 width:width
claus
parents: 138
diff changeset
  4283
			height:margin.
claus
parents: 138
diff changeset
  4284
	].
claus
parents: 138
diff changeset
  4285
    ] ifFalse:[
claus
parents: 138
diff changeset
  4286
	"otherwise memorize the need for a sizeChanged message"
claus
parents: 138
diff changeset
  4287
claus
parents: 138
diff changeset
  4288
	width := newWidth.
claus
parents: 138
diff changeset
  4289
	height := newHeight.
claus
parents: 138
diff changeset
  4290
	sameOrigin ifFalse:[
claus
parents: 138
diff changeset
  4291
	    originChanged := true.
claus
parents: 138
diff changeset
  4292
	].
claus
parents: 138
diff changeset
  4293
	extentChanged := true
claus
parents: 138
diff changeset
  4294
    ]
claus
parents: 138
diff changeset
  4295
!
claus
parents: 138
diff changeset
  4296
claus
parents: 138
diff changeset
  4297
pointFromRelative:p
claus
parents: 138
diff changeset
  4298
    "compute absolute coordinate from p"
claus
parents: 138
diff changeset
  4299
claus
parents: 138
diff changeset
  4300
    |newX newY rel inRect bw superWidth superHeight superLeft superTop |
claus
parents: 138
diff changeset
  4301
claus
parents: 138
diff changeset
  4302
    bw := borderWidth.
claus
parents: 138
diff changeset
  4303
claus
parents: 138
diff changeset
  4304
    superView isNil ifTrue:[
claus
parents: 138
diff changeset
  4305
	superWidth := device width + bw.      
claus
parents: 138
diff changeset
  4306
	superHeight := device height + bw.
claus
parents: 138
diff changeset
  4307
	superLeft := superTop := 0.
claus
parents: 138
diff changeset
  4308
    ] ifFalse:[
claus
parents: 138
diff changeset
  4309
	inRect := superView viewRectangle.
claus
parents: 138
diff changeset
  4310
	superWidth := inRect width.
claus
parents: 138
diff changeset
  4311
	superHeight := inRect height.
claus
parents: 138
diff changeset
  4312
	superLeft := inRect left.
claus
parents: 138
diff changeset
  4313
	superTop := inRect top.
claus
parents: 138
diff changeset
  4314
    ].
claus
parents: 138
diff changeset
  4315
claus
parents: 138
diff changeset
  4316
    rel := p x.
claus
parents: 138
diff changeset
  4317
    rel isInteger ifTrue:[
claus
parents: 138
diff changeset
  4318
	newX := rel
claus
parents: 138
diff changeset
  4319
    ] ifFalse:[
claus
parents: 138
diff changeset
  4320
	newX := (rel * superWidth) asInteger + superLeft.
claus
parents: 138
diff changeset
  4321
	(bw ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4322
	    rel ~= 1.0 ifTrue:[
claus
parents: 138
diff changeset
  4323
		newX := newX - bw
claus
parents: 138
diff changeset
  4324
	    ]
claus
parents: 138
diff changeset
  4325
	]
claus
parents: 138
diff changeset
  4326
    ].
claus
parents: 138
diff changeset
  4327
claus
parents: 138
diff changeset
  4328
    rel := p y.
claus
parents: 138
diff changeset
  4329
    rel isInteger ifTrue:[
claus
parents: 138
diff changeset
  4330
	newY := rel
claus
parents: 138
diff changeset
  4331
    ] ifFalse:[
claus
parents: 138
diff changeset
  4332
	newY := (rel * superHeight) asInteger + superTop.
claus
parents: 138
diff changeset
  4333
	(bw ~~ 0) ifTrue:[
claus
parents: 138
diff changeset
  4334
	    rel ~= 1.0 ifTrue:[
claus
parents: 138
diff changeset
  4335
		newY := newY - bw
claus
parents: 138
diff changeset
  4336
	    ]
claus
parents: 138
diff changeset
  4337
	]
claus
parents: 138
diff changeset
  4338
    ].
claus
parents: 138
diff changeset
  4339
    ^ newX @ newY
claus
parents: 138
diff changeset
  4340
!
claus
parents: 138
diff changeset
  4341
claus
parents: 138
diff changeset
  4342
setBorderColor
claus
parents: 138
diff changeset
  4343
    "set my borderColor"
claus
parents: 138
diff changeset
  4344
claus
parents: 138
diff changeset
  4345
    |id dither|
claus
parents: 138
diff changeset
  4346
claus
parents: 138
diff changeset
  4347
    drawableId notNil ifTrue:[
claus
parents: 138
diff changeset
  4348
	borderColor := borderColor on:device.
claus
parents: 138
diff changeset
  4349
	id := borderColor colorId.
claus
parents: 138
diff changeset
  4350
	id notNil ifTrue:[
claus
parents: 138
diff changeset
  4351
	    device setWindowBorderColor:id in:drawableId
claus
parents: 138
diff changeset
  4352
	] ifFalse:[
claus
parents: 138
diff changeset
  4353
	    dither := borderColor ditherForm.
claus
parents: 138
diff changeset
  4354
	    dither notNil ifTrue:[
claus
parents: 138
diff changeset
  4355
		device setWindowBorderPixmap:(dither id) in:drawableId
claus
parents: 138
diff changeset
  4356
	    ] ifFalse:[
145
claus
parents: 144
diff changeset
  4357
		'VIEW: bad borderColor' errorPrintNL
135
claus
parents:
diff changeset
  4358
	    ]
claus
parents:
diff changeset
  4359
	]
claus
parents:
diff changeset
  4360
    ]
claus
parents:
diff changeset
  4361
!
claus
parents:
diff changeset
  4362
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4363
setInnerClip
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4364
    "compute, and set the inside clip-area"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4365
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4366
    self computeInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4367
    self clipRect:innerClipRect
140
claus
parents: 138
diff changeset
  4368
! !
claus
parents: 138
diff changeset
  4369
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4370
!SimpleView methodsFor:'queries'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4371
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4372
buttonMotionEventPending
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4373
    "return true, if a button motion event is pending.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4374
     Normally, you dont want to use this, since no polling is needed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4375
     (not even for mouse-tracking).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4376
     Dont use it, since it does not honor the windowGroup, but
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4377
     goes directly to the device instead.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4378
     Actually, its a historical leftover"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4379
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4380
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4381
	^ windowGroup sensor hasButtonMotionEventsFor:self
140
claus
parents: 138
diff changeset
  4382
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4383
    ^ super buttonMotionEventPending
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4384
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4385
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4386
canDrop:anObjectOrCollection
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4387
    "return true, if anObjectOrCollection can be
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4388
     dropped in the receiver. This method should be
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4389
     redefined in views which can take objects"
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4390
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4391
    ^ false
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4392
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4393
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4394
canHandle:aKey
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4395
    "return true, if I like to handle the key (from a keyPress event).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4396
     OBSOLETE: do not use & depend on this method, it is a historic
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4397
     leftOver and will be removed. Use the delegation mechanism for this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4398
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4399
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4400
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4401
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4402
canHandle:aKey from:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4403
    "return true, if I like to handle the key (from a keyPress event)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4404
     in aView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4405
     OBSOLETE: do not use & depend on this method, it is a historic
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4406
     leftOver and will be removed. Use the delegation mechanism for this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4407
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4408
    ^ self canHandle:aKey
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4409
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4410
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4411
delegatesTo:someone
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4412
    "return true, if I delegate events to someone"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4413
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4414
    delegate isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4415
    ^ delegate delegatesTo:someone
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4416
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4417
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4418
hasFocus
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4419
    "return true, if the receiver has the keyboard focus
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4420
     (either via the focusView mechanism in the windowGroup,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4421
      or via delegation)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4422
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4423
    |focusView delegate|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4424
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4425
    windowGroup isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4426
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4427
    (focusView := windowGroup focusView) == self ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4428
    focusView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4429
	"mhmh - is there a delegation to me ?"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4430
	(delegate := focusView delegate) notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4431
	    delegate == self ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4432
	    ^ delegate delegatesTo:self
135
claus
parents:
diff changeset
  4433
	]
claus
parents:
diff changeset
  4434
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4435
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4436
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4437
370
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4438
is3D
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4439
    "return true, if my style is some kind of 3D style
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4440
     This is OBSOLETE and will be removed."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4441
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4442
    ^ styleSheet is3D
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4443
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4444
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4445
isPopUpView
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4446
    "return true, if this view should be put on top (raised) automatically.
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4447
     usually this is true for alertBoxes etc."
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4448
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4449
    ^ false
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4450
!
c43763552e80 category changes
Claus Gittinger <cg@exept.de>
parents: 369
diff changeset
  4451
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4452
isSubViewOf:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4453
    "return true, if I am a subview of aView"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4454
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4455
    aView == self isNil ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4456
    superView isNil ifTrue:[^ false].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4457
    superView == aView ifTrue:[^ true].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4458
    ^ superView isSubViewOf:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4459
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4460
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4461
isView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4462
    "return true, if the receiver is some kind of view;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4463
     true is returned here."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4464
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4465
    ^ true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4466
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4467
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4468
preferredBounds
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4469
    "ST-80 compatibility."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4470
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4471
    ^ 0@0 corner:self preferredExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4472
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4473
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4474
preferredExtent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4475
    "return my preferred extent - this is the minimum size I would like to have.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4476
     The default here is the actual extent, the receiver currently has."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4477
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4478
    "mhmh - if I have components, collect their
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4479
     preferred bounds ..."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4480
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4481
    |maxX maxY|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4482
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4483
    subViews isNil ifTrue:[^ self extent].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4484
"/    ^ self extent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4485
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4486
    maxX := maxY := 0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4487
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4488
	subViews do:[:aSubView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4489
	    |org corn|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4490
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4491
	    org := aSubView computeOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4492
	    corn := org + aSubView preferredExtent.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4493
	    maxX := maxX max:corn x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4494
	    maxY := maxY max:corn y.
140
claus
parents: 138
diff changeset
  4495
	]
claus
parents: 138
diff changeset
  4496
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4497
    ^ maxX @ maxY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4498
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4499
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4500
sizeFixed
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4501
    "return true, if this vew wants its size to remain unchanged.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4502
     Used by panels, to check if their components want to keep their size."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4503
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4504
    ^ false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4505
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4506
    "Created: 17.9.1995 / 20:29:20 / claus"
140
claus
parents: 138
diff changeset
  4507
! !
claus
parents: 138
diff changeset
  4508
claus
parents: 138
diff changeset
  4509
!SimpleView methodsFor:'realization'!
claus
parents: 138
diff changeset
  4510
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4511
create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4512
    "create (i.e. tell my device about me) if not already created.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4513
     This does not make the view visible (needs a #map for that)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4514
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4515
    drawableId isNil ifTrue:[
151
claus
parents: 145
diff changeset
  4516
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4517
	 make certain that superview is created also
151
claus
parents: 145
diff changeset
  4518
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4519
	superView notNil ifTrue:[
355
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4520
	     superView create.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4521
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4522
"/            "and put my controller into the superviews controller list"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4523
"/            controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4524
"/                superView controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4525
"/                    controller manager:(superView controller manager)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4526
"/                ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4527
"/            ]
355
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4528
	] ifFalse:[
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4529
	    "/
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4530
	    "/ if the display is not already dispatching events,
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4531
	    "/ this starts the event process.
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4532
	    "/
3bff8697c536 automatically start an event dispatch process when a topView is
Claus Gittinger <cg@exept.de>
parents: 343
diff changeset
  4533
	    device startDispatch
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4534
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4535
343
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4536
	cursor notNil ifTrue:[
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4537
	    cursor := cursor on:device.
f5d86df5c66b dont care for nil cursors
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  4538
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4539
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4540
	self physicalCreate.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4541
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4542
	viewBackground notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4543
	   self setViewBackground
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4544
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4545
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4546
	self initializeMiddleButtonMenu.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4547
	self initEvents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4548
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4549
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4550
	 this is the first create,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4551
	 force sizechange messages to be sent to the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4552
	"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4553
	extentChanged := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4554
	originChanged := true
151
claus
parents: 145
diff changeset
  4555
    ]
claus
parents: 145
diff changeset
  4556
!
claus
parents: 145
diff changeset
  4557
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4558
createWithAllSubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4559
    "create, then create all subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4560
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4561
    drawableId isNil ifTrue:[self create].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4562
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4563
	subViews do:[:subView | subView createWithAllSubViews]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4564
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4565
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4566
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4567
destroy
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4568
    "unrealize & destroy - make me invisible, destroy subviews then
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4569
     make me unknown to the device"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4570
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4571
    |subs|
140
claus
parents: 138
diff changeset
  4572
claus
parents: 138
diff changeset
  4573
    realized ifTrue:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4574
	self unrealize.            
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4575
	"make it go away immediately
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4576
	 - also, this hides the subview killing"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4577
"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4578
	device synchronizeOutput. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4579
"
151
claus
parents: 145
diff changeset
  4580
    ].
claus
parents: 145
diff changeset
  4581
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4582
"/    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4583
"/      controller release.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4584
"/      controller := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4585
"/    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4586
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4587
    subs := subViews.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4588
    subs notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4589
	"stupid: destroy removes itself from the subview list
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4590
	 - therefore we have to loop over a copy here"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4591
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4592
	subViews := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4593
	subs do:[:aView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4594
	    aView notNil ifTrue:[aView destroy]             
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4595
	]
140
claus
parents: 138
diff changeset
  4596
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4597
    superView notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4598
	superView removeSubView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4599
	superView := nil
140
claus
parents: 138
diff changeset
  4600
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4601
    super destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4602
312
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4603
    superView isNil ifTrue:[
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4604
	device flush
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4605
    ].
a3500ca1f37b stefans changes
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
  4606
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4607
    controller notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4608
	controller release.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4609
	controller := nil.
140
claus
parents: 138
diff changeset
  4610
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4611
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4612
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4613
	windowGroup removeView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4614
	windowGroup := nil
140
claus
parents: 138
diff changeset
  4615
    ].
claus
parents: 138
diff changeset
  4616
!
claus
parents: 138
diff changeset
  4617
claus
parents: 138
diff changeset
  4618
fixSize
claus
parents: 138
diff changeset
  4619
    "This is called right before the view is made visible.
claus
parents: 138
diff changeset
  4620
     Adjust the size of the view according to either relative/abs or
claus
parents: 138
diff changeset
  4621
     block extent; also set origin. Also, subclasses may redefine this
claus
parents: 138
diff changeset
  4622
     method to adjust the size based on some extent (for example, PopUpMenus
claus
parents: 138
diff changeset
  4623
     do so to take care of changed number of menu entries)."
claus
parents: 138
diff changeset
  4624
151
claus
parents: 145
diff changeset
  4625
    |org ext r|
claus
parents: 145
diff changeset
  4626
claus
parents: 145
diff changeset
  4627
    "please: no longer use window/viewport - they will vanish"
140
claus
parents: 138
diff changeset
  4628
    window notNil ifTrue:[
claus
parents: 138
diff changeset
  4629
	^ self superViewChangedSize
claus
parents: 138
diff changeset
  4630
    ].
claus
parents: 138
diff changeset
  4631
151
claus
parents: 145
diff changeset
  4632
    "
claus
parents: 145
diff changeset
  4633
     slowly migrating to use layoutObjects ...
claus
parents: 145
diff changeset
  4634
    "
claus
parents: 145
diff changeset
  4635
    layout notNil ifTrue:[
claus
parents: 145
diff changeset
  4636
	(originChanged or:[extentChanged or:[cornerChanged]]) ifTrue:[
claus
parents: 145
diff changeset
  4637
	    r := (layout rectangleRelativeTo:(superView viewRectangle)
claus
parents: 145
diff changeset
  4638
				   preferred:(self preferredBounds)).
claus
parents: 145
diff changeset
  4639
	    org := r origin rounded.
claus
parents: 145
diff changeset
  4640
	    ext := r extent rounded.
claus
parents: 145
diff changeset
  4641
	    self pixelOrigin:org extent:ext.
claus
parents: 145
diff changeset
  4642
	].
claus
parents: 145
diff changeset
  4643
	^ self.
claus
parents: 145
diff changeset
  4644
    ].
claus
parents: 145
diff changeset
  4645
140
claus
parents: 138
diff changeset
  4646
    "if the extent is not the one we created the window with ..."
claus
parents: 138
diff changeset
  4647
    extentChanged ifTrue:[
claus
parents: 138
diff changeset
  4648
	self sizeChanged:nil.
claus
parents: 138
diff changeset
  4649
	extentChanged := false
claus
parents: 138
diff changeset
  4650
    ].
claus
parents: 138
diff changeset
  4651
claus
parents: 138
diff changeset
  4652
    originChanged ifTrue:[
claus
parents: 138
diff changeset
  4653
"/        org := self computeOrigin.
claus
parents: 138
diff changeset
  4654
"/        self pixelOrigin:org.    
claus
parents: 138
diff changeset
  4655
	originRule notNil ifTrue:[
claus
parents: 138
diff changeset
  4656
	    self pixelOrigin:self computeOrigin
claus
parents: 138
diff changeset
  4657
	] ifFalse:[
claus
parents: 138
diff changeset
  4658
	    relativeOrigin notNil ifTrue:[
claus
parents: 138
diff changeset
  4659
		self originFromRelativeOrigin:relativeOrigin
claus
parents: 138
diff changeset
  4660
	    ] ifFalse:[
151
claus
parents: 145
diff changeset
  4661
		shown ifTrue:[
claus
parents: 145
diff changeset
  4662
		    device moveWindow:drawableId x:left y:top.
claus
parents: 145
diff changeset
  4663
		] ifFalse:[
claus
parents: 145
diff changeset
  4664
		    self pixelOrigin:left@top
claus
parents: 145
diff changeset
  4665
		].
140
claus
parents: 138
diff changeset
  4666
	    ].
claus
parents: 138
diff changeset
  4667
	].
claus
parents: 138
diff changeset
  4668
	originChanged := false
claus
parents: 138
diff changeset
  4669
    ]
claus
parents: 138
diff changeset
  4670
!
claus
parents: 138
diff changeset
  4671
393
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4672
hide
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4673
    "for protocol compatibility with modal dialogs;
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4674
     ignored here."
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4675
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4676
    ^ self
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4677
!
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4678
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4679
hideRequest
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4680
    "for protocol compatibility with modal dialogs;
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4681
     ignored here."
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4682
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4683
    ^ self
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4684
!
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  4685
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4686
map
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4687
    "make the view visible on the screen"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4688
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4689
    realized ifFalse:[
140
claus
parents: 138
diff changeset
  4690
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4691
	 now, make the view visible
140
claus
parents: 138
diff changeset
  4692
	"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4693
	device mapWindow:drawableId.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4694
	realized := true.
140
claus
parents: 138
diff changeset
  4695
    ]
claus
parents: 138
diff changeset
  4696
!
claus
parents: 138
diff changeset
  4697
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4698
physicalCreate
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4699
    "common code for create & recreate: 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4700
     physically create (but do not map) the view on the device."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4701
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4702
    "associate colors to device"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4703
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4704
    drawableId := device 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4705
		      createWindowFor:self 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4706
			  origin:(left @ top)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4707
			  extent:(width @ height)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4708
			  minExtent:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4709
			  maxExtent:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4710
			  borderWidth:borderWidth
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4711
			  subViewOf:superView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4712
			  onTop:(self isPopUpView)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4713
			  inputOnly:(self inputOnly)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4714
			  label:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4715
			  cursor:cursor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4716
			  icon:nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4717
			  iconView:nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4718
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4719
    Lobby registerChange:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4720
    extentChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4721
    originChanged := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4722
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4723
    (borderColor notNil and:[borderColor ~~ Black]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4724
"/        borderColor := borderColor on:device.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4725
	self setBorderColor
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4726
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4727
    (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4728
	device setWindowGravity:viewGravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4729
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4730
    (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4731
	device setBitGravity:bitGravity in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4732
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4733
    borderShape notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4734
	device setWindowBorderShape:(borderShape id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4735
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4736
    viewShape notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4737
	device setWindowShape:(viewShape id) in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4738
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4739
    (backed notNil and:[backed ~~ false]) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4740
	device setBackingStore:backed in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4741
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4742
    saveUnder ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4743
	device setSaveUnder:true in:drawableId
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4744
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4745
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4746
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4747
realize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4748
    "realize - make visible;
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4749
     realizing is done very late (after layout is fixed) to avoid
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4750
     visible rearranging of windows on the screen"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4751
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4752
    self realizeKeepingGroup:false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4753
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4754
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4755
realizeAllSubViews
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4756
    "realize all my subviews"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4757
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4758
    subViews notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4759
	subViews do:[:subView |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4760
	    subView realize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4761
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4762
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4763
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4764
    "Modified: 5.9.1995 / 23:30:47 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4765
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4766
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4767
realizeInGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4768
    "special realize - leave windowgroup as is; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4769
     This allows a view to be realized in any windowgroup; 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4770
     for special applications, like the kill button in the Filebrowser which has
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4771
     a windowGroup different from its superview's and is handled as a separate process."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4772
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4773
    windowGroup isForModalSubview:true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4774
    self realize.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4775
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4776
"/    self realizeKeepingGroup:true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4777
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4778
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4779
realizeKeepingGroup:keepGroupAsIs 
151
claus
parents: 145
diff changeset
  4780
    "common helper for realize and realizeInGroup.
claus
parents: 145
diff changeset
  4781
     Create the view, if the argument is not true, assign my windowGroup,
claus
parents: 145
diff changeset
  4782
     if hiddenOnRealize is not true, map it."
140
claus
parents: 138
diff changeset
  4783
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4784
    |superGroup groupChange keep|
140
claus
parents: 138
diff changeset
  4785
claus
parents: 138
diff changeset
  4786
    drawableId isNil ifTrue:[
claus
parents: 138
diff changeset
  4787
	self create.
claus
parents: 138
diff changeset
  4788
    ].
claus
parents: 138
diff changeset
  4789
372
78e5b6e96649 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
  4790
    groupChange := false.
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4791
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4792
    (windowGroup notNil and:[windowGroup isForModalSubview]) ifTrue:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4793
	keep := true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4794
    ] ifFalse:[
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4795
	keep := keepGroupAsIs
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4796
    ].
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4797
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  4798
    keep ifFalse:[
140
claus
parents: 138
diff changeset
  4799
	"
claus
parents: 138
diff changeset
  4800
	 put myself into superviews windowgroup if there is a superview
claus
parents: 138
diff changeset
  4801
	"
claus
parents: 138
diff changeset
  4802
	superView notNil ifTrue:[
claus
parents: 138
diff changeset
  4803
	    superGroup := superView windowGroup.
claus
parents: 138
diff changeset
  4804
	    (windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[
claus
parents: 138
diff changeset
  4805
		"
claus
parents: 138
diff changeset
  4806
		 mhmh - seems that the windowgroup has changed ....
claus
parents: 138
diff changeset
  4807
		"
145
claus
parents: 144
diff changeset
  4808
"/                'oops - wgroup change on realize' printNL.
140
claus
parents: 138
diff changeset
  4809
		windowGroup removeView:self.
claus
parents: 138
diff changeset
  4810
		windowGroup := nil
claus
parents: 138
diff changeset
  4811
	    ].
claus
parents: 138
diff changeset
  4812
	    superGroup ~~ windowGroup ifTrue:[
claus
parents: 138
diff changeset
  4813
		groupChange := true.
claus
parents: 138
diff changeset
  4814
		windowGroup := superGroup.
claus
parents: 138
diff changeset
  4815
		windowGroup notNil ifTrue:[
claus
parents: 138
diff changeset
  4816
		    windowGroup addView:self.
claus
parents: 138
diff changeset
  4817
		]
claus
parents: 138
diff changeset
  4818
	    ]
claus
parents: 138
diff changeset
  4819
	].
claus
parents: 138
diff changeset
  4820
    ].
claus
parents: 138
diff changeset
  4821
151
claus
parents: 145
diff changeset
  4822
    hiddenOnRealize ifFalse:[
175
claus
parents: 173
diff changeset
  4823
	(originChanged or:[extentChanged]) ifTrue:[
claus
parents: 173
diff changeset
  4824
	    self fixSize.
claus
parents: 173
diff changeset
  4825
	    self sizeChanged:nil.   "/ new 29-aug-1995
claus
parents: 173
diff changeset
  4826
	].
140
claus
parents: 138
diff changeset
  4827
claus
parents: 138
diff changeset
  4828
	(realized not or:[groupChange]) ifTrue:[
claus
parents: 138
diff changeset
  4829
	    subViews notNil ifTrue:[
180
claus
parents: 176
diff changeset
  4830
		self realizeAllSubViews.
140
claus
parents: 138
diff changeset
  4831
	    ].
claus
parents: 138
diff changeset
  4832
	].
claus
parents: 138
diff changeset
  4833
	self setInnerClip.
claus
parents: 138
diff changeset
  4834
claus
parents: 138
diff changeset
  4835
	realized ifFalse:[
claus
parents: 138
diff changeset
  4836
	    "
claus
parents: 138
diff changeset
  4837
	     now, make the view visible
claus
parents: 138
diff changeset
  4838
	    "
151
claus
parents: 145
diff changeset
  4839
	    self map
140
claus
parents: 138
diff changeset
  4840
	]
claus
parents: 138
diff changeset
  4841
    ].
claus
parents: 138
diff changeset
  4842
claus
parents: 138
diff changeset
  4843
    controller notNil ifTrue:[
claus
parents: 138
diff changeset
  4844
	controller startUp
claus
parents: 138
diff changeset
  4845
    ]
claus
parents: 138
diff changeset
  4846
!
claus
parents: 138
diff changeset
  4847
claus
parents: 138
diff changeset
  4848
recreate
claus
parents: 138
diff changeset
  4849
    "recreate (i.e. tell X about me) after a snapin"
claus
parents: 138
diff changeset
  4850
claus
parents: 138
diff changeset
  4851
    drawableId isNil ifTrue:[
claus
parents: 138
diff changeset
  4852
	super recreate.
claus
parents: 138
diff changeset
  4853
	self physicalCreate.
claus
parents: 138
diff changeset
  4854
claus
parents: 138
diff changeset
  4855
	viewBackground notNil ifTrue:[
claus
parents: 138
diff changeset
  4856
	    self setViewBackground 
claus
parents: 138
diff changeset
  4857
	].
claus
parents: 138
diff changeset
  4858
claus
parents: 138
diff changeset
  4859
	"
claus
parents: 138
diff changeset
  4860
	 XXX has to be changed: eventmasks are device specific -
claus
parents: 138
diff changeset
  4861
	 XXX will not allow restart on another Workstation-type.
claus
parents: 138
diff changeset
  4862
	 XXX event masks must become symbolic
claus
parents: 138
diff changeset
  4863
	"
claus
parents: 138
diff changeset
  4864
	device setEventMask:eventMask in:drawableId
claus
parents: 138
diff changeset
  4865
    ]
claus
parents: 138
diff changeset
  4866
!
claus
parents: 138
diff changeset
  4867
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4868
rerealize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4869
    "rerealize at old position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4870
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4871
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4872
	realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4873
	device mapView:self id:drawableId iconified:false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4874
		   atX:left y:top width:width height:height
140
claus
parents: 138
diff changeset
  4875
    ]
claus
parents: 138
diff changeset
  4876
!
claus
parents: 138
diff changeset
  4877
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4878
rerealizeInGroup:aWindowGroup
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4879
    "rerealize at old position in (a possibly different) windowGroup."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4880
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4881
    drawableId isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4882
	self create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4883
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4884
    drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4885
	aWindowGroup ~~ windowGroup ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4886
	    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4887
		windowGroup removeView:self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4888
	    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4889
	    windowGroup := aWindowGroup.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4890
	    aWindowGroup addTopView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4891
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4892
	self rerealize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4893
    ]
140
claus
parents: 138
diff changeset
  4894
!
claus
parents: 138
diff changeset
  4895
claus
parents: 138
diff changeset
  4896
rerealizeWithAllSubViews
claus
parents: 138
diff changeset
  4897
    "rerealize myself with all subviews"
claus
parents: 138
diff changeset
  4898
claus
parents: 138
diff changeset
  4899
    drawableId notNil ifTrue:[
claus
parents: 138
diff changeset
  4900
	realized := true.
claus
parents: 138
diff changeset
  4901
	subViews notNil ifTrue:[
180
claus
parents: 176
diff changeset
  4902
	    self realizeAllSubViews.
140
claus
parents: 138
diff changeset
  4903
	].
claus
parents: 138
diff changeset
  4904
	device mapView:self id:drawableId iconified:false
claus
parents: 138
diff changeset
  4905
		   atX:left y:top width:width height:height
claus
parents: 138
diff changeset
  4906
    ]
180
claus
parents: 176
diff changeset
  4907
!
claus
parents: 176
diff changeset
  4908
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4909
resize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4910
    "resize myself to make everything fit into me.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4911
     Nothing special done here, but redefined in some subclasses"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4912
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4913
    self extent:(self preferredExtent)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4914
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4915
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4916
unmap
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4917
    "hide me - the view stays created, and can be mapped again later."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4918
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4919
    realized ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4920
	drawableId notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4921
	    device unmapWindow:drawableId
151
claus
parents: 145
diff changeset
  4922
	].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4923
	realized := shown := false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4924
    ].
190
claus
parents: 189
diff changeset
  4925
claus
parents: 189
diff changeset
  4926
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4927
     |top sub|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4928
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4929
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4930
     top extent:200@200.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4931
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4932
     sub := View
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4933
		origin:0.2@0.2
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4934
		corner:0.8@0.8
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4935
		in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4936
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4937
     sub viewBackground:Color red.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4938
     sub hiddenOnRealize:true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4939
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4940
     top open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4941
     (Delay forSeconds:5) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4942
     sub map.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4943
     (Delay forSeconds:3) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4944
     sub unmap.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4945
     sub viewBackground:(Color green).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4946
     (Delay forSeconds:3) wait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4947
     sub map.
151
claus
parents: 145
diff changeset
  4948
    "
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4949
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4950
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4951
unrealize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4952
    "alias for unmap, for historic reasons"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4953
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4954
    self unmap.
151
claus
parents: 145
diff changeset
  4955
! !
claus
parents: 145
diff changeset
  4956
claus
parents: 145
diff changeset
  4957
!SimpleView methodsFor:'redrawing'!
claus
parents: 145
diff changeset
  4958
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4959
redraw
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4960
    "redraw myself
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4961
     cannot do much here - has to be redefined in subclasses"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4962
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4963
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4964
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4965
redrawDeviceX:x y:y width:w height:h
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4966
    "have to redraw part of the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4967
     The coordinates are in device space - if there is a transformation,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4968
     must inverse-transform back to logical coordinates. (since the view thinks
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4969
     in its coordinate space)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4970
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4971
    |lx ly lw lh|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4972
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4973
    lx := x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4974
    ly := y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4975
    lw := w.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4976
    lh := h.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4977
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4978
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4979
	lx := transformation applyInverseToX:lx.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4980
	ly := transformation applyInverseToY:ly.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4981
	lw := transformation applyInverseScaleX:lw.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4982
	lh := transformation applyInverseScaleY:lh.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4983
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4984
    self redrawX:lx y:ly width:lw height:lh
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4985
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  4986
151
claus
parents: 145
diff changeset
  4987
redrawX:x y:y width:w height:h
claus
parents: 145
diff changeset
  4988
    "have to redraw part of myself, given logical coordinates (if trans is nonNil)
claus
parents: 145
diff changeset
  4989
     default is to redraw everything - subclasses should add intelligence"
claus
parents: 145
diff changeset
  4990
claus
parents: 145
diff changeset
  4991
    |area|
claus
parents: 145
diff changeset
  4992
claus
parents: 145
diff changeset
  4993
    shown ifFalse:[^ self].
claus
parents: 145
diff changeset
  4994
claus
parents: 145
diff changeset
  4995
    area := Rectangle left:x top:y width:w height:h.      
claus
parents: 145
diff changeset
  4996
    self clippedTo:area do:[
claus
parents: 145
diff changeset
  4997
"/        controller notNil ifTrue:[
claus
parents: 145
diff changeset
  4998
"/            "ST-80 updating"
claus
parents: 145
diff changeset
  4999
"/            self update:#rectangle with:area
claus
parents: 145
diff changeset
  5000
"/        ] ifFalse:[
claus
parents: 145
diff changeset
  5001
	    components notNil ifTrue:[
claus
parents: 145
diff changeset
  5002
		components do:[:aComponent |
claus
parents: 145
diff changeset
  5003
		    |thisFrame is|
claus
parents: 145
diff changeset
  5004
claus
parents: 145
diff changeset
  5005
		    thisFrame := aComponent frame.
claus
parents: 145
diff changeset
  5006
		    (thisFrame intersects:area) ifTrue:[
claus
parents: 145
diff changeset
  5007
			is := thisFrame intersect:(x@y extent:w@h).
claus
parents: 145
diff changeset
  5008
			is = thisFrame ifTrue:[
claus
parents: 145
diff changeset
  5009
			    aComponent redraw
claus
parents: 145
diff changeset
  5010
			] ifFalse:[
claus
parents: 145
diff changeset
  5011
			    aComponent redrawX:is left
claus
parents: 145
diff changeset
  5012
					     y:is top
claus
parents: 145
diff changeset
  5013
					 width:is width
claus
parents: 145
diff changeset
  5014
					height:is height.
claus
parents: 145
diff changeset
  5015
			].        
claus
parents: 145
diff changeset
  5016
			"/ aComponent drawIn:self offset:0@0
claus
parents: 145
diff changeset
  5017
		    ]
claus
parents: 145
diff changeset
  5018
		]
claus
parents: 145
diff changeset
  5019
	    ] ifFalse:[
claus
parents: 145
diff changeset
  5020
		self redraw
claus
parents: 145
diff changeset
  5021
	    ]
claus
parents: 145
diff changeset
  5022
"/        ]
claus
parents: 145
diff changeset
  5023
    ]                                                              
claus
parents: 145
diff changeset
  5024
!
claus
parents: 145
diff changeset
  5025
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5026
showActive
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5027
    "redraw myself as active (i.e. busy).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5028
     Nothing done here, but redefined in some classes."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5029
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5030
    ^ self
135
claus
parents:
diff changeset
  5031
!
claus
parents:
diff changeset
  5032
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5033
showFocus:explicit
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5034
    "highlight myself somehow to tell user that I have the focus.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5035
     Explicit tells if the focus came via focusStepping (i.e. tabbing)
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5036
     or via the window manager (i.e. pointer entering).
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5037
     Only change my border, if this is an explicit focusChange."
135
claus
parents:
diff changeset
  5038
claus
parents:
diff changeset
  5039
    |delta|
claus
parents:
diff changeset
  5040
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5041
    explicit ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5042
	drawableId notNil ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5043
	    delta := DefaultFocusBorderWidth - borderWidth.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5044
	    delta ~~ 0 ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5045
		device moveWindow:drawableId x:left-delta y:top-delta
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5046
	    ].
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5047
	    device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5048
	    device setWindowBorderColor:(DefaultFocusColor on:device) colorId in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5049
	]
135
claus
parents:
diff changeset
  5050
    ]
claus
parents:
diff changeset
  5051
!
claus
parents:
diff changeset
  5052
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5053
showNoFocus:explicit
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5054
    "undo the effect of showFocus.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5055
     Explicit tells if the focus came via focusStepping (i.e. tabbing)
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5056
     or via the window manager (i.e. pointer entering).
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5057
     Only change my border, if this is an explicit focusChange."
135
claus
parents:
diff changeset
  5058
claus
parents:
diff changeset
  5059
    |delta|
claus
parents:
diff changeset
  5060
385
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5061
    explicit ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5062
	drawableId notNil ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5063
	    (windowGroup notNil
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5064
	    and:[windowGroup focusView == self]) ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5065
		delta := DefaultFocusBorderWidth - borderWidth.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5066
		delta ~~ 0 ifTrue:[
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5067
		    device moveWindow:drawableId x:left+delta y:top+delta
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5068
		].
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5069
		device setWindowBorderWidth:borderWidth in:drawableId.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5070
		self setBorderColor.
15fd1c806d2a pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents: 376
diff changeset
  5071
	    ]
364
b44b425e3ee1 oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
  5072
	]
135
claus
parents:
diff changeset
  5073
    ]
358
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  5074
27e6259fcb41 only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
  5075
    "Modified: 9.1.1996 / 16:02:32 / cg"
135
claus
parents:
diff changeset
  5076
!
claus
parents:
diff changeset
  5077
claus
parents:
diff changeset
  5078
showPassive
claus
parents:
diff changeset
  5079
    "redraw myself as inactive (i.e. nonbusy).
151
claus
parents: 145
diff changeset
  5080
     Nothing done here, but redefined in some classes."
135
claus
parents:
diff changeset
  5081
claus
parents:
diff changeset
  5082
    ^ self
claus
parents:
diff changeset
  5083
! !
claus
parents:
diff changeset
  5084
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5085
!SimpleView methodsFor:'scrolling'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5086
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5087
horizontalScrollStep
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5088
    "return the amount to scroll when stepping left/right.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5089
     Subclasses may want to redefine this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5090
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5091
    ^ (device horizontalPixelPerMillimeter * 20) asInteger
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5092
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5093
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5094
scrollDown
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5095
    "scroll down by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5096
     scroll-step down button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5097
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5098
    self scrollDown:(self verticalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5099
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5101
scrollHorizontalTo:aPixelOffset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5102
    "change origin to make aPixelOffset be the left col"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5103
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5104
    |orgX|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5105
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5106
    orgX := self viewOrigin x.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5107
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5108
    (aPixelOffset < orgX) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5109
	self scrollLeft:(orgX - aPixelOffset)
140
claus
parents: 138
diff changeset
  5110
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5111
	(aPixelOffset > orgX) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5112
	    self scrollRight:(aPixelOffset - orgX)
140
claus
parents: 138
diff changeset
  5113
	]
claus
parents: 138
diff changeset
  5114
    ]
claus
parents: 138
diff changeset
  5115
!
claus
parents: 138
diff changeset
  5116
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5117
scrollHorizontalToPercent:percent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5118
    "scroll to a position given in percent of total"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5120
    |wCont|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5121
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5122
    wCont := self widthOfContents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5123
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5124
	wCont := transformation applyScaleX:wCont.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5125
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5126
    self scrollHorizontalTo:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5127
	    ((((wCont * percent) / 100.0) + 0.5) asInteger)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5128
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5129
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5130
scrollLeft
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5131
    "scroll left by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5132
     scroll-step left button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5133
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5134
    self scrollLeft:(self horizontalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5135
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5136
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5137
scrollRight
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5138
    "scroll right by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5139
     scroll-step right button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5140
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5141
    self scrollRight:(self horizontalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5142
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5143
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5144
scrollToTop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5145
    "move viewOrigin to top"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5146
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5147
    self scrollVerticalTo:0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5148
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5149
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5150
scrollToTopLeft
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5151
    "move viewOrigin to top/left"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5152
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5153
    self scrollTo:(0 @ 0).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5154
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5155
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5156
scrollUp
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5157
    "scroll up by some amount; this is called when the scrollbars
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5158
     scroll-step up button is pressed."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5159
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5160
    self scrollUp:(self verticalScrollStep)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5161
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5162
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5163
scrollVerticalTo:aPixelOffset
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5164
    "change origin to make aPixelOffset be the top line"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5165
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5166
    |orgY|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5167
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5168
    orgY := self viewOrigin y.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5169
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5170
    (aPixelOffset < orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5171
	self scrollUp:(orgY - aPixelOffset)
140
claus
parents: 138
diff changeset
  5172
    ] ifFalse:[
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5173
	(aPixelOffset > orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5174
	    self scrollDown:(aPixelOffset - orgY)
135
claus
parents:
diff changeset
  5175
	]
claus
parents:
diff changeset
  5176
    ]
claus
parents:
diff changeset
  5177
!
claus
parents:
diff changeset
  5178
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5179
scrollVerticalToPercent:percent
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5180
    "scroll to a position given in percent of total"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5181
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5182
    |hCont|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5183
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5184
    hCont := self heightOfContents.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5185
    transformation notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5186
	hCont := transformation applyScaleY:hCont.
140
claus
parents: 138
diff changeset
  5187
    ].
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5188
    self scrollVerticalTo:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5189
	    ((((hCont * percent) / 100.0) + 0.5) asInteger)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5190
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5191
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5192
verticalScrollStep
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5193
    "return the amount to scroll when stepping up/down.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5194
     Subclasses may want to redefine this."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5195
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5196
    ^ (device verticalPixelPerMillimeter * 20) asInteger
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5197
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5198
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5199
widthForScrollBetween:yStart and:yEnd 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5200
    "return the width in pixels for a scroll between yStart and yEnd
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5201
     - return full width here since we do not know how wide contents is.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5202
     Views which only use part of their space (short lists, text) may redefine
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5203
     this method and return the number of pixels that have to be scrolled.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5204
     On slow displays, this may make a difference; on fast ones you will probably
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5205
     not notice any difference."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5206
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5207
    ^ (width - margin - margin)
135
claus
parents:
diff changeset
  5208
! !
claus
parents:
diff changeset
  5209
claus
parents:
diff changeset
  5210
!SimpleView methodsFor:'scrolling-basic'!
claus
parents:
diff changeset
  5211
claus
parents:
diff changeset
  5212
scrollDown:nPixels
claus
parents:
diff changeset
  5213
    "change origin to scroll down some pixels"
claus
parents:
diff changeset
  5214
claus
parents:
diff changeset
  5215
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5216
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5217
     w     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5218
     h     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5219
     hCont 
claus
parents:
diff changeset
  5220
     ih    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5221
     orgX  
claus
parents:
diff changeset
  5222
     orgY  "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5223
     newOrigin|
claus
parents:
diff changeset
  5224
claus
parents:
diff changeset
  5225
    hCont := self heightOfContents.
claus
parents:
diff changeset
  5226
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5227
	orgY := orgX := 0
claus
parents:
diff changeset
  5228
    ] ifFalse:[
claus
parents:
diff changeset
  5229
	hCont := (transformation applyScaleY:hCont) rounded.
claus
parents:
diff changeset
  5230
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5231
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5232
    ].
claus
parents:
diff changeset
  5233
claus
parents:
diff changeset
  5234
    count := nPixels.
claus
parents:
diff changeset
  5235
    ih := self innerHeight.
claus
parents:
diff changeset
  5236
claus
parents:
diff changeset
  5237
    ((orgY + nPixels + ih) > hCont) ifTrue:[
claus
parents:
diff changeset
  5238
	count := hCont - orgY - ih
claus
parents:
diff changeset
  5239
    ].
claus
parents:
diff changeset
  5240
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5241
claus
parents:
diff changeset
  5242
    self originWillChange.
claus
parents:
diff changeset
  5243
    newOrigin := orgX @ (orgY + count).
claus
parents:
diff changeset
  5244
    shown ifFalse:[
claus
parents:
diff changeset
  5245
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5246
    ] ifTrue:[
claus
parents:
diff changeset
  5247
	m2 := margin * 2.
claus
parents:
diff changeset
  5248
	(count >= ih) ifTrue:[
claus
parents:
diff changeset
  5249
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5250
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5251
			 width:(width - m2)
claus
parents:
diff changeset
  5252
			height:(height - m2).
claus
parents:
diff changeset
  5253
	] ifFalse:[
claus
parents:
diff changeset
  5254
	    h := height - m2 - count.
claus
parents:
diff changeset
  5255
	    w := self width.
claus
parents:
diff changeset
  5256
	    self catchExpose.
claus
parents:
diff changeset
  5257
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5258
	    self copyFrom:self x:margin y:(count + margin)
claus
parents:
diff changeset
  5259
			     toX:margin y:margin
claus
parents:
diff changeset
  5260
			   width:w 
claus
parents:
diff changeset
  5261
			  height:h.
claus
parents:
diff changeset
  5262
claus
parents:
diff changeset
  5263
	    self setInnerClip.
claus
parents:
diff changeset
  5264
	    self redrawDeviceX:margin y:(h + margin) 
claus
parents:
diff changeset
  5265
			 width:(width - m2) height:count.
claus
parents:
diff changeset
  5266
claus
parents:
diff changeset
  5267
	    self waitForExpose.
claus
parents:
diff changeset
  5268
	]
claus
parents:
diff changeset
  5269
    ].
claus
parents:
diff changeset
  5270
    self originChanged:(0 @ count).
claus
parents:
diff changeset
  5271
!
claus
parents:
diff changeset
  5272
claus
parents:
diff changeset
  5273
scrollLeft:nPixels
claus
parents:
diff changeset
  5274
    "change origin to scroll left some pixels"
claus
parents:
diff changeset
  5275
claus
parents:
diff changeset
  5276
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5277
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5278
     h     "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5279
     orgX orgY newOrigin|
claus
parents:
diff changeset
  5280
claus
parents:
diff changeset
  5281
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5282
	orgY := orgX := 0
claus
parents:
diff changeset
  5283
    ] ifFalse:[
claus
parents:
diff changeset
  5284
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5285
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5286
    ].
claus
parents:
diff changeset
  5287
claus
parents:
diff changeset
  5288
    count := nPixels.
claus
parents:
diff changeset
  5289
    (count > orgX) ifTrue:[
claus
parents:
diff changeset
  5290
	count := orgX
claus
parents:
diff changeset
  5291
    ].
claus
parents:
diff changeset
  5292
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5293
claus
parents:
diff changeset
  5294
    self originWillChange.
claus
parents:
diff changeset
  5295
    newOrigin := (orgX - count) @ orgY.
claus
parents:
diff changeset
  5296
claus
parents:
diff changeset
  5297
    shown ifFalse:[
claus
parents:
diff changeset
  5298
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5299
    ] ifTrue:[
claus
parents:
diff changeset
  5300
	m2 := margin * 2.
claus
parents:
diff changeset
  5301
	(count >= self innerWidth) ifTrue:[
claus
parents:
diff changeset
  5302
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5303
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5304
			 width:(width - m2)
claus
parents:
diff changeset
  5305
			height:(height - m2).
claus
parents:
diff changeset
  5306
	] ifFalse:[
claus
parents:
diff changeset
  5307
	    h := (height - m2).
claus
parents:
diff changeset
  5308
claus
parents:
diff changeset
  5309
	    self catchExpose.
claus
parents:
diff changeset
  5310
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5311
	    self copyFrom:self x:margin y:margin
claus
parents:
diff changeset
  5312
			     toX:(count + margin) y:margin
claus
parents:
diff changeset
  5313
			   width:(width - m2 - count) 
claus
parents:
diff changeset
  5314
			  height:h.
claus
parents:
diff changeset
  5315
claus
parents:
diff changeset
  5316
	    self setInnerClip.
claus
parents:
diff changeset
  5317
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5318
			 width:count height:(height - m2).
claus
parents:
diff changeset
  5319
claus
parents:
diff changeset
  5320
	    self waitForExpose.
claus
parents:
diff changeset
  5321
	]
claus
parents:
diff changeset
  5322
    ].
claus
parents:
diff changeset
  5323
    self originChanged:(count negated @ 0).
claus
parents:
diff changeset
  5324
!
claus
parents:
diff changeset
  5325
claus
parents:
diff changeset
  5326
scrollRight:nPixels
claus
parents:
diff changeset
  5327
    "change origin to scroll right some pixels"
claus
parents:
diff changeset
  5328
claus
parents:
diff changeset
  5329
    |count "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5330
     m2    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5331
     h     "{ Class:SmallInteger }" 
claus
parents:
diff changeset
  5332
     wCont 
claus
parents:
diff changeset
  5333
     iw    "{ Class:SmallInteger }"
claus
parents:
diff changeset
  5334
     orgX orgY newOrigin|
claus
parents:
diff changeset
  5335
claus
parents:
diff changeset
  5336
    wCont := self widthOfContents.
claus
parents:
diff changeset
  5337
    transformation isNil ifTrue:[
claus
parents:
diff changeset
  5338
	orgY := orgX := 0
claus
parents:
diff changeset
  5339
    ] ifFalse:[
claus
parents:
diff changeset
  5340
	wCont := (transformation applyScaleX:wCont) rounded.
claus
parents:
diff changeset
  5341
	orgY := transformation translation y negated.
claus
parents:
diff changeset
  5342
	orgX := transformation translation x negated.
claus
parents:
diff changeset
  5343
    ].
claus
parents:
diff changeset
  5344
claus
parents:
diff changeset
  5345
    count := nPixels.
claus
parents:
diff changeset
  5346
    iw := self innerWidth.
claus
parents:
diff changeset
  5347
claus
parents:
diff changeset
  5348
    ((orgX + nPixels + iw) > wCont) ifTrue:[
claus
parents:
diff changeset
  5349
	count := wCont - orgX - iw
claus
parents:
diff changeset
  5350
    ].
claus
parents:
diff changeset
  5351
    (count <= 0) ifTrue:[^ self].
claus
parents:
diff changeset
  5352
claus
parents:
diff changeset
  5353
    self originWillChange.
claus
parents:
diff changeset
  5354
    newOrigin := (orgX + count) @ orgY.
claus
parents:
diff changeset
  5355
claus
parents:
diff changeset
  5356
    shown ifFalse:[
claus
parents:
diff changeset
  5357
	self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5358
    ] ifTrue:[
claus
parents:
diff changeset
  5359
	m2 := margin * 2.
claus
parents:
diff changeset
  5360
	(count >= iw) ifTrue:[
claus
parents:
diff changeset
  5361
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5362
	    self redrawDeviceX:margin y:margin
claus
parents:
diff changeset
  5363
			 width:(width - m2)
claus
parents:
diff changeset
  5364
			height:(height - m2).
claus
parents:
diff changeset
  5365
	] ifFalse:[
claus
parents:
diff changeset
  5366
	    m2 := margin * 2.
claus
parents:
diff changeset
  5367
	    h := (height - m2).
claus
parents:
diff changeset
  5368
claus
parents:
diff changeset
  5369
	    self catchExpose.
claus
parents:
diff changeset
  5370
	    self setViewOrigin:newOrigin.
claus
parents:
diff changeset
  5371
	    self copyFrom:self x:(count + margin) y:margin
claus
parents:
diff changeset
  5372
			     toX:margin y:margin
claus
parents:
diff changeset
  5373
			   width:(width - m2 - count) 
claus
parents:
diff changeset
  5374
			  height:h.
claus
parents:
diff changeset
  5375
claus
parents:
diff changeset
  5376
	    self setInnerClip.
claus
parents:
diff changeset
  5377
	    self redrawDeviceX:(width - margin - count) y:margin 
claus
parents:
diff changeset
  5378
			 width:count height:(height - m2).
claus
parents:
diff changeset
  5379
claus
parents:
diff changeset
  5380
	    self waitForExpose.
claus
parents:
diff changeset
  5381
	].
claus
parents:
diff changeset
  5382
    ].
claus
parents:
diff changeset
  5383
    self originChanged:(count @ 0).
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5384
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5385
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5386
scrollTo:newOrigin 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5387
    "change origin to have newOrigin be visible at the top-left.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5388
     The argument defines the integer device coordinates of the new top-left 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5389
     point."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5390
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5391
    "due to historic reasons, the work is actually done by scrollUp/Down
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5392
     scrollLeft/Right (those where implemented first).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5393
     This will be changed to do all work here, and call it from
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5394
     the other scrolling methods."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5395
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5396
    |dX   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5397
     dY   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5398
     m2   "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5399
     orgX "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5400
     orgY "{ Class:SmallInteger }" |
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5401
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5402
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5403
	orgY := orgX := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5404
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5405
	orgY := transformation translation y negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5406
	orgX := transformation translation x negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5407
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5408
    dX := newOrigin x - orgX.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5409
    dY := newOrigin y - orgY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5410
    dX = 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5411
	dY < 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5412
	    ^ self scrollUp:(dY negated).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5413
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5414
	dY > 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5415
	    ^ self scrollDown:dY.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5416
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5417
	^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5418
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5419
    dY = 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5420
	dX < 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5421
	    ^ self scrollLeft:dX negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5422
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5423
	dX > 0 ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5424
	    ^ self scrollRight:dX
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5425
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5426
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5427
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5428
    self originWillChange.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5429
    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5430
    shown ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5431
	m2 := margin * 2. "top & bottom margins"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5432
	self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5433
		     width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5434
		    height:(height - m2).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5435
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5436
    self originChanged:(dX @ dY).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5437
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5438
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5439
scrollUp:nPixels
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5440
    "change origin to scroll up (towards the origin) by some pixels"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5441
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5442
    |count "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5443
     m2    "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5444
     w     "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5445
     h     "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5446
     orgX
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5447
     orgY  "{ Class:SmallInteger }"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5448
     newOrigin|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5449
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5450
    transformation isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5451
	orgY := orgX := 0
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5452
    ] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5453
	orgY := transformation translation y negated.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5454
	orgX := transformation translation x negated
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5455
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5456
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5457
    count := nPixels.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5458
    (count > orgY) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5459
	count := orgY
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5460
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5461
    (count <= 0) ifTrue:[^ self].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5462
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5463
    self originWillChange.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5464
    newOrigin := orgX @ (orgY - count).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5465
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5466
    shown ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5467
	self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5468
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5469
	m2 := margin * 2. "top & bottom margins"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5470
	(count >= self innerHeight) ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5471
	    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5472
	    self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5473
			 width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5474
			height:(height - m2).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5475
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5476
	    h := height - m2 - count.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5477
	    w := width.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5478
	    self catchExpose.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5479
	    self setViewOrigin:newOrigin.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5480
	    self copyFrom:self x:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5481
			     toX:margin y:(count + margin)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5482
			   width:w height:h.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5483
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5484
	    self setInnerClip.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5485
	    self redrawDeviceX:margin y:margin
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5486
			 width:(width - m2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5487
			height:count.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5488
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5489
	    self waitForExpose.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5490
	]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5491
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5492
    self originChanged:(0 @ count negated).
135
claus
parents:
diff changeset
  5493
! !
claus
parents:
diff changeset
  5494
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5495
!SimpleView methodsFor:'startup'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5496
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5497
open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5498
    "open up the view - for normal views, this is a modeless open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5499
     (i.e. the new view comes up as independent process).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5500
     Although #open is only to be sent to topviews (i.e. it could have been
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5501
     implemented in TopView), it is implemented here - therefore, every view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5502
     can be opened as a topView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5503
     This is redefined in ModalBox, which comes up modal (i.e. 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5504
     control is under the current process, so that interaction with the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5505
     current group is blocked while the modalBox is active)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5506
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5507
    ^ self openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5508
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5509
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5510
     View new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5511
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5512
     (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5513
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5514
     |top|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5515
     top := StandardSystemView new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5516
     top extent:200@200.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5517
     Button label:'hello' in:top.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5518
     top open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5519
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5520
     YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5521
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5522
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5523
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5524
openAndWait
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5525
    "open up the view - wait until it is visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5526
     In normal applications, you do not need to wait till the view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5527
     open - it should do all of its drawing itself when it gets the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5528
     first expose event.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5529
     However, if you want to 'manually' draw into the view (for example,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5530
     in doIt expressions) the view must be visible (realized) before doing so.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5531
     Use this open in those situations."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5532
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5533
    self open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5534
    self waitUntilVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5535
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5536
    "does not work:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5537
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5538
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5539
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5540
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5541
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5542
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5543
     does work:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5544
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5545
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5546
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5547
	v := View new openAndWait.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5548
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5549
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5550
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5551
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5552
openAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5553
    "open up the view modeless - positions the view"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5554
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5555
    ^self openModelessAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5556
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5557
    "Created: 18.9.1995 / 23:30:43 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5558
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5559
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5560
openAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5561
    "open up the view modeless - positions the view"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5562
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5563
    ^self openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5564
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5565
    "Created: 18.9.1995 / 23:30:56 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5566
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5567
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5568
openAutonomous
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5569
    "create and schedule a new windowgroup for me and open the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5570
     The view will be handled by its own process, effectively running in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5571
     parallel. This entry is for non-topviews, which want to be served
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5572
     autonomous from the topview. (see the fileBrowsers kill-button
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5573
     when executing unix commands as an example)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5574
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5575
    |wg|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5576
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5577
    ProcessorScheduler isPureEventDriven ifFalse:[
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5578
        wg := WindowGroup new.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5579
        self windowGroup:wg.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5580
        wg addView:self.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5581
        wg startup:false.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5582
        wg isForModalSubview:true.
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5583
        self realizeInGroup.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5584
    ] ifTrue:[
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5585
        self realize
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5586
    ]
422
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5587
bb19798ffda1 fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5588
    "Modified: 9.2.1996 / 00:17:24 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5589
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5590
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5591
openInGroup:aGroup
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5592
    "special open within another windowGroup.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5593
     This allows a view to be realized in any windowgroup; 
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5594
     for applications where multiple views act as a group
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5595
     (i.e. close and iconify together)."
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5596
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5597
    self windowGroup:aGroup.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5598
    aGroup addTopView:self.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5599
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5600
"/    self realizeKeepingGroup:true
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5601
    aGroup isForModalSubview:true.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5602
    self realize.
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5603
!
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5604
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5605
openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5606
    "create a new windowgroup, but start processing in the current process
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5607
     actually suspending event processing for the currently active group.
420
9ad55eba79ac allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
  5608
     Stay in the modalLoop while the view is visible.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5609
     (i.e. control is returned to the sender when the receiver is closed)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5610
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5611
    self openModal:[true]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5612
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5613
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5614
     the same:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5615
	 YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5616
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5617
	 YesNoBox new openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5618
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5619
     different:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5620
	 (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5621
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5622
	 (Button label:'hello') openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5623
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5624
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5625
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5626
openModal:aBlock
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5627
    "create a new windowgroup, but start processing in the current process -
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5628
     actually suspending event processing for the currently active group.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5629
     Stay in this modal loop while aBlock evaluates to true AND the receiver is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5630
     visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5631
     (i.e. control is returned to the sender when the receiver is closed)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5632
     This makes any interaction with the current window impossible - 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5633
     however, other views (in other windowgroups) still work."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5634
299
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5635
    ^ self openModal:aBlock inGroup:WindowGroup activeGroup.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5636
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5637
    "Created: 10.12.1995 / 14:06:45 / cg"
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5638
    "Modified: 10.12.1995 / 14:08:48 / cg"
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5639
!
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5640
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5641
openModal:aBlock inGroup:mainGroup
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5642
    "create a new windowgroup, but start processing in the current process -
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5643
     actually suspending event processing for the main group.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5644
     Stay in this modal loop while aBlock evaluates to true AND the receiver is
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5645
     visible.
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5646
     (i.e. control is returned to the sender when the receiver is closed)
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5647
     This makes any interaction with the current window impossible - 
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5648
     however, other views (in other windowgroups) still work."
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5649
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5650
    |tops|
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5651
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5652
    Processor activeProcessIsSystemProcess ifTrue:[
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5653
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5654
         put myself into the modal group, let it handle events for
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5655
         me as well. This is only a half way solution, since the view
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5656
         is not modal at all ... however, the only situation
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5657
         where this happens is with modal boxes popped while in a
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5658
         modal browser. You will forgive me for that inconvenience.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5659
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5660
        windowGroup := mainGroup.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5661
        mainGroup notNil ifTrue:[mainGroup addTopView:self].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5662
        self realize
135
claus
parents:
diff changeset
  5663
    ] ifFalse:[
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5664
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5665
         show a stop-cursor in the main group
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5666
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5667
        mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5668
            self isPopUpView ifFalse:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5669
                mainGroup showCursor:(Cursor stop).
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5670
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5671
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5672
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5673
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5674
         create a new window group and put myself into it
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5675
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5676
        windowGroup := WindowGroup new.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5677
        windowGroup addTopView:self.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5678
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5679
        superView notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5680
            "/
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5681
            "/ special: this is a modal subview,
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5682
            "/ prevent the view to reassign its windowGroup when realized
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5683
            "/ (subviews normally place themself into the superviews group)
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5684
            "/        
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5685
            windowGroup isForModalSubview:true.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5686
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5687
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5688
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5689
         go dispatch events in this new group
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5690
         (thus current windowgroup is blocked from interaction)
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5691
        "
426
7f0f723980e2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 424
diff changeset
  5692
        AbortSignal handle:[:ex |
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5693
            self hide.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5694
            ex return.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5695
        ] do:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5696
            [
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5697
                windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5698
            ] valueOnUnwindDo:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5699
                mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5700
                    self isPopUpView ifFalse:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5701
                        mainGroup restoreCursors.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5702
                    ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5703
                    mainGroup sensor flushUserEvents.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5704
                ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5705
                self hide.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5706
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5707
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5708
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5709
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5710
         restore cursors in the main group & flush its buffered events
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5711
        "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5712
        mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5713
            mainGroup restoreCursors.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5714
            mainGroup sensor flushUserEvents.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5715
        ].
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5716
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5717
        ReturnFocusWhenClosingModalBoxes ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5718
            "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5719
             return input focus to previously active groups top.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5720
             This helps with windowmanagers which need an explicit click
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5721
             on the view for the focus.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5722
            "
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5723
            mainGroup notNil ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5724
                tops := mainGroup topViews.
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5725
                (tops notNil and:[tops notEmpty]) ifTrue:[
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5726
                    tops first getKeyboardFocus
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5727
                ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5728
            ]
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5729
        ]
135
claus
parents:
diff changeset
  5730
    ]
299
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5731
e2c8fd828a64 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  5732
    "Created: 10.12.1995 / 14:06:14 / cg"
424
d3d266695780 dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  5733
    "Modified: 11.2.1996 / 14:38:24 / cg"
135
claus
parents:
diff changeset
  5734
!
claus
parents:
diff changeset
  5735
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5736
openModalAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5737
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5738
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5739
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5740
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5741
    self create.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5742
    device setTransient:drawableId for:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5743
    ^ self openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5744
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5745
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5746
     View new openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5747
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5748
     View new openModalAt:100@100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5749
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5750
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5751
    "Created: 18.9.1995 / 23:21:42 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5752
    "Modified: 18.9.1995 / 23:32:26 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5753
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5754
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5755
openModalAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5756
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5757
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5758
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5759
    ^ self openModalAt:(device center - (self extent//2)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5760
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5761
    "Created: 18.9.1995 / 23:31:47 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5762
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5763
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5764
openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5765
    "create and schedule a new windowgroup for me and open the view.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5766
     The view will be handled by its own process, effectively running in
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5767
     parallel (i.e. control is returned to the sender immediately)."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5768
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5769
    ProcessorScheduler isPureEventDriven ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5770
	windowGroup isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5771
	    windowGroup := WindowGroup new.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5772
	    windowGroup addTopView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5773
	    windowGroup startup:false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5774
	] ifFalse:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5775
	    windowGroup startup:false.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5776
	    self realizeInGroup.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5777
	].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5778
    ] ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5779
	self realize
135
claus
parents:
diff changeset
  5780
    ]
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5781
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5782
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5783
     the same:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5784
	 (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5785
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5786
	 (Button label:'hello') openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5787
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5788
     different:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5789
	 YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5790
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5791
	 YesNoBox new openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5792
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5793
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5794
     (almost) the same:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5795
	 YesNoBox new open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5796
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5797
	 YesNoBox new openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5798
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5799
     different:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5800
	 (Button label:'hello') open
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5801
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5802
	 (Button label:'hello') openModal
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5803
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5804
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5805
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5806
openModelessAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5807
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5808
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5809
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5810
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5811
    self create.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5812
    device setTransient:drawableId for:0.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5813
    ^ self openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5814
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5815
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5816
     View new openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5817
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5818
     View new openModelessAt:100@100
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5819
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5820
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5821
    "Created: 18.9.1995 / 23:21:42 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5822
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5823
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5824
openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5825
    "open up the view modeless - positions the view
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5826
     (i.e. circumvents window managers positioning)"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5827
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5828
    ^ self openModelessAt:(device center - (self extent//2)).
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5829
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5830
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5831
     View new openModeless
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5832
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5833
     View new openModelessAtCenter
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5834
    "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5835
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5836
    "Created: 18.9.1995 / 23:21:42 / claus"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5837
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5838
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5839
waitUntilVisible
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5840
    "wait until the receiver visible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5841
     In normal applications, you do not need to wait till a view is
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5842
     open - it should do all of its drawing itself when it gets the
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5843
     first expose event.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5844
     However, if you want to 'manually' draw into the view (for example,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5845
     in doIt expressions), or subsequent views depend on some state of
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5846
     another view (which is only available once visible), 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5847
     use this to suspend the current process until the receiver is shown.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5848
     Caveat:
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5849
	we poll here for the view to be shown - we need a semaphore
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5850
	which is raised by the view in order to do it right."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5851
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5852
    [self shown] whileFalse:[
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
  5853
	Delay waitForSeconds:0.05.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5854
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5855
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5856
    "does not work (the view is in its opening phase,
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5857
     when we attempt to draw a line - this gives an error, since
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5858
     its internals are not yet correctly setup):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5859
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5860
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5861
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5862
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5863
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5864
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5865
     does work (since we wait until the view has completely finished
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5866
     its startup phase):
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5867
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5868
	|v|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5869
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5870
	v := View new open.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5871
	v waitUntilVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5872
	v displayLineFrom:0@0 to:50@50
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5873
    "
135
claus
parents:
diff changeset
  5874
! !
claus
parents:
diff changeset
  5875
claus
parents:
diff changeset
  5876
!SimpleView methodsFor:'user notification'!
claus
parents:
diff changeset
  5877
claus
parents:
diff changeset
  5878
warn:aString
claus
parents:
diff changeset
  5879
    "like Objects warn, but translates the string via the
claus
parents:
diff changeset
  5880
     resourcePack, thus giving a translated string automatically"
claus
parents:
diff changeset
  5881
151
claus
parents: 145
diff changeset
  5882
    super warn:(resources string:aString) withCRs
135
claus
parents:
diff changeset
  5883
!
claus
parents:
diff changeset
  5884
claus
parents:
diff changeset
  5885
warn:aString with:argument
claus
parents:
diff changeset
  5886
    "like Objects warn, but translates the string via the
claus
parents:
diff changeset
  5887
     resourcePack, thus giving a translated string automatically"
claus
parents:
diff changeset
  5888
151
claus
parents: 145
diff changeset
  5889
    super warn:(resources string:aString with:argument) withCRs
claus
parents: 145
diff changeset
  5890
!
claus
parents: 145
diff changeset
  5891
claus
parents: 145
diff changeset
  5892
warn:aString with:arg1 with:arg2
claus
parents: 145
diff changeset
  5893
    "like Objects warn, but translates the string via the
claus
parents: 145
diff changeset
  5894
     resourcePack, thus giving a translated string automatically"
claus
parents: 145
diff changeset
  5895
claus
parents: 145
diff changeset
  5896
    super warn:(resources string:aString with:arg1 with:arg2) withCRs
135
claus
parents:
diff changeset
  5897
! !
claus
parents:
diff changeset
  5898
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5899
!SimpleView class methodsFor:'documentation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5900
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  5901
version
452
f38d70ba97a2 made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
  5902
    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.57 1996-02-24 16:29:06 cg Exp $'
135
claus
parents:
diff changeset
  5903
! !
claus
parents:
diff changeset
  5904
SimpleView initialize!