Hi,
VWNC 7.6 is nice but cincom seems to forgotten to do something about the boring labels of the DSV. ;-) Enclosed you find a package which solves that for ordinary labels. I' ve been using this hack for some time now and it seems to works for both 7.5 and 7.6. Rgrds, @+Maarten, <?xml version="1.0"?> <st-source> <time-stamp>From VisualWorks® NonCommercial, 7.6 of lundi 3 mars 2008 on vendredi 2 mai 2008 at 2:36:15</time-stamp> <!-- Package DataSetViewLabel* --> <component-property> <name>DataSetViewLabel</name> <type>package</type> <property>comment</property> <value>'This package modifies and overwrites some methods in DataSetView in order to display a more windows type label. Basically it draws some gray lines at the bottom of the labels and modifies the color for the first horizontal grid line. It works correctly for 7.5 and 7.6. Maarten MOSTERT '</value> </component-property> <methods> <class-id>UI.DataSetView</class-id> <category>displaying</category> <body package="DataSetViewLabel" selector="displayHeaderBackGroundOn:">displayHeaderBackGroundOn: aGraphicsContext | rightEdge columnStarts oldPaint | columnStarts := starts. oldPaint := aGraphicsContext paint. aGraphicsContext paint: SymbolicPaint background asColorValue. rightEdge := columnStarts at: columnStarts size. aGraphicsContext displayRectangle: (0 @ 0 corner: rightEdge @ self topOffsetForDisplay - 3). aGraphicsContext paint: (ColorValue red: 0.88 green: 0.87 blue: 0.80). aGraphicsContext displayLineFrom: 0 @ (self topOffsetForDisplay - 3) to: rightEdge @ (self topOffsetForDisplay - 3). aGraphicsContext paint: (ColorValue red: 0.83 green: 0.82 blue: 0.75). aGraphicsContext displayLineFrom: 0 @ (self topOffsetForDisplay - 2) to: rightEdge @ (self topOffsetForDisplay - 2). aGraphicsContext paint: oldPaint</body> <body package="DataSetViewLabel" selector="displayOn:">displayOn: aGraphicsContext "Display the receiver's content on aGraphicsContext. ADDED MODIFIED AS INDCATED" | graphicsContext visualOfLabels labelsBounds frozenColumnCount | self displayBackgroundIfNeededOn: aGraphicsContext in: super bounds. self setForegroundPaintOn: aGraphicsContext. visualOfLabels := self labelsAsButtons ifTrue: [self labelsAsButtonsVisual] ifFalse: [self labelsVisual]. visualOfLabels view: self. graphicsContext := aGraphicsContext copy. graphicsContext intersectClip: (self tableProperBounds translatedBy: self bounds origin). labelsBounds := self bounds. labelsBounds left: self leftOffsetForDisplay. labelsBounds bottom: self labelBoundsBottom. visualOfLabels bounds: labelsBounds. frozenColumnCount := self numFrozen. frozenColumnCount > 0 ifTrue: [visualOfLabels frozen: frozenColumnCount. visualOfLabels frozenTranslation: self bounds left]. self displayHeaderBackGroundOn: graphicsContext. "ADDED MODIFIED THIS LINE" visualOfLabels displayOn: graphicsContext. graphicsContext := aGraphicsContext copy. graphicsContext intersectClip: (self cellAreaBoundsForDisplay translatedBy: self bounds origin). self displayVisualsOn: graphicsContext. self displayGridLinesOn: aGraphicsContext. self displayHeaderGridLineOverDrawOn: aGraphicsContext. "ADDED MODIFIED THIS LINE" editorWrapper notNil ifTrue: [| box frozenColumnEdge | box := self cellAreaBounds. self editCell x > self numFrozen ifTrue: [frozenColumnEdge := self frozenEdge. frozenColumnEdge > 0 ifTrue: [box left: frozenColumnEdge]] ifFalse: [editorWrapper bounds: ((self boundsOfCellIndex: self editCell inBounds: self bounds) insetBy: (0 @ 0 corner: 1 @ 1))]. box := box translatedBy: self bounds origin. (editorWrapper bounds intersects: box) ifTrue: [aGraphicsContext intersectClip: box. editorWrapper displayOn: aGraphicsContext]] </body> <body package="DataSetViewLabel" selector="displayGridLinesOn:">displayGridLinesOn: aGraphicsContext | box clippingBox lineGrid left rightEdge top bottom columnStarts frozenEdgeOffset range oldPaint | columnStarts := starts. lineGrid := self lineGrid. clippingBox := aGraphicsContext clippingBounds. box := super bounds. bottom := self bottom. left := box left. oldPaint := aGraphicsContext paint. aGraphicsContext paint: self gridLineColor. self showHorizontalLines ifTrue: [rightEdge := columnStarts at: columnStarts size. top := box top + self topOffsetForDisplay - 1. [top < bottom] whileTrue: [aGraphicsContext displayRectangle: (left @ top corner: rightEdge @ (top + 1)). top := top + lineGrid]]. self showVerticalLines ifTrue: [top := box top. range := self visibleXIndexRangeFor: self bounds. range first > 0 ifTrue: [range first to: self numFrozen + 1 do: [:index | | columnRight | columnRight := columnStarts at: index. columnRight > clippingBox right ifTrue: [^self]. columnRight := columnRight + left. columnRight >= clippingBox left ifTrue: [aGraphicsContext displayLineFrom: columnRight - 1 @ top to: columnRight - 1 @ (bottom - 1)]]]. frozenEdgeOffset := self frozenEdge + left. self numFrozen + 2 to: range last + 1 do: [:index | | columnRight | columnRight := columnStarts at: index. columnRight > clippingBox right ifTrue: [^self]. (columnRight >= clippingBox left and: [columnRight >= frozenEdgeOffset]) ifTrue: [aGraphicsContext displayLineFrom: columnRight - 1 @ top to: columnRight - 1 @ (bottom - 1)]]]. aGraphicsContext paint: oldPaint</body> <body package="DataSetViewLabel" selector="displayHeaderGridLineOverDrawOn:">displayHeaderGridLineOverDrawOn: aGraphicsContext "This method will draw the last line of the header decoration over the top gridline This to avoid modifiying displayGridLinesOn: " | rightEdge columnStarts oldPaint | columnStarts := starts. oldPaint := aGraphicsContext paint. rightEdge := columnStarts at: columnStarts size. aGraphicsContext paint: (ColorValue red: 0.79 green: 0.78 blue: 0.71). aGraphicsContext displayLineFrom: 0 @ (self topOffsetForDisplay - 1) to: rightEdge @ (self topOffsetForDisplay - 1). aGraphicsContext paint: oldPaint</body> </methods> <methods> <class-id>UI.DataSetView</class-id> <category>accessing</category> <body package="DataSetViewLabel" selector="gridLineColor">gridLineColor ^gridLineColor isNil ifTrue: [ColorValue lightGray] ifFalse: [gridLineColor]</body> <body package="DataSetViewLabel" selector="topOffset:">topOffset: anObject ^topOffset := anObject</body> <body package="DataSetViewLabel" selector="topOffset">topOffset ^topOffset</body> </methods> </st-source> _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |