Blender V4.5
blender::ui::greasepencil::LayerGroupViewItem Class Reference

Inherits blender::ui::AbstractTreeViewItem.

Public Member Functions

 LayerGroupViewItem (GreasePencil &grease_pencil, LayerGroup &group)
 
std::optional< bool > should_be_collapsed () const override
 
bool set_collapsed (const bool collapsed) override
 
void on_collapse_change (bContext &C, const bool is_collapsed) override
 
void build_row (uiLayout &row) override
 
std::optional< bool > should_be_active () const override
 
void build_context_menu (bContext &C, uiLayout &layout) const override
 
void on_activate (bContext &C) override
 
bool supports_renaming () const override
 
bool rename (const bContext &C, StringRefNull new_name) override
 
StringRef get_rename_string () const override
 
std::unique_ptr< AbstractViewItemDragControllercreate_drag_controller () const override
 
std::unique_ptr< TreeViewItemDropTargetcreate_drop_target () override
 
- Public Member Functions inherited from blender::ui::AbstractTreeViewItem
 ~AbstractTreeViewItem () override=default
 
std::optional< std::string > debug_name () const override
 
std::unique_ptr< DropTargetInterfacecreate_item_drop_target () final
 
AbstractTreeViewget_tree_view () const
 
std::optional< rctfget_win_rect (const ARegion &region) const
 
void begin_renaming ()
 
bool toggle_collapsed ()
 
void uncollapse_by_default ()
 
bool is_collapsed () const
 
bool is_collapsible () const
 
int count_parents () const
 
- Public Member Functions inherited from blender::ui::AbstractViewItem
virtual ~AbstractViewItem ()=default
 
AbstractViewget_view () const
 
uiButViewItemview_item_button () const
 
void disable_interaction ()
 
bool is_interactive () const
 
void disable_activatable ()
 
bool is_active () const
 
bool is_search_highlight () const
 
void activate (bContext &C)
 
void deactivate ()
 
bool is_renaming () const
 
void begin_renaming ()
 
void end_renaming ()
 
void rename_apply (const bContext &C)
 
bool is_filtered_visible () const
 
- Public Member Functions inherited from blender::ui::TreeViewItemContainer
template<class ItemT , typename... Args>
ItemT & add_tree_item (Args &&...args)
 
AbstractTreeViewItemadd_tree_item (std::unique_ptr< AbstractTreeViewItem > item)
 

Additional Inherited Members

- Public Types inherited from blender::ui::TreeViewItemContainer
enum class  IterOptions { None = 0 , SkipCollapsed = 1 << 0 , SkipFiltered = 1 << 1 }
 
using ItemIterFn = FunctionRef<void(AbstractTreeViewItem &)>
 
- Protected Member Functions inherited from blender::ui::AbstractTreeViewItem
virtual bool supports_collapsing () const
 
void toggle_collapsed_from_view (bContext &C)
 
void change_state_delayed () override
 
bool matches (const AbstractViewItem &other) const override
 
void update_from_old (const AbstractViewItem &old) override
 
virtual bool matches_single (const AbstractTreeViewItem &other) const
 
bool is_hovered () const
 
void ensure_parents_uncollapsed ()
 
- Protected Member Functions inherited from blender::ui::AbstractViewItem
 AbstractViewItem ()=default
 
void add_rename_button (uiBlock &block)
 
virtual bool should_be_filtered_visible (StringRefNull filter_string) const
 
