MWPhotoBrowser.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. - (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 shareButtonPressedForPhotoAtIndex:(NSUInteger)index;
  30. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButtonPressedForPhotoAtIndex:(NSUInteger)index deleteButton:(UIBarButtonItem *)deleteButton;
  31. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  32. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  33. - (void)photoBrowserDidFinishPresentation:(MWPhotoBrowser *)photoBrowser;
  34. - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
  35. @end
  36. @interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate>
  37. @property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
  38. @property (nonatomic) BOOL zoomPhotosToFill;
  39. @property (nonatomic) BOOL displayNavArrows;
  40. @property (nonatomic) BOOL displayActionButton;
  41. @property (nonatomic) BOOL displayShareButton; //TWS
  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 enableSwipeToDismiss;
  47. @property (nonatomic) BOOL autoPlayOnAppear;
  48. @property (nonatomic) NSUInteger delayToHideElements;
  49. @property (nonatomic, readonly) NSUInteger currentIndex;
  50. // Customise image selection icons as they are the only icons with a colour tint
  51. // Icon should be located in the app's main bundle
  52. @property (nonatomic, strong) NSString *customImageSelectedIconName;
  53. @property (nonatomic, strong) NSString *customImageSelectedSmallIconName;
  54. @property (nonatomic, strong) UIBarButtonItem *previousButton, *nextButton, *actionButton, *doneButton, *popoverButton, *deleteButton, *shareButton; //TWS
  55. //TWS Navigation & controls
  56. @property (nonatomic, strong) UIToolbar *toolbar;
  57. // Video
  58. @property (nonatomic, strong) AVPlayer *currentVideoPlayer;
  59. // Init
  60. - (id)initWithPhotos:(NSArray *)photosArray;
  61. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  62. // Reloads the photo browser and refetches data
  63. - (void)reloadData;
  64. // Set page that photo browser starts on
  65. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  66. // Navigation
  67. - (void)showNextPhotoAnimated:(BOOL)animated;
  68. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  69. - (void)hideControls;
  70. - (void)showControls;
  71. @end