Blender V4.3
blender::ui::BuildOnlyVisibleButtonsHelper Class Reference

Public Member Functions

 BuildOnlyVisibleButtonsHelper (const View2D &v2d, const AbstractGridView &grid_view, int cols_per_row, const AbstractGridViewItem *force_visible_item)
 
bool is_item_visible (int item_idx) const
 
void fill_layout_before_visible (uiBlock &block) const
 
void fill_layout_after_visible (uiBlock &block) const
 

Detailed Description

Helper for only adding layout items for grid items that are actually in view. 3 main functions:

  • is_item_visible(): Query if an item of a given index is visible in the view (others should be skipped when building the layout).
  • fill_layout_before_visible(): Add empty space to the layout before a visible row is drawn, so the layout height is the same as if all items were added (important to get the correct scroll height).
  • fill_layout_after_visible(): Same thing, just adds empty space for after the last visible row.

Does two assumptions:

  • Top-to-bottom flow (ymax = 0 and ymin < 0). If that's not good enough, View2D should probably provide queries for the scroll offset.
  • Only vertical scrolling. For horizontal scrolling, spacers would have to be added on the side(s) as well.

Definition at line 214 of file grid_view.cc.

Constructor & Destructor Documentation

◆ BuildOnlyVisibleButtonsHelper()

blender::ui::BuildOnlyVisibleButtonsHelper::BuildOnlyVisibleButtonsHelper ( const View2D & v2d,
const AbstractGridView & grid_view,
int cols_per_row,
const AbstractGridViewItem * force_visible_item )

Member Function Documentation

◆ fill_layout_after_visible()

void blender::ui::BuildOnlyVisibleButtonsHelper::fill_layout_after_visible ( uiBlock & block) const

◆ fill_layout_before_visible()

void blender::ui::BuildOnlyVisibleButtonsHelper::fill_layout_before_visible ( uiBlock & block) const

Definition at line 307 of file grid_view.cc.

Referenced by blender::ui::GridViewLayoutBuilder::build_from_view().

◆ is_item_visible()

bool blender::ui::BuildOnlyVisibleButtonsHelper::is_item_visible ( int item_idx) const

Definition at line 302 of file grid_view.cc.

Referenced by blender::ui::GridViewLayoutBuilder::build_from_view().


The documentation for this class was generated from the following file: