2
0

MWPhotoBrowser.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 "MWPhoto.h"
  10. #import "MWPhotoProtocol.h"
  11. #import "MWCaptionView.h"
  12. // Debug Logging
  13. #if 0 // Set to 1 to enable debug logging
  14. #define MWLog(x, ...) NSLog(x, ## __VA_ARGS__);
  15. #else
  16. #define MWLog(x, ...)
  17. #endif
  18. @class MWPhotoBrowser;
  19. @protocol MWPhotoBrowserDelegate <NSObject>
  20. - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser;
  21. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index;
  22. @optional
  23. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index;
  24. - (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index;
  25. - (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index;
  26. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index;
  27. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index;
  28. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  29. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  30. - (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
  31. @end
  32. @interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate>
  33. @property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
  34. @property (nonatomic) BOOL zoomPhotosToFill;
  35. @property (nonatomic) BOOL displayNavArrows;
  36. @property (nonatomic) BOOL displayActionButton;
  37. @property (nonatomic) BOOL displaySelectionButtons;
  38. @property (nonatomic) BOOL alwaysShowControls;
  39. @property (nonatomic) BOOL enableGrid;
  40. @property (nonatomic) BOOL enableSwipeToDismiss;
  41. @property (nonatomic) BOOL startOnGrid;
  42. @property (nonatomic) BOOL autoPlayOnAppear;
  43. @property (nonatomic) NSUInteger delayToHideElements;
  44. @property (nonatomic, readonly) NSUInteger currentIndex;
  45. // Customise image selection icons as they are the only icons with a colour tint
  46. // Icon should be located in the app's main bundle
  47. @property (nonatomic, strong) NSString *customImageSelectedIconName;
  48. @property (nonatomic, strong) NSString *customImageSelectedSmallIconName;
  49. // Init
  50. - (id)initWithPhotos:(NSArray *)photosArray;
  51. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  52. // Reloads the photo browser and refetches data
  53. - (void)reloadData;
  54. // Set page that photo browser starts on
  55. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  56. // Navigation
  57. - (void)showNextPhotoAnimated:(BOOL)animated;
  58. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  59. @end