Squeak Class Documentation category index | class index  
 
View
  category: ST80-Framework
  superclass: Object
  subclasses: FormView PluggableButtonView DisplayTextView StringHolderView ListView MorphWorldView FormMenuView StandardSystemView

My instances are intended to be components in a structured picture. Each View in the structured picture can contain other Views as sub-components. These sub-components are called subViews. A View can be a subView of only one View. This View is called its superView. The set of Views in a structured picture forms a hierarchy. The one View in the hierarchy that has no superView is called the topView of the structured picture. A View in a structured picture with no subViews is called a bottom View. A View and all of its subViews, and all of their subViews and so on, are treated as a unit in many operations on the View. For example, if a View is displayed, all of its subViews are displayed as well. There are several categories of operations that can be performed on a View. Among these are the following:

1. Adding subViews to a View.
2. Positioning subViews within a View.
3. Deleting subViews from a View.
4. Transforming a View.
5. Displaying a View.

Each View has its own coordinate system. In order to change from one coordinate system to another, each View has two transformations associated with it. The local transformation is a WindowingTransformation that maps objects in the coordinate system of the View to objects in the coordinate system of the superView of the View. The displayTransformation is a WindowingTransformation that maps objects in the coordinate system of the View to objects in the display screen coordinate system.

The part of the space that is to be made visible is represented by the window of the View. The window of a View is a Rectangle expressed in the coordinate system of the View. The area occupied by a View in the coordinate system of its superView is called its viewport. The viewport of a View is its window transformed by its local transformation. The region of the display screen occupied by a View is called its displayBox. The display box of a View can include a border. The width of the border expressed in display screen coordinates is called the border width of the View. The color of the border is called the border color. The region of the display box of a View excluding the border is called the inset display box. The color of the inset display box is called the inside color of the View.

instance methods
  basic control sequence
  subViewWantingControl

  bordering
  backgroundColor
backgroundColor:
borderWidth
borderWidth:
borderWidthLeft:right:top:bottom:
foregroundColor
foregroundColor:
insideColor:

  clearing
  clear
clear:
clearInside
clearInside:

  controller access
  controller
controller:
defaultController
defaultControllerClass
model:controller:

  deEmphasizing
  deEmphasize
deEmphasizeForDebugger
deEmphasizeSubViews
deEmphasizeView
emphasize
emphasizeSubViews
emphasizeView

  display box access
  apparentDisplayBox
boundingBox
computeBoundingBox
displayBox
insetDisplayBox

  display transformation
  displayTransform:
displayTransformation
inverseDisplayTransform:

  displaying
  clippingTo:do:
display
displayBorder
displayClippingTo:
displayDeEmphasized
displaySubViews
displayView
displayViewDeEmphasized
inspectFirstSubView
inspectModel
inspectView
maximumSize
minimumSize

  indicating
  flash
highlight

  initialize-release
  initialize
release
setDefaultBackgroundColor

  lock access
  isLocked
isUnlocked
lock
unlock

  miscellaneous
  clipRect
clipRect:
gridSpacing
nestedViewport
printViewSpecOn:nested:
stretchFrame:startingWith:

  model access
  model
model:

  morphic compatibility
  setBalloonText:

  private
  computeDisplayTransformation
computeInsetDisplayBox
getController
getViewport
getWindow
isCyclic:
setTransformation:
setWindow:
superView:

  scrolling
  scrollBy:

  subView access
  firstSubView
lastSubView
resetSubViews
subViewContaining:
subViewSatisfying:
subViews
textEditorView

  subView inserting
  addSubView:
addSubView:above:
addSubView:align:with:
addSubView:below:
addSubView:ifCyclic:
addSubView:toLeftOf:
addSubView:toRightOf:
addSubView:viewport:
addSubView:window:viewport:

  subView removing
  releaseSubView:
releaseSubViews
removeFromSuperView
removeSubView:
removeSubViews

  superView access
  isTopView
superView
topView

  testing
  canDiscardEdits
containsPoint:
hasUnacceptedEdits
isObscured

  transforming
  align:with:
