diff options
author | Julian Eisel <julian@blender.org> | 2021-10-05 15:25:40 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-05 17:10:27 +0300 |
commit | dbe3981b0a805c1a40f42f57dc7ccc3d28270fda (patch) | |
tree | c646101190ece7bf46ee025b79c261b792abb08e /source/blender/editors/include | |
parent | 9a0850c8c25ea0c28f6ac313f076fd6a8563d0b4 (diff) |
Cleanup: Better way to pass activate callbacks to Tree-View items
The `ui::BasicTreeViewItem` took a function-like object to execute on
item activation via the constructor. This was mainly intended to be used
with lambdas. However, it's confusing to just have this lambda there,
with no indication of what it's for (activation).
Instead, assign the function-like object via an explicit `on_activate()`
function.
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/UI_tree_view.hh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh index a82aae021f2..4028bee9e15 100644 --- a/source/blender/editors/include/UI_tree_view.hh +++ b/source/blender/editors/include/UI_tree_view.hh @@ -239,10 +239,11 @@ class BasicTreeViewItem : public AbstractTreeViewItem { using ActivateFn = std::function<void(BasicTreeViewItem &new_active)>; BIFIconID icon; - BasicTreeViewItem(StringRef label, BIFIconID icon = ICON_NONE, ActivateFn activate_fn = nullptr); + BasicTreeViewItem(StringRef label, BIFIconID icon = ICON_NONE); void build_row(uiLayout &row) override; void on_activate() override; + void on_activate(ActivateFn fn); protected: /** Created in the #build() function. */ |