VLCWatchTableController.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /* updates the table with the current configuration (pagesize, page, objects) */
  45. - (void)updateTable;
  46. - (IBAction)previousPageButtonPressed;
  47. - (IBAction)nextPageButtonPressed;
  48. @end