DSVColumnView.st
changeset 1087 8e97cbfebe12
parent 1067 c66188014600
child 1089 931865a72ba7
--- a/DSVColumnView.st	Sun Aug 23 14:33:52 1998 +0200
+++ b/DSVColumnView.st	Sun Aug 23 15:14:03 1998 +0200
@@ -16,15 +16,16 @@
 View subclass:#DSVColumnView
 	instanceVariableNames:'editValue editView multipleSelectOk selectedColIndex
 		selectedRowIndex rowHeight columnDescriptors viewOrigin colorMap
-		lockRowIndex rowIfAbsentBlock columnHolder registererImages list
-		fgColor canFit separatorSize catchChangeEvents beDependentOfRows
-		bgColor hgLgFgColor hgLgBgColor actionBlock builder
-		doubleClickActionBlock verticalSpacing horizontalSpacing
-		rowSelectorForm buttonLightColor buttonShadowColor
-		buttonHalfLightColor buttonHalfShadowColor checkToggleExtent
-		checkToggleForm checkToggleLevel comboButtonExtent
-		comboButtonForm comboButtonLevel clickPosition dragAccessPoint
-		dragIsActive dropTarget dropSource columnAdaptor dataSetView'
+		rowFontAscent lockRowIndex rowIfAbsentBlock columnHolder
+		registererImages list fgColor canFit separatorSize
+		catchChangeEvents beDependentOfRows bgColor hgLgFgColor
+		hgLgBgColor actionBlock builder doubleClickActionBlock
+		verticalSpacing horizontalSpacing rowSelectorForm
+		buttonLightColor buttonShadowColor buttonHalfLightColor
+		buttonHalfShadowColor checkToggleExtent checkToggleForm
+		checkToggleLevel comboButtonExtent comboButtonForm
+		comboButtonLevel clickPosition dragAccessPoint dragIsActive
+		dropTarget dropSource columnAdaptor dataSetView'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
 		RowSelector ButtonLightColor ButtonShadowColor
@@ -58,22 +59,90 @@
 
     [Instance variables:]
 
+        dataSetView             <DataSetView>           parent view
+
         editValue               <Model>                 current editing model
         editView                <View>                  current editing component
+
+        multipleSelectOk        <Boolean>               multiple selection enabled/disabled
+
         selectedColIndex        <Integer>               selected column index or 0
-        selectedRowIndex        <Integer>               selected row index or 0
+        selectedRowIndex        <Integer>               selected row    index or 0
+
         rowHeight               <Integer>               maximum height of any row
+
         columnDescriptors       <SequancableCollection> list of column descriptors
+
+        viewOrigin              <Point>                 current view origin
+
+        colorMap                <Dictionary>            store and register used colors on device
+
+        rowFontAscent           <SmallInteger>          inset of a printable text in a row
+                                                        including separator and font ascent.
+
+        lockRowIndex            <SmallInteger>          internal used to indicate a row which has
+                                                        changed its contents but no redraw should be
+                                                        done( at:put: ).
+
+        columnHolder            <ValueHolder>           holder which keeps the list of column descriptors.
+
+        registererImages        <IdentityDictionary>    list of images registered on the device
+
         list                    <SequancableCollection> list of rows
-        fgColor                 <Color>                 foreground color
-        registererImages        <IdentityDictionary>    list of images registered on the device
-        beDependentOfRows       <Coolean>               keep rows dependent; on default is disabled.
+
+        canFit                  <Boolean>               boolean set to true if colums can be fit to view
+
+
+        catchChangeEvents       <Boolean>               internal used to discard change notifications
+
+        beDependentOfRows       <Boolean>               keep rows dependent; on default is disabled.
                                                         in case of enabled a row can raise a change
                                                         notification whithout a parameter which
                                                         will force a redraw of the row or the
                                                         readSelector of the column which will
                                                         redraw the cell in the row only.
 
