KMToolbar.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // KMToolbar.h
  3. //
  4. // Copyright © 2022 Kdan Mobile. All rights reserved.
  5. //
  6. #import <Cocoa/Cocoa.h>
  7. typedef NS_ENUM(NSInteger, KMToolBoxImagePosition) {
  8. KMToolBoxImagePosition_Only = 0,
  9. KMToolBoxImagePosition_Left,
  10. KMToolBoxImagePosition_ExpandLeft,
  11. KMToolBoxImagePosition_Above,
  12. };
  13. extern NSString *KMNewToolbarSpaceItemIdentifier;
  14. extern NSString *KMToolbarDividerItemIdentifier;
  15. @interface KMToolbarClickButton : NSButton
  16. @property (nonatomic,assign) id clickObject;
  17. @end
  18. @interface KMToolBoxItem : NSView
  19. @property (nonatomic,retain) NSMenuItem *menuFormRepresentation;
  20. @property (nonatomic,readonly) NSString *itemIdentifier;
  21. @property(nonatomic,readonly) KMToolbarClickButton *clickButton;
  22. @property (nonatomic,assign) BOOL isSelected;
  23. @property (nonatomic,assign) BOOL unEnabled;
  24. @property (nonatomic,assign) BOOL isShowCustomToolTip;
  25. @property (nonatomic,assign) KMToolBoxImagePosition boxImagePosition;
  26. @property (nonatomic,retain) NSImage * image;
  27. @property (nonatomic,retain) NSImage * selectedImage;
  28. @property (nonatomic,retain) NSString * titleName;
  29. @property (nonatomic,retain) NSImage * alternateImage;
  30. @property (nonatomic,assign) id target;
  31. @property (nonatomic,assign) BOOL needExpandAction;
  32. @property (nonatomic,assign) NSInteger btnTag;
  33. @property (nonatomic,assign) SEL btnAction;
  34. @property (nonatomic,retain) NSView *customizeView;
  35. @property (nonatomic,assign) BOOL isMainTool;
  36. @property (nonatomic,retain) NSView *linView;
  37. @property (nonatomic,retain) NSColor *normalBackgroundColor;
  38. @property (nonatomic,retain) NSColor *selectedBackgroundColor;
  39. //- (instancetype)initWithItemIdentifier:(NSString *)itemIdentifier
  40. // postition:(KMToolBoxImagePosition)imagePositionImagePosition
  41. // withPopMenu:(KMCustomButtonPopMenuViewController *)popMenuViewController;
  42. - (instancetype)initWithItemIdentifier:(NSString *)itemIdentifier
  43. postition:(KMToolBoxImagePosition)imagePositionImagePosition;
  44. - (instancetype)initWithItemIdentifier:(NSString *)itemIdentifier;
  45. @end
  46. @protocol KMNewToolbarDelegate;
  47. @interface KMToolbar : NSView
  48. @property (nonatomic,readonly) NSString *toolbarIdentifier;
  49. @property (nonatomic,weak) id<KMNewToolbarDelegate> delegate;
  50. @property (nonatomic,readonly) NSArray<KMToolBoxItem *> *items;
  51. - (instancetype)initWithIdentifier:(NSString *)identifier;
  52. - (void)reloadData;
  53. - (KMToolBoxItem * _Nullable)itemForItemIdentifier:(NSString * _Nonnull)itemIdentifier;
  54. @end
  55. @protocol KMNewToolbarDelegate <NSObject>
  56. @optional
  57. - (KMToolBoxItem *)toolbar:(KMToolbar *)toolbar itemForItemIdentifier:(NSString *)identifier;
  58. - (NSArray<NSString *> *)toolbarAllowedItemIdentifiers:(KMToolbar *)toolbar;
  59. - (NSArray<NSString *> *)toolbarDefaultItemIdentifiers:(KMToolbar *)toolbar;
  60. - (NSArray<NSString *> *)toolbarLeftDefaultItemIdentifiers:(KMToolbar *)toolbar;
  61. - (NSArray<NSString *> *)toolbarRightDefaultItemIdentifiers:(KMToolbar *)toolbar;
  62. @end