fakes.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #import "FLEXMacros.h"
  10. #import "KBSlider.h"
  11. #import "KBDatePickerView.h"
  12. @interface UIFakeSwitch : UIButton <NSCoding>
  13. @property(nullable, nonatomic, strong) UIColor *onTintColor;
  14. @property(nullable, nonatomic, strong) UIColor *thumbTintColor;
  15. @property(nullable, nonatomic, strong) UIImage *onImage;
  16. @property(nullable, nonatomic, strong) UIImage *offImage;
  17. @property(nonatomic,getter=isOn) BOOL on;
  18. - (instancetype _Nonnull )initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; // This class enforces a size appropriate for the control, and so the frame size is ignored.
  19. - (nullable instancetype)initWithCoder:(NSCoder *_Nonnull)coder NS_DESIGNATED_INITIALIZER;
  20. - (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action
  21. + (id _Nonnull )newSwitch;
  22. @end
  23. @interface UIFakeSlider: UIControl <NSCoding>
  24. @property(nonatomic) float value;
  25. @property(nonatomic) float minimumValue;
  26. @property(nonatomic) float maximumValue;
  27. @property(nonatomic) float minValue;
  28. @property(nonatomic) float maxValue;
  29. @property(nonatomic) float allowedMinValue;
  30. @property(nonatomic) float allowedMaxValue;
  31. @property(nullable, nonatomic,strong) UIImage *minimumValueImage;
  32. @property(nullable, nonatomic,strong) UIImage *maximumValueImage;
  33. @property(nonatomic,getter=isContinuous) BOOL continuous;
  34. @property(nullable, nonatomic,strong) UIColor *minimumTrackTintColor;
  35. @property(nullable, nonatomic,strong) UIColor *maximumTrackTintColor;
  36. @property(nullable, nonatomic,strong) UIColor *thumbTintColor;
  37. - (void)setValue:(float)value animated:(BOOL)animated;
  38. - (void)setThumbImage:(nullable UIImage *)image forState:(UIControlState)state;
  39. - (void)setMinimumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
  40. - (void)setMaximumTrackImage:(nullable UIImage *)image forState:(UIControlState)state;
  41. - (nullable UIImage *)thumbImageForState:(UIControlState)state;
  42. - (nullable UIImage *)minimumTrackImageForState:(UIControlState)state;
  43. - (nullable UIImage *)maximumTrackImageForState:(UIControlState)state;
  44. @property(nullable,nonatomic,readonly) UIImage *currentThumbImage;
  45. @property(nullable,nonatomic,readonly) UIImage *currentMinimumTrackImage;
  46. @property(nullable,nonatomic,readonly) UIImage *currentMaximumTrackImage;
  47. // lets a subclass lay out the track and thumb as needed
  48. - (CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
  49. - (CGRect)maximumValueImageRectForBounds:(CGRect)bounds;
  50. - (CGRect)trackRectForBounds:(CGRect)bounds;
  51. - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value;
  52. @end