You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.9 KiB

6 years ago
  1. //
  2. // FXPageControl.h
  3. //
  4. // Version 1.4
  5. //
  6. // Created by Nick Lockwood on 07/01/2010.
  7. // Copyright 2010 Charcoal Design
  8. //
  9. // Distributed under the permissive zlib License
  10. // Get the latest version of FXPageControl from here:
  11. //
  12. // https://github.com/nicklockwood/FXPageControl
  13. //
  14. // This software is provided 'as-is', without any express or implied
  15. // warranty. In no event will the authors be held liable for any damages
  16. // arising from the use of this software.
  17. //
  18. // Permission is granted to anyone to use this software for any purpose,
  19. // including commercial applications, and to alter it and redistribute it
  20. // freely, subject to the following restrictions:
  21. //
  22. // 1. The origin of this software must not be misrepresented; you must not
  23. // claim that you wrote the original software. If you use this software
  24. // in a product, an acknowledgment in the product documentation would be
  25. // appreciated but is not required.
  26. //
  27. // 2. Altered source versions must be plainly marked as such, and must not be
  28. // misrepresented as being the original software.
  29. //
  30. // 3. This notice may not be removed or altered from any source distribution.
  31. //
  32. #pragma GCC diagnostic push
  33. #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis"
  34. #import <UIKit/UIKit.h>
  35. #import <Availability.h>
  36. #undef weak_delegate
  37. #if __has_feature(objc_arc_weak)
  38. #define weak_delegate weak
  39. #else
  40. #define weak_delegate unsafe_unretained
  41. #endif
  42. extern const CGPathRef FXPageControlDotShapeCircle;
  43. extern const CGPathRef FXPageControlDotShapeSquare;
  44. extern const CGPathRef FXPageControlDotShapeTriangle;
  45. @protocol FXPageControlDelegate;
  46. IB_DESIGNABLE @interface FXPageControl : UIControl
  47. - (void)setUp;
  48. - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount;
  49. - (void)updateCurrentPageDisplay;
  50. @property (nonatomic, weak_delegate) IBOutlet id <FXPageControlDelegate> delegate;
  51. @property (nonatomic, assign) IBInspectable NSInteger currentPage;
  52. @property (nonatomic, assign) IBInspectable NSInteger numberOfPages;
  53. @property (nonatomic, assign) IBInspectable BOOL defersCurrentPageDisplay;
  54. @property (nonatomic, assign) IBInspectable BOOL hidesForSinglePage;
  55. @property (nonatomic, assign, getter = isWrapEnabled) IBInspectable BOOL wrapEnabled;
  56. @property (nonatomic, assign, getter = isVertical) IBInspectable BOOL vertical;
  57. @property (nonatomic, strong) IBInspectable UIImage *dotImage;
  58. @property (nonatomic, assign) IBInspectable CGPathRef dotShape;
  59. @property (nonatomic, assign) IBInspectable CGFloat dotSize;
  60. @property (nonatomic, strong) IBInspectable UIColor *dotColor;
  61. @property (nonatomic, strong) IBInspectable UIColor *dotShadowColor;
  62. @property (nonatomic, assign) IBInspectable CGFloat dotShadowBlur;
  63. @property (nonatomic, assign) IBInspectable CGSize dotShadowOffset;
  64. @property (nonatomic, strong) IBInspectable UIImage *selectedDotImage;
  65. @property (nonatomic, assign) IBInspectable CGPathRef selectedDotShape;
  66. @property (nonatomic, assign) IBInspectable CGFloat selectedDotSize;
  67. @property (nonatomic, strong) IBInspectable UIColor *selectedDotColor;
  68. @property (nonatomic, strong) IBInspectable UIColor *selectedDotShadowColor;
  69. @property (nonatomic, assign) IBInspectable CGFloat selectedDotShadowBlur;
  70. @property (nonatomic, assign) IBInspectable CGSize selectedDotShadowOffset;
  71. @property (nonatomic, assign) IBInspectable CGFloat dotSpacing;
  72. @end
  73. @protocol FXPageControlDelegate <NSObject>
  74. @optional
  75. - (UIImage *)pageControl:(FXPageControl *)pageControl imageForDotAtIndex:(NSInteger)index;
  76. - (CGPathRef)pageControl:(FXPageControl *)pageControl shapeForDotAtIndex:(NSInteger)index;
  77. - (UIColor *)pageControl:(FXPageControl *)pageControl colorForDotAtIndex:(NSInteger)index;
  78. - (UIImage *)pageControl:(FXPageControl *)pageControl selectedImageForDotAtIndex:(NSInteger)index;
  79. - (CGPathRef)pageControl:(FXPageControl *)pageControl selectedShapeForDotAtIndex:(NSInteger)index;
  80. - (UIColor *)pageControl:(FXPageControl *)pageControl selectedColorForDotAtIndex:(NSInteger)index;
  81. @end
  82. #pragma GCC diagnostic pop