RATreeNodeController.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //The MIT License (MIT)
  2. //
  3. //Copyright (c) 2014 Rafał Augustyniak
  4. //
  5. //Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. //this software and associated documentation files (the "Software"), to deal in
  7. //the Software without restriction, including without limitation the rights to
  8. //use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9. //the Software, and to permit persons to whom the Software is furnished to do so,
  10. //subject to the following conditions:
  11. //
  12. //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. //FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. //IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. //CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. //
  19. #import <Foundation/Foundation.h>
  20. @class RATreeNodeController, RATreeNode, RATreeNodeItem;
  21. @interface RATreeNodeController : NSObject
  22. @property (nonatomic, weak, readonly) RATreeNodeController *parentController;
  23. @property (nonatomic, strong, readonly) NSArray *childControllers;
  24. @property (nonatomic, strong, readonly) RATreeNode *treeNode;
  25. @property (nonatomic, readonly) NSInteger index;
  26. @property (nonatomic, readonly) NSInteger numberOfVisibleDescendants;
  27. @property (nonatomic, strong, readonly) NSIndexSet *descendantsIndexes;
  28. @property (nonatomic, readonly) NSInteger level;
  29. - (instancetype)initWithParent:(RATreeNodeController *)parentController item:(RATreeNodeItem *)item expandedBlock:(BOOL (^)(id))expanded;
  30. - (void)collapseAndCollapseChildren:(BOOL)collapseChildren;
  31. - (void)expandAndExpandChildren:(BOOL)expandChildren;
  32. - (void)insertChildControllers:(NSArray *)controllers atIndexes:(NSIndexSet *)indexes;
  33. - (void)moveChildControllerAtIndex:(NSInteger)index toIndex:(NSInteger)newIndex;
  34. - (void)removeChildControllersAtIndexes:(NSIndexSet *)indexes;
  35. - (NSInteger)indexForItem:(id)item;
  36. - (NSInteger)lastVisibleDescendatIndexForItem:(id)item;
  37. - (RATreeNodeController *)controllerForIndex:(NSInteger)index;
  38. - (RATreeNodeController *)controllerForItem:(id)item;
  39. @end