MWPhotoBrowser.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 <AVKit/AVKit.h>
  11. #import "MWPhoto.h"
  12. #import "MWPhotoProtocol.h"
  13. #import "MWCaptionView.h"
  14. // Debug Logging
  15. #if 0 // Set to 1 to enable debug logging
  16. #define MWLog(x, ...) NSLog(x, ## __VA_ARGS__);
  17. #else
  18. #define MWLog(x, ...)
  19. #endif
  20. @class MWPhotoBrowser;
  21. @protocol MWPhotoBrowserDelegate <NSObject>
  22. - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser;
  23. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index;
  24. @optional
  25. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index;
  26. - (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index;
  27. - (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index;
  28. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index;
  29. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index;
  30. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser shareButtonPressedForPhotoAtIndex:(NSUInteger)index;
  31. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButtonPressedForPhotoAtIndex:(NSUInteger)index deleteButton:(UIBarButtonItem *)deleteButton;
  32. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  33. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  34. - (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
  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 displayShareButton; //TWS
  43. @property (nonatomic) BOOL displayDeleteButton; //TWS
  44. @property (nonatomic) BOOL displaySelectionButtons;
  45. @property (nonatomic) BOOL displayPopoverButton; //TWS
  46. @property (nonatomic) BOOL alwaysShowControls;
  47. @property (nonatomic) BOOL enableSwipeToDismiss;
  48. @property (nonatomic) BOOL autoPlayOnAppear;
  49. @property (nonatomic) NSUInteger delayToHideElements;
  50. @property (nonatomic, readonly) NSUInteger currentIndex;
  51. // Customise image selection icons as they are the only icons with a colour tint
  52. // Icon should be located in the app's main bundle
  53. @property (nonatomic, strong) NSString *customImageSelectedIconName;
  54. @property (nonatomic, strong) NSString *customImageSelectedSmallIconName;
  55. @property (nonatomic, strong) UIBarButtonItem *previousButton, *nextButton, *actionButton, *doneButton, *popoverButton, *deleteButton, *shareButton; //TWS
  56. //TWS Navigation & controls
  57. @property (nonatomic, strong) UIToolbar *toolbar;
  58. // Video
  59. @property (nonatomic, strong) AVPlayer *currentVideoPlayer;
  60. // Init
  61. - (id)initWithPhotos:(NSArray *)photosArray;
  62. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  63. // Reloads the photo browser and refetches data
  64. - (void)reloadData;
  65. // Set page that photo browser starts on
  66. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  67. // Navigation
  68. - (void)showNextPhotoAnimated:(BOOL)animated;
  69. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  70. - (void)hideControls;
  71. - (void)showControls;
  72. @end