REMenu.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // REMenu.h
  3. // REMenu
  4. //
  5. // Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. //
  25. #import <UIKit/UIKit.h>
  26. #import <QuartzCore/QuartzCore.h>
  27. #import "RECommonFunctions.h"
  28. #import "REMenuItem.h"
  29. #import "REMenuContainerView.h"
  30. @class REMenuItem;
  31. typedef NS_ENUM(NSInteger, REMenuImageAlignment) {
  32. REMenuImageAlignmentLeft,
  33. REMenuImageAlignmentRight
  34. };
  35. typedef NS_ENUM(NSInteger, REMenuLiveBackgroundStyle) {
  36. REMenuLiveBackgroundStyleLight,
  37. REMenuLiveBackgroundStyleDark
  38. };
  39. @interface REMenu : NSObject
  40. // Menu View
  41. //
  42. @property (strong, readwrite, nonatomic) UIView *menuView;
  43. // Data
  44. //
  45. @property (strong, readwrite, nonatomic) NSArray *items;
  46. @property (strong, readwrite, nonatomic) UIView *backgroundView;
  47. @property (assign, readonly, nonatomic) BOOL isOpen;
  48. @property (assign, readonly, nonatomic) BOOL isAnimating;
  49. @property (assign, readwrite, nonatomic) BOOL waitUntilAnimationIsComplete;
  50. @property (copy, readwrite, nonatomic) void (^closeCompletionHandler)(void);
  51. @property (copy, readwrite, nonatomic) void (^closePreparationBlock)(void);
  52. @property (assign, readwrite, nonatomic) BOOL closeOnSelection;
  53. // Style
  54. //
  55. @property (assign, readwrite, nonatomic) CGFloat cornerRadius;
  56. @property (strong, readwrite, nonatomic) UIColor *shadowColor;
  57. @property (assign, readwrite, nonatomic) CGSize shadowOffset;
  58. @property (assign, readwrite, nonatomic) CGFloat shadowOpacity;
  59. @property (assign, readwrite, nonatomic) CGFloat shadowRadius;
  60. @property (assign, readwrite, nonatomic) CGFloat itemHeight;
  61. @property (assign, readwrite, nonatomic) CGFloat backgroundAlpha;
  62. @property (strong, readwrite, nonatomic) UIColor *backgroundColor;
  63. @property (strong, readwrite, nonatomic) UIColor *separatorColor;
  64. @property (assign, readwrite, nonatomic) CGFloat separatorHeight;
  65. @property (assign, readwrite, nonatomic) CGSize separatorOffset;
  66. @property (strong, readwrite, nonatomic) UIFont *font;
  67. @property (strong, readwrite, nonatomic) UIColor *textColor;
  68. @property (strong, readwrite, nonatomic) UIColor *textShadowColor;
  69. @property (assign, readwrite, nonatomic) CGSize textOffset;
  70. @property (assign, readwrite, nonatomic) CGSize textShadowOffset;
  71. @property (assign, readwrite, nonatomic) REMenuImageAlignment imageAlignment;
  72. @property (strong, readwrite, nonatomic) UIColor *imageTintColor;
  73. @property (assign, readwrite, nonatomic) CGSize imageOffset;
  74. @property (strong, readwrite, nonatomic) UIColor *highlightedBackgroundColor;
  75. @property (strong, readwrite, nonatomic) UIColor *highlightedSeparatorColor;
  76. @property (strong, readwrite, nonatomic) UIColor *highlightedTextColor;
  77. @property (strong, readwrite, nonatomic) UIColor *highlightedTextShadowColor;
  78. @property (strong, readwrite, nonatomic) UIColor *highlightedImageTintColor;
  79. @property (assign, readwrite, nonatomic) CGSize highlightedTextShadowOffset;
  80. @property (assign, readwrite, nonatomic) CGFloat borderWidth;
  81. @property (strong, readwrite, nonatomic) UIColor *borderColor;
  82. @property (assign, readwrite, nonatomic) NSTextAlignment textAlignment;
  83. @property (strong, readwrite, nonatomic) UIFont *subtitleFont;
  84. @property (strong, readwrite, nonatomic) UIColor *subtitleTextColor;
  85. @property (strong, readwrite, nonatomic) UIColor *subtitleTextShadowColor;
  86. @property (assign, readwrite, nonatomic) CGSize subtitleTextOffset;
  87. @property (assign, readwrite, nonatomic) CGSize subtitleTextShadowOffset;
  88. @property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextColor;
  89. @property (strong, readwrite, nonatomic) UIColor *subtitleHighlightedTextShadowColor;
  90. @property (assign, readwrite, nonatomic) CGSize subtitleHighlightedTextShadowOffset;
  91. @property (assign, readwrite, nonatomic) NSTextAlignment subtitleTextAlignment;
  92. @property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
  93. @property (assign, readwrite, nonatomic) NSTimeInterval closeAnimationDuration;
  94. @property (assign, readwrite, nonatomic) NSTimeInterval bounceAnimationDuration;
  95. @property (assign, readwrite, nonatomic) BOOL appearsBehindNavigationBar;
  96. @property (assign, readwrite, nonatomic) BOOL bounce;
  97. @property (assign, readwrite, nonatomic) BOOL liveBlur; // Available only in iOS 7
  98. @property (strong, readwrite, nonatomic) UIColor *liveBlurTintColor; // Available only in iOS 7
  99. @property (assign, readwrite, nonatomic) REMenuLiveBackgroundStyle liveBlurBackgroundStyle; // Available only in iOS 7
  100. @property (copy, readwrite, nonatomic) void (^badgeLabelConfigurationBlock)(UILabel *badgeLabel, REMenuItem *item);
  101. - (id)initWithItems:(NSArray *)items;
  102. - (void)showFromRect:(CGRect)rect inView:(UIView *)view;
  103. - (void)showInView:(UIView *)view;
  104. - (void)showFromNavigationController:(UINavigationController *)navigationController;
  105. - (void)showFromNavigationController:(UINavigationController *)navigationController offsetX:(CGFloat)offsetX width:(CGFloat)width;
  106. - (void)setNeedsLayout;
  107. - (void)closeWithCompletion:(void (^)(void))completion;
  108. - (void)close;
  109. @end