MWPhotoBrowser.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 <MessageUI/MessageUI.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. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  30. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  31. - (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
  32. @end
  33. @interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate, MFMailComposeViewControllerDelegate>
  34. @property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
  35. @property (nonatomic) BOOL zoomPhotosToFill;
  36. @property (nonatomic) BOOL displayNavArrows;
  37. @property (nonatomic) BOOL displayActionButton;
  38. @property (nonatomic) BOOL displaySelectionButtons;
  39. @property (nonatomic) BOOL alwaysShowControls;
  40. @property (nonatomic) BOOL enableGrid;
  41. @property (nonatomic) BOOL enableSwipeToDismiss;
  42. @property (nonatomic) BOOL startOnGrid;
  43. @property (nonatomic) NSUInteger delayToHideElements;
  44. @property (nonatomic, readonly) NSUInteger currentIndex;
  45. // Init
  46. - (id)initWithPhotos:(NSArray *)photosArray __attribute__((deprecated("Use initWithDelegate: instead"))); // Depreciated
  47. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  48. // Reloads the photo browser and refetches data
  49. - (void)reloadData;
  50. // Set page that photo browser starts on
  51. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  52. - (void)setInitialPageIndex:(NSUInteger)index __attribute__((deprecated("Use setCurrentPhotoIndex: instead"))); // Depreciated
  53. // Navigation
  54. - (void)showNextPhotoAnimated:(BOOL)animated;
  55. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  56. @end