# TreeDataGridPresenterHooks

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-treedatagrid/primitives/trait-treedatagridpresenterhooks/

**trait** · [`ferroui-controls-treedatagrid`](/docs/0.5.0/api/ferroui-controls-treedatagrid/) · v0.5.0

```rust
trait TreeDataGridPresenterHooks: ObjectType + Upcast<ferroui_controls::Control> + 'static
```

The abstract and virtual members of the reference's presenter base, implemented by each
presenter class. The defaults are the base implementations.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L67)

## Members

- [`Item`](#assoc_type-item)
- [`presenter_base`](#function-presenter_base)
- [`presenter_control`](#function-presenter_control)
- [`orientation`](#function-orientation)
- [`item_count`](#function-item_count)
- [`item_at`](#function-item_at)
- [`subscribe_to_items`](#function-subscribe_to_items)
- [`unsubscribe_from_items`](#function-unsubscribe_from_items)
- [`realize_element`](#function-realize_element)
- [`update_element_index`](#function-update_element_index)
- [`unrealize_element`](#function-unrealize_element)
- [`unrealize_element_on_item_removed`](#function-unrealize_element_on_item_removed)
- [`finalize_recycled_element`](#function-finalize_recycled_element)
- [`arrange_element`](#function-arrange_element)
- [`measure_element`](#function-measure_element)
- [`get_initial_constraint`](#function-get_initial_constraint)
- [`needs_final_measure_pass`](#function-needs_final_measure_pass)
- [`get_final_constraint`](#function-get_final_constraint)
- [`get_element_from_factory`](#function-get_element_from_factory)
- [`get_element_at`](#function-get_element_at)
- [`get_element_position`](#function-get_element_position)
- [`calculate_size_u`](#function-calculate_size_u)
- [`get_or_estimate_anchor_element_for_viewport`](#function-get_or_estimate_anchor_element_for_viewport)
- [`estimate_element_size_u`](#function-estimate_element_size_u)
- [`get_parent_presenter_viewport`](#function-get_parent_presenter_viewport)
- [`get_measure_viewport`](#function-get_measure_viewport)
- [`needs_measure_for_viewport_change`](#function-needs_measure_for_viewport_change)
- [`on_effective_viewport_changed`](#function-on_effective_viewport_changed)
- [`as_final_measure_selector`](#function-as_final_measure_selector)
- [`trace_enabled`](#function-trace_enabled)

<a id="assoc_type-item"></a>

### Item

```rust
type Item: Clone + 'static
```

The type of the items the presenter shows.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L69)

<a id="function-presenter_base"></a>

### presenter_base

```rust
fn presenter_base(self: &Self) -> &TreeDataGridPresenterBase
```

The state of the base.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L72)

<a id="function-presenter_control"></a>

### presenter_control

```rust
fn presenter_control(self: &Self) -> &Control
```

The presenter as a control.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L76)

<a id="function-orientation"></a>

### orientation

```rust
fn orientation(self: &Self) -> Orientation
```

The axis along which the items are laid out.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L81)

<a id="function-item_count"></a>

### item_count

```rust
fn item_count(self: &Self) -> Option<usize>
```

The number of items, or `None` when the presenter has no items (`Items is null`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L84)

<a id="function-item_at"></a>

### item_at

```rust
fn item_at(self: &Self, index: usize) -> <Self as >::Item
```

The item at `index`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L87)

<a id="function-subscribe_to_items"></a>

### subscribe_to_items

```rust
fn subscribe_to_items(self: &Self, handler: Rc<dyn Fn(&PresenterItemsChange) -> ()>) -> Option<u64>
```

Subscribes to the changes of the items; `None` when the items do not notify.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L90)

<a id="function-unsubscribe_from_items"></a>

### unsubscribe_from_items

```rust
fn unsubscribe_from_items(self: &Self, token: u64)
```

Removes a subscription of `subscribe_to_items`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L93)

<a id="function-realize_element"></a>

### realize_element

```rust
fn realize_element(self: &Self, element: &Ref<Control>, item: &<Self as >::Item, index: i32)
```

Prepares `element` to show `item`, at `index` (`RealizeElement`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L96)

<a id="function-update_element_index"></a>

### update_element_index

```rust
fn update_element_index(self: &Self, element: &Ref<Control>, old_index: i32, new_index: i32)
```

The index of a realized element changed (`UpdateElementIndex`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L99)

<a id="function-unrealize_element"></a>

### unrealize_element

```rust
fn unrealize_element(self: &Self, element: &Ref<Control>)
```

Clears `element` before it is recycled (`UnrealizeElement`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L102)

<a id="function-unrealize_element_on_item_removed"></a>

### unrealize_element_on_item_removed

```rust
fn unrealize_element_on_item_removed(self: &Self, element: &Ref<Control>)
```

Clears `element` before it is recycled because its item was removed
(`UnrealizeElementOnItemRemoved`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L106)

<a id="function-finalize_recycled_element"></a>

### finalize_recycled_element

```rust
fn finalize_recycled_element(self: &Self, _element: &Ref<Control>)
```

Releases what a recycled element retained when it is no longer needed for a quick reuse
(`FinalizeRecycledElement`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L112)

<a id="function-arrange_element"></a>

### arrange_element

```rust
fn arrange_element(self: &Self, _index: i32, element: &Ref<Control>, rect: Rect) -> Rect
```

Arranges `element` (`ArrangeElement`); returns the rect it was arranged in.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L115)

<a id="function-measure_element"></a>

### measure_element

```rust
fn measure_element(self: &Self, _index: i32, element: &Ref<Control>, available_size: Size) -> Size
```

Measures `element` (`MeasureElement`); returns its size.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L121)

<a id="function-get_initial_constraint"></a>

### get_initial_constraint

```rust
fn get_initial_constraint(self: &Self, _element: &Ref<Control>, _index: i32, available_size: Size) -> Size
```

Gets the initial constraint for the first pass of the two-pass measure
(`GetInitialConstraint`).

The measure pass is split into two parts:

- The initial pass is used to determine the "natural" size of the elements. In this pass,
  infinity can be used as the measure constraint if the element has no other constraints on
  its size.
- The final pass is made once the "natural" sizes of the elements are known and any layout
  logic has been run. This pass is needed because controls should not be arranged with a size
  less than that passed as the constraint during the measure pass. This pass is only run if
  `needs_final_measure_pass` returns true.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L137)

<a id="function-needs_final_measure_pass"></a>

### needs_final_measure_pass

```rust
fn needs_final_measure_pass(self: &Self, _first_index: i32, _elements: &[Option<Ref<Control>>]) -> bool
```

Called when the initial pass of the two-pass measure has been completed, in order to
determine whether a final measure pass is necessary (`NeedsFinalMeasurePass`).
`first_index` is the index of the first element in `elements`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L144)

<a id="function-get_final_constraint"></a>

### get_final_constraint

```rust
fn get_final_constraint(self: &Self, element: &Ref<Control>, _index: i32, _available_size: Size) -> Size
```

Gets the final constraint for the second pass of the two-pass measure
(`GetFinalConstraint`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L150)

<a id="function-get_element_from_factory"></a>

### get_element_from_factory

```rust
fn get_element_from_factory(self: &Self, item: &<Self as >::Item, _index: i32) -> Ref<Control>
```

Gets the element that shows `item` from the element factory (`GetElementFromFactory`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L155)

<a id="function-get_element_at"></a>

### get_element_at

```rust
fn get_element_at(self: &Self, _position: f64) -> (i32, f64)
```

The index and position of the element at `position` (`GetElementAt`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L160)

<a id="function-get_element_position"></a>

### get_element_position

```rust
fn get_element_position(self: &Self, _index: i32) -> f64
```

The position of the element at `index` (`GetElementPosition`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L165)

<a id="function-calculate_size_u"></a>

### calculate_size_u

```rust
fn calculate_size_u(self: &Self, _available_size: Size) -> f64
```

The estimated size of all the items on the primary axis (`CalculateSizeU`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L170)

<a id="function-get_or_estimate_anchor_element_for_viewport"></a>

### get_or_estimate_anchor_element_for_viewport

```rust
fn get_or_estimate_anchor_element_for_viewport(self: &Self, viewport_start: f64, viewport_end: f64, item_count: i32) -> (i32, f64)
```

The anchor element from which realization starts (`GetOrEstimateAnchorElementForViewport`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L179)

<a id="function-estimate_element_size_u"></a>

### estimate_element_size_u

```rust
fn estimate_element_size_u(self: &Self) -> f64
```

The estimated size of an element on the primary axis (`EstimateElementSizeU`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L193)

<a id="function-get_parent_presenter_viewport"></a>

### get_parent_presenter_viewport

```rust
fn get_parent_presenter_viewport(self: &Self) -> Option<Rect>
```

The viewport of the parent presenter, if the presenter is nested in one
(`GetParentPresenterViewPort`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L199)

<a id="function-get_measure_viewport"></a>

### get_measure_viewport

```rust
fn get_measure_viewport(self: &Self, viewport: Rect) -> Rect
```

The viewport realization fills, from the effective viewport (`GetMeasureViewport`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L204)

<a id="function-needs_measure_for_viewport_change"></a>

### needs_measure_for_viewport_change

```rust
fn needs_measure_for_viewport_change(self: &Self, _measure_viewport: Rect, _viewport: Rect) -> bool
```

Whether a change of the effective viewport needs a new measure
(`NeedsMeasureForViewportChange`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L210)

<a id="function-on_effective_viewport_changed"></a>

### on_effective_viewport_changed

```rust
fn on_effective_viewport_changed(self: &Self, e: &EffectiveViewportChangedEventArgs)
```

Called when the effective viewport of the presenter changes (`OnEffectiveViewportChanged`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L215)

<a id="function-as_final_measure_selector"></a>

### as_final_measure_selector

```rust
fn as_final_measure_selector(self: &Self) -> Option<&dyn IFinalMeasureSelector>
```

The presenter as a selector of the elements of the final measure pass
(`this is IFinalMeasureSelector`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L221)

<a id="function-trace_enabled"></a>

### trace_enabled

```rust
fn trace_enabled(self: &Self) -> bool
```

Whether the diagnostic trace of the presenter is written (the rows presenter's).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/TreeDataGrid/FerroUI.Controls.TreeDataGrid/primitives/tree_data_grid_presenter_base.rs#L226)

## Trait implementations

- [`TreeDataGridPresenterHooks`](/docs/0.5.0/api/ferroui-controls-treedatagrid/primitives/trait-treedatagridpresenterhooks/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
