UIObjectView.st
changeset 175 0b0b4d99e3e7
parent 156 b332d7117c40
child 194 2b05bd327785
equal deleted inserted replaced
174:0e87610c2768 175:0b0b4d99e3e7
    12 
    12 
    13 
    13 
    14 
    14 
    15 ObjectView subclass:#UIObjectView
    15 ObjectView subclass:#UIObjectView
    16 	instanceVariableNames:'saveSelection inputView enableChannel undoHistory copiedExtent
    16 	instanceVariableNames:'saveSelection inputView enableChannel undoHistory copiedExtent
    17 		copiedLayout actionData createClass clipChildren
    17 		copiedLayout resizeData clipChildren selectionHiddenLevel
    18 		selectionHiddenLevel setOfSuperViewsSizeChanged'
    18 		setOfSuperViewsSizeChanged'
    19 	classVariableNames:''
    19 	classVariableNames:''
    20 	poolDictionaries:''
    20 	poolDictionaries:''
    21 	category:'Interface-UIPainter'
    21 	category:'Interface-UIPainter'
    22 !
    22 !
    23 
    23 
   165 hitDelta
   165 hitDelta
   166     ^ 4
   166     ^ 4
   167 
   167 
   168 ! !
   168 ! !
   169 
   169 
       
   170 !UIObjectView class methodsFor:'handles'!
       
   171 
       
   172 handlesOf:aView do:aBlock
       
   173     |type v h|
       
   174 
       
   175     type := self layoutType:aView.
       
   176 
       
   177     (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
       
   178         v := self isVerticalResizable:aView.
       
   179         h := self isHorizontalResizable:aView.
       
   180 
       
   181         h ifTrue:[  aBlock value:(aView leftCenter ) value:#left.
       
   182                     aBlock value:(aView rightCenter) value:#right.
       
   183                  ].
       
   184         v ifTrue:[  aBlock value:(aView topCenter   ) value:#top.
       
   185                     aBlock value:(aView bottomCenter) value:#bottom.
       
   186                  ].
       
   187 
       
   188         (h and:[v]) ifTrue:[
       
   189             aBlock value:(aView origin    ) value:#origin.
       
   190             aBlock value:(aView topRight  ) value:#topRight.
       
   191             aBlock value:(aView bottomLeft) value:#bottomLeft.
       
   192             aBlock value:(aView corner    ) value:#corner.
       
   193           ^ self
       
   194         ]
       
   195     ].
       
   196 
       
   197     aBlock value:(aView origin    ) value:#view.
       
   198     aBlock value:(aView topRight  ) value:#view.
       
   199     aBlock value:(aView bottomLeft) value:#view.
       
   200 
       
   201     type == #Extent ifTrue:[
       
   202         v := self isVerticalResizable:aView.
       
   203         h := self isHorizontalResizable:aView.
       
   204 
       
   205         v ifTrue:[aBlock value:(aView bottomCenter) value:#bottom].
       
   206         h ifTrue:[aBlock value:(aView rightCenter ) value:#right ].
       
   207 
       
   208         (h and:[v]) ifTrue:[
       
   209             aBlock value:(aView corner) value:#corner.
       
   210           ^ self
       
   211         ]
       
   212     ].
       
   213     aBlock value:(aView corner) value:#view.
       
   214 
       
   215 
       
   216 ! !
       
   217 
   170 !UIObjectView class methodsFor:'queries'!
   218 !UIObjectView class methodsFor:'queries'!
       
   219 
       
   220 isHorizontalResizable:aComponent
       
   221     "returns true if instance is horizontal resizeable
       
   222     "
       
   223     (aComponent isKindOf:ScrollBar) ifTrue:[
       
   224         ^ aComponent orientation == #horizontal
       
   225     ].
       
   226     (aComponent isKindOf:Scroller) ifTrue:[
       
   227         ^ aComponent orientation == #horizontal
       
   228     ].
       
   229     (aComponent isKindOf:Slider) ifTrue:[
       
   230         ^ aComponent orientation == #horizontal
       
   231     ].
       
   232     ^ true
       
   233 
       
   234 !
       
   235 
       
   236 isVerticalResizable:aComponent
       
   237     "returns true if instance is vertical resizeable
       
   238     "
       
   239     (aComponent isKindOf:EditField) ifTrue:[
       
   240         ^ false
       
   241     ].
       
   242     (aComponent isKindOf:ComboBoxView) ifTrue:[
       
   243         ^ false
       
   244     ].
       
   245     (aComponent isKindOf:CheckBox) ifTrue:[
       
   246         ^ false
       
   247     ].
       
   248     (aComponent isKindOf:ScrollBar) ifTrue:[
       
   249         ^ aComponent orientation == #vertical
       
   250     ].
       
   251     (aComponent isKindOf:Scroller) ifTrue:[
       
   252         ^ aComponent orientation == #vertical
       
   253     ].
       
   254     (aComponent isKindOf:Slider) ifTrue:[
       
   255         ^ aComponent orientation == #vertical
       
   256     ].
       
   257     ^ true
       
   258 
       
   259 !
   171 
   260 
   172 layoutType:aView
   261 layoutType:aView
   173     "returns layout type of aView or nil
   262     "returns layout type of aView or nil
   174     "
   263     "
   175     |layout spec superView|
   264     |layout spec superView|
   327 addObjectWithoutRedraw:anObject
   416 addObjectWithoutRedraw:anObject
   328     "add the argument, anObject to the contents - with redraw
   417     "add the argument, anObject to the contents - with redraw
   329     "
   418     "
   330     self halt
   419     self halt
   331 
   420 
       
   421 !
       
   422 
       
   423 startCreate:aPoint
       
   424     self setDefaultActions.
       
   425     self halt
   332 ! !
   426 ! !
   333 
   427 
   334 !UIObjectView methodsFor:'event handling'!
   428 !UIObjectView methodsFor:'event handling'!
   335 
   429 
   336 elementChangedSize:aView
   430 elementChangedSize:aView
   345 !
   439 !
   346 
   440 
   347 exposeX:x y:y width:w height:h
   441 exposeX:x y:y width:w height:h
   348     "handle an expose event from device; redraw selection
   442     "handle an expose event from device; redraw selection
   349     "
   443     "
   350     super exposeX:x y:y width:w height:h.
   444     resizeData isNil ifTrue:[
   351 
   445         super exposeX:x y:y width:w height:h.
   352 "
   446 
   353 catch expose events for all subviews associated with
   447         "/ handle any expose events (for subcomponents) before
   354 a selected instance
   448         "/ redrawing the handles.
   355 "
   449         (self sensor hasExposeEventFor:nil) ifTrue:[^ self].
   356 
   450 
   357     "/ handle any expose events (for subcomponents) before
   451         self selectionDo:[:aComponent |
   358     "/ redrawing the handles.
   452             aComponent withAllSubViewsDo:[:v |
   359     (self sensor hasExposeEventFor:nil) ifTrue:[^ self].
   453                 self sensor flushExposeEventsFor:v.
   360 
   454                 v exposeX:0 y:0 width:9999 height:9999.
   361     self selectionDo:[:aComponent |
   455             ].
   362         aComponent withAllSubViewsDo:[:v |
   456 
   363             self sensor flushExposeEventsFor:v.
   457             self showSelected:aComponent
   364             v exposeX:0 y:0 width:9999 height:9999.
   458         ]
   365         ].
       
   366 
       
   367         self showSelected:aComponent
       
   368     ]
   459     ]
   369 
   460 
   370 !
   461 !
   371 
   462 
   372 keyPress:key x:x y:y
   463 keyPress:key x:x y:y
   453     super cursor:aCursor
   544     super cursor:aCursor
   454 
   545 
   455 
   546 
   456 !
   547 !
   457 
   548 
   458 invertOutlineOf:anObject
   549 invertOutlineOf:something
   459     "invert outline of an object
   550     "invert outline of an object or collection of objects
   460     "
   551     "
   461     |wasClipped delta|
   552     |wasClipped p|
   462 
   553 
   463     (wasClipped := clipChildren) ifTrue:[
   554     (wasClipped := clipChildren) ifTrue:[
   464         self clippedByChildren:(clipChildren := false).
   555         self clippedByChildren:(clipChildren := false).
   465     ].
   556     ].
   466     delta := (anObject originRelativeTo:self) - anObject origin.
   557 
   467 
   558     something isCollection ifTrue:[
   468     self xoring:[
   559         something do:[:v|
   469         self displayRectangle:((anObject origin + delta) extent:anObject extent).
   560             p := v originRelativeTo:self.
       
   561             self xoring:[self displayRectangle:(p extent:v extent)].
       
   562         ]
       
   563     ] ifFalse:[
       
   564         p := something originRelativeTo:self.
       
   565         self xoring:[self displayRectangle:(p extent:something extent)]
   470     ].
   566     ].
   471 
   567 
   472     wasClipped ifTrue:[
   568     wasClipped ifTrue:[
   473         self clippedByChildren:(clipChildren := true).
   569         self clippedByChildren:(clipChildren := true).
   474     ].
   570     ].
   475 
       
   476     "Modified: 5.9.1995 / 12:25:25 / claus"
       
   477 
       
   478 
   571 
   479 !
   572 !
   480 
   573 
   481 minSetOfSuperViews:setOfViews
   574 minSetOfSuperViews:setOfViews
   482 
   575 
   500 
   593 
   501     self cursor:Cursor normal.
   594     self cursor:Cursor normal.
   502 
   595 
   503 ! !
   596 ! !
   504 
   597 
   505 !UIObjectView methodsFor:'object creation'!
       
   506 
       
   507 actionCreate:anObject frame:aFrame delta:aDelta
       
   508     "create and initialize action data
       
   509     "
       
   510     |extent x y selectors values|
       
   511 
       
   512 "minimum extent
       
   513 "
       
   514     (anObject specClass supportsSubComponents) ifTrue:[
       
   515         extent := 25@25
       
   516     ] ifFalse:[
       
   517         extent := self extent.
       
   518         x := extent x // 3.
       
   519         y := extent y // 3.
       
   520         extent := anObject preferredExtent.
       
   521 
       
   522         (extent x > x) ifTrue:[extent x:x].
       
   523         (extent y > y) ifTrue:[extent y:y].
       
   524     ].
       
   525 
       
   526 "setup structure
       
   527 "
       
   528     selectors := #( object frame delta vertical horizontal minExtent ).
       
   529     values    := Array new:(selectors size).
       
   530 
       
   531     values at:1 put:anObject.
       
   532     values at:2 put:aFrame.
       
   533     values at:3 put:aDelta.
       
   534     values at:4 put:(self isVerticalResizable:anObject).
       
   535     values at:5 put:(self isHorizontalResizable:anObject).
       
   536     values at:6 put:extent.
       
   537 
       
   538     actionData := Structure newWith:selectors values:values.
       
   539 
       
   540 
       
   541 "can change cursor dependent on vertical/horizontal resizing
       
   542 "
       
   543     oldCursor := cursor.
       
   544     self cursor:(Cursor leftHand).
       
   545 
       
   546 
       
   547 
       
   548 !
       
   549 
       
   550 createWidgetWithClass:aClass
       
   551     "prepare to create new widgets
       
   552     "
       
   553     aClass notNil ifTrue:[
       
   554         createClass := aClass.
       
   555         pressAction := [:aPoint| self startCreate:aPoint].
       
   556         self cursor:Cursor origin.
       
   557     ]
       
   558 
       
   559 !
       
   560 
       
   561 doDragCreate:aPoint
       
   562     "do a widget create drag
       
   563     "
       
   564     |frame object extent minimum|
       
   565 
       
   566     frame   := actionData frame.
       
   567     frame corner:((self alignToGrid:aPoint) - (actionData delta)).
       
   568 
       
   569     object  := actionData object.
       
   570     minimum := actionData minExtent.
       
   571     extent  := frame extent.
       
   572 
       
   573     ((extent x < minimum x) or:[actionData horizontal not]) ifTrue:[
       
   574         extent x:(minimum x)
       
   575     ].
       
   576 
       
   577     ((extent y < minimum y) or:[actionData vertical not]) ifTrue:[
       
   578         extent y:(minimum y)
       
   579     ].
       
   580 
       
   581     frame extent:extent.
       
   582 
       
   583     self invertOutlineOf:object.
       
   584     object origin:(frame origin) extent:(frame extent).
       
   585     self invertOutlineOf:object.
       
   586 !
       
   587 
       
   588 endCreate
       
   589     "end a widget create drag
       
   590     "
       
   591     |object specClass|
       
   592 
       
   593     object := actionData object.
       
   594     self invertOutlineOf:object.
       
   595     inputView raise.
       
   596 
       
   597     self setupInitialLayoutFor:object.
       
   598     self select:object.
       
   599     actionData := nil.
       
   600 
       
   601     self setDefaultActions.
       
   602 
       
   603 !
       
   604 
       
   605 initializeCreatedObject:anObject
       
   606     self subclassResponsibility
       
   607 !
       
   608 
       
   609 setupInitialLayoutFor:anObject
       
   610     "setup initial layout for an object; !!!! some kludge !!!!
       
   611     "
       
   612     |spec topSpec|
       
   613 
       
   614     topSpec := anObject superView specClass basicNew.
       
   615 
       
   616     topSpec class isLayoutContainer ifFalse:[
       
   617 
       
   618 "/ ... KLUDGE ....
       
   619 
       
   620         spec := anObject specClass.
       
   621 
       
   622         (    spec == ViewSpec
       
   623          or:[spec == SubCanvasSpec
       
   624          or:[spec == TextEditorSpec
       
   625          or:[spec == SequenceViewSpec]]]
       
   626         ) ifTrue:[
       
   627             anObject geometryLayout:(anObject bounds asLayout).
       
   628           ^ self
       
   629         ]
       
   630     ].
       
   631     topSpec setupInitialLayoutFor:anObject.
       
   632 
       
   633 !
       
   634 
       
   635 startCreate:aPoint
       
   636     "start a widget create
       
   637     "
       
   638     |widget object start frame delta|
       
   639 
       
   640     self select:nil.
       
   641     widget := self findContainerViewAt:aPoint.
       
   642 
       
   643     motionAction  := [:movePoint| self doDragCreate:movePoint].
       
   644     releaseAction := [ self endCreate].
       
   645 
       
   646     object := createClass new.
       
   647     (widget isKindOf:ScrollableView) ifTrue:[
       
   648         widget scrolledView:object
       
   649     ] ifFalse:[
       
   650         widget addSubView:object.
       
   651     ].
       
   652 
       
   653     start := self alignToGrid:aPoint.
       
   654     delta := widget originRelativeTo:self.
       
   655     frame := Rectangle origin:(start - delta) corner:start.
       
   656 
       
   657     object origin:(frame origin).
       
   658     self initializeCreatedObject:object.
       
   659     self actionCreate:object frame:frame delta:delta.
       
   660     object extent:(actionData minExtent).
       
   661     object realize.
       
   662     self invertOutlineOf:object.
       
   663 ! !
       
   664 
       
   665 !UIObjectView methodsFor:'object moving'!
   598 !UIObjectView methodsFor:'object moving'!
   666 
   599 
   667 doObjectMove:aPoint
   600 doObjectMove:aPoint
   668     "move selection
   601     "move selection
   669     "
   602     "
   670     movedObject notNil ifTrue:[
   603     movedObject notNil ifTrue:[
   671         movedObject keysAndValuesDo:[:nr :aView|
   604         self invertOutlineOf:movedObject.
   672             self invertOutlineOf:aView.
   605 
   673             self moveObject:aView to:(aPoint - (moveDelta at:nr)).
   606         movedObject keysAndValuesDo:[:i :v|
   674             self invertOutlineOf:aView.
   607             self moveObject:v to:(aPoint - (moveDelta at:i)).
   675         ]
   608         ].
       
   609         self invertOutlineOf:movedObject.
   676     ]
   610     ]
   677 
   611 
   678 !
   612 !
   679 
   613 
   680 endObjectMove
   614 endObjectMove
   681     "cleanup after object(s) move
   615     "cleanup after object(s) move
   682     "
   616     "
   683     movedObject notNil ifTrue:[
   617     movedObject notNil ifTrue:[
   684         movedObject do:[:aView|self invertOutlineOf:aView].
   618         self invertOutlineOf:movedObject.
   685 
   619 
   686         movedObject size == 1 ifTrue:[
   620         movedObject size == 1 ifTrue:[
   687             movedObject := movedObject first
   621             movedObject := movedObject first
   688         ].
   622         ].
   689 
       
   690         self setSelection:movedObject withRedraw:true.
   623         self setSelection:movedObject withRedraw:true.
   691         movedObject := nil.
   624         movedObject := nil.
   692         self setDefaultActions.
   625         self setDefaultActions.
   693         self changed:#layout.
   626         self changed:#layout.
   694     ].
   627     ].
   726     self setSelection:nil withRedraw:true.
   659     self setSelection:nil withRedraw:true.
   727 
   660 
   728     moveDelta := movedObject collect:[:aView|
   661     moveDelta := movedObject collect:[:aView|
   729         aPoint - aView computeOrigin
   662         aPoint - aView computeOrigin
   730     ].
   663     ].
   731 
   664     self transaction:#move objects:movedObject do:[:v|self createUndoLayout:v].
   732     self transaction:#move objects:movedObject do:[:aView|
   665     self invertOutlineOf:movedObject.
   733         self invertOutlineOf:aView.
       
   734         self createUndoLayout:aView
       
   735     ].
       
   736 
       
   737 !
   666 !
   738 
   667 
   739 startSelectMoreOrMove:aPoint
   668 startSelectMoreOrMove:aPoint
   740     "add/remove to/from selection"
   669     "add/remove to/from selection"
   741 
   670 
   817     |selector delta|
   746     |selector delta|
   818 
   747 
   819     delta    := anObject container originRelativeTo:self.
   748     delta    := anObject container originRelativeTo:self.
   820     selector := ('resize:', aSelector, ':') asSymbol.
   749     selector := ('resize:', aSelector, ':') asSymbol.
   821 
   750 
   822     actionData := Structure with:(#object->anObject)
   751     resizeData := Structure with:(#object->anObject)
   823                             with:(#selector->selector)
   752                             with:(#selector->selector)
   824                             with:(#delta->delta).
   753                             with:(#delta->delta).
   825 
   754 
   826 "can change cursor dependent on vertical/horizontal resizing
   755 "can change cursor dependent on vertical/horizontal resizing
   827 "
   756 "
   835 doDragResize:aPoint
   764 doDragResize:aPoint
   836     "do a widget resize drag
   765     "do a widget resize drag
   837     "
   766     "
   838     |p object|
   767     |p object|
   839 
   768 
   840     object := actionData object.
   769     object := resizeData object.
   841 
   770 
   842     self invertOutlineOf:object.
   771     self invertOutlineOf:object.
   843     p := (self alignToGrid:aPoint) - (actionData delta).
   772     p := (self alignToGrid:aPoint) - (resizeData delta).
   844 
   773 
   845     self perform:(actionData selector) with:object with:p.
   774     self perform:(resizeData selector) with:object with:p.
   846    "/ object geometryLayout:(object geometryLayout).
   775    "/ object geometryLayout:(object geometryLayout).
   847     self invertOutlineOf:object
   776     self invertOutlineOf:object
   848 
   777 
   849 !
   778 !
   850 
   779 
   851 endResize
   780 endResize
   852     "cleanup after object resize
   781     "cleanup after object resize
   853     "
   782     "
   854     |object|
   783     |object|
   855 
   784 
   856     object := actionData object.
   785     object := resizeData object.
   857     actionData := nil.
   786     resizeData := nil.
   858 
   787 
   859     self invertOutlineOf:object.
   788     self invertOutlineOf:object.
   860     self setDefaultActions.
   789     self setDefaultActions.
   861     self elementChangedSize:object.
   790     self elementChangedSize:object.
   862 
   791 
   889     self invertOutlineOf:object
   818     self invertOutlineOf:object
   890 ! !
   819 ! !
   891 
   820 
   892 !UIObjectView methodsFor:'private handles'!
   821 !UIObjectView methodsFor:'private handles'!
   893 
   822 
   894 handlesOf:aView do:aBlock
   823 handlesOf:aComponent do:aTwoArgAction
   895     |dlta type v h|
   824     "perform action on each handle of a component
   896 
   825     "
   897     dlta := (aView originRelativeTo:self) - aView origin.
   826     |dlt ext|
   898     type := self class layoutType:aView.
   827 
   899 
   828     dlt := (aComponent originRelativeTo:self) - aComponent origin.
   900     (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
   829     dlt := dlt - (3@3).
   901         v := self isVerticalResizable:aView.
   830     ext := 6@6.
   902         h := self isHorizontalResizable:aView.
   831 
   903 
   832     self class handlesOf:aComponent do:[:pnt :wht |
   904         h ifTrue:[  aBlock value:(aView leftCenter   + dlta) value:#left.
   833         aTwoArgAction value:(pnt + dlt extent:ext) value:wht
   905                     aBlock value:(aView rightCenter  + dlta) value:#right.
   834     ]
   906                  ].
       
   907         v ifTrue:[  aBlock value:(aView topCenter    + dlta) value:#top.
       
   908                     aBlock value:(aView bottomCenter + dlta) value:#bottom.
       
   909                  ].
       
   910 
       
   911         (h and:[v]) ifTrue:[
       
   912             aBlock value:(aView origin     + dlta) value:#origin.
       
   913             aBlock value:(aView topRight   + dlta) value:#topRight.
       
   914             aBlock value:(aView bottomLeft + dlta) value:#bottomLeft.
       
   915             aBlock value:(aView corner     + dlta) value:#corner.
       
   916           ^ self
       
   917         ]
       
   918     ].
       
   919 
       
   920     aBlock value:(aView origin     + dlta) value:#view.
       
   921     aBlock value:(aView topRight   + dlta) value:#view.
       
   922     aBlock value:(aView bottomLeft + dlta) value:#view.
       
   923 
       
   924     type == #Extent ifTrue:[
       
   925         v := self isVerticalResizable:aView.
       
   926         h := self isHorizontalResizable:aView.
       
   927 
       
   928         v ifTrue:[aBlock value:(aView bottomCenter + dlta) value:#bottom].
       
   929         h ifTrue:[aBlock value:(aView rightCenter  + dlta) value:#right ].
       
   930 
       
   931         (h and:[v]) ifTrue:[
       
   932             aBlock value:(aView corner + dlta) value:#corner.
       
   933           ^ self
       
   934         ]
       
   935     ].
       
   936     aBlock value:(aView corner + dlta) value:#view.
       
   937 !
   835 !
   938 
   836 
   939 showSelected:aComponent
   837 showSelected:aComponent
   940     "show object selected
   838     "show object selected
   941     "
   839     "
   942     |wasClipped delta|
   840     |wasClipped|
       
   841 
       
   842     selectionHiddenLevel == 0 ifTrue:[
       
   843         self paint:Color black.
       
   844 
       
   845         (wasClipped := clipChildren) ifTrue:[
       
   846             self clippedByChildren:(clipChildren := false). 
       
   847         ].
       
   848 
       
   849         self handlesOf:aComponent do:[:rectangle :what|
       
   850             what == #view ifTrue:[self displayRectangle:rectangle]
       
   851                          ifFalse:[self fillRectangle:rectangle]
       
   852         ].
       
   853 
       
   854         wasClipped ifTrue:[
       
   855             self clippedByChildren:(clipChildren := true).
       
   856         ]
       
   857     ]
       
   858 !
       
   859 
       
   860 showUnselected:aComponent
       
   861     "show object unselected
       
   862     "
       
   863     |wasClipped delta r|
   943 
   864 
   944     selectionHiddenLevel ~~ 0 ifTrue:[^ self].
   865     selectionHiddenLevel ~~ 0 ifTrue:[^ self].
   945 
       
   946     self paint:Color black.
       
   947 
   866 
   948     (wasClipped := clipChildren) ifTrue:[
   867     (wasClipped := clipChildren) ifTrue:[
   949         self clippedByChildren:(clipChildren := false). 
   868         self clippedByChildren:(clipChildren := false). 
   950     ].
   869     ].
   951 
   870 
   952     self handlesOf:aComponent do:[:pnt :what |
   871     self handlesOf:aComponent do:[:rec :wht| self clearRectangle:rec ].
   953         what == #view ifTrue:[self displayRectangle:(pnt - (4@4) extent:7@7)]
       
   954                      ifFalse:[self    fillRectangle:(pnt - (4@4) extent:7@7)]
       
   955     ].
       
   956 
       
   957     wasClipped ifTrue:[
       
   958         self clippedByChildren:(clipChildren := true).
       
   959     ].
       
   960 
       
   961 !
       
   962 
       
   963 showUnselected:aComponent
       
   964     "show object unselected
       
   965     "
       
   966     |wasClipped delta r|
       
   967 
       
   968     selectionHiddenLevel ~~ 0 ifTrue:[^ self].
       
   969 
       
   970     (wasClipped := clipChildren) ifTrue:[
       
   971         self clippedByChildren:(clipChildren := false). 
       
   972     ].
       
   973 
       
   974     self handlesOf:aComponent do:[:pnt :what |
       
   975         self clearRectangle:(pnt - (4@4) extent:7@7).
       
   976     ].
       
   977 
   872 
   978     wasClipped ifTrue:[
   873     wasClipped ifTrue:[
   979         self clippedByChildren:(clipChildren := true). 
   874         self clippedByChildren:(clipChildren := true). 
   980     ].
   875     ].
   981 
   876 
   982     "/ must redraw all components which are affected b the handles
   877     "/ must redraw all components which are affected b the handles
   983 
   878 
   984     r := (aComponent originRelativeTo:self) - (4@4)
   879     r := (aComponent originRelativeTo:self) - (3@3) extent:(aComponent extent + (6@6)).
   985              extent:(aComponent extent + (4@4)).
       
   986 
   880 
   987     subViews do:[:anotherComponent |
   881     subViews do:[:anotherComponent |
   988         |absOrg absFrame|
   882         |absOrg absFrame|
   989 
   883 
   990         anotherComponent ~~ inputView ifTrue:[
   884         anotherComponent ~~ inputView ifTrue:[
  1002     ]
   896     ]
  1003 
   897 
  1004     "Modified: 8.4.1997 / 00:32:26 / cg"
   898     "Modified: 8.4.1997 / 00:32:26 / cg"
  1005 !
   899 !
  1006 
   900 
  1007 whichHandleOf:aView isHitBy:aPoint
   901 whichHandleOf:aComponent isHitBy:aPoint
  1008     "returns kind of handle or nil
   902     "returns kind of handle or nil
  1009     "
   903     "
  1010     |bounds|
   904     self handlesOf:aComponent do:[:rectangle :what|
  1011 
   905         (rectangle containsPoint:aPoint) ifTrue:[^ what]
  1012     self handlesOf:aView do:[:pnt :what |
   906     ].
  1013         ((pnt - (4@4) extent:7@7) containsPoint:aPoint) ifTrue:[
   907   ^ nil
  1014             ^ what
       
  1015         ].
       
  1016     ].
       
  1017 
       
  1018     ^ nil
       
  1019 
       
  1020     "Modified: 5.9.1995 / 14:39:34 / claus"
       
  1021 
       
  1022 ! !
   908 ! !
  1023 
   909 
  1024 !UIObjectView methodsFor:'private resizing-subviews'!
   910 !UIObjectView methodsFor:'private resizing-subviews'!
  1025 
   911 
  1026 resize:aView bottom:aPoint
   912 resize:aView bottom:aPoint
  1217         ^ listOfViews last
  1103         ^ listOfViews last
  1218     ].
  1104     ].
  1219     ^ nil
  1105     ^ nil
  1220 
  1106 
  1221 
  1107 
  1222 !
       
  1223 
       
  1224 isPoint:aPoint containedIn:aView
       
  1225     "checks whether a point is covered by a view.
       
  1226     "
       
  1227     |p|
       
  1228 
       
  1229     p := device translatePoint:aPoint from:inputView id to:aView id.
       
  1230 
       
  1231     (p x >= 0 and:[p y >= 0]) ifTrue:[
       
  1232         p := aView extent - p.
       
  1233 
       
  1234         (p x >= 0 and:[p y >= 0]) ifTrue:[
       
  1235             ^ true
       
  1236         ]
       
  1237     ].
       
  1238     ^ false
       
  1239 !
       
  1240 
       
  1241 whichBorderOf:aView isHitBy:aPoint
       
  1242     |p r bw org|
       
  1243 
       
  1244     bw := aView borderWidth.
       
  1245     p := aPoint - (aView superView originRelativeTo:self).
       
  1246 
       
  1247     r := Rectangle origin:(aView origin)
       
  1248                    extent:(aView width @ bw).
       
  1249     (r containsPoint:p) ifTrue:[^ #top:].
       
  1250 
       
  1251     r origin:(aView left @ (aView bottom + bw)) extent:(aView width @ bw).
       
  1252     (r containsPoint:p) ifTrue:[^ #bottom:].
       
  1253 
       
  1254     r top:(aView top).
       
  1255     r extent:(bw @ aView height).
       
  1256     (r containsPoint:p) ifTrue:[^ #left:].
       
  1257 
       
  1258     r origin:((aView right + bw) @ aView top).
       
  1259     (r containsPoint:p) ifTrue:[^ #right:].
       
  1260 
       
  1261     ^ nil
       
  1262 
       
  1263 
       
  1264 ! !
  1108 ! !
  1265 
  1109 
  1266 !UIObjectView methodsFor:'selections'!
  1110 !UIObjectView methodsFor:'selections'!
  1267 
  1111 
  1268 moveableSelection
  1112 moveableSelection
  1531     "
  1375     "
  1532     ^ self numberOfSelections ~~ 0
  1376     ^ self numberOfSelections ~~ 0
  1533 
  1377 
  1534 !
  1378 !
  1535 
  1379 
  1536 isHorizontalResizable:aComponent
       
  1537     "returns true if instance is horizontal resizeable
       
  1538     "
       
  1539     ^ self subclassResponsibility
       
  1540 
       
  1541 
       
  1542 !
       
  1543 
       
  1544 isModified
  1380 isModified
  1545     "returns true if painter is modified
  1381     "returns true if painter is modified
  1546     "
  1382     "
  1547   ^ undoHistory isModified
  1383   ^ undoHistory isModified
  1548 !
  1384 !
  1552     "
  1388     "
  1553     anObject notNil ifTrue:[
  1389     anObject notNil ifTrue:[
  1554         self selectionDo:[:el| el == anObject ifTrue:[^ true]]
  1390         self selectionDo:[:el| el == anObject ifTrue:[^ true]]
  1555     ].
  1391     ].
  1556   ^ false
  1392   ^ false
  1557 
       
  1558 !
       
  1559 
       
  1560 isVerticalResizable:aComponent
       
  1561     "returns true if instance is vertical resizeable
       
  1562     "
       
  1563     ^ self subclassResponsibility
       
  1564 
       
  1565 
       
  1566 !
       
  1567 
       
  1568 supportsLabel:aComponent
       
  1569     "returns true if component supports label
       
  1570     "
       
  1571     ^ self subclassResponsibility
       
  1572 
       
  1573 
  1393 
  1574 ! !
  1394 ! !
  1575 
  1395 
  1576 !UIObjectView methodsFor:'transaction'!
  1396 !UIObjectView methodsFor:'transaction'!
  1577 
  1397