PKDownloadButton.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // PKDownloadButton.h
  3. // PKDownloadButton
  4. //
  5. // Created by Pavel on 28/05/15.
  6. // Copyright (c) 2015 Katunin. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "PKStopDownloadButton.h"
  10. #import "PKBorderedButton.h"
  11. #import "PKCircleProgressView.h"
  12. #import "PKPendingView.h"
  13. typedef NS_ENUM(NSUInteger, PKDownloadButtonState) {
  14. kPKDownloadButtonState_StartDownload,
  15. kPKDownloadButtonState_Pending,
  16. kPKDownloadButtonState_Downloading,
  17. kPKDownloadButtonState_Downloaded
  18. };
  19. @class PKDownloadButton;
  20. typedef void(^DownloadButtonTappedCallback)(PKDownloadButton *downloadButton, PKDownloadButtonState state);
  21. @protocol PKDownloadButtonDelegate <NSObject>
  22. - (void)downloadButtonTapped:(PKDownloadButton *)downloadButton
  23. currentState:(PKDownloadButtonState)state;
  24. @end
  25. IB_DESIGNABLE
  26. @interface PKDownloadButton : UIView
  27. @property (nonatomic, weak) IBOutlet id <PKDownloadButtonDelegate> delegate;
  28. @property (nonatomic, copy) DownloadButtonTappedCallback callback;
  29. @property (nonatomic, weak, readonly) PKBorderedButton *startDownloadButton;
  30. @property (nonatomic, weak, readonly) PKStopDownloadButton *stopDownloadButton;
  31. @property (nonatomic, weak, readonly) PKBorderedButton *downloadedButton;
  32. @property (nonatomic, weak, readonly) PKPendingView *pendingView;
  33. @property (nonatomic, assign) PKDownloadButtonState state;
  34. -(void)updateStartDownloadButtonText:(NSString *)title;
  35. -(void)updateDownloadedButtonText:(NSString *)title;
  36. -(void)updateStartDownloadButtonText:(NSString *)title font:(UIFont *)font;
  37. -(void)updateDownloadedButtonText:(NSString *)title font:(UIFont *)font;
  38. @end