16 "{ Package: 'stx:libwidg2' }" |
16 "{ Package: 'stx:libwidg2' }" |
17 |
17 |
18 View subclass:#DSVColumnView |
18 View subclass:#DSVColumnView |
19 instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
19 instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
20 selectedColIndex selectedRowIndex selectRowOnDefault |
20 selectedColIndex selectedRowIndex selectRowOnDefault |
21 buttonMotionAction buttonReleaseAction rowHeight |
21 buttonMotionAction buttonReleaseAction rowHeight minRowHeight |
22 columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
22 columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
23 rowIfAbsentBlock columnHolder registererImages list fgColor |
23 rowIfAbsentBlock columnHolder registererImages list fgColor |
24 separatorSize catchChangeEvents beDependentOfRows bgColor |
24 separatorSize catchChangeEvents beDependentOfRows bgColor |
25 actionBlock builder tabIntern doubleClickActionBlock |
25 actionBlock builder tabIntern doubleClickActionBlock |
26 verticalSpacing horizontalSpacing rowSelectorForm |
26 verticalSpacing horizontalSpacing rowSelectorForm |
36 DefaultHilightForegroundColor DefaultHilightBackgroundColor |
36 DefaultHilightForegroundColor DefaultHilightBackgroundColor |
37 ButtonLightColor ButtonShadowColor CheckToggleActiveImage |
37 ButtonLightColor ButtonShadowColor CheckToggleActiveImage |
38 CheckTogglePassiveImage ButtonHalfLightColor |
38 CheckTogglePassiveImage ButtonHalfLightColor |
39 ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm |
39 ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm |
40 CheckToggleLevel CheckToggleExtent ComboButtonForm |
40 CheckToggleLevel CheckToggleExtent ComboButtonForm |
41 ComboButtonLevel ComboButtonExtent' |
41 ComboButtonLevel ComboButtonExtent StopRedrawSignal' |
42 poolDictionaries:'' |
42 poolDictionaries:'' |
43 category:'Views-DataSet' |
43 category:'Views-DataSet' |
44 ! |
44 ! |
45 |
45 |
46 !DSVColumnView class methodsFor:'documentation'! |
46 !DSVColumnView class methodsFor:'documentation'! |
79 |
79 |
80 selectedColIndex <Integer> selected column index or 0 |
80 selectedColIndex <Integer> selected column index or 0 |
81 selectedRowIndex <Integer> selected row index or 0 |
81 selectedRowIndex <Integer> selected row index or 0 |
82 |
82 |
83 rowHeight <Integer> maximum height of any row |
83 rowHeight <Integer> maximum height of any row |
|
84 minRowHeight <Integer> minimum height of all displayed labels |
84 |
85 |
85 columnDescriptors <SequancableCollection> list of column descriptors |
86 columnDescriptors <SequancableCollection> list of column descriptors |
86 |
87 |
87 viewOrigin <Point> current view origin |
88 viewOrigin <Point> current view origin |
88 |
89 |
285 <resource: #image> |
286 <resource: #image> |
286 |
287 |
287 ^Icon |
288 ^Icon |
288 constantNamed:#'DSVColumnView dragIconSingle' |
289 constantNamed:#'DSVColumnView dragIconSingle' |
289 ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
290 ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
291 ! ! |
|
292 |
|
293 !DSVColumnView class methodsFor:'signal constants'! |
|
294 |
|
295 stopRedrawSignal |
|
296 "returns the signal which is raised during drawing if the |
|
297 required label height is less than the current rowHeight |
|
298 " |
|
299 StopRedrawSignal isNil ifTrue:[ |
|
300 StopRedrawSignal := Notification newSignalMayProceed:true. |
|
301 StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
|
302 ]. |
|
303 ^ StopRedrawSignal |
290 ! ! |
304 ! ! |
291 |
305 |
292 !DSVColumnView methodsFor:'accessing'! |
306 !DSVColumnView methodsFor:'accessing'! |
293 |
307 |
294 builder |
308 builder |
1718 ! |
1732 ! |
1719 |
1733 |
1720 redrawX:x y:y width:w height:h |
1734 redrawX:x y:y width:w height:h |
1721 "redraw part of myself immediately, given logical coordinates |
1735 "redraw part of myself immediately, given logical coordinates |
1722 " |
1736 " |
1723 |c0 savClip |
1737 |c0 savClip stopRedraw |
1724 start "{ Class:SmallInteger }" |
1738 start "{ Class:SmallInteger }" |
1725 stop "{ Class:SmallInteger }" |
1739 stop "{ Class:SmallInteger }" |
1726 x0 "{ Class:SmallInteger }" |
1740 x0 "{ Class:SmallInteger }" |
1727 x1 "{ Class:SmallInteger }" |
1741 x1 "{ Class:SmallInteger }" |
1728 maxX "{ Class:SmallInteger }" |
1742 maxX "{ Class:SmallInteger }" |
1753 x0 := margin - viewOrigin x. |
1767 x0 := margin - viewOrigin x. |
1754 yTop := yTop + ((start - 1) * rowHeight). |
1768 yTop := yTop + ((start - 1) * rowHeight). |
1755 clHg := (stop - start + 1) * rowHeight. |
1769 clHg := (stop - start + 1) * rowHeight. |
1756 yBot := yTop + clHg. |
1770 yBot := yTop + clHg. |
1757 |
1771 |
1758 columnDescriptors do:[:aCol| |cw| |
1772 stopRedraw := false. |
1759 x1 := x0 + aCol width. |
1773 |
1760 |
1774 self class stopRedrawSignal handle:[:ex| |
1761 (x1 > x and:[x0 < maxX]) ifTrue:[ |
1775 stopRedraw := true. |
1762 |left right rect| |
1776 ] do:[ |
1763 left := x0 max:x. |
1777 columnDescriptors do:[:aCol| |cw| |
1764 right := x1 min:maxX. |
1778 x1 := x0 + aCol width. |
1765 rect := Rectangle left:left top:y width:(right - left) height:h. |
1779 |
1766 |
1780 (x1 > x and:[x0 < maxX]) ifTrue:[ |
1767 clipRect := nil. |
1781 |left right rect| |
1768 self clippingRectangle:rect. |
1782 left := x0 max:x. |
1769 aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
1783 right := x1 min:maxX. |
1770 ]. |
1784 rect := Rectangle left:left top:y width:(right - left) height:h. |
1771 x0 := x1 |
1785 |
|
1786 clipRect := nil. |
|
1787 self clippingRectangle:rect. |
|
1788 aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
|
1789 ]. |
|
1790 x0 := x1 |
|
1791 ]. |
1772 ]. |
1792 ]. |
1773 |
1793 |
1774 "/ restore old clipping rectangle |
1794 "/ restore old clipping rectangle |
1775 self clippingRectangle:savClip. |
1795 self clippingRectangle:savClip. |
|
1796 |
|
1797 stopRedraw ifTrue:[ |
|
1798 self invalidate. |
|
1799 self makeSelectionVisible. |
|
1800 ^ self |
|
1801 ]. |
1776 |
1802 |
1777 stop == size ifTrue:[ |
1803 stop == size ifTrue:[ |
1778 yTop := y + h. |
1804 yTop := y + h. |
1779 yBot < (yTop - margin) ifTrue:[ |
1805 yBot < (yTop - margin) ifTrue:[ |
1780 "/ clear to bottom of screen |
1806 "/ clear to bottom of screen |
1804 ]. |
1830 ]. |
1805 ]. |
1831 ]. |
1806 ! ! |
1832 ! ! |
1807 |
1833 |
1808 !DSVColumnView methodsFor:'drawing interactors'! |
1834 !DSVColumnView methodsFor:'drawing interactors'! |
|
1835 |
|
1836 displayLabel:aLabel x:xLeft y:yTop |
|
1837 "display the label at x y; test whether the height of the label matches to the current |
|
1838 rowHeight. If not, an exception is raised and the rowHeight is recomputed |
|
1839 " |
|
1840 |y h | |
|
1841 |
|
1842 aLabel notNil ifTrue:[ |
|
1843 y := yTop. |
|
1844 |
|
1845 aLabel isString ifTrue:[ |
|
1846 y := y + (aLabel ascentOn:self). |
|
1847 ] ifFalse:[ |
|
1848 h := aLabel heightOn:self. |
|
1849 |
|
1850 h > minRowHeight ifTrue:[ |
|
1851 minRowHeight := h. |
|
1852 |
|
1853 preferredExtent notNil ifTrue:[ |
|
1854 rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
|
1855 preferredExtent := preferredExtent copy. |
|
1856 preferredExtent y: (list size * rowHeight). |
|
1857 self contentsChanged. |
|
1858 ]. |
|
1859 self class stopRedrawSignal raiseRequest. |
|
1860 ]. |
|
1861 y := y + self rowFontAscent. |
|
1862 ]. |
|
1863 aLabel displayOn:self x:xLeft y:y. |
|
1864 ]. |
|
1865 ! |
1809 |
1866 |
1810 drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1867 drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1811 "draw a check toggle button |
1868 "draw a check toggle button |
1812 " |
1869 " |
1813 |e form |
1870 |e form |
2592 tabIntern := true. |
2649 tabIntern := true. |
2593 useIndex := true. |
2650 useIndex := true. |
2594 viewOrigin := 0@0. |
2651 viewOrigin := 0@0. |
2595 font := font onDevice:device. |
2652 font := font onDevice:device. |
2596 rowHeight := font height. |
2653 rowHeight := font height. |
|
2654 minRowHeight := rowHeight. |
2597 multipleSelectOk := false. "/ multiselect disabled |
2655 multipleSelectOk := false. "/ multiselect disabled |
2598 selectedRowIndex := selectedColIndex := 0. "/ no selection |
2656 selectedRowIndex := selectedColIndex := 0. "/ no selection |
2599 registererImages := Dictionary new. |
2657 registererImages := Dictionary new. |
2600 columnDescriptors := #(). |
2658 columnDescriptors := #(). |
2601 beDependentOfRows := false. |
2659 beDependentOfRows := false. |
2976 ! |
3034 ! |
2977 |
3035 |
2978 preferredExtent |
3036 preferredExtent |
2979 "recompute preferred extent; raise notification |
3037 "recompute preferred extent; raise notification |
2980 " |
3038 " |
2981 |x "{ Class:SmallInteger }" |
3039 |x| |
2982 h "{ Class:SmallInteger }" |
|
2983 | |
|
2984 |
3040 |
2985 preferredExtent notNil ifTrue:[ |
3041 preferredExtent notNil ifTrue:[ |
2986 ^ preferredExtent |
3042 ^ preferredExtent |
2987 ]. |
3043 ]. |
2988 x := 3. |
3044 x := 3. |
2989 h := 0. |
|
2990 |
3045 |
2991 columnDescriptors do:[:aCol| |
3046 columnDescriptors do:[:aCol| |
2992 h := (aCol heightOfHighestRow) max:h. |
3047 minRowHeight := (aCol heightOfHighestRow) max:minRowHeight. |
2993 x := x + (aCol minWidth). |
3048 x := x + (aCol minWidth). |
2994 ]. |
3049 ]. |
2995 h == 0 ifTrue:[h := font height]. |
3050 rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
2996 rowHeight := (h + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
|
2997 preferredExtent := x @ (list size * rowHeight). |
3051 preferredExtent := x @ (list size * rowHeight). |
2998 rowFontAscent := font ascent. |
3052 rowFontAscent := font ascent. |
2999 |
3053 |
3000 ^ preferredExtent |
3054 ^ preferredExtent |
3001 |
|
3002 |
|
3003 ! |
3055 ! |
3004 |
3056 |
3005 preferredExtentChanged |
3057 preferredExtentChanged |
3006 "called if the preffered extent changed |
3058 "called if the preffered extent changed |
3007 " |
3059 " |