- Protected Member Functions inherited from blender::ui::TreeViewItemContainer
void foreach_item_recursive (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
 
void foreach_parent (ItemIterFn iter_fn) const
 
- Protected Attributes inherited from blender::ui::AbstractTreeViewItem
std::string label_
 
- Protected Attributes inherited from blender::ui::AbstractViewItem
AbstractViewview_ = nullptr
 
uiButViewItemview_item_but_ = nullptr
 
bool is_activatable_ = true
 
bool is_interactive_ = true
 
bool is_active_ = false
 
bool is_renaming_ = false
 
bool is_highlighted_search_ = false
 
bool is_filtered_visible_ = true
 
bool is_always_collapsible_ = false
 
- Protected Attributes inherited from blender::ui::TreeViewItemContainer
Vector< std::unique_ptr< AbstractTreeViewItem > > children_
 
TreeViewItemContainerroot_ = nullptr
 
AbstractTreeViewItemparent_ = nullptr
 
bool is_flat_ = false
 

Detailed Description

Constructor & Destructor Documentation

◆ LayerGroupViewItem()

blender::ui::greasepencil::LayerGroupViewItem::LayerGroupViewItem ( GreasePencil & grease_pencil,
LayerGroup & group )
inline

Member Function Documentation

◆ build_context_menu()

void blender::ui::greasepencil::LayerGroupViewItem::build_context_menu ( bContext & C,
uiLayout & layout ) const
inlineoverridevirtual

◆ build_row()

void blender::ui::greasepencil::LayerGroupViewItem::build_row ( uiLayout & row)
inlineoverridevirtual

◆ create_drag_controller()

std::unique_ptr< AbstractViewItemDragController > blender::ui::greasepencil::LayerGroupViewItem::create_drag_controller ( ) const
inlineoverridevirtual

If an item wants to support being dragged, it has to return a drag controller here. That is an object implementing #AbstractViewItemDragController.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 448 of file interface_template_grease_pencil_layer_tree.cc.

References GreasePencilLayerTreeGroup::base, and blender::ui::AbstractTreeViewItem::get_tree_view().

◆ create_drop_target()

std::unique_ptr< TreeViewItemDropTarget > blender::ui::greasepencil::LayerGroupViewItem::create_drop_target ( )
inlineoverridevirtual

◆ get_rename_string()

StringRef blender::ui::greasepencil::LayerGroupViewItem::get_rename_string ( ) const
inlineoverridevirtual

◆ on_activate()

void blender::ui::greasepencil::LayerGroupViewItem::on_activate ( bContext & C)
inlineoverridevirtual

Called when the view changes an item's state from inactive to active. Will only be called if the state change is triggered through the view, not through external changes. E.g. a click on an item calls it, a change in the value returned by should_be_active() to reflect an external state change does not.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 402 of file interface_template_grease_pencil_layer_tree.cc.

References active, CTX_wm_message_bus(), ED_undo_push(), GreasePencil::id, RNA_pointer_create_discrete(), RNA_property_pointer_set(), RNA_property_update(), RNA_struct_find_property(), and WM_msg_publish_rna_prop.

◆ on_collapse_change()

void blender::ui::greasepencil::LayerGroupViewItem::on_collapse_change ( bContext & C,
const bool is_collapsed )
inlineoverridevirtual

Called when the view changes an item's state from expanded to collapsed, or vice versa. Will only be called if the state change is triggered through the view, not through external changes. E.g. a click on an item calls it, a change in the value returned by should_be_collapsed() to reflect an external state change does not.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 361 of file interface_template_grease_pencil_layer_tree.cc.

References GreasePencil::id, blender::ui::AbstractTreeViewItem::is_collapsed(), RNA_pointer_create_discrete(), RNA_property_boolean_set(), RNA_property_update(), and RNA_struct_find_property().

◆ rename()

bool blender::ui::greasepencil::LayerGroupViewItem::rename ( const bContext & C,
StringRefNull new_name )
inlineoverridevirtual

◆ set_collapsed()

bool blender::ui::greasepencil::LayerGroupViewItem::set_collapsed ( const bool collapsed)
inlineoverridevirtual

Expand or collapse this tree view item.

Note
this does not call on_collapse_change().
Returns
true when the collapsed state was changed, false otherwise.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 352 of file interface_template_grease_pencil_layer_tree.cc.

References blender::ui::AbstractTreeViewItem::set_collapsed(), and blender::bke::greasepencil::LayerGroup::set_expanded().

◆ should_be_active()

std::optional< bool > blender::ui::greasepencil::LayerGroupViewItem::should_be_active ( ) const
inlineoverridevirtual

If the result is not empty, it controls whether the item should be active or not, usually depending on the data that the view represents. Note that since this is meant to reflect externally managed state changes, on_activate() will never be called if this returns true.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 385 of file interface_template_grease_pencil_layer_tree.cc.

◆ should_be_collapsed()

std::optional< bool > blender::ui::greasepencil::LayerGroupViewItem::should_be_collapsed ( ) const
inlineoverridevirtual

If the result is not empty, it controls whether the item should be collapsed or not, usually depending on the data that the view represents.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 346 of file interface_template_grease_pencil_layer_tree.cc.

References blender::ui::AbstractTreeViewItem::is_collapsed(), and blender::bke::greasepencil::LayerGroup::is_expanded().

◆ supports_renaming()

bool blender::ui::greasepencil::LayerGroupViewItem::supports_renaming ( ) const
inlineoverridevirtual

Queries if the view item supports renaming in principle. Renaming may still fail, e.g. if another item is already being renamed.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 425 of file interface_template_grease_pencil_layer_tree.cc.


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