MWPhotoBrowser.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // MWPhotoBrowser.h
  3. // MWPhotoBrowser
  4. //
  5. // Created by Michael Waterfall on 14/10/2010.
  6. // Copyright 2010 d3i. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <MediaPlayer/MediaPlayer.h>
  10. #import "MWPhoto.h"
  11. #import "MWPhotoProtocol.h"
  12. #import "MWCaptionView.h"
  13. // Debug Logging
  14. #if 0 // Set to 1 to enable debug logging
  15. #define MWLog(x, ...) NSLog(x, ## __VA_ARGS__);
  16. #else
  17. #define MWLog(x, ...)
  18. #endif
  19. @class MWPhotoBrowser;
  20. @protocol MWPhotoBrowserDelegate <NSObject>
  21. - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser;
  22. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index;
  23. @optional
  24. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index;
  25. - (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index;
  26. - (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index;
  27. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index;
  28. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index;
  29. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButtonPressedForPhotoAtIndex:(NSUInteger)index deleteButton:(UIBarButtonItem *)deleteButton;
  30. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  31. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  32. - (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
  33. - (void)gridWillAppear:(MWPhotoBrowser *)photoBrowser; //TWS
  34. - (void)gridWillDisappear:(MWPhotoBrowser *)photoBrowser; //TWS
  35. - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
  36. @end
  37. @interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate>
  38. @property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
  39. @property (nonatomic) BOOL zoomPhotosToFill;
  40. @property (nonatomic) BOOL displayNavArrows;
  41. @property (nonatomic) BOOL displayActionButton;
  42. @property (nonatomic) BOOL displayDeleteButton; //TWS
  43. @property (nonatomic) BOOL displaySelectionButtons;
  44. @property (nonatomic) BOOL displayPopoverButton; //TWS
  45. @property (nonatomic) BOOL alwaysShowControls;
  46. @property (nonatomic) BOOL enableGrid;
  47. @property (nonatomic) BOOL enableSwipeToDismiss;
  48. @property (nonatomic) BOOL startOnGrid;
  49. @property (nonatomic) BOOL autoPlayOnAppear;
  50. @property (nonatomic) NSUInteger delayToHideElements;
  51. @property (nonatomic, readonly) NSUInteger currentIndex;
  52. // Customise image selection icons as they are the only icons with a colour tint
  53. // Icon should be located in the app's main bundle
  54. @property (nonatomic, strong) NSString *customImageSelectedIconName;
  55. @property (nonatomic, strong) NSString *customImageSelectedSmallIconName;
  56. @property (nonatomic, strong) UIBarButtonItem *previousButton, *nextButton, *actionButton, *doneButton, *popoverButton, *deleteButton; //TWS
  57. //TWS Video
  58. @property (nonatomic, strong) MPMoviePlayerViewController *currentVideoPlayerViewController;
  59. @property NSUInteger currentVideoIndex;
  60. @property (nonatomic, strong) UIActivityIndicatorView *currentVideoLoadingIndicator;
  61. //TWS Navigation & controls
  62. @property (nonatomic, strong) UIToolbar *toolbar;
  63. // Init
  64. - (id)initWithPhotos:(NSArray *)photosArray;
  65. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  66. // Reloads the photo browser and refetches data
  67. - (void)reloadData;
  68. - (void)reloadDataGridAtIndex:(NSArray *)indexPaths;
  69. // Set page that photo browser starts on
  70. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  71. // Navigation
  72. - (void)showNextPhotoAnimated:(BOOL)animated;
  73. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  74. - (void)hideControls;
  75. - (void)showControls;
  76. // TWS
  77. - (BOOL)isGridReload:(NSUInteger)index;
  78. - (BOOL)isGridController;
  79. @end