32 class AbstractTreeView;
33 class AbstractTreeViewItem;
85 template<
class ItemT,
typename... Args>
inline ItemT &
add_tree_item(Args &&...args);
123 void update_children_from_old(
const AbstractView &old_view)
override;
124 static void update_children_from_old_recursive(
const TreeViewOrItem &new_items,
134 void change_state_delayed();
157 bool is_open_ =
false;
242 static void tree_row_click_fn(
struct bContext *,
void *,
void *);
243 static void collapse_chevron_click_fn(
bContext *,
void *but_arg1,
void *);
244 static bool is_collapse_chevron_but(
const uiBut *but);
247 void change_state_delayed();
249 void add_treerow_button(
uiBlock &block);
250 void add_indent(
uiLayout &row)
const;
251 void add_collapse_chevron(
uiBlock &block)
const;
252 void add_rename_button(
uiLayout &row);
254 bool has_active_child()
const;
255 int count_parents()
const;
296 static void tree_row_click_fn(
struct bContext *C,
void *arg1,
void *arg2);
298 std::optional<bool> should_be_active()
const override;
299 void on_activate()
override;
321 template<
class ItemT,
typename... Args>
324 static_assert(std::is_base_of<AbstractTreeViewItem, ItemT>::value,
325 "Type must derive from and implement the AbstractTreeViewItem interface");
327 return dynamic_cast<ItemT &
>(
328 add_tree_item(std::make_unique<ItemT>(std::forward<Args>(args)...)));
Abstract base class for defining a customizable tree-view item.
virtual void update_from_old(const AbstractViewItem &old) override
bool is_collapsed() const
uiButViewItem * view_item_button()
uiButViewItem * view_item_but_
AbstractTreeView & get_tree_view() const
bool is_collapsible() const
virtual StringRef get_rename_string() const override
virtual void build_row(uiLayout &row)=0
virtual bool matches(const AbstractViewItem &other) const override
virtual void on_activate()
virtual ~AbstractTreeViewItem()=default
virtual bool matches_single(const AbstractTreeViewItem &other) const
virtual std::optional< bool > should_be_active() const
virtual bool supports_collapsing() const
virtual bool rename(StringRefNull new_name) override
friend class TreeViewItemAPIWrapper
void ensure_parents_uncollapsed()
void set_collapsed(bool collapsed)
virtual ~AbstractTreeView()=default
virtual void build_tree()=0
void foreach_item(ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
void set_is_active_fn(IsActiveFn fn)
BasicTreeViewItem(StringRef label, BIFIconID icon=ICON_NONE)
void build_row(uiLayout &row) override
std::function< bool()> IsActiveFn
std::function< void(BasicTreeViewItem &new_active)> ActivateFn
void add_label(uiLayout &layout, StringRefNull label_override="")
void set_on_activate_fn(ActivateFn fn)
TreeViewBuilder(uiBlock &block)
void build_tree_view(AbstractTreeView &tree_view)
ItemT & add_tree_item(Args &&...args)
AbstractTreeViewItem * parent_
TreeViewItemContainer * root_
void foreach_item_recursive(ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
Vector< std::unique_ptr< AbstractTreeViewItem > > children_
CCL_NAMESPACE_BEGIN struct Options options
SyclQueue void void size_t num_bytes void
ENUM_OPERATORS(TreeViewItemContainer::IterOptions, TreeViewItemContainer::IterOptions::SkipCollapsed)