scale:translation:
scaleBy:
transform:
transformation
transformation:
translateBy:
window:viewport:

  updating
  update
update:

  viewport access
  viewport

  window access
  defaultWindow
insetWindow
window
window:

class methods
  instance creation
  new

instance methods
  basic control sequence top  
 

subViewWantingControl

Answer the first subView that has a controller that now wants control.


  bordering top  
 

backgroundColor


 

backgroundColor:


 

borderWidth

Answer either 0, indicating no border, or a Rectangle whose left value is
the width in display coordinates of the receiver's left border. Right, top,
and bottom widths are analogous. The border width is initially 0. A
View with a border width of 0 will not have any border displayed.


 

borderWidth:

Set the four border widths of the receiver to anInteger.


 

borderWidthLeft:right:top:bottom:

Set the border widths of the receiver. These arguments represent the left,
right, top, and bottom border widths.


 

foregroundColor


 

foregroundColor:


 

insideColor:


  clearing top  
 

clear

Use the border color to paint the display box (including the border, see
View|displayBox) of the receiver.


 

clear:

Use aColor to paint the display box (including the border, see
View|displayBox) of the receiver.


 

clearInside

Use the inside color to paint the inset display box (excluding the border,
see View|insetDisplayBox) of the receiver.


 

clearInside:

Use aColor to paint the inset display box (excluding the border, see
View|insetDisplayBox) of the receiver.


  controller access top  
 

controller

If the receiver's controller is nil (the default case), answer an initialized
instance of the receiver's default controller. If the receiver does not
allow a controller, answer the symbol #NoControllerAllowed.


 

controller:

Set the receiver's controller to aController. #NoControllerAllowed can be
specified to indicate that the receiver will not have a controller. The
model of aController is set to the receiver's model.


 

defaultController

Answer an initialized instance of the receiver's default controller.
Subclasses should redefine this message only if the default controller
instances need to be initialized in a nonstandard way.


 

defaultControllerClass

Answer the class of the default controller for the receiver. Subclasses
should redefine View|defaultControllerClass if the class of the default
controller is not Controller.


 

model:controller:

Set the receiver's model to aModel, add the receiver to aModel's list of
dependents, and set the receiver's controller to aController. Subsequent
changes to aModel (see Model|change) will result in View|update:
messages being sent to the receiver. #NoControllerAllowed for the value
of aController indicates that no default controller is available; nil for the
value of aController indicates that the default controller is to be used
when needed. If aController is neither #NoControllerAllowed nor nil, its
view is set to the receiver and its model is set to aModel.


  deEmphasizing top  
 

deEmphasize

Modify the emphasis (highlighting, special tabs) of the receiver. This
includes objects such as labels, lines, and boxes. Typically used so that
the receiver is not presented as active. Do this for the receiver and then
for each of the receiver's subViews.


 

deEmphasizeForDebugger

Overridden by StandardSystemView. This default behavior does nothing.


 

deEmphasizeSubViews

Send the deEmphasize message to each of the receiver's subviews.


 

deEmphasizeView

Subclasses should redefine View|deEmphasizeView in order to modify
the emphasis (highlighting, special tabs) of particular objects associated
with the View such as labels, lines, and boxes.


 

emphasize

Modify the emphasis (highlighting, special tabs) of the receiver. This
includes objects such as labels, lines, and boxes. Typically used so that
the receiver is presented as active. Do this for the receiver and then
for each of the receiver's subViews.


 

emphasizeSubViews

Send the emphasize message to each of the receiver's subviews.


 

emphasizeView

Subclasses should redefine View|emphasizeView in order to modify
the emphasis (highlighting, special tabs) of particular objects associated
with the View such as labels, lines, and boxes.


  display box access top  
 

apparentDisplayBox


 

boundingBox

Answer the bounding box which for the default case is the rectangular
area surrounding the bounding boxes of all the subViews.


 

computeBoundingBox

Answer the minimum Rectangle that encloses the bounding boxes of the
receiver's subViews. If the receiver has no subViews, then the bounding
box is the receiver's window. Subclasses should redefine
View|boundingBox if a more suitable default for the case of no subViews
is available.


 

