VLCWatchTableController.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*****************************************************************************
  2. * VLCWatchTableController.h
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2015 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Author: Tobias Conradi <videolan # tobias-conradi.de>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import <WatchKit/WatchKit.h>
  13. typedef NSString *(^VLCWatchTableControllerRowTypeForObjectBlock)(id object);
  14. typedef void(^VLCWatchTableControllerConfigureRowControllerWithObjectBlock)(id rowController, id object);
  15. @interface VLCWatchTableController : NSObject
  16. @property (nonatomic, weak) IBOutlet WKInterfaceTable *table;
  17. /*
  18. * previous and next buttons are automatically hidden/shown depening on number
  19. * of objects, page size and the current page
  20. */
  21. @property (nonatomic, weak) IBOutlet WKInterfaceButton *previousPageButton;
  22. @property (nonatomic, weak) IBOutlet WKInterfaceButton *nextPageButton;
  23. /*
  24. * Interface object which will be shown when the objects array is empty;
  25. */
  26. @property (nonatomic, weak) IBOutlet WKInterfaceObject *emptyLibraryInterfaceObjects;
  27. /*
  28. * set eigher rowType if every row should have the same rowType or the
  29. * rowTypeForObjectBlock which returns the matching row type for an object
  30. */
  31. @property (nonatomic, copy) NSString *rowType;
  32. @property (nonatomic, copy) VLCWatchTableControllerRowTypeForObjectBlock rowTypeForObjectBlock;
  33. @property (nonatomic, copy) VLCWatchTableControllerConfigureRowControllerWithObjectBlock configureRowControllerWithObjectBlock;
  34. @property (nonatomic, copy, readonly) NSArray *displayedObjects;
  35. @property (nonatomic, copy, readonly) NSIndexSet *displayedIndexes;
  36. /* does setting these does not trigger table update call updateTable manually to update table */
  37. @property (nonatomic, assign) NSUInteger pageSize;
  38. @property (nonatomic, assign) NSUInteger currentPage;
  39. /*
  40. * When the objects array changes it will figure out inserted and removed objects
  41. * and updates the table accoringly.
  42. */
  43. @property (nonatomic, copy) NSArray *objects;
  44. /*
  45. * Set the identifierKeyPath to the key path of a unique identifier of the objects.
  46. * The identifier at the keyPath is used to determine if a object was added or removed.
  47. * Default is @"self".
  48. */
  49. @property (nonatomic, copy) NSString *identifierKeyPath;
  50. /* updates the table with the current configuration (pagesize, page, objects) */
  51. - (void)updateTable;
  52. - (IBAction)previousPageButtonPressed;
  53. - (IBAction)nextPageButtonPressed;
  54. @end