Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/views/tree_view.cc
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
| void AbstractTreeViewItem::add_treerow_button(uiBlock &block) | void AbstractTreeViewItem::add_treerow_button(uiBlock &block) | ||||
| { | { | ||||
| /* For some reason a width > (UI_UNIT_X * 2) make the layout system use all available width. */ | /* For some reason a width > (UI_UNIT_X * 2) make the layout system use all available width. */ | ||||
| view_item_but_ = (uiButViewItem *)uiDefBut( | view_item_but_ = (uiButViewItem *)uiDefBut( | ||||
| &block, UI_BTYPE_VIEW_ITEM, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nullptr, 0, 0, 0, 0, ""); | &block, UI_BTYPE_VIEW_ITEM, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nullptr, 0, 0, 0, 0, ""); | ||||
| view_item_but_->view_item = reinterpret_cast<uiViewItemHandle *>(this); | view_item_but_->view_item = reinterpret_cast<uiViewItemHandle *>(this); | ||||
| UI_but_func_set(&view_item_but_->but, tree_row_click_fn, view_item_but_, nullptr); | UI_but_func_set(view_item_but_, tree_row_click_fn, view_item_but_, nullptr); | ||||
| } | } | ||||
| void AbstractTreeViewItem::add_indent(uiLayout &row) const | void AbstractTreeViewItem::add_indent(uiLayout &row) const | ||||
| { | { | ||||
| uiBlock *block = uiLayoutGetBlock(&row); | uiBlock *block = uiLayoutGetBlock(&row); | ||||
| uiLayout *subrow = uiLayoutRow(&row, true); | uiLayout *subrow = uiLayoutRow(&row, true); | ||||
| uiLayoutSetFixedSize(subrow, true); | uiLayoutSetFixedSize(subrow, true); | ||||
| ▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | BLI_assert_msg(get_tree_view().is_reconstructed(), | ||||
| "State can't be queried until reconstruction is completed"); | "State can't be queried until reconstruction is completed"); | ||||
| BLI_assert_msg(view_item_but_ != nullptr, | BLI_assert_msg(view_item_but_ != nullptr, | ||||
| "Hovered state can't be queried before the tree row is being built"); | "Hovered state can't be queried before the tree row is being built"); | ||||
| const uiViewItemHandle *this_item_handle = reinterpret_cast<const uiViewItemHandle *>(this); | const uiViewItemHandle *this_item_handle = reinterpret_cast<const uiViewItemHandle *>(this); | ||||
| /* The new layout hasn't finished construction yet, so the final state of the button is unknown. | /* The new layout hasn't finished construction yet, so the final state of the button is unknown. | ||||
| * Get the matching button from the previous redraw instead. */ | * Get the matching button from the previous redraw instead. */ | ||||
| uiButViewItem *old_item_but = ui_block_view_find_matching_view_item_but_in_old_block( | uiButViewItem *old_item_but = ui_block_view_find_matching_view_item_but_in_old_block( | ||||
| view_item_but_->but.block, this_item_handle); | view_item_but_->block, this_item_handle); | ||||
| return old_item_but && (old_item_but->but.flag & UI_ACTIVE); | return old_item_but && (old_item_but->flag & UI_ACTIVE); | ||||
| } | } | ||||
| bool AbstractTreeViewItem::is_collapsed() const | bool AbstractTreeViewItem::is_collapsed() const | ||||
| { | { | ||||
| BLI_assert_msg(get_tree_view().is_reconstructed(), | BLI_assert_msg(get_tree_view().is_reconstructed(), | ||||
| "State can't be queried until reconstruction is completed"); | "State can't be queried until reconstruction is completed"); | ||||
| return is_collapsible() && !is_open_; | return is_collapsible() && !is_open_; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines | |||||