displayBox

Answer the receiver's inset display box (see View|insetDisplayBox)
expanded by the borderWidth. The display box represents the region of
the display screen in which the receiver (including the border) is
displayed. If the receiver is totally clipped by the display screen and its
superView, the resulting Rectangle will be invalid.


 

insetDisplayBox

Answer the receiver's inset display box. The inset display box is the
intersection of the receiver's window, tranformed to display coordinates,
and the inset display box of the superView, inset by the border width.
The inset display box represents the region of the display screen in
which the inside of the receiver (all except the border) is displayed. If
the receiver is totally clipped by the display screen and its superView,
the resulting Rectangle will be invalid.


  display transformation top  
 

displayTransform:

Apply the display transformation of the receiver to anObject (see
View|displayTransformation) and answer the resulting scaled, translated
object. It is normally applied to Rectangles, Points, and other objects with
coordinates defined in the View's local coordinate system in order to get
a corresponding object in display coordinates.


 

displayTransformation

Answer a WindowingTransformation that is the result of composing all
local transformations in the receiver's superView chain with the
receiver's own local transformation. The resulting transformation
transforms objects in the receiver's coordinate system into objects in the
display screen coordinate system.


 

inverseDisplayTransform:

Answer a Point that is obtained from the argument, aPoint, by applying
to it the inverse of the receiver's display transformation. It is typically
used by the Controller of the receiver in order to convert a point in
display coordinates, such as the cursor point, to the local coordinate
system of the receiver.


  displaying top  
 

clippingTo:do:


 

display

Display the receiver's border, display the receiver, then display the
subViews of the receiver. Can be sent to the top View of a structured
picture in order to display the entire structure, or to any particular View
in the structure in order to display that View and its subViews. It is
typically sent in response to an update request to a View.


 

displayBorder

Display the receiver's border (using the receiver's borderColor).


 

displayClippingTo:


 

displayDeEmphasized


 

displaySubViews

Display all the subViews of the receiver.


 

displayView

Subclasses should redefine View|displayView in order to display
particular objects associated with the View such as labels, lines, and
boxes.


 

displayViewDeEmphasized


 

inspectFirstSubView


 

inspectModel


 

inspectView


 

maximumSize

Answer the maximum size of the receiver.


 

minimumSize

Answer the minimum size of the receiver.


  indicating top  
 

flash

Cause the inset display box (the display box excluding the border, see
View|insetDisplayBox) of the receiver to complement twice in succession.


 

highlight

Cause the inset display box (the display box excluding the border, see
View|insetDisplayBox) of the receiver to complement.


  initialize-release top  
 

initialize

Initialize the state of the receiver. Subclasses should include 'super
initialize' when redefining this message to insure proper initialization.


 

release

Remove the receiver from its model's list of dependents (if the model
exists), and release all of its subViews. It is used to break possible cycles
in the receiver and should be sent when the receiver is no longer needed.
Subclasses should include 'super release.' when redefining release.


 

setDefaultBackgroundColor

Obtain the background color from the receiver's model, unless the #uniformWindowColors preference is set to true, in which case obtain it from generic Object; and install it as the receiver's background color. 5/1/96 sw


  lock access top  
 

isLocked

Answer whether the receiver is locked. A View is 'locked' if its display
transformation and inset display box are defined. If these are undefined,
the View is 'unlocked'. The display transformation and inset display box
become undefined when the transformation of the View (or the
transformation of a View in its superView chain) is changed, or when
the superView of the View is changed, or any other change to the View
that affects the display screen coordinates of the View. The locking and
unlocking of a View is handled automatically by the internal methods of
the View, but can also be done explicitly if desired (see View|lock, and
View|unlock).


 

isUnlocked

Answer whether the receiver is unlocked. See comment in
View|isLocked.


 

lock

'Lock' the receiver and all of its subViews (see View|isLocked). This has
the effect of computing and storing the display transformation (see
View|displayTransformation) and inset display box (see
View|insetDisplayBox) of the receiver and all its subViews. The locking
and unlocking of a View is handled automatically by the internal
methods of the View, but can also be done explicitly if desired.


 

