summaryrefslogtreecommitdiffstats
path: root/macosx/HBTreeNode.h
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-01-20 12:12:27 +0100
committerDamiano Galassi <[email protected]>2020-01-20 12:12:27 +0100
commit063e587158fead42f198f73fd16f42e091c536f4 (patch)
treedfb3f6910dd69ddcbe03c5a9ee762a794c46988e /macosx/HBTreeNode.h
parent97424db9a6b116054ec31f4a6f1aee8a95e090da (diff)
MacGui: add a Save menu item in the presets menu to save the changes to the selected preset. Fix a bunch of presets issues and weird behaviour.
Diffstat (limited to 'macosx/HBTreeNode.h')
-rw-r--r--macosx/HBTreeNode.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/macosx/HBTreeNode.h b/macosx/HBTreeNode.h
index 4b0afcb12..d52590d68 100644
--- a/macosx/HBTreeNode.h
+++ b/macosx/HBTreeNode.h
@@ -8,6 +8,8 @@
NS_ASSUME_NONNULL_BEGIN
+@class HBTreeNode;
+
/**
* Notify a delegate that something changed in the tree.
* KVO observing a tree looks complicated and expensive, so this is a lightweight
@@ -15,10 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
*/
@protocol HBTreeNodeDelegate <NSObject>
-- (void)nodeDidChange:(id)node;
+- (void)nodeDidChange:(HBTreeNode *)node;
@optional
-- (void)treeDidRemoveNode:(id)node;
+- (void)treeDidRemoveNode:(HBTreeNode *)node;
@end
@@ -28,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface HBTreeNode : NSObject <NSCopying>
// NSTreeController required properties
-@property (nonatomic, readonly) NSMutableArray *children;
+@property (nonatomic, readonly) NSMutableArray<HBTreeNode *> *children;
@property (nonatomic) BOOL isLeaf;
@property (nonatomic, weak) id<HBTreeNodeDelegate> delegate;
@@ -56,11 +58,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)removeObjectAtIndexPath:(NSIndexPath *)idx;
+/// Replaces the object at the specified index path.
+/// @param idx the NSIndexPath of the object to replace
+/// @param object the new object
+- (void)replaceObjectAtIndexPath:(NSIndexPath *)idx withObject:(HBTreeNode *)object;
+
// KVC Accessor Methods
@property (nonatomic, readonly) NSUInteger countOfChildren;
- (id)objectInChildrenAtIndex:(NSUInteger)index;
- (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index;
+- (void)replaceObjectInChildrenAtIndex:(NSUInteger)index withObject:(HBTreeNode *)object;
- (void)removeObjectFromChildrenAtIndex:(NSUInteger)index;
@end