DSVLabelView.st
changeset 1408 1cda0a4fb566
parent 1269 f33ad4d38b5b
child 1426 9a067c26db45
equal deleted inserted replaced
1407:4f151198c452 1408:1cda0a4fb566
   118     enabled := aState.
   118     enabled := aState.
   119 ! !
   119 ! !
   120 
   120 
   121 !DSVLabelView methodsFor:'drawing'!
   121 !DSVLabelView methodsFor:'drawing'!
   122 
   122 
   123 redraw
   123 invalidateItem:anItem
   124     "redraw complete view
   124     "invalidate rectangle assigned to an item
   125     "
   125     "
   126     self redrawX:0 y:0 width:(self width) height:(self height).
   126     shown ifTrue:[
   127 
   127         self invalidate:(anItem layout)
   128 !
   128     ]
   129 
   129 !
   130 redrawItem:anItem
   130 
   131     "redraw rectangle assigned to an item
   131 invalidateX:x y:y width:w height:h
   132     "
   132     "invalidate a rectangle
   133     |layout|
   133     "
   134 
   134     shown ifTrue:[
   135     layout := anItem layout.
   135         self invalidate:(Rectangle left:x top:y width:w height:h)
   136 
   136     ].
   137     self redrawX:(layout left)
   137 !
   138                y:(layout top)
       
   139            width:(layout width)
       
   140           height:(layout height).
       
   141 
       
   142 ! !
       
   143 
       
   144 !DSVLabelView methodsFor:'drawing basics'!
       
   145 
   138 
   146 redrawX:x y:y width:w height:h
   139 redrawX:x y:y width:w height:h
   147     "redraw a rectangle
   140     "redraw a rectangle
   148     "
   141     "
   149     |inset savClip bg fg fgColor bgColor maxX layout left width actLvl pasLvl lv|
   142     |inset savClip bg fg fgColor bgColor maxX layout left width actLvl pasLvl lv|
   221         (     button == 1
   214         (     button == 1
   222          and:[selection isNil
   215          and:[selection isNil
   223          and:[(item := self detectItemAtX:x y:y) notNil
   216          and:[(item := self detectItemAtX:x y:y) notNil
   224          and:[item isSelectable]]]
   217          and:[item isSelectable]]]
   225         ) ifTrue:[
   218         ) ifTrue:[
   226             self redrawItem:(selection := item)
   219             self invalidateItem:(selection := item)
   227         ]
   220         ]
   228     ].
   221     ].
   229     super buttonPress:button x:x y:y
   222     super buttonPress:button x:x y:y
   230 
   223 
   231 
   224 
   243         same      := (self detectItemAtX:x y:y) == selection.
   236         same      := (self detectItemAtX:x y:y) == selection.
   244         item      := selection.
   237         item      := selection.
   245         layout    := item layout.
   238         layout    := item layout.
   246         selection := nil.
   239         selection := nil.
   247 
   240 
   248         self redrawItem:item.
   241         self invalidateItem:item.
   249 
   242 
   250         same ifTrue:[
   243         same ifTrue:[
   251             item sendClickMsgTo:(self application)
   244             item sendClickMsgTo:(self application)
   252         ]
   245         ]
   253     ].
   246     ].
   264     prevEntered := enteredItem.
   257     prevEntered := enteredItem.
   265     enteredItem := anItemOrNil.
   258     enteredItem := anItemOrNil.
   266 
   259 
   267     prevEntered notNil ifTrue:[
   260     prevEntered notNil ifTrue:[
   268         prevEntered isSelectable ifTrue:[
   261         prevEntered isSelectable ifTrue:[
   269             self redrawItem:prevEntered
   262             self invalidateItem:prevEntered
   270         ]
   263         ]
   271     ].
   264     ].
   272 
   265 
   273     enteredItem notNil ifTrue:[
   266     enteredItem notNil ifTrue:[
   274         enteredItem isSelectable ifTrue:[
   267         enteredItem isSelectable ifTrue:[
   275             self redrawItem:enteredItem
   268             self invalidateItem:enteredItem
   276         ]
   269         ]
   277     ]
   270     ]
   278 !
   271 !
   279 
   272 
   280 pointerLeave:state
   273 pointerLeave:state
   307     "
   300     "
   308     items size == columnView numberOfColumns ifFalse:[
   301     items size == columnView numberOfColumns ifFalse:[
   309         self columnsSizeChanged
   302         self columnsSizeChanged
   310     ] ifTrue:[
   303     ] ifTrue:[
   311         self updateLayoutsHeight:(self height).
   304         self updateLayoutsHeight:(self height).
   312         self redraw.
   305         self invalidate.
   313     ].
   306     ].
   314 
   307 
   315 
   308 
   316 !
   309 !
   317 
   310 
   321     |point pX x w h|
   314     |point pX x w h|
   322 
   315 
   323     (pX := aPoint x) == 0 ifTrue:[
   316     (pX := aPoint x) == 0 ifTrue:[
   324         ^ self
   317         ^ self
   325     ].
   318     ].
   326 
   319     (self sensor hasExposeEventFor:self) ifTrue:[
       
   320         ^ self invalidate
       
   321     ].
   327     point := Point x:(aPoint x) y:0.
   322     point := Point x:(aPoint x) y:0.
   328     items do:[:anItem| anItem originChanged:point].
   323     items do:[:anItem| anItem originChanged:point].
   329 
   324 
   330     (self sensor hasExposeEventFor:self) ifTrue:[
       
   331         ^ self invalidateRepairNow:true
       
   332     ].
       
   333 
       
   334     x := pX abs.
   325     x := pX abs.
   335     w := self width - x.
   326 
       
   327     (w := self width - x) < 20 ifTrue:[
       
   328         ^ self invalidate
       
   329     ].
   336     h := self height.
   330     h := self height.
   337 
       
   338     w < 20 ifTrue:[
       
   339         ^ self redraw
       
   340     ].
       
   341 
   331 
   342     self catchExpose.
   332     self catchExpose.
   343 
   333 
   344     pX < 0 ifTrue:[
   334     pX < 0 ifTrue:[
   345         self copyFrom:self x:0 y:0 toX:x y:0 width:w height:h async:true.
   335         self copyFrom:self x:0 y:0 toX:x y:0 width:w height:h async:true.
   346         w := 0.
   336         w := 0.
   347     ] ifFalse:[
   337     ] ifFalse:[
   348         self copyFrom:self x:x y:0 toX:0 y:0 width:w height:h async:true.
   338         self copyFrom:self x:x y:0 toX:0 y:0 width:w height:h async:true.
   349     ].
   339     ].
   350     self redrawX:w y:0 width:x height:h.
       
   351     self waitForExpose.
   340     self waitForExpose.
       
   341     self invalidateX:w y:0 width:x height:h.
   352 
   342 
   353 
   343 
   354 !
   344 !
   355 
   345 
   356 columnsSizeChanged
   346 columnsSizeChanged
   371         ].
   361         ].
   372         height := height + self class verticalInset.
   362         height := height + self class verticalInset.
   373         self updateLayoutsHeight:height.
   363         self updateLayoutsHeight:height.
   374         self bottomInset:height negated.
   364         self bottomInset:height negated.
   375     ].
   365     ].
   376     self redraw.
   366     self invalidate.
   377 
   367 
   378 ! !
   368 ! !
   379 
   369 
   380 !DSVLabelView methodsFor:'private'!
   370 !DSVLabelView methodsFor:'private'!
   381 
   371 
   407 ! !
   397 ! !
   408 
   398 
   409 !DSVLabelView class methodsFor:'documentation'!
   399 !DSVLabelView class methodsFor:'documentation'!
   410 
   400 
   411 version
   401 version
   412     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.21 1999-03-19 21:22:34 cg Exp $'
   402     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.22 1999-06-11 17:22:04 cg Exp $'
   413 ! !
   403 ! !