unlock

Unlock the receiver and all of its subViews (see View|isUnlocked). This
has the effect of forcing the display transformation (see
View|displayTransformation) and inset display box (see
View|insetDisplayBox) of the receiver and all its subViews to be
recomputed the next time they are referenced. The locking and
unlocking of a View is handled automatically by the internal methods of
the View, but can also be done explicitly if desired.


  miscellaneous top  
 

clipRect


 

clipRect:


 

gridSpacing


 

nestedViewport

The viewport size used to control scaling of nested user views.


 

printViewSpecOn:nested:

Print window and viewport specs
of this and all nested views.


 

stretchFrame:startingWith:

Track the outline of a newFrame as long as mouse drags it.
Maintain max and min constraints throughout the drag


  model access top  
 

model

Answer the receiver's model.


 

model:

Set the receiver's model to aModel. The model of the receiver's controller
is also set to aModel.


  morphic compatibility top  
 

setBalloonText:

Unfortunately we just ignore this help text because we are not morphic


  private top  
 

computeDisplayTransformation

Answer a WindowingTransformation that transforms the coordinate
system of the View into that of the display screen. The transformation is
computed by composing the View's transformation with all transformations
along its superView chain. It is sent by View|displayTransformation when
the View is unlocked (see View|unlock).


 

computeInsetDisplayBox

Compute the View's inset display box by intersecting the superView's
inset display box with the View's window transformed to display
coordinates and then inseting the result by the border width. It is sent by
View|insetDisplayBox if the inset display box is nil.

The insetDisplayBox points are truncated to prevent sending floating point numbers to QuickDraw which will die.


 

getController

Answer the View's controller if one exists. nil indicates that the default
controller is to be used.


 

getViewport

Answer the Rectangle representing the View's viewport (in the
coordinate system of the superclass). If no viewport has been specified,
the View's window transformed into the superView's coordinate system is
saved and returned. It should be used by methods of View and subclasses
(instead of directly referring to the viewport) unless it is known that a
viewport actually exists. It should not be used outside of View or
subclasses because the viewport is not sharable.


 

getWindow

Answer the Rectangle that represents the window of this View. If no
window has been specified, a default window (see View|defaultWindow)
is created, saved, and returned. Should be used by methods of View and
subclasses to access the View window instead of directly accessing the
field unless it is known that a window actually exists. It is not to be used
outside of View (or subclasses) because the window is not sharable.
View|window should be used for outside access to the window.


 

isCyclic:

Answer true if aView is the same as this View or its superView, false
otherwise.


 

setTransformation:

Set the View's local transformation to aTransformation, unlock the View
(see View|unlock), and set the viewport to undefined (this forces it to be
recomputed when needed). Should be used instead of setting the
transformation directly.


 

setWindow:

Set the View's window to aWindow and unlock the View (see
View|unlock). View|setWindow should be used by methods of View and
subclasses to set the View window (rather than directly setting the
instance variable) to insure that the View is unlocked.


 

superView:

Set the View's superView to aView and unlock the View (see
View|unlock). It is sent by View|addSubView: in order to properly set all
the links.


  scrolling top  
 

scrollBy:

The x component of aPoint specifies the amount of scrolling in the x
direction; the y component specifies the amount of scrolling in the y
direction. The amounts are specified in the receiver's local coordinate
system. Scroll the receiver up or down, left or right. The window of the
receiver is kept stationary and the subViews and other objects in the
receiver are translated relative to it. Scrolling doesn't change the
insetDisplayBox or the viewport since the change in the transformation
is canceled by the change in the window. In other words, all display
objects in the view, except the window, are translated by the scrolling
operation.
Note: subclasses may override to return false if no scrolling takes place.


  subView access top  
 

firstSubView

Answer the first subView in the receiver's list of subViews if it is not
empty, else nil.


 

lastSubView

Answer the last subView in the receiver's list of subViews if it is not
empty, else nil.


 

resetSubViews

