UI: Move rename buffer management to new view base class
Renaming is a nice example of a feature that shouldn't need a specific implementation for a specific view type (e.g. grid or tree view). So it's something that can be supported in the general view code. Individual views can use it "for free" then. This ports the view level part of the renaming code, the view item level part of it can be ported once we have a common base class for the view items.
This commit is contained in:
@@ -117,20 +117,11 @@ class AbstractTreeView : public AbstractView, public TreeViewItemContainer {
|
||||
friend class AbstractTreeViewItem;
|
||||
friend class TreeViewBuilder;
|
||||
|
||||
/**
|
||||
* Only one item can be renamed at a time. So the tree is informed about the renaming state to
|
||||
* enforce that.
|
||||
*/
|
||||
std::unique_ptr<std::array<char, MAX_NAME>> rename_buffer_;
|
||||
|
||||
public:
|
||||
virtual ~AbstractTreeView() = default;
|
||||
|
||||
void foreach_item(ItemIterFn iter_fn, IterOptions options = IterOptions::None) const;
|
||||
|
||||
/** Only one item can be renamed at a time. */
|
||||
bool is_renaming() const;
|
||||
|
||||
protected:
|
||||
virtual void build_tree() = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user