From 6fa635da35a07675b4a24bb0da27914eae8548ba Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Mon, 7 Jan 2013 16:51:12 +0100 Subject: [PATCH 1/4] Added gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b627ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +build +*.mode1v3 +*.pbxuser +project.xcworkspace +xcuserdata +.svn From 0bab4dae6e42ed4e3e21fe1eac7d86ec2b9e5261 Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Wed, 11 Oct 2023 16:23:57 +0200 Subject: [PATCH 2/4] Fix a few warnings --- DMTabBar/DMTabBar/DMTabBar.m | 4 ++-- DMTabBar/DMTabBar/DMTabBarItem.m | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DMTabBar/DMTabBar/DMTabBar.m b/DMTabBar/DMTabBar/DMTabBar.m index cf63abb..d0bcf97 100644 --- a/DMTabBar/DMTabBar/DMTabBar.m +++ b/DMTabBar/DMTabBar/DMTabBar.m @@ -140,7 +140,7 @@ - (void) setTabBarItems:(NSArray *)newTabBarItems { [self.tabBarItems enumerateObjectsUsingBlock:^(DMTabBarItem * tabBarItem, NSUInteger idx, BOOL *stop) { NSButton *itemButton = tabBarItem.tabBarItemButton; itemButton.frame = NSMakeRect(0.0f, 0.0f, kDMTabBarItemWidth, NSHeight(self.bounds)); - itemButton.state = (itemIndex == selectedItemIndex ? NSOnState : NSOffState); + itemButton.state = (itemIndex == selectedItemIndex ? NSControlStateValueOn : NSControlStateValueOff); itemButton.action = @selector(selectTabBarItem:); itemButton.target = self; [self addSubview:itemButton]; @@ -164,7 +164,7 @@ - (void) setSelectedTabBarItem:(DMTabBarItem *)newSelectedTabBarItem { __block NSUInteger buttonIndex = 0; [self.tabBarItems enumerateObjectsUsingBlock:^(DMTabBarItem* tabBarItem, NSUInteger idx, BOOL *stop) { - tabBarItem.state = (buttonIndex == selectedItemIndex ? NSOnState : NSOffState); + tabBarItem.state = (buttonIndex == selectedItemIndex ? NSControlStateValueOn : NSControlStateValueOff); ++buttonIndex; }]; } diff --git a/DMTabBar/DMTabBar/DMTabBarItem.m b/DMTabBar/DMTabBar/DMTabBarItem.m index 1e40021..68ad569 100644 --- a/DMTabBar/DMTabBar/DMTabBarItem.m +++ b/DMTabBar/DMTabBar/DMTabBarItem.m @@ -44,12 +44,12 @@ - (id)initWithIcon:(NSImage *) iconImage tag:(NSUInteger) itemTag { self = [super init]; if (self) { // Create associated NSButton to place inside the bar (it's customized by DMTabBarButtonCell with a special gradient for selected state) - tabBarItemButton = [[NSButton alloc] initWithFrame:NSZeroRect]; - tabBarItemButton.cell = [[DMTabBarButtonCell alloc] init]; - tabBarItemButton.image = iconImage; - [tabBarItemButton setEnabled:YES]; - tabBarItemButton.tag = itemTag; - [tabBarItemButton sendActionOn:NSLeftMouseDownMask]; + self.tabBarItemButton = [[NSButton alloc] initWithFrame:NSZeroRect]; + self.tabBarItemButton.cell = [[DMTabBarButtonCell alloc] init]; + self.tabBarItemButton.image = iconImage; + self.tabBarItemButton.enabled = YES; + self.tabBarItemButton.tag = itemTag; + [self.tabBarItemButton sendActionOn:NSEventMaskLeftMouseDown]; } return self; } @@ -130,7 +130,7 @@ - (NSInteger) nextState { } - (void) drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView { - if (self.state == NSOnState) { + if (self.state == NSControlStateValueOn) { // If selected we need to draw the border new background for selection (otherwise we will use default back color) // Save current context [[NSGraphicsContext currentContext] saveGraphicsState]; From f1c4b25cabbefc7bb8cefa6b640c417b773dd441 Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Mon, 16 Oct 2023 20:15:50 +0200 Subject: [PATCH 3/4] Fix build error --- DMTabBar/DMTabBar/DMTabBarItem.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DMTabBar/DMTabBar/DMTabBarItem.m b/DMTabBar/DMTabBar/DMTabBarItem.m index 68ad569..b2c4259 100644 --- a/DMTabBar/DMTabBar/DMTabBarItem.m +++ b/DMTabBar/DMTabBar/DMTabBarItem.m @@ -44,12 +44,12 @@ - (id)initWithIcon:(NSImage *) iconImage tag:(NSUInteger) itemTag { self = [super init]; if (self) { // Create associated NSButton to place inside the bar (it's customized by DMTabBarButtonCell with a special gradient for selected state) - self.tabBarItemButton = [[NSButton alloc] initWithFrame:NSZeroRect]; - self.tabBarItemButton.cell = [[DMTabBarButtonCell alloc] init]; - self.tabBarItemButton.image = iconImage; - self.tabBarItemButton.enabled = YES; - self.tabBarItemButton.tag = itemTag; - [self.tabBarItemButton sendActionOn:NSEventMaskLeftMouseDown]; + tabBarItemButton = [[NSButton alloc] initWithFrame:NSZeroRect]; + tabBarItemButton.cell = [[DMTabBarButtonCell alloc] init]; + tabBarItemButton.image = iconImage; + tabBarItemButton.enabled = YES; + tabBarItemButton.tag = itemTag; + [tabBarItemButton sendActionOn:NSEventMaskLeftMouseDown]; } return self; } From 7c9d184beaf78a099b74f77993f70ed257c147fa Mon Sep 17 00:00:00 2001 From: Oliver Drobnik Date: Mon, 23 Oct 2023 10:36:58 +0200 Subject: [PATCH 4/4] Fixed warnings --- DMTabBar/DMTabBar/DMTabBarItem.h | 10 +++++----- DMTabBar/DMTabBar/DMTabBarItem.m | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DMTabBar/DMTabBar/DMTabBarItem.h b/DMTabBar/DMTabBar/DMTabBarItem.h index 56352ef..2052f86 100644 --- a/DMTabBar/DMTabBar/DMTabBarItem.h +++ b/DMTabBar/DMTabBar/DMTabBarItem.h @@ -11,13 +11,13 @@ @interface DMTabBarItem : NSButtonCell { } -@property (nonatomic,assign) BOOL enabled; // YES or NO to enable or disable the item +@property (getter=isEnabled) BOOL enabled; // YES or NO to enable or disable the item @property (nonatomic,strong) NSImage* icon; // That's the image of the item @property (nonatomic,strong) NSString* toolTip; // Tool tip message -@property (nonatomic,strong) NSString* keyEquivalent; // Shortcut key equivalent -@property (nonatomic,assign) NSUInteger keyEquivalentModifierMask; // Shortcut modifier key (keyEquivalentModifierMask+keyEquivalent = event) -@property (nonatomic,assign) NSUInteger tag; // Tag of the item -@property (nonatomic,assign) NSInteger state; // Current state (NSOnState = selected) +@property (copy) NSString *keyEquivalent; // Shortcut key equivalent +@property NSEventModifierFlags keyEquivalentModifierMask; // Shortcut modifier key (keyEquivalentModifierMask+keyEquivalent = event) +@property NSInteger tag; // Tag of the item +@property NSControlStateValue state; // Current state (NSOnState = selected) // Internal use // We'll use a customized NSButton (+NSButtonCell) and apply it inside the bar for each item. diff --git a/DMTabBar/DMTabBar/DMTabBarItem.m b/DMTabBar/DMTabBar/DMTabBarItem.m index b2c4259..6960441 100644 --- a/DMTabBar/DMTabBar/DMTabBarItem.m +++ b/DMTabBar/DMTabBar/DMTabBarItem.m @@ -70,11 +70,11 @@ - (NSImage *) icon { return tabBarItemButton.image; } -- (void) setTag:(NSUInteger)newTag { +- (void) setTag:(NSInteger)newTag { tabBarItemButton.tag = newTag; } -- (NSUInteger) tag { +- (NSInteger) tag { return tabBarItemButton.tag; } @@ -86,11 +86,11 @@ - (NSString *) toolTip { return tabBarItemButton.toolTip; } -- (void) setKeyEquivalentModifierMask:(NSUInteger)newKeyEquivalentModifierMask { - tabBarItemButton.keyEquivalentModifierMask = newKeyEquivalentModifierMask; +- (void) setKeyEquivalentModifierMask:(NSEventModifierFlags)newKeyEquivalentModifierMask { + tabBarItemButton.keyEquivalentModifierMask = newKeyEquivalentModifierMask; } -- (NSUInteger) keyEquivalentModifierMask { +- (NSEventModifierFlags) keyEquivalentModifierMask { return tabBarItemButton.keyEquivalentModifierMask; } @@ -120,7 +120,7 @@ @implementation DMTabBarButtonCell - (id)init { self = [super init]; if (self) { - self.bezelStyle = NSTexturedRoundedBezelStyle; + self.bezelStyle = NSBezelStyleToolbar; } return self; }