Set the list of subviews to an empty collection.


 

subViewContaining:

Answer the first subView that contains aPoint within its window and
answer nil, otherwise. It is typically sent from a Controller in order to
determine where to pass control (usually to the Controller of the View
returned by View|subViewContaining:).


 

subViewSatisfying:

Return the first subview that satisfies aBlock, or nil if none does. 1/31/96 sw


 

subViews

Answer the receiver's collection of subViews.


 

textEditorView

Return the first view in the receiver whose controller is a ParagraphEdior, or nil if none. 1/31/96 sw


  subView inserting top  
 

addSubView:

Remove aView from the tree of Views it is in (if any) and adds it to the
rear of the list of subViews of the receiver. Set the superView of aView
to be the receiver. It is typically used to build up a hierarchy of Views
(a structured picture). An error notification is generated if aView is the
same as the receiver or its superView, and so on.


 

addSubView:above:

Adds aView (see View|addSubView:) so that it lies above topView.


 

addSubView:align:with:

Add aView to the receiver's list of subViews (see View|addSubView:)
and translate aView so that aPoint1 coincides with aPoint2. It is typically
used to build up a hierarchy of Views (a structured picture). Normally,
aPoint1 is a point on aView's viewport (e.g. aView viewport topLeft),
and aPoint2 is either an arbitrary point in the receiver's coordinate
system or a point on the receiver's window (e.g., self window topRight).


 

addSubView:below:

Add the argument, aSubView, (see View|addSubView:) so that it lies
below the view, topView.


 

addSubView:ifCyclic:

Remove aView from the tree of Views it is in (if any) and add it to the
rear of the list of subViews of the receiver. Set the superView of aView
to be the receiver. It is typically used to build up a hierarchy of Views
(a structured picture). An error notification is generated if aView is the
same as the receiver or its superView, and so on.


 

addSubView:toLeftOf:

Adds aView (see addSubView:) so that it lies to the right of rightView.


 

addSubView:toRightOf:

Add the argument, aSubView, (see View|addSubView:) so that it lies to
the right of the view, leftView.


 

addSubView:viewport:

Add aView to the receiver's list of subViews (see View|addSubView:) and
applies to aView a scale and translation computed from its window and
aViewport (such that its window fills aViewport).


 

addSubView:window:viewport:

Add aView to the receiver's list of subViews (see View|addSubView:)
and applies to aView a scale and translation computed from aWindow
and aViewport (such that aWindow fills aViewport).


  subView removing top  
 

releaseSubView:

Delete aView from the receiver's list of subViews and send it the
message 'release' (so that it can break up cycles with subViews, etc.).


 

releaseSubViews

Release (see View|releaseSubView:) all subViews in the receiver's list of
subViews.


 

removeFromSuperView

Delete the receiver from its superView's collection of subViews.


 

removeSubView:

Delete aView from the receiver's list of subViews. If the list of subViews
does not contain aView, create an error notification.


 

removeSubViews

Delete all the receiver's subViews.


  superView access top  
 

isTopView

Answer whether the receiver is a top view, that is, if it has no
superView.


 

superView

Answer the superView of the receiver.


 

topView

Answer the root of the tree of Views in which the receiver is a node.
The root of the tree is found by going up the superView path until
reaching a View whose superView is nil.


  testing top  
 

canDiscardEdits

Return true if this pane is not dirty.


 

containsPoint:

