| 253 | } |
| 254 | |
| 255 | UIWidget* UITreeView::updateCell( const Vector2<Int64>& posIndex, const ModelIndex& index, |
| 256 | const size_t& indentLevel, const Float& yOffset ) { |
| 257 | if ( posIndex.y >= (int)mWidgets.size() ) |
| 258 | mWidgets.resize( posIndex.y + 1 ); |
| 259 | auto* widget = mWidgets[posIndex.y][index.column()]; |
| 260 | if ( !widget ) { |
| 261 | UIWidget* rowWidget = updateRow( posIndex.y, index, yOffset ); |
| 262 | widget = createCell( rowWidget, index ); |
| 263 | mWidgets[posIndex.y][index.column()] = widget; |
| 264 | widget->reloadStyle( true, true, true ); |
| 265 | } |
| 266 | if ( !index.isValid() ) |
| 267 | return widget; |
| 268 | const auto& colData = columnData( index.column() ); |
| 269 | if ( !colData.visible ) { |
| 270 | widget->setVisible( false, false ); |
| 271 | return widget; |
| 272 | } else { |
| 273 | widget->setVisible( true, false ); |
| 274 | } |
| 275 | widget->setPixelsSize( colData.width, getRowHeight() ); |
| 276 | widget->setPixelsPosition( { getColumnPosition( index.column() ).x, 0 } ); |
| 277 | if ( widget->isType( UI_TYPE_TABLECELL ) ) { |
| 278 | UITableCell* cell = widget->asType<UITableCell>(); |
| 279 | updateTableCellData( cell, index ); |
| 280 | |
| 281 | bool hasChildren = false; |
| 282 | |
| 283 | if ( widget->isType( UI_TYPE_TREEVIEW_CELL ) && |
| 284 | index.column() == (Int64)getModel()->treeColumn() ) { |
| 285 | UITreeViewCell* tcell = widget->asType<UITreeViewCell>(); |
| 286 | UIImage* image = widget->asType<UITreeViewCell>()->getImage(); |
| 287 | |
| 288 | Float minIndent = 0; |
| 289 | if ( !mExpandersAsIcons && mExpandIcon && mContractIcon ) { |
| 290 | minIndent = |
| 291 | eemax( |
| 292 | mExpandIcon->getSize( mExpanderIconSize )->getPixelsSize().getWidth(), |
| 293 | mContractIcon->getSize( mExpanderIconSize )->getPixelsSize().getWidth() ) + |
| 294 | image->getLayoutPixelsMargin().Right; |
| 295 | } |
| 296 | |
| 297 | Float indentation = minIndent + getIndentWidth() * indentLevel; |
| 298 | |
| 299 | hasChildren = getModel()->hasChildren( index ); |
| 300 | |
| 301 | if ( hasChildren ) { |
| 302 | UIIcon* icon = getIndexMetadata( index ).open ? mExpandIcon : mContractIcon; |
| 303 | Drawable* drawable = icon ? icon->getSize( mExpanderIconSize ) : nullptr; |
| 304 | |
| 305 | if ( drawable == nullptr ) { |
| 306 | image->setVisible( false ); |
| 307 | } else { |
| 308 | image->setVisible( true ); |
| 309 | image->setPixelsSize( drawable ? drawable->getPixelsSize() : Sizef( 0, 0 ) ); |
| 310 | image->setDrawable( drawable ); |
| 311 | if ( !mExpandersAsIcons ) |
| 312 | indentation = indentation - image->getPixelsSize().getWidth(); |
nothing calls this directly
no test coverage detected