+        fgColor                 <Color>                 foreground color
+        bgColor                 <Color>                 background color
+        hgLgFgColor             <Color>                 highlight foreground color (selected)
+        hgLgBgColor             <Color>                 highlight background color (selected)
+
+        buttonLightColor        <Color>                 LightColor      ( drawing the edge of a button )
+        buttonShadowColor       <Color>                 ShadowColor     ( drawing the edge of a button )
+        buttonHalfLightColor    <Color>                 HalfLightColor  ( drawing the edge of a button )
+        buttonHalfShadowColor   <Color>                 HalfShadowColor ( drawing the edge of a button )
+
+        actionBlock             <a OneArgBlock>         action block performed on select
+        doubleClickActionBlock  <a OneArgBlock>         action block performed on double click
+        rowIfAbsentBlock        <a OneArgBlock>         this block is performed on an emty list entry
+                                                        to retrive the item from the application. The
+                                                        argument to the block is the index into the list.
+                                                        The block should return the row instance which
+                                                        is put to the list under the index.
+
+        builder                 <UIBuilder>             builder set by application
+
+        verticalSpacing         <SmallInteger>          vertical   row spacing( top  & bottom )
+        horizontalSpacing       <SmallInteger>          horizontal row spacing( left & right )
+        separatorSize           <SmallInteger>          line width of a vertical or horizontal separator
+
+        rowSelectorForm         <Form>                  form used by a row selector
+
+        checkToggleForm         <Form>                  form used by a checkToggle
+        checkToggleExtent       <Point>                 extent of a checkToggle
+        checkToggleLevel        <SmallInteger>          level used to draw a check toggle
+
+        comboButtonForm         <Form>                  form used by a comboList or -Box
+        comboButtonExtent       <Point>                 extent of a comboList or -Box
+        comboButtonLevel        <SmallInteger>          level used to draw a comboList or -Box
+
+        clickPosition           <Point>                 click position of the mouse
+
+        dragAccessPoint         <Point>                 point where the drag operation starts
+        dragIsActive            <Boolean>               true if a drag operation is active
+        dropTarget              <DropTarget>            drag & drop target
+        dropSource              <DropSource>            drag & drop source
+
     [author:]
         Claus Atzkern
 
@@ -108,6 +177,8 @@
 !DSVColumnView class methodsFor:'defaults'!
 
 horizontalSpacing
+    "returns the default horizontal space between rows
+    "
     ^ 4
 
 !
@@ -142,6 +213,8 @@
 !
 
 verticalSpacing
+    "returns the default vertical space between rows
+    "
     ^ 2
 
 ! !
@@ -187,14 +260,20 @@
 !DSVColumnView methodsFor:'accessing'!
 
 builder
+    "get the builder (UIBuilder or nil)
+    "
     ^ builder
 !
 
 builder:aBuilder
+    "set the builder (UIBuilder or nil)
+    "
     builder := aBuilder
 !
 
 columnView
+    "returns self
+    "
     ^ self
 !
 
@@ -212,6 +291,12 @@
     dataSetView := something.
 
     "Created: / 7.8.1998 / 22:13:43 / cg"
+!
+
+rowFontAscent
+    "returns the inset of a printable text in a row
+    "
+    ^ rowFontAscent
 ! !
 
 !DSVColumnView methodsFor:'accessing actions'!
@@ -432,26 +517,38 @@
 !DSVColumnView methodsFor:'accessing interactors'!
 
 checkToggleExtent
+    "returns the extent of a checkToggle
+    "
     ^ checkToggleExtent
 !
 
 checkToggleForm
+    "returns the form of a checkToggle
+    "
     ^ checkToggleForm
 !
 
 checkToggleLevel
+    "returns the level of a checkToggle button
+    "
     ^ checkToggleLevel
 !
 
 comboButtonExtent
+    "returns the extent of a comboList or -Box
+    "
     ^ comboButtonExtent
 !
 
 comboButtonForm
+    "returns the form of a comboList or -Box
+    "
     ^ comboButtonForm
 !
 
 comboButtonLevel