Answer whether aPoint is within the receiver's display box. It is sent to
a View's subViews by View|subViewAt: in order to determine which
subView contains the cursor point (so that, for example, control can be
pass down to that subView's controller).


 

hasUnacceptedEdits

Return true if this view has unaccepted edits.


 

isObscured


  transforming top  
 

align:with:

Add a translation of (aPoint2 - aPoint1) to the receiver's local
transformation. The point in the receiver's coordinate system that
previously was transformed to aPoint1 in the superView's coordinate
system will now be transformed to aPoint2 in the superView's coordinate
system. Other points will be translated by the same amount. It is
normally used when adding subViews to their superView in order to
line up the Viewport of one subView with that of another subView (see
View|addSubView:align:with:). aPoint1 and aPoint2 are usually points on
the viewports that are to be aligned. For example, 'subView2 align:
subView2 viewport topLeft with: subView1 viewport topRight' would be
used to place the viewport of subView2 next to the viewport of
subView1 with the topLeft and topRight corners, respectively,
coinciding. It is also possible to align the viewport of a subView with
the window of the superView, e.g., 'subView align: subView viewport
center with: superView window center'. View|align:with: assumes that
the view has been properly scaled, if necessary, to match its superView
(see View|scaleBy:). Typically, the coordinate systems of the receiver
and its superView will differ only by a translation offset so that no
scaling is necessary.


 

scale:translation:

The x component of aScale (a Point) specifies the scale (translation) in
the x direction; the y component specifies the scale (translation) in the y
direction. aScale can optionally be an instance of Integer or Float in
order to specify uniform scaling in both directions. Create a new local
transformation for the receiver with a scale factor of aScale and a
translation offset of aTranslation. When the transformation is applied (see
View|transform:), the scale is applied first, followed by the translation. It
is typically used when building a superView from its subViews in order
to line up the viewports of the subViews in the desired way. If no
scaling is required between subView and superView, then
View|align:with: is often more convenient to use.


 

scaleBy:

The x component of aScale (a Point) specifies the scale in the x
direction; the y component specifies the scale in the y direction. aScale
can, optionally, be an instance of Integer or Float in order to specify
uniform scaling in both directions. Scales the View by aScale. The scale
is concatenated with the current transformation of the receiver and is
applied when View|transform is sent. This happens automatically in the
process of displaying the receiver, for example.


 

transform:

Apply the local transformation of the receiver to anObject and answer
the resulting transformation. It is used to get the superView coordinates
of an object. For example, the viewport is equal to the window
transformed.


 

transformation

Answer a copy of the receiver's local transformation.


 

transformation:

Set the receiver's local transformation to a copy of aTransformation,
unlock the receiver (see View|unlock) and set the viewport to undefined
(this forces it to be recomputed when needed).


 

translateBy:

Translate the receiver by aPoint. The translation is concatenated with
the current transformation of the receiver and is applied when
View|transform is sent. This happens automatically in the process of
displaying the receiver.


 

window:viewport:

Set the receiver's window to aWindow, set its viewport to aViewport, and
create a new local transformation for the receiver based on aWindow and
aViewport. The receiver is scaled and translated so that aWindow, when
transformed, coincides with aViewport. It is used to position a subView's
window within some specific region of its superView's area. For example,
'subView window: aRectangle1 viewport: aRectangle2' sets subView's
window to aRectangle1, its viewport to aRectangle2, and its local
transformation to one that transforms aRectangle1 to aRectange2.


  updating top  
 

update

Normally sent by the receiver's model in order to notify the receiver of
a change in the model's state. Subclasses implement this message to do
particular update actions. A typical action that might be required is to
redisplay the receiver.


 

update:

Normally sent by the receiver's model in order to notify the receiver of
a change in the model's state. Subclasses implement this message to do
particular update actions. A typical action that might be required is to
redisplay the receiver.


  viewport access top  
 

viewport

Answer a copy of the receiver's viewport.


  window access top  
 

defaultWindow

Build the minimum Rectangle that encloses all the windows of the
receiver's subViews. The answer is a Rectangle obtained by expanding
this minimal Rectangle by the borderWidth of the receiver. If the
receiver has no subViews, then a Rectangle enclosing the entire display
screen is answered. It is used internally by View methods if no window
has been specified for the View. Specialized subclasses of View should
redefine View|defaultWindow to handle the default case for instances
that have no subViews.


 

insetWindow

Answer a Rectangle that is obtained by insetting the receiver's window
rectangle by the border width.


 

window

Answer a copy of the receiver's window.


 

window:

Set the receiver's window to a copy of aWindow.


class methods
  instance creation top  
 

new

Answer an initialized instance of me. The transformation is an identity
transformation, the borderWidth is 0, the borderColor is black, and the
insideColor is transparent.