MWPhotoBrowser.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // This file is based on third party code, see below for the original author
  2. // and original license.
  3. // Modifications are (c) by Threema GmbH and licensed under the AGPLv3.
  4. //
  5. // MWPhotoBrowser.h
  6. // MWPhotoBrowser
  7. //
  8. // Created by Michael Waterfall on 14/10/2010.
  9. // Copyright 2010 d3i. All rights reserved.
  10. //
  11. #import <UIKit/UIKit.h>
  12. #import <MessageUI/MessageUI.h>
  13. #import "MWPhoto.h"
  14. #import "MWPhotoProtocol.h"
  15. #import "MWCaptionView.h"
  16. ///***** BEGIN THREEMA MODIFICATION: ignore mute switch *********/
  17. #import <AVKit/AVKit.h>
  18. ///***** END THREEMA MODIFICATION: ignore mute switch *********/
  19. // Debug Logging
  20. #if 0 // Set to 1 to enable debug logging
  21. #define MWLog(x, ...) NSLog(x, ## __VA_ARGS__);
  22. #else
  23. #define MWLog(x, ...)
  24. #endif
  25. @class MWPhotoBrowser;
  26. @protocol MWPhotoBrowserDelegate <NSObject>
  27. - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser;
  28. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index;
  29. @optional
  30. - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser thumbPhotoAtIndex:(NSUInteger)index;
  31. - (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index;
  32. - (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index;
  33. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index;
  34. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser actionButtonPressedForPhotoAtIndex:(NSUInteger)index;
  35. /***** BEGIN THREEMA MODIFICATION: add delete button *********/
  36. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButton:(UIBarButtonItem *)deleteButton pressedForPhotoAtIndex:(NSUInteger)index;
  37. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButton:(UIBarButtonItem *)deleteButton;
  38. - (void)photoBrowserResetSelection:(MWPhotoBrowser *)photoBrowser;
  39. - (void)photoBrowserSelectAll:(MWPhotoBrowser *)photoBrowser;
  40. /***** END THREEMA MODIFICATION: add delete button *********/
  41. - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
  42. - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
  43. - (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
  44. @end
  45. ///***** BEGIN THREEMA MODIFICATION: ignore mute switch *********/
  46. @interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate, AVPlayerViewControllerDelegate>
  47. ///***** END THREEMA MODIFICATION: ignore mute switch *********/
  48. @property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
  49. @property (nonatomic) BOOL zoomPhotosToFill;
  50. @property (nonatomic) BOOL displayNavArrows;
  51. @property (nonatomic) BOOL displayActionButton;
  52. /***** BEGIN THREEMA MODIFICATION: add select all button *********/
  53. @property (nonatomic) BOOL displayDeleteButton;
  54. /***** END THREEMA MODIFICATION: add select all button *********/
  55. @property (nonatomic) BOOL displaySelectionButtons;
  56. @property (nonatomic) BOOL alwaysShowControls;
  57. @property (nonatomic) BOOL enableGrid;
  58. @property (nonatomic) BOOL enableSwipeToDismiss;
  59. @property (nonatomic) BOOL startOnGrid;
  60. @property (nonatomic) BOOL autoPlayOnAppear;
  61. @property (nonatomic) NSUInteger delayToHideElements;
  62. @property (nonatomic, readonly) NSUInteger currentIndex;
  63. /***** BEGIN THREEMA MODIFICATION: add peeking *********/
  64. @property (nonatomic) BOOL peeking;
  65. @property (nonatomic) NSUInteger testCount;
  66. /***** END THREEMA MODIFICATION: add peeking *********/
  67. ///***** BEGIN THREEMA MODIFICATION: ignore mute switch *********/
  68. @property (nonatomic, strong) NSString *prevAudioCategory;
  69. ///***** END THREEMA MODIFICATION: ignore mute switch *********/
  70. // Customise image selection icons as they are the only icons with a colour tint
  71. // Icon should be located in the app's main bundle
  72. ///***** BEGIN THREEMA MODIFICATION: use image instead of name *********/
  73. @property (nonatomic, strong) UIImage *customImageSelectedIcon;
  74. @property (nonatomic, strong) UIToolbar *gridToolbar;
  75. ///***** END THREEMA MODIFICATION: use image instead of name *********/
  76. @property (nonatomic, strong) NSString *customImageSelectedSmallIconName;
  77. // Init
  78. - (id)initWithPhotos:(NSArray *)photosArray;
  79. - (id)initWithDelegate:(id <MWPhotoBrowserDelegate>)delegate;
  80. // Reloads the photo browser and refetches data
  81. /***** BEGIN THREEMA MODIFICATION: delete file *********/
  82. //- (void)reloadData;
  83. - (void)reloadData:(BOOL)updateLayout;
  84. /***** BEGIN THREEMA MODIFICATION: delete file *********/
  85. // Set page that photo browser starts on
  86. - (void)setCurrentPhotoIndex:(NSUInteger)index;
  87. // Navigation
  88. - (void)showNextPhotoAnimated:(BOOL)animated;
  89. - (void)showPreviousPhotoAnimated:(BOOL)animated;
  90. - (id<MWPhoto>)photoAtIndex:(NSUInteger)index;
  91. /***** BEGIN THREEMA MODIFICATION: delete file *********/
  92. - (void)finishedDeleteMedia;
  93. - (void)toggleControls;
  94. /***** BEGIN THREEMA MODIFICATION: delete file *********/
  95. - (void)shareMedia:(MWPhoto *)item;
  96. - (void)showAlert:(NSString *)title message:(NSString *)message;
  97. @end