MCPcopy Create free account
hub / github.com/SpartanJ/eepp / drawChildren

Method drawChildren

src/eepp/ui/uitableview.cpp:30–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void UITableView::drawChildren() {
31 int realRowIndex = 0;
32 int realColIndex = 0;
33 ConditionalLock l( getModel() != nullptr, getModel() ? &getModel()->resourceMutex() : nullptr );
34 buildRowHeader();
35 if ( getModel() ) {
36 Float rowHeight = getRowHeight();
37 size_t start = mScrollOffset.y / rowHeight;
38 size_t end = eemin<size_t>(
39 (size_t)eeceil( ( mScrollOffset.y + mSize.getHeight() ) / rowHeight ), getItemCount() );
40 Float yOffset = 0;
41 Float xOffset;
42 auto colCount = getModel()->columnCount();
43 auto headerHeight = getHeaderHeight();
44 for ( size_t i = start; i < end; i++ ) {
45 xOffset = 0;
46 yOffset = headerHeight + i * rowHeight;
47 ModelIndex rowIndex( getModel()->index( i ) );
48 if ( yOffset - mScrollOffset.y > mSize.getHeight() )
49 break;
50 if ( yOffset - mScrollOffset.y + rowHeight < 0 )
51 continue;
52 UITableRow* rowNode = updateRow( realRowIndex, rowIndex, yOffset );
53 rowNode->setChildrenVisibility( false, false );
54 realColIndex = 0;
55 for ( size_t colIndex = 0; colIndex < colCount; colIndex++ ) {
56 auto& colData = columnData( colIndex );
57 if ( !colData.visible || ( xOffset + colData.width ) - mScrollOffset.x < 0 ) {
58 if ( colData.visible )
59 xOffset += colData.width;
60 continue;
61 }
62 if ( xOffset - mScrollOffset.x > mSize.getWidth() )
63 break;
64 xOffset += colData.width;
65 updateCell( { realColIndex, realRowIndex },
66 getModel()->index( rowIndex.row(), colIndex, rowIndex.parent() ), 0,
67 yOffset );
68 realColIndex++;
69 }
70 rowNode->nodeDraw();
71 if ( mRowHeaderWidth ) {
72 updateRowHeader( realRowIndex, rowIndex,
73 realRowIndex == 0 ? fmodf( -mScrollOffset.y, rowHeight ) : 0.f );
74 }
75 realRowIndex++;
76 }
77 }
78 if ( mHeader && mHeader->isVisible() )
79 mHeader->nodeDraw();
80 if ( mRowHeader && mRowHeader->isVisible() )
81 mRowHeader->nodeDraw();
82 if ( mHScroll->isVisible() )
83 mHScroll->nodeDraw();
84 if ( mVScroll->isVisible() )
85 mVScroll->nodeDraw();
86}
87

Callers

nothing calls this directly

Calls 10

getModelFunction · 0.85
setChildrenVisibilityMethod · 0.80
rowMethod · 0.80
getHeightMethod · 0.45
columnCountMethod · 0.45
indexMethod · 0.45
getWidthMethod · 0.45
parentMethod · 0.45
nodeDrawMethod · 0.45
isVisibleMethod · 0.45

Tested by

no test coverage detected