forked from pharo-project/pharo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pharo-project#4971 from estebanlm/fasttable-not-ho…
…mogeneous-rows fasttable-not-homogeneous-rows
- Loading branch information
Showing
7 changed files
with
144 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Morphic-Widgets-FastTable/FTExampleMethodNotHomogeneousListDataSource.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Class { | ||
#name : #FTExampleMethodNotHomogeneousListDataSource, | ||
#superclass : #FTExampleMethodListDataSource, | ||
#category : #'Morphic-Widgets-FastTable-Examples' | ||
} | ||
|
||
{ #category : #accessing } | ||
FTExampleMethodNotHomogeneousListDataSource >> cellColumn: column row: rowIndex [ | ||
|
||
^ FTCellMorph new | ||
cellInset: 5; | ||
addMorphBack: (self iconFor: rowIndex) asMorph; | ||
addMorphBack: (Morph new | ||
changeTableLayout; | ||
hResizing: #shrinkWrap; | ||
listDirection: #topToBottom; | ||
color: Color transparent; | ||
addMorphBack: ((self elementAt: rowIndex) protocol asMorph emphasis: 2r10); | ||
addMorphBack: (self elementAt: rowIndex) name asMorph; | ||
yourself); | ||
yourself | ||
] | ||
|
||
{ #category : #accessing } | ||
FTExampleMethodNotHomogeneousListDataSource >> rowHeight: rowIndex [ | ||
|
||
^ 50 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Morphic-Widgets-FastTable/FTTableContainerRowNotHomogeneousMorph.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
" | ||
I contain table rows, but opposite to my parent, I calculate my row heights allowing users to display tables with rows of different height. | ||
" | ||
Class { | ||
#name : #FTTableContainerRowNotHomogeneousMorph, | ||
#superclass : #FTTableContainerMorph, | ||
#category : #'Morphic-Widgets-FastTable' | ||
} | ||
|
||
{ #category : #private } | ||
FTTableContainerRowNotHomogeneousMorph >> calculateExactVisibleRows [ | ||
"Answer the rows to show in list - with possible fraction" | ||
| rowIndex maxHeight height | | ||
|
||
self table hasDataSource ifFalse: [ | ||
^ super calculateExactVisibleRows ]. | ||
|
||
rowIndex := self table showIndex max: 1. | ||
height := 0. | ||
maxHeight := self height. | ||
headerRow ifNotNil: [ maxHeight := maxHeight - headerRow height ]. | ||
|
||
[ (height < maxHeight) and: [ rowIndex <= self table dataSource numberOfRows ] ] | ||
whileTrue: [ | ||
height := height + (self table dataSource rowHeight: rowIndex). | ||
rowIndex := rowIndex + 1 ]. | ||
|
||
^ rowIndex - self table showIndex | ||
] | ||
|
||
{ #category : #drawing } | ||
FTTableContainerRowNotHomogeneousMorph >> rowHeight: rowIndex default: aNumber [ | ||
|
||
^ self table dataSource rowHeight: rowIndex | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters