fakes.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // fakes.h
  3. // FLEX
  4. //
  5. // Created by Kevin Bradley on 12/22/20.
  6. // Copyright © 2020 Flipboard. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @interface UIFakeSwitch : UIControl <NSCoding>
  10. @property(nullable, nonatomic, strong) UIColor *onTintColor;
  11. @property(nullable, nonatomic, strong) UIColor *thumbTintColor;
  12. @property(nullable, nonatomic, strong) UIImage *onImage;
  13. @property(nullable, nonatomic, strong) UIImage *offImage;
  14. @property(nonatomic,getter=isOn) BOOL on;
  15. - (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; // This class enforces a size appropriate for the control, and so the frame size is ignored.
  16. - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
  17. - (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action
  18. @end
  19. @interface UIFakeSlider: UIControl <NSCoding>
  20. @property(nonatomic) float value;
  21. @property(nonatomic) float minimumValue;
  22. @property(nonatomic) float maximumValue;
  23. @property(nonatomic) float minValue;
  24. @property(nonatomic) float maxValue;
  25. @property(nonatomic) float allowedMinValue;
  26. @property(nonatomic) float allowedMaxValue;
  27. @property(nullable, nonatomic,strong) UIImage *minimumValueImage;
  28. @property(nullable, nonatomic,strong) UIImage *maximumValueImage;
  29. @property(nonatomic,getter=isContinuous) BOOL continuous;
  30. @property(nullable, nonatomic,strong) UIColor *minimumTrackTintColor;
  31. @property(nullable, nonatomic,strong) UIColor *maximumTrackTintColor;
  32. @property(nullable, nonatomic,strong) UIColor *thumbTintColor;
  33. - (void)setValue:(float)value animated:(BOOL)animated;
  34. - (void)setThumbImage:(nullable UIImage *)image forState:(UIControlState)state;
  35. - (void)setMinimumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
  36. - (void)setMaximumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
  37. - (nullable UIImage *)thumbImageForState:(UIControlState)state;
  38. - (nullable UIImage *)minimumTrackImageForState:(UIControlState)state;
  39. - (nullable UIImage *)maximumTrackImageForState:(UIControlState)state;
  40. @property(nullable,nonatomic,readonly) UIImage *currentThumbImage;
  41. @property(nullable,nonatomic,readonly) UIImage *currentMinimumTrackImage;
  42. @property(nullable,nonatomic,readonly) UIImage *currentMaximumTrackImage;
  43. // lets a subclass lay out the track and thumb as needed
  44. - (CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
  45. - (CGRect)maximumValueImageRectForBounds:(CGRect)bounds;
  46. - (CGRect)trackRectForBounds:(CGRect)bounds;
  47. - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value;
  48. @end