13 |
13 |
14 |
14 |
15 |
15 |
16 Object subclass:#DataSetColumn |
16 Object subclass:#DataSetColumn |
17 instanceVariableNames:'columnNumber dataSet minWidth width description buttonExtent |
17 instanceVariableNames:'columnNumber dataSet minWidth width description buttonExtent |
18 drawableAction rendererType backgroundColor foregroundColor |
18 drawableAction rendererType drawFormSelector backgroundColor |
19 fgSelector bgSelector columnAlignment label readSelector |
19 foregroundColor fgSelector bgSelector columnAlignment label |
20 columnAdaptor' |
20 readSelector columnAdaptor' |
21 classVariableNames:'' |
21 classVariableNames:'' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
23 category:'Views-DataSet' |
23 category:'Views-DataSet' |
24 ! |
24 ! |
25 |
25 |
209 |
209 |
210 ! ! |
210 ! ! |
211 |
211 |
212 !DataSetColumn methodsFor:'drawing'! |
212 !DataSetColumn methodsFor:'drawing'! |
213 |
213 |
214 drawCheckTogglesX:xTop y:yTop from:start to:stop with:fgColor and:bgColor |
214 drawCheckTogglesX:xTop y:yTop from:start to:stop |
215 "draw CheckToggles between start and stop |
215 "draw CheckToggles between start and stop |
216 " |
216 " |
217 |extent toggleForm |
217 |extent toggleForm |
218 toggleLevel "{ Class:SmallInteger }" |
218 toggleLevel "{ Class:SmallInteger }" |
219 toggleWidth "{ Class:SmallInteger }" |
219 toggleWidth "{ Class:SmallInteger }" |
236 |
236 |
237 start to:stop do:[:aRowNr| |
237 start to:stop do:[:aRowNr| |
238 dataSet drawEdgesAtX:x y:y width:toggleWidth height:toggleHeight level:toggleLevel. |
238 dataSet drawEdgesAtX:x y:y width:toggleWidth height:toggleHeight level:toggleLevel. |
239 |
239 |
240 (self extractColFromRow:(dataSet at:aRowNr)) ifTrue:[ |
240 (self extractColFromRow:(dataSet at:aRowNr)) ifTrue:[ |
241 (dataSet isRowSelected:aRowNr) ifFalse:[dataSet paint:fgColor on:bgColor] |
241 dataSet setFgBgPaintFor:aRowNr. |
242 ifTrue:[dataSet paint:(dataSet hgLgFgColor) on:(dataSet hgLgBgColor)]. |
|
243 |
|
244 dataSet displayImage:toggleForm x:(x + extent x) y:(y + extent y). |
242 dataSet displayImage:toggleForm x:(x + extent x) y:(y + extent y). |
245 ]. |
243 ]. |
246 y := y + height. |
244 y := y + height. |
247 ] |
245 ] |
248 |
246 |
249 ! |
247 ! |
250 |
248 |
251 drawComboButtonsX:xTop y:yTop from:start to:stop with:fgColor and:bgColor |
249 drawComboButtonsX:xTop y:yTop from:start to:stop |
252 "draw ComboButtons between start and stop |
250 "draw ComboButtons between start and stop |
253 " |
251 " |
254 |extent buttonForm |
252 |extent buttonForm |
255 buttonLevel "{ Class:SmallInteger }" |
253 buttonLevel "{ Class:SmallInteger }" |
256 buttonWidth "{ Class:SmallInteger }" |
254 buttonWidth "{ Class:SmallInteger }" |
270 x := xTop + (width - buttonWidth - 4). |
268 x := xTop + (width - buttonWidth - 4). |
271 |
269 |
272 start to:stop do:[:aRowNr| |
270 start to:stop do:[:aRowNr| |
273 (self hasChoices:aRowNr) ifTrue:[ |
271 (self hasChoices:aRowNr) ifTrue:[ |
274 dataSet drawEdgesAtX:x y:y width:buttonWidth height:buttonHeight level:buttonLevel. |
272 dataSet drawEdgesAtX:x y:y width:buttonWidth height:buttonHeight level:buttonLevel. |
275 |
273 dataSet setFgBgPaintFor:aRowNr. |
276 (dataSet isRowSelected:aRowNr) ifFalse:[dataSet paint:fgColor on:bgColor] |
|
277 ifTrue:[dataSet paint:(dataSet hgLgFgColor) |
|
278 on:(dataSet hgLgBgColor) |
|
279 ]. |
|
280 |
|
281 dataSet displayImage:buttonForm x:(x + extent x) y:(y + extent y) |
274 dataSet displayImage:buttonForm x:(x + extent x) y:(y + extent y) |
282 ]. |
275 ]. |
283 y := y + height. |
276 y := y + height. |
284 ] |
277 ] |
285 ! |
278 |
286 |
279 ! |
287 drawSeparatorsX:xTop y:yTop from:start to:stop with:fgColor |
280 |
|
281 drawSeparatorsX:xTop y:yTop from:start to:stop |
288 "redraw rows between start and stop |
282 "redraw rows between start and stop |
289 " |
283 " |
290 |lgCol showColSeparator showRowSeparator yBot |
284 |lgCol showColSeparator showRowSeparator yBot |
291 h "{ Class:SmallInteger }" |
285 h "{ Class:SmallInteger }" |
292 y "{ Class:SmallInteger }" |
286 y "{ Class:SmallInteger }" |
304 ^ self |
298 ^ self |
305 ] |
299 ] |
306 ]. |
300 ]. |
307 |
301 |
308 dataSet separatorSize == 1 ifTrue:[ |
302 dataSet separatorSize == 1 ifTrue:[ |
309 dataSet paint:fgColor. |
303 dataSet paint:(dataSet foregroundColor). |
310 |
304 |
311 showColSeparator ifTrue:[ |
305 showColSeparator ifTrue:[ |
312 dataSet displayLineFromX:x y:yTop toX:x y:yBot |
306 dataSet displayLineFromX:x y:yTop toX:x y:yBot |
313 ]. |
307 ]. |
314 showRowSeparator ifTrue:[ |
308 showRowSeparator ifTrue:[ |
357 " |
351 " |
358 minWidth := width := nil. |
352 minWidth := width := nil. |
359 |
353 |
360 ! |
354 ! |
361 |
355 |
362 redrawX:xTop y:yTop from:start to:stop with:fgColor and:bgColor |
356 redrawX:xTop y:yTop from:start to:stop |
363 "redraw rows between start and stop |
357 "redraw rows between start and stop |
364 " |
358 " |
365 |lgCol dkCol fg bg lblFg lblBg label row sel |
359 |lgCol dkCol fg bg lblFg lblBg label row sel |
366 h "{ Class:SmallInteger }" |
360 h "{ Class:SmallInteger }" |
367 y "{ Class:SmallInteger }" |
361 y "{ Class:SmallInteger }" |
371 inset "{ Class:SmallInteger }" |
365 inset "{ Class:SmallInteger }" |
372 | |
366 | |
373 h := dataSet rowHeight. |
367 h := dataSet rowHeight. |
374 |
368 |
375 (bg := backgroundColor) isNil ifTrue:[ |
369 (bg := backgroundColor) isNil ifTrue:[ |
376 bg := bgColor |
370 bg := dataSet backgroundColor |
377 ] ifFalse:[ |
371 ] ifFalse:[ |
378 dataSet paint:(dataSet colorOnDevice:bg). |
372 dataSet paint:(dataSet colorOnDevice:bg). |
379 dataSet fillRectangleX:xTop y:yTop width:width height:(h * (stop - start + 1) - 1) |
373 dataSet fillRectangleX:xTop y:yTop width:width height:(h * (stop - start + 1) - 1) |
380 ]. |
374 ]. |
381 fg := foregroundColor ? fgColor. |
375 |
|
376 (fg := foregroundColor) isNil ifTrue:[ |
|
377 fg := dataSet foregroundColor |
|
378 ]. |
382 lgCol := dataSet hgLgFgColor. |
379 lgCol := dataSet hgLgFgColor. |
383 dkCol := dataSet hgLgBgColor. |
380 dkCol := dataSet hgLgBgColor. |
384 space := dataSet horizontalSpacing. |
381 space := dataSet horizontalSpacing. |
385 inset := dataSet rowFontAscent. |
382 inset := dataSet rowFontAscent. |
386 y := yTop. |
383 y := yTop. |
443 ]. |
440 ]. |
444 y := y + h. |
441 y := y + h. |
445 ]. |
442 ]. |
446 |
443 |
447 "/ DRAW FORM |
444 "/ DRAW FORM |
448 rendererType == #CheckToggle ifTrue:[ |
445 drawFormSelector notNil ifTrue:[ |
449 self drawCheckTogglesX:xTop y:yTop from:start to:stop with:fgColor and:bgColor |
446 self perform:drawFormSelector with:xTop with:yTop with:start with:stop |
450 ] ifFalse:[ |
|
451 (rendererType == #ComboList or:[rendererType == #ComboBox]) ifTrue:[ |
|
452 self drawComboButtonsX:xTop y:yTop from:start to:stop with:fgColor and:bgColor |
|
453 ] |
|
454 ]. |
447 ]. |
455 |
448 |
456 "/ DRAW SEPARATORS |
449 "/ DRAW SEPARATORS |
457 self drawSeparatorsX:xTop y:yTop from:start to:stop with:fgColor |
450 self drawSeparatorsX:xTop y:yTop from:start to:stop |
458 ! ! |
451 ! ! |
459 |
452 |
460 !DataSetColumn methodsFor:'editing'! |
453 !DataSetColumn methodsFor:'editing'! |
461 |
454 |
462 editorAt:aRowNr |
455 editorAt:aRowNr |
516 on:aDSVColumnView description:aDescription columnNumber:aNumber |
509 on:aDSVColumnView description:aDescription columnNumber:aNumber |
517 "instance creation; set attributes dependent on the description |
510 "instance creation; set attributes dependent on the description |
518 " |
511 " |
519 |device selector format idx type oldFont newFont| |
512 |device selector format idx type oldFont newFont| |
520 |
513 |
521 columnNumber := aNumber. |
514 columnNumber := aNumber. |
522 dataSet := aDSVColumnView. |
515 dataSet := aDSVColumnView. |
523 description := aDescription. |
516 description := aDescription. |
524 rendererType := description rendererType. |
517 rendererType := description rendererType. |
525 width := nil. |
518 width := nil. |
526 device := dataSet device. |
519 device := dataSet device. |
527 drawableAction := [:aRow| nil ]. |
520 drawableAction := [:aRow| nil ]. |
528 fgSelector := description foregroundSelector. |
521 fgSelector := description foregroundSelector. |
529 bgSelector := description backgroundSelector. |
522 bgSelector := description backgroundSelector. |
530 backgroundColor := description backgroundColor. |
523 backgroundColor := description backgroundColor. |
531 foregroundColor := description foregroundColor. |
524 foregroundColor := description foregroundColor. |
532 readSelector := description readSelector. |
525 readSelector := description readSelector. |
533 columnAdaptor := dataSet columnAdaptor. |
526 columnAdaptor := dataSet columnAdaptor. |
534 buttonExtent := 0 @ 0. |
527 buttonExtent := 0 @ 0. |
535 columnAlignment := #left. |
528 columnAlignment := #left. |
|
529 drawFormSelector := nil. |
536 |
530 |
537 backgroundColor notNil ifTrue:[ |
531 backgroundColor notNil ifTrue:[ |
538 backgroundColor := backgroundColor on:dataSet device |
532 backgroundColor := backgroundColor on:dataSet device |
539 ]. |
533 ]. |
540 foregroundColor notNil ifTrue:[ |
534 foregroundColor notNil ifTrue:[ |
561 oldFont notNil ifTrue:[ |
555 oldFont notNil ifTrue:[ |
562 dataSet font:oldFont |
556 dataSet font:oldFont |
563 ]. |
557 ]. |
564 |
558 |
565 rendererType == #CheckToggle ifTrue:[ |
559 rendererType == #CheckToggle ifTrue:[ |
566 buttonExtent := dataSet checkToggleExtent. |
560 buttonExtent := dataSet checkToggleExtent. |
|
561 drawFormSelector := #drawCheckTogglesX:y:from:to:. |
567 ^ self |
562 ^ self |
568 ]. |
563 ]. |
569 |
564 |
570 rendererType == #rowSelector ifTrue:[ |
565 rendererType == #rowSelector ifTrue:[ |
571 buttonExtent := dataSet rowSelectorExtent. |
566 buttonExtent := dataSet rowSelectorExtent. |
572 ^ self |
567 ^ self |
573 ]. |
568 ]. |
574 |
569 |
575 (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
570 (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
576 buttonExtent := dataSet comboButtonExtent. |
571 buttonExtent := dataSet comboButtonExtent. |
|
572 drawFormSelector := #drawComboButtonsX:y:from:to:. |
577 ] ifFalse:[ |
573 ] ifFalse:[ |
578 columnAlignment := description columnAlignment |
574 columnAlignment := description columnAlignment |
579 ]. |
575 ]. |
580 |
576 |
581 selector := description printSelector. |
577 selector := description printSelector. |
714 "returns true if text might exist |
710 "returns true if text might exist |
715 " |
711 " |
716 ^ (rendererType ~~ #rowSelector and:[rendererType ~~ #CheckToggle]) |
712 ^ (rendererType ~~ #rowSelector and:[rendererType ~~ #CheckToggle]) |
717 ! |
713 ! |
718 |
714 |
719 drawableForm |
|
720 rendererType == #CheckToggle ifTrue:[ |
|
721 ^ dataSet checkToggleForm. |
|
722 ]. |
|
723 (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
724 ^ dataSet comboButtonForm |
|
725 ]. |
|
726 rendererType == #rowSelector ifTrue:[ |
|
727 ^ dataSet rowSelectorForm |
|
728 ]. |
|
729 ^ nil |
|
730 |
|
731 |
|
732 ! |
|
733 |
|
734 hasChoices:aRowNr |
715 hasChoices:aRowNr |
735 ^ (description choicesFor:(dataSet at:aRowNr)) notNil |
716 ^ (description choicesFor:(dataSet at:aRowNr)) notNil |
736 ! |
717 ! |
737 |
718 |
738 heightOfHighestRow |
719 heightOfHighestRow |