+    "returns the level of a comboList or -Box button
+    "
     ^ comboButtonLevel
 !
 
@@ -464,9 +561,6 @@
 rowSelectorForm
     "returns the bitmap of a selected row
     "
-    rowSelectorForm isNil ifTrue:[      
-        rowSelectorForm := (self class rowSelector) on:device
-    ].
     ^ rowSelectorForm
 ! !
 
@@ -483,11 +577,15 @@
     columnAdaptor := something.!
 
 columnHolder
+    "get the valueHolder, which keeps the list of column descriptions
+    "
     ^ columnHolder
 
 !
 
 columnHolder:aValueHolder
+    "set the valueHolder, which keeps the list of column descriptions
+    "
     |columns|
 
     columnHolder notNil ifTrue:[
@@ -1213,8 +1311,6 @@
      maxX  "{ Class:SmallInteger }"
      minX  "{ Class:SmallInteger }"
      yTop  "{ Class:SmallInteger }"
-     yBot  "{ Class:SmallInteger }"
-     times "{ Class:SmallInteger }"
      yMax  "{ Class:SmallInteger }"
     |
 
@@ -1229,13 +1325,12 @@
         start := (c0 // rowHeight) + 1.
         stop  := (c0 + h - 1 // rowHeight + 1) min:(list size).
 
-        (times := stop - start + 1) > 0 ifTrue:[
+        stop >= start ifTrue:[
             savClip := clipRect.
 
             maxX := (x + w) min:(width - margin).
             x0   := margin - viewOrigin x.
             yTop := yTop + ((start - 1) * rowHeight).
-            yBot := yTop + (times * rowHeight).
             yMax := height - margin - margin.
             minX := x max:margin.
 
@@ -1246,7 +1341,7 @@
                     rW := (x1 min:maxX) - x.
 
                     self clippingRectangle:(Rectangle left:x top:y width:rW height:h).
-                    aCol drawFrom:start times:times x0:x0 yTop:yTop yBot:yBot with:fgColor and:bgColor.
+                    aCol redrawX:x0 y:yTop from:start to:stop with:fgColor and:bgColor.
                 ].
                 x0 := x1
             ].
@@ -1745,6 +1840,7 @@
             buttonHalfShadowColor := buttonShadowColor lightened
         ]
     ].
+    rowSelectorForm := (self class rowSelector) on:device.
 
     v := ComboBoxView new.
     b := v menuButton.
@@ -1796,7 +1892,7 @@
     colorMap          := Dictionary new.
     catchChangeEvents := false.
     dragIsActive      := false.
-
+    rowFontAscent     := 0.             "/ dummy initialization
     self lineWidth:0.
 !
 
@@ -1841,6 +1937,8 @@
 !DSVColumnView methodsFor:'private'!
 
 detectViewAt:aPoint in:aView
+    "returns the view at a point
+    "
     |p|
 
     (aView notNil and:[aView subViews notNil]) ifTrue:[
@@ -2071,8 +2169,7 @@
     rowHeight := (rowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
     preferredExtent := (x + margin + margin) @ (self size * rowHeight).
 
-    x := (rowHeight - separatorSize - font height) // 2 + font ascent.
-    self columnsDo:[:aCol|aCol textInsetChanged:x].
+    rowFontAscent := (rowHeight - separatorSize - font height) // 2 + font ascent.
     self changed:#columnsLayout.
   ^ preferredExtent
 
@@ -2080,6 +2177,8 @@
 !
 
 preferredExtentChanged
+    "called if the preffered extent changed
+    "
     |y x|
 
     y := viewOrigin y.
@@ -2094,7 +2193,8 @@
 !
 
 recomputeHeightOfContents
-
+    "recompute height of contents( scrolling )
+    "
     preferredExtent notNil ifTrue:[
         preferredExtent y:(rowHeight * self size)
     ] ifFalse:[
@@ -2671,5 +2771,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.48 1998-08-08 11:49:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.49 1998-08-23 13:14:03 ca Exp $'
 ! !