12345678910111213141516171819202122232425262728293031323334353637 |
- //
- // KMToolbarItem.m
- // SignFlow
- //
- // Created by 王帅 on 2021/3/26.
- //
- #import "KMToolbarItem.h"
- @implementation KMToolbarItem
- - (void)validate {
- if ([self view] && [[[self toolbar] delegate] respondsToSelector:@selector(validateToolbarItem:)]) {
- BOOL enabled = [(id)[[self toolbar] delegate] validateToolbarItem:self];
- [self setEnabled:enabled];
- }
- [super validate];
- }
- - (void)setLabels:(NSString *)label {
- [self setLabel:label];
- [self setPaletteLabel:label];
- }
- - (void)setViewWithSizes:(NSView *)view {
- if ([view isKindOfClass:[NSSegmentedControl class]]) {
- [(NSSegmentedControl *)view sizeToFit];
- }
- [self setView:view];
- [self.view setFrame:view.bounds];
- }
- - (void)setImageNamed:(NSString *)name {
- [self setImage:[NSImage imageNamed:name]];
- }
- @end
|