From c20ece1b66ca8c3c48be54c4b1dcd42623942e88 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 14:39:37 +0200 Subject: [PATCH 01/21] Using ARC, some code optimization --- MMTabBarView/MMTabBarView/MMTabBarButton.Common.h | 13 +++++++++++++ .../MMTabBarView/MMTabBarButtonCell.Private.h | 13 +++++++++++++ MMTabBarView/MMTabBarView/MMTabBarView.Private.h | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 MMTabBarView/MMTabBarView/MMTabBarButton.Common.h create mode 100644 MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h create mode 100644 MMTabBarView/MMTabBarView/MMTabBarView.Private.h diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h new file mode 100644 index 00000000..aecd59dd --- /dev/null +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h @@ -0,0 +1,13 @@ +// +// MMTabBarButton.Common.h +// MMTabBarView +// +// Created by Michael Monscheuer on 23/05/15. +// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// + +#ifndef MMTabBarView_MMTabBarButton_Common_h +#define MMTabBarView_MMTabBarButton_Common_h + + +#endif diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h new file mode 100644 index 00000000..18b6996d --- /dev/null +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h @@ -0,0 +1,13 @@ +// +// MMTabBarButtonCell.Private.h +// MMTabBarView +// +// Created by Michael Monscheuer on 23/05/15. +// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// + +#ifndef MMTabBarView_MMTabBarButtonCell_Private_h +#define MMTabBarView_MMTabBarButtonCell_Private_h + + +#endif diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h new file mode 100644 index 00000000..c9812081 --- /dev/null +++ b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h @@ -0,0 +1,13 @@ +// +// MMTabBarView.Private.h +// MMTabBarView +// +// Created by Michael Monscheuer on 23/05/15. +// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// + +#ifndef MMTabBarView_MMTabBarView_Private_h +#define MMTabBarView_MMTabBarView_Private_h + + +#endif From 2ddaf4396097594c2d0dabf64d0070207e8f8c22 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 14:40:28 +0200 Subject: [PATCH 02/21] ARC, code optimization, min required: 10.9 --- Configurations/Base.xcconfig | 5 +- .../project.pbxproj | 6 +- .../MMTabBarView Demo/DemoFakeModel.h | 10 +- .../MMTabBarView Demo/DemoFakeModel.m | 15 +- .../MMTabBarView Demo/DemoWindowController.m | 16 +- .../MMTabBarView Demo/MMAppDelegate.m | 4 - .../MMTabBarView.xcodeproj/project.pbxproj | 14 ++ .../MMTabBarView/MMAttachedTabBarButton.h | 30 ++- .../MMTabBarView/MMAttachedTabBarButton.m | 52 ++--- .../MMTabBarView/MMAttachedTabBarButtonCell.h | 11 +- .../MMTabBarView/MMAttachedTabBarButtonCell.m | 13 +- .../MMTabBarView/MMOverflowPopUpButton.h | 2 +- .../MMTabBarView/MMOverflowPopUpButton.m | 7 +- .../MMTabBarView/MMOverflowPopUpButtonCell.h | 4 +- .../MMTabBarView/MMOverflowPopUpButtonCell.m | 19 +- MMTabBarView/MMTabBarView/MMRolloverButton.m | 8 +- .../MMTabBarView/MMRolloverButtonCell.h | 6 +- .../MMTabBarView/MMRolloverButtonCell.m | 13 +- .../MMTabBarView/MMSlideButtonsAnimation.h | 2 +- .../MMTabBarView/MMSlideButtonsAnimation.m | 4 +- .../MMTabBarView/MMTabBarButton.Common.h | 29 ++- MMTabBarView/MMTabBarView/MMTabBarButton.h | 71 +++---- MMTabBarView/MMTabBarView/MMTabBarButton.m | 30 +-- .../MMTabBarView/MMTabBarButtonCell.Private.h | 11 +- .../MMTabBarView/MMTabBarButtonCell.h | 185 ++++++++++-------- .../MMTabBarView/MMTabBarButtonCell.m | 101 +++------- .../MMTabBarView/MMTabBarController.h | 2 +- .../MMTabBarView/MMTabBarController.m | 9 +- .../MMTabBarView/MMTabBarView.Private.h | 8 +- MMTabBarView/MMTabBarView/MMTabBarView.h | 21 +- MMTabBarView/MMTabBarView/MMTabBarView.m | 90 ++++----- .../MMTabBarView/MMTabDragAssistant.h | 10 +- .../MMTabBarView/MMTabDragAssistant.m | 28 ++- MMTabBarView/MMTabBarView/MMTabDragView.m | 13 +- MMTabBarView/MMTabBarView/MMTabDragWindow.h | 4 +- MMTabBarView/MMTabBarView/MMTabDragWindow.m | 8 +- .../MMTabBarView/MMTabDragWindowController.h | 2 +- .../MMTabBarView/MMTabDragWindowController.m | 12 +- .../MMTabBarView/MMTabPasteboardItem.m | 2 +- .../NSBezierPath+MMTabBarViewExtensions.h | 5 +- .../NSString+MMTabBarViewExtensions.m | 2 +- .../NSView+MMTabBarViewExtensions.m | 1 - .../MMTabBarView/Styles/MMAdiumTabStyle.h | 23 +-- .../MMTabBarView/Styles/MMAdiumTabStyle.m | 124 +++--------- .../MMTabBarView/Styles/MMAquaTabStyle.h | 20 +- .../MMTabBarView/Styles/MMAquaTabStyle.m | 123 +++++------- .../MMTabBarView/Styles/MMCardTabStyle.h | 11 -- .../MMTabBarView/Styles/MMCardTabStyle.m | 44 ++--- .../MMTabBarView/Styles/MMLiveChatTabStyle.h | 13 +- .../MMTabBarView/Styles/MMLiveChatTabStyle.m | 61 +++--- .../MMTabBarView/Styles/MMMetalTabStyle.h | 14 +- .../MMTabBarView/Styles/MMMetalTabStyle.m | 72 +++---- .../MMTabBarView/Styles/MMUnifiedTabStyle.h | 12 +- .../MMTabBarView/Styles/MMUnifiedTabStyle.m | 73 ++----- .../Safari Tab Style/MMSafariTabStyle.h | 6 +- .../Safari Tab Style/MMSafariTabStyle.m | 25 +-- .../xcshareddata/default.xccheckout | 10 +- .../xcschemes/MMTabBarView Demo.xcscheme | 8 +- .../xcschemes/MMTabBarView.xcscheme | 11 +- 59 files changed, 623 insertions(+), 912 deletions(-) diff --git a/Configurations/Base.xcconfig b/Configurations/Base.xcconfig index 0f5ac13d..147a3727 100644 --- a/Configurations/Base.xcconfig +++ b/Configurations/Base.xcconfig @@ -1,8 +1,8 @@ -ARCHS = $(ARCHS_STANDARD_32_64_BIT) +ARCHS = $(ARCHS_STANDARD) GCC_WARN_ABOUT_RETURN_TYPE = YES GCC_C_LANGUAGE_STANDARD = gnu99 GCC_WARN_UNUSED_VARIABLE = YES -MACOSX_DEPLOYMENT_TARGET = 10.6 +MACOSX_DEPLOYMENT_TARGET = 10.9 SDKROOT = macosx COMBINE_HIDPI_IMAGES = NO WARNING_CFLAGS = -Wmost -Wno-four-char-constants -Wno-unknown-pragmas @@ -10,4 +10,3 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0 GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h GCC_PRECOMPILE_PREFIX_HEADER = YES CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES - diff --git a/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj b/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj index a08b30a6..2cf2943a 100644 --- a/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj +++ b/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 0634F0A0160A0D3F00A6C86A /* DemoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0634F09E160A0D3F00A6C86A /* DemoWindowController.m */; }; 0634F0A6160A0D6200A6C86A /* largeImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 0634F0A5160A0D6200A6C86A /* largeImage.png */; }; 0634F0AB160A0D7900A6C86A /* DemoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0634F0A7160A0D7900A6C86A /* DemoWindow.xib */; }; - 0634F0B6160A1D5D00A6C86A /* MMTabBarView.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 06DB23EA1609F5D80071BDA0 /* MMTabBarView.framework */; }; + 0634F0B6160A1D5D00A6C86A /* MMTabBarView.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 06DB23EA1609F5D80071BDA0 /* MMTabBarView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 06DB23CE1609F5B90071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23CD1609F5B90071BDA0 /* Cocoa.framework */; }; 06DB23D81609F5B90071BDA0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 06DB23D61609F5B90071BDA0 /* InfoPlist.strings */; }; 06DB23DA1609F5B90071BDA0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 06DB23D91609F5B90071BDA0 /* main.m */; }; @@ -208,7 +208,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = MM; - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0630; ORGANIZATIONNAME = "Michael Monscheuer"; }; buildConfigurationList = 06DB23C31609F5B90071BDA0 /* Build configuration list for PBXProject "MMTabBarView Demo" */; @@ -340,6 +340,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 0634F0BB160A1F6500A6C86A /* MMTabBarViewDemo-Debug.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MMTabBarView Demo/MMTabBarView Demo-Prefix.pch"; @@ -353,6 +354,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 0634F0BC160A1F6500A6C86A /* MMTabBarViewDemo-Release.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MMTabBarView Demo/MMTabBarView Demo-Prefix.pch"; diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h index 586e66d8..7d8f204e 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h @@ -24,18 +24,18 @@ } @property (copy) NSString *title; -@property (retain) NSImage *largeImage; -@property (retain) NSImage *icon; -@property (retain) NSString *iconName; +@property (strong) NSImage *largeImage; +@property (strong) NSImage *icon; +@property (strong) NSString *iconName; @property (assign) BOOL isProcessing; @property (assign) NSInteger objectCount; -@property (retain) NSColor *objectCountColor; +@property (strong) NSColor *objectCountColor; @property (assign) BOOL showObjectCount; @property (assign) BOOL isEdited; @property (assign) BOOL hasCloseButton; // designated initializer -- (id)init; +- (instancetype)init; @end diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m index 8249f15b..89f148a2 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m @@ -22,7 +22,7 @@ @implementation DemoFakeModel @synthesize isEdited = _isEdited; @synthesize hasCloseButton = _hasCloseButton; -- (id)init { +- (instancetype)init { if (self = [super init]) { _isProcessing = NO; _icon = nil; @@ -31,7 +31,7 @@ - (id)init { _objectCount = 2; _isEdited = NO; _hasCloseButton = YES; - _title = [@"Untitled" retain]; + _title = @"Untitled"; _objectCountColor = nil; _showObjectCount = YES; } @@ -40,13 +40,12 @@ - (id)init { -(void)dealloc { - [_title release], _title = nil; - [_icon release], _icon = nil; - [_iconName release], _iconName = nil; - [_largeImage release], _largeImage = nil; - [_objectCountColor release], _objectCountColor = nil; + _title = nil; + _icon = nil; + _iconName = nil; + _largeImage = nil; + _objectCountColor = nil; - [super dealloc]; } @end diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m b/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m index 81f0bd35..d9d25070 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m @@ -60,7 +60,7 @@ - (void)awakeFromNib { [toolbar setAutosavesConfiguration:YES]; [toolbar setShowsBaselineSeparator:NO]; - [[self window] setToolbar:[toolbar autorelease]]; + [[self window] setToolbar:toolbar]; [tabBar addObserver:self forKeyPath:@"orientation" options:NSKeyValueObservingOptionNew context:NULL]; @@ -82,8 +82,6 @@ - (void)addNewTabWithTitle:(NSString *)aTitle { NSTabViewItem *newItem = [[NSTabViewItem alloc] initWithIdentifier:newModel]; [tabView addTabViewItem:newItem]; [tabView selectTabViewItem:newItem]; - [newModel release]; - [newItem release]; } - (void)addDefaultTabs { @@ -111,7 +109,7 @@ - (IBAction)closeTab:(id)sender { [[tabBar delegate] tabView:tabView willCloseTabViewItem:tabViewItem]; } - [tabView removeTabViewItem:[[tabViewItem retain] autorelease]]; + [tabView removeTabViewItem:tabViewItem]; if (([tabBar delegate]) && ([[tabBar delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)])) { [[tabBar delegate] tabView:tabView didCloseTabViewItem:tabViewItem]; @@ -188,8 +186,6 @@ - (MMTabBarView *)tabBar { - (void)windowWillClose:(NSNotification *)note { [tabBar removeObserver:self forKeyPath:@"orientation"]; - - [self autorelease]; } - (void)menuNeedsUpdate:(NSMenu *)menu { @@ -503,17 +499,17 @@ - (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabView - (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(NSUInteger *)styleMask { // grabs whole window image - NSImage *viewImage = [[[NSImage alloc] init] autorelease]; + NSImage *viewImage = [[NSImage alloc] init]; NSRect contentFrame = [[[self window] contentView] frame]; [[[self window] contentView] lockFocus]; - NSBitmapImageRep *viewRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:contentFrame] autorelease]; + NSBitmapImageRep *viewRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:contentFrame]; [viewImage addRepresentation:viewRep]; [[[self window] contentView] unlockFocus]; // grabs snapshot of dragged tabViewItem's view (represents content being dragged) NSView *viewForImage = [tabViewItem view]; NSRect viewRect = [viewForImage frame]; - NSImage *tabViewImage = [[[NSImage alloc] initWithSize:viewRect.size] autorelease]; + NSImage *tabViewImage = [[NSImage alloc] initWithSize:viewRect.size]; [tabViewImage lockFocus]; [viewForImage drawRect:[viewForImage bounds]]; [tabViewImage unlockFocus]; @@ -621,7 +617,7 @@ - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString [item setAction:@selector(toggle:)]; } - return [item autorelease]; + return item; } - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar { diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m index 9d075543..35d0962e 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m +++ b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m @@ -12,10 +12,6 @@ @implementation MMAppDelegate -- (void)dealloc -{ - [super dealloc]; -} - (void)applicationDidFinishLaunching:(NSNotification *)pNotification { [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; diff --git a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj index fead80e5..bec2f94c 100644 --- a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj +++ b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj @@ -158,6 +158,9 @@ 06789DBF161337770080FCFE /* NSBezierPath+MMTabBarViewExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 06789DBD161337770080FCFE /* NSBezierPath+MMTabBarViewExtensions.m */; }; 069789581610A9E8009BB894 /* MMOverflowPopUpButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 069789561610A9E8009BB894 /* MMOverflowPopUpButtonCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; 069789591610A9E8009BB894 /* MMOverflowPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 069789571610A9E8009BB894 /* MMOverflowPopUpButtonCell.m */; }; + 06AE02301B10A21000C65A84 /* MMTabBarButton.Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAF160B555F00153FA2 /* MMSafariTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */; }; 06DB23AA1609F5830071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23A91609F5830071BDA0 /* Cocoa.framework */; }; @@ -322,6 +325,9 @@ 06789DBD161337770080FCFE /* NSBezierPath+MMTabBarViewExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBezierPath+MMTabBarViewExtensions.m"; sourceTree = ""; }; 069789561610A9E8009BB894 /* MMOverflowPopUpButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMOverflowPopUpButtonCell.h; sourceTree = ""; }; 069789571610A9E8009BB894 /* MMOverflowPopUpButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMOverflowPopUpButtonCell.m; sourceTree = ""; }; + 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Common.h; sourceTree = ""; }; + 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButtonCell.Private.h; sourceTree = ""; }; + 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarView.Private.h; sourceTree = ""; }; 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMSafariTabStyle.h; sourceTree = ""; }; 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMSafariTabStyle.m; sourceTree = ""; }; 06DB23A61609F5830071BDA0 /* MMTabBarView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MMTabBarView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -439,8 +445,10 @@ 0634EFE11609FC7F00A6C86A /* MMAttachedTabBarButtonCell.h */, 0634EFE21609FC7F00A6C86A /* MMAttachedTabBarButtonCell.m */, 0634EFED1609FC7F00A6C86A /* MMTabBarButton.h */, + 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */, 0634EFEE1609FC7F00A6C86A /* MMTabBarButton.m */, 0634EFEF1609FC7F00A6C86A /* MMTabBarButtonCell.h */, + 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */, 0634EFF01609FC7F00A6C86A /* MMTabBarButtonCell.m */, ); name = "Tab Buttons"; @@ -637,6 +645,7 @@ 066375A116171EEF004A1128 /* MMTabBarItem.h */, 0634F0001609FC7F00A6C86A /* MMTabStyle.h */, 06DB23B61609F5830071BDA0 /* MMTabBarView.h */, + 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */, 06DB23B71609F5830071BDA0 /* MMTabBarView.m */, 0634F0261609FD4400A6C86A /* Animations */, 0634F0431609FEB200A6C86A /* Button Layout */, @@ -675,11 +684,13 @@ 0634F0091609FC7F00A6C86A /* MMProgressIndicator.h in Headers */, 0634F00B1609FC7F00A6C86A /* MMRolloverButton.h in Headers */, 0634F00D1609FC7F00A6C86A /* MMRolloverButtonCell.h in Headers */, + 06AE02301B10A21000C65A84 /* MMTabBarButton.Common.h in Headers */, 0634F00F1609FC7F00A6C86A /* MMSlideButtonsAnimation.h in Headers */, 0634F0111609FC7F00A6C86A /* MMTabBarButton.h in Headers */, 0634F0131609FC7F00A6C86A /* MMTabBarButtonCell.h in Headers */, 0634F0181609FC7F00A6C86A /* MMTabBarController.h in Headers */, 0634F01A1609FC7F00A6C86A /* MMTabDragAssistant.h in Headers */, + 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */, 0634F01C1609FC7F00A6C86A /* MMTabDragView.h in Headers */, 0634F01E1609FC7F00A6C86A /* MMTabDragWindow.h in Headers */, 0634F0201609FC7F00A6C86A /* MMTabDragWindowController.h in Headers */, @@ -694,6 +705,7 @@ 0634F09A160A0CDB00A6C86A /* MMTabBarView.h in Headers */, 0634F0B2160A1B6600A6C86A /* NSString+MMTabBarViewExtensions.h in Headers */, 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */, + 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */, 069789581610A9E8009BB894 /* MMOverflowPopUpButtonCell.h in Headers */, 06789D731611FE1E0080FCFE /* NSCell+MMTabBarViewExtensions.h in Headers */, 06789DB6161324D50080FCFE /* NSAffineTransform+MMTabBarViewExtensions.h in Headers */, @@ -951,6 +963,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 0634F0C8160A1F8100A6C86A /* MMTabBarViewFramework-Debug.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -967,6 +980,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 0634F0C9160A1F8100A6C86A /* MMTabBarViewFramework-Release.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.h b/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.h index 2a73a1fb..a5e746a0 100644 --- a/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.h +++ b/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.h @@ -15,32 +15,30 @@ @protocol MMTabStyle; -@interface MMAttachedTabBarButton : MMTabBarButton { +@interface MMAttachedTabBarButton : MMTabBarButton -@private - NSTabViewItem *_tabViewItem; - BOOL _isInAnimatedSlide; - BOOL _isInDraggedSlide; -} +// designated initializer +- (instancetype)initWithFrame:(NSRect)frame tabViewItem:(NSTabViewItem *)anItem NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithFrame:(NSRect)frame NS_UNAVAILABLE; + +// overidden accessors (casting) +@property (strong) MMAttachedTabBarButtonCell *cell; + +#pragma mark Properties -@property (retain) NSTabViewItem *tabViewItem; +@property (strong) NSTabViewItem *tabViewItem; @property (assign) NSRect slidingFrame; @property (readonly) BOOL isInAnimatedSlide; @property (assign) BOOL isInDraggedSlide; @property (readonly) BOOL isSliding; @property (assign) BOOL isOverflowButton; -// designated initializer -- (id)initWithFrame:(NSRect)frame tabViewItem:(NSTabViewItem *)anItem; - -// overidden accessors (casting) -- (MMAttachedTabBarButtonCell *)cell; -- (void)setCell:(MMAttachedTabBarButtonCell *)aCell; - #pragma mark Drag Support -- (NSRect)draggingRect; -- (NSImage *)dragImage; +@property (readonly) NSRect draggingRect; +@property (readonly) NSImage *dragImage; #pragma mark - #pragma mark Animation Support diff --git a/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.m b/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.m index 406ef85d..401484c9 100644 --- a/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.m +++ b/MMTabBarView/MMTabBarView/MMAttachedTabBarButton.m @@ -13,22 +13,11 @@ #import "MMTabStyle.h" #import "NSView+MMTabBarViewExtensions.h" -@interface MMAttachedTabBarButton (/*Private*/) - -- (MMAttachedTabBarButton *)_selectedAttachedTabBarButton; -- (NSRect)_draggingRect; - +@interface MMAttachedTabBarButton () @end @implementation MMAttachedTabBarButton -@synthesize tabViewItem = _tabViewItem; -@dynamic slidingFrame; -@synthesize isInAnimatedSlide = _isInAnimatedSlide; -@synthesize isInDraggedSlide = _isInDraggedSlide; -@dynamic isSliding; -@dynamic isOverflowButton; - + (void)initialize { [super initialize]; } @@ -37,11 +26,11 @@ + (Class)cellClass { return [MMAttachedTabBarButtonCell class]; } -- (id)initWithFrame:(NSRect)frame tabViewItem:(NSTabViewItem *)anItem { +- (instancetype)initWithFrame:(NSRect)frame tabViewItem:(NSTabViewItem *)anItem { self = [super initWithFrame:frame]; if (self) { - _tabViewItem = [anItem retain]; + _tabViewItem = anItem; _isInAnimatedSlide = NO; _isInDraggedSlide = NO; } @@ -49,18 +38,16 @@ - (id)initWithFrame:(NSRect)frame tabViewItem:(NSTabViewItem *)anItem { return self; } -- (id)initWithFrame:(NSRect)frame { +- (instancetype)initWithFrame:(NSRect)frame { NSAssert(FALSE,@"please use designated initializer -initWithFrame:tabViewItem:"); - [self release]; return nil; } - (void)dealloc { - [_tabViewItem release], _tabViewItem = nil; - [super dealloc]; + _tabViewItem = nil; } - (void)drawRect:(NSRect)dirtyRect { @@ -84,7 +71,7 @@ -(void)viewWillDraw { } #pragma mark - -#pragma mark Accessors +#pragma mark Properties - (NSRect)slidingFrame { @synchronized(self) { @@ -215,11 +202,11 @@ - (NSImage *)dragImage { [tabBarView lockFocus]; [tabBarView display]; // forces update to ensure that we get current state - NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:draggingRect] autorelease]; + NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:draggingRect]; [tabBarView unlockFocus]; - NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *image = [[NSImage alloc] initWithSize:[rep size]]; [image addRepresentation:rep]; - NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *returnImage = [[NSImage alloc] initWithSize:[rep size]]; [returnImage lockFocus]; [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; [returnImage unlockFocus]; @@ -229,7 +216,6 @@ - (NSImage *)dragImage { NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kMMTabBarIndicatorWidth, MARGIN_Y); [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; [returnImage unlockFocus]; - [pi release]; } return returnImage; } @@ -245,6 +231,26 @@ - (void)slideAnimationDidEnd { _isInAnimatedSlide = NO; } +#pragma mark - +#pragma mark NSCoding + +- (instancetype)initWithCoder:(NSCoder *)coder { + + self = [super initWithCoder:coder]; + if (self) { + _tabViewItem = nil; + _isInAnimatedSlide = NO; + _isInDraggedSlide = NO; + } + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder +{ + [super encodeWithCoder:aCoder]; +} + #pragma mark - #pragma mark Private Methods diff --git a/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.h b/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.h index cc12200a..df74d575 100644 --- a/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.h @@ -7,18 +7,13 @@ // #import "MMTabBarButtonCell.h" -#import "MMTabBarView.h" -@class MMAttachedTabBarButton; +#import "MMAttachedTabBarButton.h" -@interface MMAttachedTabBarButtonCell : MMTabBarButtonCell { - - BOOL _isOverflowButton; -} +@interface MMAttachedTabBarButtonCell : MMTabBarButtonCell @property (assign) BOOL isOverflowButton; -- (MMAttachedTabBarButton *)controlView; -- (void)setControlView:(MMAttachedTabBarButton *)aView; +@property (assign) MMAttachedTabBarButton *controlView; @end diff --git a/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.m b/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.m index 3aa3945e..5a69c593 100644 --- a/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.m @@ -12,18 +12,15 @@ @implementation MMAttachedTabBarButtonCell -@synthesize isOverflowButton = _isOverflowButton; - -- (id)init { +- (instancetype)init { if ((self = [super init])) { _isOverflowButton = NO; } return self; } -- (void)dealloc { - [super dealloc]; -} +#pragma mark - +#pragma mark Properties - (MMAttachedTabBarButton *)controlView { return (MMAttachedTabBarButton *)[super controlView]; @@ -36,7 +33,7 @@ - (void)setControlView:(MMAttachedTabBarButton *)aView { #pragma mark - #pragma mark NSCopying -- (id)copyWithZone:(NSZone *)zone { +- (instancetype)copyWithZone:(NSZone *)zone { MMAttachedTabBarButtonCell *cellCopy = [super copyWithZone:zone]; if (cellCopy) { @@ -57,7 +54,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { } } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { if ([aDecoder allowsKeyedCoding]) { diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h index d12d7ee7..0c555f32 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h @@ -22,7 +22,7 @@ typedef void (^MMCellBezelDrawingBlock)(NSCell *cell, NSRect frame, NSView *cont // archiving - (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; +- (instancetype)initWithCoder:(NSCoder *)aDecoder; // bezel drawing - (MMCellBezelDrawingBlock)bezelDrawingBlock; diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m index f09a5778..95a9b1c8 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m @@ -48,7 +48,7 @@ + (Class)cellClass { return [MMOverflowPopUpButtonCell class]; } -- (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag { +- (instancetype)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag { if (self = [super initWithFrame:frameRect pullsDown:YES]) { _isAnimating = NO; @@ -67,9 +67,6 @@ - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag { return self; } -- (void)dealloc { - [super dealloc]; -} - (void)viewWillMoveToSuperview:(NSView *)newSuperview { [super viewWillMoveToSuperview:newSuperview]; @@ -194,7 +191,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { [super encodeWithCoder:aCoder]; } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { } return self; diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h index 0f418413..2aec6606 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h @@ -22,8 +22,8 @@ } @property (copy) MMCellBezelDrawingBlock bezelDrawingBlock; -@property (retain) NSImage *image; -@property (retain) NSImage *secondImage; +@property (strong) NSImage *image; +@property (strong) NSImage *secondImage; @property (assign) CGFloat secondImageAlpha; - (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView alpha:(CGFloat)alpha; diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m index ee083f27..2d908c76 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m @@ -22,7 +22,7 @@ @implementation MMOverflowPopUpButtonCell @synthesize secondImageAlpha = _secondImageAlpha; @synthesize bezelDrawingBlock = _bezelDrawingBlock; -- (id)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullDown { +- (instancetype)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullDown { self = [super initTextCell:stringValue pullsDown:pullDown]; if (self) { _bezelDrawingBlock = nil; @@ -36,11 +36,10 @@ - (id)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullDown { - (void)dealloc { - [_bezelDrawingBlock release], _bezelDrawingBlock = nil; - [_image release], _image = nil; - [_secondImage release], _secondImage = nil; + _bezelDrawingBlock = nil; + _image = nil; + _secondImage = nil; - [super dealloc]; } #pragma mark - @@ -54,10 +53,10 @@ - (void)setImage:(NSImage *)image { // as super class ignores setting image, we store it separately. if (_image) { - [_image release], _image = nil; + _image = nil; } - _image = [image retain]; + _image = image; } #pragma mark - @@ -130,12 +129,12 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { } } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { if ([aDecoder allowsKeyedCoding]) { - _image = [[aDecoder decodeObjectForKey:@"MMTabBarOverflowPopUpImage"] retain]; - _secondImage = [[aDecoder decodeObjectForKey:@"MMTabBarOverflowPopUpSecondImage"] retain]; + _image = [aDecoder decodeObjectForKey:@"MMTabBarOverflowPopUpImage"]; + _secondImage = [aDecoder decodeObjectForKey:@"MMTabBarOverflowPopUpSecondImage"]; } } return self; diff --git a/MMTabBarView/MMTabBarView/MMRolloverButton.m b/MMTabBarView/MMTabBarView/MMRolloverButton.m index eb91742f..168bedcc 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButton.m +++ b/MMTabBarView/MMTabBarView/MMRolloverButton.m @@ -15,7 +15,7 @@ + (Class)cellClass { return [MMRolloverButtonCell class]; } -- (id)initWithFrame:(NSRect)frameRect { +- (instancetype)initWithFrame:(NSRect)frameRect { self = [super initWithFrame:frameRect]; if (self) { @@ -25,10 +25,6 @@ - (id)initWithFrame:(NSRect)frameRect { return self; } -- (void)dealloc { - - [super dealloc]; -} - (void)awakeFromNib { if ([[self superclass] instancesRespondToSelector:@selector(awakeFromNib)]) { @@ -122,7 +118,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { } } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { diff --git a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h index 195b42b0..833fe3a0 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h @@ -7,11 +7,11 @@ #import -typedef enum MMRolloverButtonType : NSUInteger +typedef NS_ENUM(NSUInteger, MMRolloverButtonType) { MMRolloverActionButton = 0, MMRolloverSwitchButton -} MMRolloverButtonType; +}; @interface MMRolloverButtonCell : NSButtonCell { @@ -23,7 +23,7 @@ typedef enum MMRolloverButtonType : NSUInteger } @property (readonly) BOOL mouseHovered; -@property (retain) NSImage *rolloverImage; +@property (strong) NSImage *rolloverImage; @property (assign) MMRolloverButtonType rolloverButtonType; @property (assign) BOOL simulateClickOnMouseHovered; diff --git a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m index 96f7dfcb..69c5c454 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m @@ -14,7 +14,7 @@ @implementation MMRolloverButtonCell @dynamic rolloverButtonType; @synthesize simulateClickOnMouseHovered = _simulateClickOnMouseHovered; -- (id)init +- (instancetype)init { self = [super init]; if (self) { @@ -27,8 +27,7 @@ - (id)init - (void)dealloc { - [_rolloverImage release], _rolloverImage = nil; - [super dealloc]; + _rolloverImage = nil; } - (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView { @@ -90,7 +89,7 @@ - (void)addTrackingAreasForView:(NSView *)controlView inRect:(NSRect)cellFrame w // We make the view the owner, and it delegates the calls back to the cell after it is properly setup for the corresponding row/column in the outlineview area = [[NSTrackingArea alloc] initWithRect:cellFrame options:options owner:controlView userInfo:userInfo]; [controlView addTrackingArea:area]; - [area release], area = nil; + area = nil; } - (void)mouseEntered:(NSEvent *)event { @@ -122,11 +121,11 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { } } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { - _rolloverImage = [[aDecoder decodeObjectForKey:@"rolloverImage"] retain]; + _rolloverImage = [aDecoder decodeObjectForKey:@"rolloverImage"]; _simulateClickOnMouseHovered = [aDecoder decodeIntegerForKey:@"simulateClickOnMouseHovered"]; _rolloverButtonType = [aDecoder decodeIntegerForKey:@"rolloverButtonType"]; } @@ -143,7 +142,7 @@ - (id)copyWithZone:(NSZone *)zone { if (cellCopy) { cellCopy->_rolloverButtonType = _rolloverButtonType; cellCopy->_simulateClickOnMouseHovered = _simulateClickOnMouseHovered; - cellCopy->_rolloverImage = [_rolloverImage retain]; + cellCopy->_rolloverImage = _rolloverImage; } return cellCopy; diff --git a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h index 9d1f2c61..47f03dd4 100644 --- a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h +++ b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h @@ -10,7 +10,7 @@ @interface MMSlideButtonsAnimation : NSViewAnimation -- (id)initWithTabBarButtons:(NSSet *)buttons; +- (instancetype)initWithTabBarButtons:(NSSet *)buttons; - (void)addAnimationDictionary:(NSDictionary *)aDict; diff --git a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.m b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.m index 7c11a675..d6bf9d2e 100644 --- a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.m +++ b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.m @@ -12,7 +12,7 @@ @implementation MMSlideButtonsAnimation -- (id)initWithTabBarButtons:(NSSet *)buttons { +- (instancetype)initWithTabBarButtons:(NSSet *)buttons { NSArray *viewAnimations = [self _viewAnimationsForButtons:buttons]; @@ -32,7 +32,6 @@ - (void)addAnimationDictionary:(NSDictionary *)aDict { NSMutableArray *animations = [[self viewAnimations] mutableCopy]; [animations addObject:aDict]; [self setViewAnimations:animations]; - [animations release]; } #pragma mark - @@ -54,7 +53,6 @@ - (NSArray *)_viewAnimationsForButtons:(NSSet *)buttons { [animations addObject:animDict]; - [animDict release]; } return animations; diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h index aecd59dd..29720a39 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h @@ -6,8 +6,29 @@ // Copyright (c) 2015 Michael Monscheuer. All rights reserved. // -#ifndef MMTabBarView_MMTabBarButton_Common_h -#define MMTabBarView_MMTabBarButton_Common_h +typedef NS_ENUM(NSUInteger, MMCloseButtonImageType) +{ + MMCloseButtonImageTypeStandard = 0, + MMCloseButtonImageTypeRollover, + MMCloseButtonImageTypePressed, + MMCloseButtonImageTypeDirty, + MMCloseButtonImageTypeDirtyRollover, + MMCloseButtonImageTypeDirtyPressed +}; - -#endif +typedef NS_ENUM(NSUInteger,MMTabStateMask) +{ + MMTab_LeftIsSelectedMask = 1 << 2, + MMTab_RightIsSelectedMask = 1 << 3, + + MMTab_LeftIsSliding = 1 << 4, + MMTab_RightIsSliding = 1 << 5, + + MMTab_PlaceholderOnLeft = 1 << 6, + MMTab_PlaceholderOnRight = 1 << 7, + + MMTab_PositionLeftMask = 1 << 8, + MMTab_PositionMiddleMask = 1 << 9, + MMTab_PositionRightMask = 1 << 10, + MMTab_PositionSingleMask = 1 << 11 +}; diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.h b/MMTabBarView/MMTabBarView/MMTabBarButton.h index 3b2523c9..b80afb14 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.h @@ -11,42 +11,38 @@ #import "MMTabBarView.h" #import "MMRolloverButton.h" #import "MMProgressIndicator.h" -#import "MMTabBarButtonCell.h" +#import "MMTabBarButton.Common.h" @class MMTabBarView; +@class MMTabBarButtonCell; @protocol MMTabStyle; -@interface MMTabBarButton : MMRolloverButton { +@interface MMTabBarButton : MMRolloverButton - // the layouted frame rect - NSRect _stackingFrame; - - // close button - MMRolloverButton *_closeButton; - - // progress indicator - MMProgressIndicator *_indicator; -} +- (instancetype)initWithFrame:(NSRect)frame; + +#pragma mark Properties @property (assign) NSRect stackingFrame; -@property (retain) MMRolloverButton *closeButton; +@property (strong) MMRolloverButton *closeButton; @property (assign) SEL closeButtonAction; -@property (readonly, retain) MMProgressIndicator *indicator; - -- (id)initWithFrame:(NSRect)frame; +@property (readonly, strong) MMProgressIndicator *indicator; - (MMTabBarButtonCell *)cell; - (void)setCell:(MMTabBarButtonCell *)aCell; - (MMTabBarView *)tabBarView; +#pragma mark Update Cell + - (void)updateCell; +- (void)updateImages; #pragma mark Dividers -- (BOOL)shouldDisplayLeftDivider; -- (BOOL)shouldDisplayRightDivider; +@property (readonly) BOOL shouldDisplayLeftDivider; +@property (readonly) BOOL shouldDisplayRightDivider; #pragma mark Determine Sizes @@ -55,37 +51,24 @@ #pragma mark Interfacing Cell -- (id )style; -- (void)setStyle:(id )newStyle; - -- (MMTabStateMask)tabState; -- (void)setTabState:(MMTabStateMask)newState; - -- (NSImage *)icon; -- (void)setIcon:(NSImage *)anIcon; -- (NSImage *)largeImage; -- (void)setLargeImage:(NSImage *)anImage; -- (BOOL)showObjectCount; -- (void)setShowObjectCount:(BOOL)newState; -- (NSInteger)objectCount; -- (void)setObjectCount:(NSInteger)newCount; -- (NSColor *)objectCountColor; -- (void)setObjectCountColor:(NSColor *)newColor; -- (BOOL)isEdited; -- (void)setIsEdited:(BOOL)newState; -- (BOOL)isProcessing; -- (void)setIsProcessing:(BOOL)newState; +@property (strong) id style; +@property (assign) MMTabStateMask tabState; -- (void)updateImages; +@property (strong) NSImage *icon; +@property (strong) NSImage *largeImage; -#pragma mark Close Button Support +@property (assign) BOOL showObjectCount; +@property (assign) NSInteger objectCount; -- (BOOL)shouldDisplayCloseButton; +@property (strong) NSColor *objectCountColor; -- (BOOL)hasCloseButton; -- (void)setHasCloseButton:(BOOL)newState; +@property (assign) BOOL isEdited; +@property (assign) BOOL isProcessing; + +#pragma mark Close Button Support -- (BOOL)suppressCloseButton; -- (void)setSuppressCloseButton:(BOOL)newState; +@property (readonly) BOOL shouldDisplayCloseButton; +@property (assign) BOOL hasCloseButton; +@property (assign) BOOL suppressCloseButton; @end diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.m b/MMTabBarView/MMTabBarView/MMTabBarButton.m index 070666ef..b63068e7 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.m +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.m @@ -31,23 +31,24 @@ @implementation MMTabBarButton @dynamic closeButtonAction; @synthesize indicator = _indicator; -+ (void)initialize { - [super initialize]; - - [self exposeBinding:@"isProcessing"]; - [self exposeBinding:@"isEdited"]; - [self exposeBinding:@"objectCount"]; - [self exposeBinding:@"objectCountColor"]; - [self exposeBinding:@"icon"]; - [self exposeBinding:@"largeImage"]; - [self exposeBinding:@"hasCloseButton"]; ++ (void)initialize +{ + if (self == [MMTabBarButton class]) { + [self exposeBinding:@"isProcessing"]; + [self exposeBinding:@"isEdited"]; + [self exposeBinding:@"objectCount"]; + [self exposeBinding:@"objectCountColor"]; + [self exposeBinding:@"icon"]; + [self exposeBinding:@"largeImage"]; + [self exposeBinding:@"hasCloseButton"]; + } } + (Class)cellClass { return [MMTabBarButtonCell class]; } -- (id)initWithFrame:(NSRect)frame { +- (instancetype)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { [self _commonInit]; @@ -58,9 +59,8 @@ - (id)initWithFrame:(NSRect)frame { - (void)dealloc { - [_closeButton release], _closeButton = nil; - [_indicator release], _indicator = nil; - [super dealloc]; + _closeButton = nil; + _indicator = nil; } - (MMTabBarButtonCell *)cell { @@ -293,7 +293,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - if (context == kMMTabBarButtonOberserverContext) + if (context == (__bridge void *)(kMMTabBarButtonOberserverContext)) { if ([[self tabBarView] sizeButtonsToFit]) { diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h index 18b6996d..939277f1 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h @@ -6,8 +6,13 @@ // Copyright (c) 2015 Michael Monscheuer. All rights reserved. // -#ifndef MMTabBarView_MMTabBarButtonCell_Private_h -#define MMTabBarView_MMTabBarButtonCell_Private_h +@interface MMTabBarButtonCell (PrivateDrawing) +- (NSRect)_closeButtonRectForBounds:(NSRect)theRect; +- (CGFloat)_leftMargin; +- (CGFloat)_rightMargin; -#endif +- (void)_drawObjectCounterWithFrame:(NSRect)frame inView:(NSView *)controlView; +- (void)_drawIconWithFrame:(NSRect)frame inView:(NSView *)controlView; + +@end \ No newline at end of file diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.h b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.h index 57ed7e77..8f8efb84 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.h @@ -11,99 +11,135 @@ #import "MMTabBarView.h" #import "MMRolloverButton.h" +#import "MMTabBarButton.h" + @class MMTabBarView; -@class MMTabBarButton; @class MMProgressIndicator; @protocol MMTabStyle; -typedef enum MMCloseButtonImageType : NSUInteger -{ - MMCloseButtonImageTypeStandard = 0, - MMCloseButtonImageTypeRollover, - MMCloseButtonImageTypePressed, - MMCloseButtonImageTypeDirty, - MMCloseButtonImageTypeDirtyRollover, - MMCloseButtonImageTypeDirtyPressed -} MMCloseButtonImageType; - -typedef enum MMTabStateMask : NSUInteger { - MMTab_LeftIsSelectedMask = 1 << 2, - MMTab_RightIsSelectedMask = 1 << 3, - - MMTab_LeftIsSliding = 1 << 4, - MMTab_RightIsSliding = 1 << 5, - - MMTab_PlaceholderOnLeft = 1 << 6, - MMTab_PlaceholderOnRight = 1 << 7, - - MMTab_PositionLeftMask = 1 << 8, - MMTab_PositionMiddleMask = 1 << 9, - MMTab_PositionRightMask = 1 << 10, - MMTab_PositionSingleMask = 1 << 11 -} MMTabStateMask; - -@interface MMTabBarButtonCell : MMRolloverButtonCell { - -@private - id _style; - - // state - MMTabStateMask _tabState; - - // cell values - NSImage *_icon; - NSImage *_largeImage; - BOOL _showObjectCount; - NSInteger _objectCount; - NSColor *_objectCountColor; - BOOL _isEdited; - BOOL _isProcessing; - - // close button - BOOL _hasCloseButton; - BOOL _suppressCloseButton; - BOOL _closeButtonOver; -} - -@property (retain) id style; - -@property (retain) NSImage *icon; -@property (retain) NSImage *largeImage; +@interface MMTabBarButtonCell : MMRolloverButtonCell + +/** + * Default color for object count display + * + * @return The default color + */ ++ (NSColor *)defaultObjectCountColor; + +/** + * The control view + */ +@property (assign) MMTabBarButton *controlView; + +/** + * Tab bar view the tab bar button belongs to + */ +@property (readonly) MMTabBarView *tabBarView; + +#pragma mark Update images + +/** + * Update images + */ +- (void)updateImages; + +#pragma mark Additional Properties + +/** + * Tab style + */ +@property (strong) id style; + +/** + * Icon of receiver + */ +@property (strong) NSImage *icon; + +/** + * Large image of receiver + */ +@property (strong) NSImage *largeImage; + +/** + * Visibility of object count + */ @property (assign) BOOL showObjectCount; + +/** + * Current object count + */ @property (assign) NSInteger objectCount; -@property (retain) NSColor *objectCountColor; + +/** + * Color of object count + */ +@property (strong) NSColor *objectCountColor; + +/** + * Edited state + */ @property (assign) BOOL isEdited; + +/** + * Processing state + */ @property (assign) BOOL isProcessing; +/** + * Visibility of close button + */ @property (assign) BOOL hasCloseButton; + +/** + * Check if close button should be suppressed + */ @property (assign) BOOL suppressCloseButton; +/** + * Current tab state mask + */ @property (assign) MMTabStateMask tabState; -+ (NSColor *)defaultObjectCountColor; - -- (MMTabBarButton *)controlView; -- (void)setControlView:(MMTabBarButton *)aView; - -- (MMTabBarView *)tabBarView; - -- (void)updateImages; - #pragma mark Progress Indicator Support -- (MMProgressIndicator *)indicator; +/** + * Get progress indicator + */ +@property (readonly) MMProgressIndicator *indicator; #pragma mark Close Button Support -- (MMRolloverButton *)closeButton; -- (BOOL)shouldDisplayCloseButton; +/** + * The close button + */ +@property (readonly) MMRolloverButton *closeButton; + +/** + * Check if receiver should display close button + */ +@property (readonly) BOOL shouldDisplayCloseButton; + +/** + * Get close button image + * + * @param type Close button image type + * + * @return The image + */ - (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type; #pragma mark Cell Values -- (NSAttributedString *)attributedStringValue; -- (NSAttributedString *)attributedObjectCountStringValue; +/** + * Attributed string value + */ +@property (readonly) NSAttributedString *attributedStringValue; + +/** + * Object count string value + */ +@property (readonly) NSAttributedString *attributedObjectCountStringValue; #pragma mark Determining Cell Size @@ -116,8 +152,8 @@ typedef enum MMTabStateMask : NSUInteger { - (NSRect)objectCounterRectForBounds:(NSRect)theRect; - (NSRect)closeButtonRectForBounds:(NSRect)theRect; -- (CGFloat)minimumWidthOfCell; -- (CGFloat)desiredWidthOfCell; +@property (readonly) CGFloat minimumWidthOfCell; +@property (readonly) CGFloat desiredWidthOfCell; #pragma mark Drawing @@ -131,11 +167,4 @@ typedef enum MMTabStateMask : NSUInteger { - (void)drawIndicatorWithFrame:(NSRect)frame inView:(NSView *)controlView; - (void)drawCloseButtonWithFrame:(NSRect)frame inView:(NSView *)controlView; -/* -#pragma mark Tracking Area Support - -- (void)addTrackingAreasForView:(NSView *)view inRect:(NSRect)cellFrame withUserInfo:(NSDictionary *)userInfo mouseLocation:(NSPoint)currentPoint; -- (void)mouseEntered:(NSEvent *)theEvent; -- (void)mouseExited:(NSEvent *)theEvent; -*/ @end diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m index b326ccca..45697bab 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m @@ -14,65 +14,24 @@ #import "NSView+MMTabBarViewExtensions.h" #import "NSCell+MMTabBarViewExtensions.h" -@interface MMTabBarButtonCell (/*Private*/) - -- (NSImage *)_closeButtonImageOfType:(MMCloseButtonImageType)type; - -- (CGFloat)_leftMargin; -- (CGFloat)_rightMargin; - -- (NSRect)_drawingRectForBounds:(NSRect)theRect; -- (NSRect)_titleRectForBounds:(NSRect)theRect; -- (NSRect)_iconRectForBounds:(NSRect)theRect; -- (NSRect)_largeImageRectForBounds:(NSRect)theRect; -- (NSRect)_indicatorRectForBounds:(NSRect)theRect; -- (NSSize)_objectCounterSize; -- (NSRect)_objectCounterRectForBounds:(NSRect)theRect; -- (NSSize)_closeButtonSizeForBounds:(NSRect)theRect; -- (NSRect)_closeButtonRectForBounds:(NSRect)theRect; - -- (CGFloat)_minimumWidthOfCell; -- (CGFloat)_desiredWidthOfCell; - -- (NSAttributedString *)_attributedStringValue; -- (NSAttributedString *)_attributedObjectCountStringValue; - -- (void)_updateSubButtons; -- (void)_updateCloseButtonImages; -- (void)_updateCloseButton; -- (void)_updateIndicator; - -- (void)_drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -- (void)_drawBezelWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -- (void)_drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -- (void)_drawLargeImageWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawIconWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawTitleWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawObjectCounterWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawIndicatorWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawCloseButtonWithFrame:(NSRect)frame inView:(NSView *)controlView; - +@interface MMTabBarButtonCell () @end @implementation MMTabBarButtonCell - -@dynamic style; -@dynamic hasCloseButton; -@dynamic suppressCloseButton; -@synthesize icon = _icon; -@synthesize largeImage = _largeImage; -@synthesize showObjectCount = _showObjectCount; -@synthesize objectCount = _objectCount; -@synthesize objectCountColor = _objectCountColor; -@dynamic isEdited; -@synthesize isProcessing = _isProcessing; -@synthesize tabState = _tabState; +{ + id _style; + BOOL _isProcessing; + BOOL _isEdited; + BOOL _hasCloseButton; + BOOL _suppressCloseButton; + BOOL _closeButtonOver; +} + (NSColor *)defaultObjectCountColor { return [NSColor colorWithCalibratedWhite:0.3 alpha:0.45]; } -- (id)init { +- (instancetype)init { if ((self = [super init])) { _style = nil; @@ -81,7 +40,7 @@ - (id)init { _icon = nil; _largeImage = nil; _showObjectCount = NO; - _objectCountColor = [[NSColor colorWithCalibratedWhite:0.3 alpha:0.45] retain]; + _objectCountColor = [NSColor colorWithCalibratedWhite:0.3 alpha:0.45]; _isEdited = NO; _tabState = 0; @@ -93,12 +52,11 @@ - (id)init { } - (void)dealloc { - [_style release], _style = nil; - [_icon release], _icon = nil; - [_largeImage release], _largeImage = nil; - [_objectCountColor release], _objectCountColor = nil; + _style = nil; + _icon = nil; + _largeImage = nil; + _objectCountColor = nil; - [super dealloc]; } - (MMTabBarButton *)controlView { @@ -139,8 +97,8 @@ - (void)setStyle:(id)style { @synchronized (self) { - [_style release], _style = nil; - _style = [style retain]; + _style = nil; + _style = style; [self _updateSubButtons]; } @@ -515,10 +473,10 @@ - (id)copyWithZone:(NSZone *)zone { MMTabBarButtonCell *cellCopy = [super copyWithZone:zone]; if (cellCopy) { - cellCopy->_style = [_style retain]; - cellCopy->_icon = [_icon retain]; - cellCopy->_largeImage = [_largeImage retain]; - cellCopy->_objectCountColor = [_objectCountColor retain]; + cellCopy->_style = _style; + cellCopy->_icon = _icon; + cellCopy->_largeImage = _largeImage; + cellCopy->_objectCountColor = _objectCountColor; cellCopy->_tabState = _tabState; cellCopy->_showObjectCount = _showObjectCount; @@ -556,14 +514,14 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { } } -- (id)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { if ([aDecoder allowsKeyedCoding]) { - _style = [[aDecoder decodeObjectForKey:@"MMTabBarButtonCellStyle"] retain]; - _icon = [[aDecoder decodeObjectForKey:@"MMTabBarButtonCellIcon"] retain]; - _largeImage = [[aDecoder decodeObjectForKey:@"MMTabBarButtonCellLargeImage"] retain]; - _objectCountColor = [[aDecoder decodeObjectForKey:@"MMTabBarButtonCellLargeObjectCountColor"] retain]; + _style = [aDecoder decodeObjectForKey:@"MMTabBarButtonCellStyle"]; + _icon = [aDecoder decodeObjectForKey:@"MMTabBarButtonCellIcon"]; + _largeImage = [aDecoder decodeObjectForKey:@"MMTabBarButtonCellLargeImage"]; + _objectCountColor = [aDecoder decodeObjectForKey:@"MMTabBarButtonCellLargeObjectCountColor"]; _tabState = [aDecoder decodeIntegerForKey:@"MMTabBarButtonCellTabState"]; _showObjectCount = [aDecoder decodeBoolForKey:@"MMTabBarButtonCellShowObjectCount"]; @@ -587,7 +545,7 @@ - (NSAttributedString *)_attributedStringValue { NSMutableAttributedString *attrStr; NSString *contents = [self title]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; @@ -596,7 +554,7 @@ - (NSAttributedString *)_attributedStringValue { // Paragraph Style for Truncating Long Text static NSMutableParagraphStyle *truncatingTailParagraphStyle = nil; if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; } @@ -614,7 +572,7 @@ - (NSAttributedString *)_attributedObjectCountStringValue { } NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[self objectCount]]; - return [[[NSMutableAttributedString alloc] initWithString:contents attributes:objectCountStringAttributes] autorelease]; + return [[NSMutableAttributedString alloc] initWithString:contents attributes:objectCountStringAttributes]; } #pragma mark > Sub Buttons @@ -1096,7 +1054,6 @@ - (void)_drawTitleWithFrame:(NSRect)frame inView:(NSView *)controlView { [NSGraphicsContext restoreGraphicsState]; - [shadow release]; } - (void)_drawObjectCounterWithFrame:(NSRect)frame inView:(NSView *)controlView { diff --git a/MMTabBarView/MMTabBarView/MMTabBarController.h b/MMTabBarView/MMTabBarView/MMTabBarController.h index ba0cfcf5..e197f4d0 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarController.h +++ b/MMTabBarView/MMTabBarView/MMTabBarController.h @@ -16,7 +16,7 @@ NSMenu *_overflowMenu; } -- (id)initWithTabBarView:(MMTabBarView *)aTabBarView; +- (instancetype)initWithTabBarView:(MMTabBarView *)aTabBarView; - (NSMenu *)overflowMenu; diff --git a/MMTabBarView/MMTabBarView/MMTabBarController.m b/MMTabBarView/MMTabBarView/MMTabBarController.m index b412836d..563420d8 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarController.m +++ b/MMTabBarView/MMTabBarView/MMTabBarController.m @@ -30,7 +30,7 @@ @implementation MMTabBarController @param A MMTabBarView. @returns A newly created MMTabBarController instance. */ -- (id)initWithTabBarView:(MMTabBarView *)aTabBarView { +- (instancetype)initWithTabBarView:(MMTabBarView *)aTabBarView { if ((self = [super init])) { _tabBarView = aTabBarView; } @@ -41,9 +41,8 @@ - (void)dealloc { _tabBarView = nil; // non retained! - [_overflowMenu release], _overflowMenu = nil; + _overflowMenu = nil; - [super dealloc]; } /*! @@ -72,7 +71,7 @@ - (void)layoutButtons { MMAttachedTabBarButton *draggedButton = [_tabBarView attachedTabBarButtonForDraggedItems]; if (draggedButton) { - NSMutableArray *mutable = [[attachedButtons mutableCopy] autorelease]; + NSMutableArray *mutable = [attachedButtons mutableCopy]; [mutable insertObject:draggedButton atIndex:[_tabBarView destinationIndexForDraggedItem]]; attachedButtons = mutable; @@ -407,7 +406,7 @@ - (void)_setupAttachedButtons:(NSArray *)buttons withWidths:(NSArray *)widths { NSUInteger buttonCount = [buttons count]; - [_overflowMenu release], _overflowMenu = nil; + _overflowMenu = nil; __block NSRect buttonRect = [_tabBarView genericButtonRect]; diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h index c9812081..93e91e6d 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h @@ -6,8 +6,10 @@ // Copyright (c) 2015 Michael Monscheuer. All rights reserved. // -#ifndef MMTabBarView_MMTabBarView_Private_h -#define MMTabBarView_MMTabBarView_Private_h +@interface MMTabBarView (PrivateDrawing) +- (void)_drawInteriorInRect:(NSRect)rect; +- (NSRect)_addTabButtonRect; +- (NSRect)_overflowButtonRect; -#endif +@end diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.h b/MMTabBarView/MMTabBarView/MMTabBarView.h index 672c6d6e..a45fe59b 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.h @@ -48,22 +48,25 @@ static NSImage* _static##name##Image() \ @protocol MMTabStyle; -typedef enum MMTabBarOrientation : NSUInteger { +typedef NS_ENUM(NSUInteger, MMTabBarOrientation) +{ MMTabBarHorizontalOrientation = 0, MMTabBarVerticalOrientation -} MMTabBarOrientation; +}; -typedef enum MMTabBarTearOffStyle : NSUInteger { +typedef NS_ENUM(NSUInteger, MMTabBarTearOffStyle) +{ MMTabBarTearOffAlphaWindow, MMTabBarTearOffMiniwindow -} MMTabBarTearOffStyle; +}; -typedef enum MMAttachedButtonsEnumerationOptions : NSUInteger { +typedef NS_ENUM(NSUInteger, MMAttachedButtonsEnumerationOptions) +{ MMAttachedButtonsEnumerationNone = 0, MMAttachedButtonsEnumerationUpdateTabStateMask = 1 << 1, MMAttachedButtonsEnumerationUpdateButtonState = 1 << 2 -} MMAttachedButtonsEnumerationOptions; +}; @protocol MMTabBarViewDelegate; @@ -127,9 +130,9 @@ typedef enum MMAttachedButtonsEnumerationOptions : NSUInteger { id _delegate; } -@property (retain) IBOutlet NSTabView *tabView; -@property (retain) IBOutlet NSView *partnerView; -@property (assign) IBOutlet id delegate; +@property (strong) IBOutlet NSTabView *tabView; +@property (strong) IBOutlet NSView *partnerView; +@property (unsafe_unretained) IBOutlet id delegate; @property (assign) NSUInteger destinationIndexForDraggedItem; @property (readonly) BOOL isResizing; @property (assign) BOOL needsUpdate; diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index dcfb2489..b0b8546e 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -102,16 +102,18 @@ @implementation MMTabBarView static NSMutableDictionary *registeredStyleClasses = nil; -+(void)initialize { - - if (registeredStyleClasses == nil) { - registeredStyleClasses = [[NSMutableDictionary dictionaryWithCapacity:10] retain]; - - [self registerDefaultTabStyleClasses]; ++ (void)initialize +{ + if (self == [MMTabBarView class]) { + if (registeredStyleClasses == nil) { + registeredStyleClasses = [NSMutableDictionary dictionaryWithCapacity:10]; + + [self registerDefaultTabStyleClasses]; + } } } -- (id)initWithFrame:(NSRect)frame { +- (instancetype)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization @@ -136,16 +138,16 @@ - (void)dealloc { // assure that pending animation will stop if (_slideButtonsAnimation) { [_slideButtonsAnimation stopAnimation]; - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } if (_hideShowTabBarAnimation) { [_hideShowTabBarAnimation stopAnimation]; - [_hideShowTabBarAnimation release], _hideShowTabBarAnimation = nil; + _hideShowTabBarAnimation = nil; } //Also unwind the spring, if it's wound. [_springTimer invalidate]; - [_springTimer release]; _springTimer = nil; + _springTimer = nil; //unbind all the items to prevent crashing //not sure if this is necessary or not @@ -155,16 +157,15 @@ - (void)dealloc { [self removeAttachedButton:aButton]; } - [_overflowPopUpButton release], _overflowPopUpButton = nil; - [_controller release], _controller = nil; - [_tabView release], _tabView = nil; - [_addTabButton release], _addTabButton = nil; - [_partnerView release], _partnerView = nil; - [_style release], _style = nil; + _overflowPopUpButton = nil; + _controller = nil; + _tabView = nil; + _addTabButton = nil; + _partnerView = nil; + _style = nil; [self unregisterDraggedTypes]; - [super dealloc]; } - (void)viewWillMoveToWindow:(NSWindow *)aWindow { @@ -172,12 +173,12 @@ - (void)viewWillMoveToWindow:(NSWindow *)aWindow { if (_hideShowTabBarAnimation) { [_hideShowTabBarAnimation stopAnimation]; - [_hideShowTabBarAnimation release]; _hideShowTabBarAnimation = nil; + _hideShowTabBarAnimation = nil; } if (_slideButtonsAnimation) { [_slideButtonsAnimation stopAnimation]; - [_slideButtonsAnimation release]; _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } if ([self window]) { @@ -416,10 +417,8 @@ - (void)moveTabViewItem:(NSTabViewItem *)anItem toIndex:(NSUInteger)index { [self setIsReorderingTabViewItems:YES]; - [anItem retain]; [_tabView removeTabViewItem:anItem]; [_tabView insertTabViewItem:anItem atIndex:index]; - [anItem release]; // assure that item gets re-selected [_tabView selectTabViewItem:anItem]; @@ -567,7 +566,6 @@ - (void)insertAttachedButtonForTabViewItem:(NSTabViewItem *)item atIndex:(NSUInt // add button as subview [self addSubview:button]; - [button release]; // add tab item at specified index if ([[_tabView tabViewItems] indexOfObjectIdenticalTo:item] == NSNotFound) { @@ -849,8 +847,7 @@ - (MMTabBarButton *)tabBarButtonAtPoint:(NSPoint)point - (void)setStyle:(id )newStyle { if (_style != newStyle) { - [_style autorelease]; - _style = [newStyle retain]; + _style = newStyle; // assure that orientation is valid if (![self supportsOrientation:MMTabBarHorizontalOrientation] && _orientation == MMTabBarHorizontalOrientation) @@ -879,7 +876,6 @@ - (void)setStyleNamed:(NSString *)name { id newStyle = [[(Class)styleClass alloc] init]; [self setStyle:newStyle]; - [newStyle release]; } - (MMTabBarOrientation)orientation { @@ -1092,10 +1088,10 @@ - (void)setTabView:(NSTabView *)view { return; if (_tabView) { - [_tabView release],_tabView = nil; + _tabView = nil; } - _tabView = [view retain]; + _tabView = view; // build buttons from existing tab view items for (NSTabViewItem *item in [_tabView tabViewItems]) { @@ -1303,7 +1299,7 @@ - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate { // stop running animation if (_hideShowTabBarAnimation) { [_hideShowTabBarAnimation stopAnimation]; - [_hideShowTabBarAnimation release], _hideShowTabBarAnimation = nil; + _hideShowTabBarAnimation = nil; } // start animated update of partner view @@ -1587,7 +1583,6 @@ - (void)update:(BOOL)animate { [NSValue valueWithRect:[self addTabButtonRect]], NSViewAnimationEndFrameKey, nil]; [_slideButtonsAnimation addAnimationDictionary:addButtonAnimDict]; - [addButtonAnimDict release]; } else { [self _positionAddTabButton]; } @@ -1711,18 +1706,18 @@ - (NSDragOperation)draggingUpdated:(id )sender { //If the user has dragged to a different tab, reset the timer. if (_tabViewItemWithSpring != [destinationButton tabViewItem]) { [_springTimer invalidate]; - [_springTimer release]; _springTimer = nil; + _springTimer = nil; _tabViewItemWithSpring = [destinationButton tabViewItem]; } if (!_springTimer) { //Finder's default delay time, as of Tiger, is 668 ms. If the user has never changed it, there's no setting in its defaults, so we default to that amount. - NSNumber *delayNumber = [(NSNumber *)CFPreferencesCopyAppValue((CFStringRef)@"SpringingDelayMilliseconds", (CFStringRef)@"com.apple.finder") autorelease]; + NSNumber *delayNumber = (NSNumber *)CFBridgingRelease(CFPreferencesCopyAppValue((CFStringRef)@"SpringingDelayMilliseconds", (CFStringRef)@"com.apple.finder")); NSTimeInterval delaySeconds = delayNumber ?[delayNumber doubleValue] / 1000.0 : 0.668; - _springTimer = [[NSTimer scheduledTimerWithTimeInterval:delaySeconds + _springTimer = [NSTimer scheduledTimerWithTimeInterval:delaySeconds target:self selector:@selector(fireSpring:) userInfo:sender - repeats:NO] retain]; + repeats:NO]; } return NSDragOperationCopy; } @@ -1732,7 +1727,7 @@ - (NSDragOperation)draggingUpdated:(id )sender { - (void)draggingExited:(id )sender { [_springTimer invalidate]; - [_springTimer release]; _springTimer = nil; + _springTimer = nil; [[MMTabDragAssistant sharedDragAssistant] draggingExitedTabBarView:self draggingInfo:sender]; } @@ -1949,7 +1944,7 @@ - (void)fireSpring:(NSTimer *)timer { _tabViewItemWithSpring = nil; [_springTimer invalidate]; - [_springTimer release]; _springTimer = nil; + _springTimer = nil; } } @@ -2012,7 +2007,7 @@ - (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView { -(void)_finalizeAnimation:(NSAnimation *)animation { if (animation == _slideButtonsAnimation) { - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; [self _positionAddTabButton]; @@ -2028,7 +2023,7 @@ -(void)_finalizeAnimation:(NSAnimation *)animation { if (!isHidden) [self setHidden:NO]; - [_hideShowTabBarAnimation release], _hideShowTabBarAnimation = nil; + _hideShowTabBarAnimation = nil; [self updateTrackingAreas]; //send the delegate messages @@ -2091,7 +2086,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder } } -- (id)initWithCoder:(NSCoder *)aDecoder +- (instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { @@ -2105,10 +2100,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self]; if ([aDecoder allowsKeyedCoding]) { - _tabView = [[aDecoder decodeObjectForKey:@"MMtabView"] retain]; - _overflowPopUpButton = [[aDecoder decodeObjectForKey:@"MMOverflowPopUpButton"] retain]; - _addTabButton = [[aDecoder decodeObjectForKey:@"MMaddTabButton"] retain]; - _style = [[aDecoder decodeObjectForKey:@"MMstyle"] retain]; + _tabView = [aDecoder decodeObjectForKey:@"MMtabView"]; + _overflowPopUpButton = [aDecoder decodeObjectForKey:@"MMOverflowPopUpButton"]; + _addTabButton = [aDecoder decodeObjectForKey:@"MMaddTabButton"]; + _style = [aDecoder decodeObjectForKey:@"MMstyle"]; _orientation = (MMTabBarOrientation)[aDecoder decodeIntegerForKey:@"MMorientation"]; _onlyShowCloseOnHover = [aDecoder decodeBoolForKey:@"MMonlyShowCloseOnHover"]; _canCloseOnlyTab = [aDecoder decodeBoolForKey:@"MMcanCloseOnlyTab"]; @@ -2123,7 +2118,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder _buttonMaxWidth = [aDecoder decodeIntegerForKey:@"MMbuttonMaxWidth"]; _buttonOptimumWidth = [aDecoder decodeIntegerForKey:@"MMbuttonOptimumWidth"]; _isHidden = [aDecoder decodeBoolForKey:@"MMisHidden"]; - _partnerView = [[aDecoder decodeObjectForKey:@"MMpartnerView"] retain]; + _partnerView = [aDecoder decodeObjectForKey:@"MMpartnerView"]; _useOverflowMenu = [aDecoder decodeBoolForKey:@"MMuseOverflowMenu"]; _automaticallyAnimates = [aDecoder decodeBoolForKey:@"MMautomaticallyAnimates"]; _alwaysShowActiveTab = [aDecoder decodeBoolForKey:@"MMalwaysShowActiveTab"]; @@ -2216,7 +2211,6 @@ - (void)_didClickCloseButton:(id)sender { return; } - [sender retain]; if (([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:shouldCloseTabViewItem:)])) { if (![[self delegate] tabView:_tabView shouldCloseTabViewItem:tabViewItem]) { @@ -2228,15 +2222,12 @@ - (void)_didClickCloseButton:(id)sender { [[self delegate] tabView:_tabView willCloseTabViewItem:tabViewItem]; } - [tabViewItem retain]; [_tabView removeTabViewItem:tabViewItem]; if (([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)])) { [[self delegate] tabView:_tabView didCloseTabViewItem:tabViewItem]; } - [tabViewItem release]; - [sender release]; } - (void)frameDidChange:(NSNotification *)notification { @@ -2472,7 +2463,7 @@ - (void)_drawInteriorInRect:(NSRect)rect { labelRect.origin.y += 4.0; NSMutableAttributedString *attrStr; NSString *contents = @"MMTabBarView"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; NSMutableParagraphStyle *centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; @@ -2481,7 +2472,6 @@ - (void)_drawInteriorInRect:(NSRect)rect { [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; - [centeredParagraphStyle release]; return; } } @@ -2751,7 +2741,7 @@ - (void)_updateAddTabButton { if (_addTabButton) { [_addTabButton removeFromSuperview]; - [_addTabButton release], _addTabButton = nil; + _addTabButton = nil; } // new tab button NSRect addTabButtonRect = [self addTabButtonRect]; diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h index d28a4693..678a0cfc 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h @@ -46,17 +46,17 @@ extern NSString *AttachedTabBarButtonUTI; MMSlideButtonsAnimation *_slideButtonsAnimation; } -@property (retain) MMTabBarView *sourceTabBar; -@property (retain) MMAttachedTabBarButton *attachedTabBarButton; -@property (retain) MMTabPasteboardItem *pasteboardItem; -@property (retain) MMTabBarView *destinationTabBar; +@property (strong) MMTabBarView *sourceTabBar; +@property (strong) MMAttachedTabBarButton *attachedTabBarButton; +@property (strong) MMTabPasteboardItem *pasteboardItem; +@property (strong) MMTabBarView *destinationTabBar; @property (assign) BOOL isDragging; @property (assign) NSPoint currentMouseLocation; @property (assign) BOOL isSliding; // Creation/destruction -+ (MMTabDragAssistant *)sharedDragAssistant; ++ (instancetype)sharedDragAssistant; #pragma mark Dragging Source Handling diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index 1da0eec8..e85086bc 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -70,7 +70,7 @@ @implementation MMTabDragAssistant #pragma mark - #pragma mark Creation/Destruction -+ (MMTabDragAssistant *)sharedDragAssistant { ++ (instancetype)sharedDragAssistant { if (!sharedDragAssistant) { sharedDragAssistant = [[MMTabDragAssistant alloc] init]; } @@ -78,7 +78,7 @@ + (MMTabDragAssistant *)sharedDragAssistant { return sharedDragAssistant; } -- (id)init { +- (instancetype)init { if ((self = [super init])) { _destinationTabBar = nil; _isDragging = NO; @@ -93,13 +93,12 @@ - (id)init { - (void)dealloc { if (_slideButtonsAnimation) { [_slideButtonsAnimation stopAnimation]; - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } - [_destinationTabBar release], _destinationTabBar = nil; - [_pasteboardItem release], _pasteboardItem = nil; + _destinationTabBar = nil; + _pasteboardItem = nil; - [super dealloc]; } #pragma mark - @@ -403,13 +402,11 @@ - (void)finishDragOfPasteboardItem:(MMTabPasteboardItem *)pasteboardItem { if (_draggedTab) { [[_draggedTab window] orderOut:nil]; - [_draggedTab release]; _draggedTab = nil; } if (_draggedView) { [[_draggedView window] orderOut:nil]; - [_draggedView release]; _draggedView = nil; } @@ -463,7 +460,7 @@ - (void)_finalizeAnimation:(NSAnimation *)animation { i++; } - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } } @@ -620,7 +617,7 @@ - (NSImage *)_imageForViewOfAttachedButton:(MMAttachedTabBarButton *)aButton for } else { //the delegate doesn't give a custom image, so use an image of the view NSView *tabView = [[aButton tabViewItem] view]; - viewImage = [[[NSImage alloc] initWithSize:[tabView frame].size] autorelease]; + viewImage = [[NSImage alloc] initWithSize:[tabView frame].size]; [viewImage lockFocus]; [tabView drawRect:[tabView bounds]]; [viewImage unlockFocus]; @@ -635,7 +632,7 @@ - (NSImage *)_imageForViewOfAttachedButton:(MMAttachedTabBarButton *)aButton for - (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window { NSRect rect = [window frame]; - NSImage *image = [[[NSImage alloc] initWithSize:rect.size] autorelease]; + NSImage *image = [[NSImage alloc] initWithSize:rect.size]; [image lockFocus]; rect.origin = NSZeroPoint; CGContextCopyWindowCaptureContentsToRect([[NSGraphicsContext currentContext] graphicsPort], *(CGRect *)&rect, [NSApp contextID], [window windowNumber], 0); @@ -672,7 +669,6 @@ - (void)_dragAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView [self setSourceTabBar:tabBarView]; [self setAttachedTabBarButton:aButton]; [self setPasteboardItem:pasteboardItem]; - [pasteboardItem release]; // informal [[NSNotificationCenter defaultCenter] postNotificationName:MMTabDragDidBeginNotification object:pasteboardItem]; @@ -782,11 +778,9 @@ - (void)_dragAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView [self setIsSliding:NO]; [aButton setIsInDraggedSlide:NO]; - [aButton retain]; [self _dragDetachedButton:aButton ofTabBarView:tabBarView withEvent:firstEvent pasteboard:pboard source:sourceObject]; - [aButton release]; } else { [self setPasteboardItem:nil]; } @@ -813,14 +807,14 @@ - (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTa NSPoint location = [aButton frame].origin; - [tabBarView dragImage:[[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] autorelease] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; + [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; } - (void)_slideBackTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView { if (_slideButtonsAnimation != nil) { [_slideButtonsAnimation stopAnimation]; - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } [aButton slideAnimationWillStart]; @@ -838,7 +832,7 @@ - (NSUInteger)_moveAttachedTabBarButton:(MMAttachedTabBarButton *)aButton inTabB if (_slideButtonsAnimation != nil) { [_slideButtonsAnimation stopAnimation]; - [_slideButtonsAnimation release], _slideButtonsAnimation = nil; + _slideButtonsAnimation = nil; } NSRange slidingRange; diff --git a/MMTabBarView/MMTabBarView/MMTabDragView.m b/MMTabBarView/MMTabBarView/MMTabDragView.m index 51449cfd..1889ebd7 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragView.m +++ b/MMTabBarView/MMTabBarView/MMTabDragView.m @@ -11,18 +11,13 @@ @implementation MMTabDragView -- (id)initWithFrame:(NSRect)frame { +- (instancetype)initWithFrame:(NSRect)frame { if ((self = [super initWithFrame:frame])) { _alpha = 1.0; } return self; } -- (void)dealloc { - [_image release]; - [_alternateImage release]; - [super dealloc]; -} - (void)drawRect:(NSRect)rect { //1.0 fade means show the primary image @@ -46,8 +41,7 @@ - (NSImage *)image { } - (void)setImage:(NSImage *)image { - [_image release]; - _image = [image retain]; + _image = image; } - (NSImage *)alternateImage { @@ -55,8 +49,7 @@ - (NSImage *)alternateImage { } - (void)setAlternateImage:(NSImage *)image { - [_alternateImage release]; - _alternateImage = [image retain]; + _alternateImage = image; } @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindow.h b/MMTabBarView/MMTabBarView/MMTabDragWindow.h index c248149d..c34af082 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindow.h +++ b/MMTabBarView/MMTabBarView/MMTabDragWindow.h @@ -13,8 +13,8 @@ @interface MMTabDragWindow : NSWindow { MMTabDragView *_dragView; } -+ (MMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; ++ (instancetype)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; -- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; +- (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; - (MMTabDragView *)dragView; @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindow.m b/MMTabBarView/MMTabBarView/MMTabDragWindow.m index d26286a8..5bb430e7 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindow.m +++ b/MMTabBarView/MMTabBarView/MMTabDragWindow.m @@ -11,15 +11,15 @@ @implementation MMTabDragWindow -+ (MMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask { - return [[[MMTabDragWindow alloc] initWithImage:image styleMask:styleMask] autorelease]; ++ (instancetype)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask { + return [[MMTabDragWindow alloc] initWithImage:image styleMask:styleMask]; } -- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask { +- (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask { NSSize size = [image size]; if ((self = [super initWithContentRect:NSMakeRect(0, 0, size.width, size.height) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO])) { - _dragView = [[[MMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)] autorelease]; + _dragView = [[MMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)]; [self setContentView:_dragView]; [self setLevel:NSStatusWindowLevel]; [self setIgnoresMouseEvents:YES]; diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindowController.h b/MMTabBarView/MMTabBarView/MMTabDragWindowController.h index 157adc52..f87a949f 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindowController.h +++ b/MMTabBarView/MMTabBarView/MMTabDragWindowController.h @@ -23,7 +23,7 @@ BOOL _showingAlternate; NSRect _originalWindowFrame; } -- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger) styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle; +- (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger) styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle; - (NSImage *)image; - (NSImage *)alternateImage; diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindowController.m b/MMTabBarView/MMTabBarView/MMTabDragWindowController.m index 2c578fc7..90c27dc0 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindowController.m +++ b/MMTabBarView/MMTabBarView/MMTabDragWindowController.m @@ -12,10 +12,10 @@ @implementation MMTabDragWindowController -- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle { +- (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle { MMTabDragWindow *window = [MMTabDragWindow dragWindowWithImage:image styleMask:styleMask]; if ((self = [super initWithWindow:window])) { - _view = [[window dragView] retain]; + _view = [window dragView]; _tearOffStyle = tearOffStyle; if (tearOffStyle == MMTabBarTearOffMiniwindow) { @@ -33,12 +33,7 @@ - (void)dealloc { [_timer invalidate]; } - if (_animation) { - [_animation release]; - } - [_view release]; - [super dealloc]; } - (NSImage *)image { @@ -69,7 +64,6 @@ - (void)switchImages { //An animation already exists, get the current progress progress = 1.0f - [_animation currentProgress]; [_animation stopAnimation]; - [_animation release]; } //begin animating @@ -102,7 +96,7 @@ - (void)animateTimer:(NSTimer *)timer { [[self window] setFrame:frame display:YES]; if (![_animation isAnimating]) { - [_animation release], _animation = nil; + _animation = nil; [timer invalidate]; _timer = nil; } diff --git a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m index 21ee3a9e..acbf5d14 100644 --- a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m +++ b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m @@ -12,7 +12,7 @@ @implementation MMTabPasteboardItem @synthesize sourceIndex = _sourceIndex; -- (id)init { +- (instancetype)init { self = [super init]; if (self) { _sourceIndex = NSNotFound; diff --git a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h index 25b15662..4c590135 100644 --- a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h @@ -8,7 +8,8 @@ #import -typedef enum MMBezierShapeCapMask : NSUInteger { +typedef NS_ENUM(NSUInteger, MMBezierShapeCapMask) +{ MMBezierShapeLeftCap = 0x0001, MMBezierShapeRightCap = 0x0002, @@ -16,7 +17,7 @@ typedef enum MMBezierShapeCapMask : NSUInteger { MMBezierShapeFlippedVertically = 0x1000, MMBezierShapeFillPath = 0x2000 -} MMBezierShapeCapMask; +}; @interface NSBezierPath (MMTabBarViewExtensions) diff --git a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m index f3000e53..8a7a1472 100644 --- a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m @@ -14,7 +14,7 @@ @implementation NSString (MMTabBarViewExtensions) - (NSString *)stringByTruncatingToLength:(NSUInteger)truncationLength { NSUInteger len = [self length]; if (len < truncationLength) - return [[self copy] autorelease]; + return [self copy]; // Unicode character 2026 is ellipsis return [[self substringToIndex:truncationLength - 10] stringByAppendingString:@"\u2026"]; diff --git a/MMTabBarView/MMTabBarView/NSView+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSView+MMTabBarViewExtensions.m index 5d3bbe73..4e6f6f9f 100644 --- a/MMTabBarView/MMTabBarView/NSView+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSView+MMTabBarViewExtensions.m @@ -96,7 +96,6 @@ - (void)orderFront { [subviews removeObjectIdenticalTo:self]; [subviews addObject:self]; [superview setSubviews:subviews]; - [subviews release]; } @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.h index 0a235c43..62f6a6e0 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.h @@ -10,27 +10,8 @@ #import "MMTabStyle.h" @interface MMAdiumTabStyle : NSObject -{ - NSImage *_closeButton; - NSImage *_closeButtonDown; - NSImage *_closeButtonOver; - NSImage *_closeDirtyButton; - NSImage *_closeDirtyButtonDown; - NSImage *_closeDirtyButtonOver; - NSImage *_gradientImage; - BOOL _drawsUnified; - BOOL _drawsRight; -} - -- (void)loadImages; - -- (BOOL)drawsUnified; -- (void)setDrawsUnified:(BOOL)value; -- (BOOL)drawsRight; -- (void)setDrawsRight:(BOOL)value; - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; +@property (assign) BOOL drawsUnified; +@property (assign) BOOL drawsRight; @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.m index 03c3d98a..e5e99ea2 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMAdiumTabStyle.m @@ -13,28 +13,25 @@ #import "NSView+MMTabBarViewExtensions.h" #import "NSCell+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" +#import "MMTabBarButtonCell.Private.h" // #define Adium_CellPadding 2 #define Adium_MARGIN_X 4 #define kMMAdiumCounterPadding 3.0 -@interface MMTabBarButtonCell(SharedPrivates) - -- (void)_drawIconWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawCloseButtonWithFrame:(NSRect)frame inView:(NSView *)controlView; -- (void)_drawObjectCounterWithFrame:(NSRect)frame inView:(NSView *)controlView; - -@end - -@interface MMAdiumTabStyle (/*Private*/) - -- (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView applyShadow:(BOOL)applyShadow drawRollovers:(BOOL)drawRollovers; - -- (void)_drawBezelWithFrame:(NSRect)frame usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView applyShadow:(BOOL)applyShadow drawRollovers:(BOOL)drawRollovers; - +@interface MMAdiumTabStyle () @end @implementation MMAdiumTabStyle +{ + NSImage *_closeButton; + NSImage *_closeButtonDown; + NSImage *_closeButtonOver; + NSImage *_closeDirtyButton; + NSImage *_closeDirtyButtonDown; + NSImage *_closeDirtyButtonOver; + NSImage *_gradientImage; +} + (NSString *)name { return @"Adium"; @@ -47,58 +44,26 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id)init { +- (instancetype)init { if ((self = [super init])) { - [self loadImages]; + [self _loadImages]; _drawsUnified = NO; _drawsRight = NO; } return self; } -- (void)loadImages { - _closeButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; - _closeButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; - _closeButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; - - _closeDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; - _closeDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; - _closeDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; - - _gradientImage = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AdiumGradient"]]; -} - - (void)dealloc { - [_closeButton release], _closeButton = nil; - [_closeButtonDown release], _closeButtonDown = nil; - [_closeButtonOver release], _closeButtonOver = nil; + _closeButton = nil; + _closeButtonDown = nil; + _closeButtonOver = nil; - [_closeDirtyButton release], _closeDirtyButton = nil; - [_closeDirtyButtonDown release], _closeDirtyButtonDown = nil; - [_closeDirtyButtonOver release], _closeDirtyButtonOver = nil; + _closeDirtyButton = nil; + _closeDirtyButtonDown = nil; + _closeDirtyButtonOver = nil; - [_gradientImage release], _gradientImage = nil; + _gradientImage = nil; - [super dealloc]; -} - -#pragma mark - -#pragma mark Drawing Style Accessors - -- (BOOL)drawsUnified { - return _drawsUnified; -} - -- (void)setDrawsUnified:(BOOL)value { - _drawsUnified = value; -} - -- (BOOL)drawsRight { - return _drawsRight; -} - -- (void)setDrawsRight:(BOOL)value { - _drawsRight = value; } #pragma mark - @@ -433,7 +398,6 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { if ([tabBarView isWindowActive]) { NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]]; [gradient drawInRect:rect angle:90.0]; - [gradient release]; } else { [[NSColor windowBackgroundColor] set]; NSRectFill(rect); @@ -521,7 +485,6 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { } } - [shadow release]; [NSGraphicsContext restoreGraphicsState]; } @@ -629,39 +592,19 @@ - (void)drawCloseButtonOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)fr } #pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:_closeButton forKey:@"closeButton"]; - [aCoder encodeObject:_closeButtonDown forKey:@"closeButtonDown"]; - [aCoder encodeObject:_closeButtonOver forKey:@"closeButtonOver"]; - [aCoder encodeObject:_closeDirtyButton forKey:@"closeDirtyButton"]; - [aCoder encodeObject:_closeDirtyButtonDown forKey:@"closeDirtyButtonDown"]; - [aCoder encodeObject:_closeDirtyButtonOver forKey:@"closeDirtyButtonOver"]; - [aCoder encodeBool:_drawsUnified forKey:@"drawsUnified"]; - [aCoder encodeBool:_drawsRight forKey:@"drawsRight"]; - } -} +#pragma mark Private Methods -- (id)initWithCoder:(NSCoder *)aDecoder { - if ((self = [super init])) { - if ([aDecoder allowsKeyedCoding]) { - _closeButton = [[aDecoder decodeObjectForKey:@"closeButton"] retain]; - _closeButtonDown = [[aDecoder decodeObjectForKey:@"closeButtonDown"] retain]; - _closeButtonOver = [[aDecoder decodeObjectForKey:@"closeButtonOver"] retain]; - _closeDirtyButton = [[aDecoder decodeObjectForKey:@"closeDirtyButton"] retain]; - _closeDirtyButtonDown = [[aDecoder decodeObjectForKey:@"closeDirtyButtonDown"] retain]; - _closeDirtyButtonOver = [[aDecoder decodeObjectForKey:@"closeDirtyButtonOver"] retain]; - _drawsUnified = [aDecoder decodeBoolForKey:@"drawsUnified"]; - _drawsRight = [aDecoder decodeBoolForKey:@"drawsRight"]; - } - } - return self; -} +- (void)_loadImages { + _closeButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; + _closeButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; + _closeButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; -#pragma mark - -#pragma mark Private Methods + _closeDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; + _closeDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; + _closeDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; + + _gradientImage = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AdiumGradient"]]; +} - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView applyShadow:(BOOL)applyShadow drawRollovers:(BOOL)drawRollovers { @@ -697,7 +640,6 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]]; [gradient drawInRect:aRect angle:90.0]; - [gradient release]; } else { [[NSColor windowBackgroundColor] set]; NSRectFill(aRect); @@ -788,7 +730,6 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]]; [gradient drawInRect:aRect angle:90.0]; - [gradient release]; } else { [[NSColor windowBackgroundColor] set]; NSRectFill(aRect); @@ -803,7 +744,6 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask } [gradient drawInRect:aRect angle:0.0]; - [gradient release]; } // frame @@ -846,7 +786,6 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask } [NSGraphicsContext restoreGraphicsState]; - [shadow release]; } - (void)_drawBezelWithFrame:(NSRect)frame usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView applyShadow:(BOOL)applyShadow drawRollovers:(BOOL)drawRollovers @@ -903,7 +842,6 @@ - (void)_drawBezelWithFrame:(NSRect)frame usingStatesOfAttachedButton:(MMAttache } [NSGraphicsContext restoreGraphicsState]; - [shadow release]; } @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.h index 046f469a..7af3803c 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.h @@ -9,24 +9,6 @@ #import #import "MMTabStyle.h" -@interface MMAquaTabStyle : NSObject { - NSImage *aquaTabBg; - NSImage *aquaTabBgDown; - NSImage *aquaTabBgDownGraphite; - NSImage *aquaTabBgDownNonKey; - NSImage *aquaDividerDown; - NSImage *aquaDivider; - NSImage *aquaCloseButton; - NSImage *aquaCloseButtonDown; - NSImage *aquaCloseButtonOver; - NSImage *aquaCloseDirtyButton; - NSImage *aquaCloseDirtyButtonDown; - NSImage *aquaCloseDirtyButtonOver; -} - -- (void)loadImages; - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; +@interface MMAquaTabStyle : NSObject @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.m index 59d73d60..b86022b1 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMAquaTabStyle.m @@ -12,6 +12,20 @@ #import "NSView+MMTabBarViewExtensions.h" @implementation MMAquaTabStyle +{ + NSImage *aquaTabBg; + NSImage *aquaTabBgDown; + NSImage *aquaTabBgDownGraphite; + NSImage *aquaTabBgDownNonKey; + NSImage *aquaDividerDown; + NSImage *aquaDivider; + NSImage *aquaCloseButton; + NSImage *aquaCloseButtonDown; + NSImage *aquaCloseButtonOver; + NSImage *aquaCloseDirtyButton; + NSImage *aquaCloseDirtyButtonDown; + NSImage *aquaCloseDirtyButtonOver; +} + (NSString *)name { return @"Aqua"; @@ -24,49 +38,24 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if ((self = [super init])) { - [self loadImages]; + [self _loadImages]; } return self; } -- (void) loadImages { - // Aqua Tabs Images - aquaTabBg = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsBackground"]]; - - aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDown"]]; - - aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDownGraphite"]]; - - aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDownNonKey"]]; - - aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsSeparatorDown"]]; - - aquaDivider = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsSeparator"]]; - - aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; - aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; - aquaCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; - - aquaCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; - aquaCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; - aquaCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; -} - - (void)dealloc { - [aquaTabBg release], aquaTabBg = nil; - [aquaTabBgDown release], aquaTabBgDown = nil; - [aquaDividerDown release], aquaDividerDown = nil; - [aquaDivider release], aquaDivider = nil; - [aquaCloseButton release], aquaCloseButton = nil; - [aquaCloseButtonDown release], aquaCloseButtonDown = nil; - [aquaCloseButtonOver release], aquaCloseButtonOver = nil; - [aquaCloseDirtyButton release], aquaCloseDirtyButton = nil; - [aquaCloseDirtyButtonDown release], aquaCloseDirtyButtonDown = nil; - [aquaCloseDirtyButtonOver release], aquaCloseDirtyButtonOver = nil; - - [super dealloc]; + aquaTabBg = nil; + aquaTabBgDown = nil; + aquaDividerDown = nil; + aquaDivider = nil; + aquaCloseButton = nil; + aquaCloseButtonDown = nil; + aquaCloseButtonOver = nil; + aquaCloseDirtyButton = nil; + aquaCloseDirtyButtonDown = nil; + aquaCloseDirtyButtonOver = nil; } #pragma mark - @@ -260,45 +249,29 @@ - (void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabB } #pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:aquaTabBg forKey:@"aquaTabBg"]; - [aCoder encodeObject:aquaTabBgDown forKey:@"aquaTabBgDown"]; - [aCoder encodeObject:aquaTabBgDownGraphite forKey:@"aquaTabBgDownGraphite"]; - [aCoder encodeObject:aquaTabBgDownNonKey forKey:@"aquaTabBgDownNonKey"]; - [aCoder encodeObject:aquaDividerDown forKey:@"aquaDividerDown"]; - [aCoder encodeObject:aquaDivider forKey:@"aquaDivider"]; - [aCoder encodeObject:aquaCloseButton forKey:@"aquaCloseButton"]; - [aCoder encodeObject:aquaCloseButtonDown forKey:@"aquaCloseButtonDown"]; - [aCoder encodeObject:aquaCloseButtonOver forKey:@"aquaCloseButtonOver"]; - [aCoder encodeObject:aquaCloseDirtyButton forKey:@"aquaCloseDirtyButton"]; - [aCoder encodeObject:aquaCloseDirtyButtonDown forKey:@"aquaCloseDirtyButtonDown"]; - [aCoder encodeObject:aquaCloseDirtyButtonOver forKey:@"aquaCloseDirtyButtonOver"]; - } -} +#pragma mark Private Methods -- (id)initWithCoder:(NSCoder *)aDecoder { - //self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - aquaTabBg = [[aDecoder decodeObjectForKey:@"aquaTabBg"] retain]; - aquaTabBgDown = [[aDecoder decodeObjectForKey:@"aquaTabBgDown"] retain]; - aquaTabBgDownGraphite = [[aDecoder decodeObjectForKey:@"aquaTabBgDownGraphite"] retain]; - aquaTabBgDownNonKey = [[aDecoder decodeObjectForKey:@"aquaTabBgDownNonKey"] retain]; - aquaDividerDown = [[aDecoder decodeObjectForKey:@"aquaDividerDown"] retain]; - aquaDivider = [[aDecoder decodeObjectForKey:@"aquaDivider"] retain]; - aquaCloseButton = [[aDecoder decodeObjectForKey:@"aquaCloseButton"] retain]; - aquaCloseButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseButtonDown"] retain]; - aquaCloseButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseButtonOver"] retain]; - aquaCloseDirtyButton = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButton"] retain]; - aquaCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonDown"] retain]; - aquaCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonOver"] retain]; - } - //} - return self; +- (void)_loadImages { + // Aqua Tabs Images + aquaTabBg = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsBackground"]]; + + aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDown"]]; + + aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDownGraphite"]]; + + aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsDownNonKey"]]; + + aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsSeparatorDown"]]; + + aquaDivider = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabsSeparator"]]; + + aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; + aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; + aquaCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; + + aquaCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; + aquaCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; + aquaCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; } @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.h index 1006e4f3..0cb5fec6 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.h @@ -11,17 +11,6 @@ #import "NSBezierPath+MMTabBarViewExtensions.h" @interface MMCardTabStyle : NSObject -{ - NSImage *cardCloseButton; - NSImage *cardCloseButtonDown; - NSImage *cardCloseButtonOver; - NSImage *cardCloseDirtyButton; - NSImage *cardCloseDirtyButtonDown; - NSImage *cardCloseDirtyButtonOver; - - CGFloat _horizontalInset; - CGFloat _topMargin; -} @property (assign) CGFloat horizontalInset; @property (assign) CGFloat topMargin; diff --git a/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.m index c4217c9d..d2c675cf 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMCardTabStyle.m @@ -11,25 +11,20 @@ #import "MMAttachedTabBarButton.h" #import "NSView+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" +#import "MMTabBarView.Private.h" -@interface MMTabBarView(SharedPrivates) - -- (void)_drawInteriorInRect:(NSRect)rect; -- (NSRect)_addTabButtonRect; -- (NSRect)_overflowButtonRect; - -@end - -@interface MMCardTabStyle (/*Private*/) - -- (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; - +@interface MMCardTabStyle () @end @implementation MMCardTabStyle - -@synthesize horizontalInset = _horizontalInset; -@synthesize topMargin = _topMargin; +{ + NSImage *cardCloseButton; + NSImage *cardCloseButtonDown; + NSImage *cardCloseButtonOver; + NSImage *cardCloseDirtyButton; + NSImage *cardCloseDirtyButtonDown; + NSImage *cardCloseDirtyButtonOver; +} + (NSString *)name { return @"Card"; @@ -42,7 +37,7 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if ( (self = [super init]) ) { cardCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; cardCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; @@ -58,14 +53,12 @@ - (id) init { } - (void)dealloc { - [cardCloseButton release], cardCloseButton = nil; - [cardCloseButtonDown release], cardCloseButtonDown = nil; - [cardCloseButtonOver release], cardCloseButtonOver = nil; - [cardCloseDirtyButton release], cardCloseDirtyButton = nil; - [cardCloseDirtyButtonDown release], cardCloseDirtyButtonDown = nil; - [cardCloseDirtyButtonOver release], cardCloseDirtyButtonOver = nil; - - [super dealloc]; + cardCloseButton = nil; + cardCloseButtonDown = nil; + cardCloseButtonOver = nil; + cardCloseDirtyButton = nil; + cardCloseDirtyButtonDown = nil; + cardCloseDirtyButtonOver = nil; } #pragma mark - @@ -181,7 +174,6 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { if (gradient) { [gradient drawInRect:bounds angle:270]; - [gradient release]; } bounds = [tabBarView bounds]; @@ -271,7 +263,7 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask if (gradient != nil) { [gradient drawInBezierPath:fillPath angle:90.0f]; - [gradient release], gradient = nil; + gradient = nil; } } else { [[NSColor windowBackgroundColor] set]; diff --git a/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.h index f457abb7..5afb2a6b 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.h @@ -10,18 +10,7 @@ #import "MMTabStyle.h" #import "NSBezierPath+MMTabBarViewExtensions.h" -@interface MMLiveChatTabStyle : NSObject { - NSImage *liveChatCloseButton; - NSImage *liveChatCloseButtonDown; - NSImage *liveChatCloseButtonOver; - NSImage *liveChatCloseDirtyButton; - NSImage *liveChatCloseDirtyButtonDown; - NSImage *liveChatCloseDirtyButtonOver; - - NSDictionary *_objectCountStringAttributes; - - CGFloat _leftMargin; -} +@interface MMLiveChatTabStyle : NSObject @property (assign) CGFloat leftMarginForTabBarView; diff --git a/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.m index b7f206e8..8f3997d6 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMLiveChatTabStyle.m @@ -13,15 +13,20 @@ #import "NSCell+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" -@interface MMLiveChatTabStyle (/*Private*/) - -- (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; - +@interface MMLiveChatTabStyle () @end @implementation MMLiveChatTabStyle - -@synthesize leftMarginForTabBarView = _leftMargin; +{ + NSImage *liveChatCloseButton; + NSImage *liveChatCloseButtonDown; + NSImage *liveChatCloseButtonOver; + NSImage *liveChatCloseDirtyButton; + NSImage *liveChatCloseDirtyButtonDown; + NSImage *liveChatCloseDirtyButtonOver; + + NSDictionary *_objectCountStringAttributes; +} + (NSString *)name { return @"LiveChat"; @@ -34,7 +39,7 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if ((self = [super init])) { liveChatCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; liveChatCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; @@ -48,22 +53,20 @@ - (id) init { [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName, [[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Lucida Grande" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName, nil]; - _leftMargin = 5.0; + _leftMarginForTabBarView = 5.0; } return self; } - (void)dealloc { - [liveChatCloseButton release], liveChatCloseButton = nil; - [liveChatCloseButtonDown release], liveChatCloseButtonDown = nil; - [liveChatCloseButtonOver release], liveChatCloseButtonOver = nil; - [liveChatCloseDirtyButton release], liveChatCloseDirtyButton = nil; - [liveChatCloseDirtyButtonDown release], liveChatCloseDirtyButtonDown = nil; - [liveChatCloseDirtyButtonOver release], liveChatCloseDirtyButtonOver = nil; + liveChatCloseButton = nil; + liveChatCloseButtonDown = nil; + liveChatCloseButtonOver = nil; + liveChatCloseDirtyButton = nil; + liveChatCloseDirtyButtonDown = nil; + liveChatCloseDirtyButtonOver = nil; - [_objectCountStringAttributes release], _objectCountStringAttributes = nil; - - [super dealloc]; + _objectCountStringAttributes = nil; } #pragma mark - @@ -71,14 +74,14 @@ - (void)dealloc { - (CGFloat)leftMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) - return _leftMargin; + return _leftMarginForTabBarView; else return 0.0; } - (CGFloat)rightMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) - return _leftMargin; + return _leftMarginForTabBarView; else return 0.0; } @@ -334,13 +337,13 @@ -(NSRect)largeImageRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell * - (NSAttributedString *)attributedObjectCountStringValueForTabCell:(MMTabBarButtonCell *)cell { NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell objectCount]]; - return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease]; + return [[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes]; } - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)cell { NSMutableAttributedString *attrStr; NSString * contents = [cell title]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; @@ -348,7 +351,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)ce // Paragraph Style for Truncating Long Text static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil; if (!TruncatingTailParagraphStyle) { - TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range]; @@ -369,7 +372,6 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { NSBezierPath *path = [NSBezierPath bezierPathWithRect:gradientRect]; NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.75 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.75 alpha:0.0]]; [gradient drawInBezierPath:path angle:90.0]; - [gradient release]; } [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set]; @@ -496,18 +498,6 @@ - (void)drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask [self _drawBezelInRect:aRect withCapMask:capMask usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; } -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - // ... do not encode anything -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - // ... do not read anything - return [self init]; -} - #pragma mark - #pragma mark Private Methods @@ -542,7 +532,6 @@ - (void)_drawBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; [gradient drawInBezierPath:fillPath angle:90.0]; - [gradient release]; NSBezierPath *outlinePath = outlinePath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask]; diff --git a/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.h index 9c7b9c65..105397e3 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.h @@ -9,18 +9,6 @@ #import #import "MMTabStyle.h" -@interface MMMetalTabStyle : NSObject { - NSImage *metalCloseButton; - NSImage *metalCloseButtonDown; - NSImage *metalCloseButtonOver; - NSImage *metalCloseDirtyButton; - NSImage *metalCloseDirtyButtonDown; - NSImage *metalCloseDirtyButtonOver; - - NSDictionary *_objectCountStringAttributes; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; +@interface MMMetalTabStyle : NSObject @end diff --git a/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.m index 1e6d8cda..d2c7fb46 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMMetalTabStyle.m @@ -12,13 +12,21 @@ #import "NSView+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" -@interface MMMetalTabStyle (/*Private*/) - -- (BOOL)_shouldDrawHorizontalTopBorderLineInView:(id)controlView; +@interface MMMetalTabStyle () @end @implementation MMMetalTabStyle +{ + NSImage *metalCloseButton; + NSImage *metalCloseButtonDown; + NSImage *metalCloseButtonOver; + NSImage *metalCloseDirtyButton; + NSImage *metalCloseDirtyButtonDown; + NSImage *metalCloseDirtyButtonOver; + + NSDictionary *_objectCountStringAttributes; +} StaticImage(TabNewMetal) StaticImage(TabNewMetalPressed) @@ -35,7 +43,7 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if ((self = [super init])) { metalCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"TabClose_Front"]]; metalCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"TabClose_Front_Pressed"]]; @@ -53,16 +61,14 @@ - (id) init { } - (void)dealloc { - [metalCloseButton release], metalCloseButton = nil; - [metalCloseButtonDown release], metalCloseButtonDown = nil; - [metalCloseButtonOver release], metalCloseButtonOver = nil; - [metalCloseDirtyButton release], metalCloseDirtyButton = nil; - [metalCloseDirtyButtonDown release], metalCloseDirtyButtonDown = nil; - [metalCloseDirtyButtonOver release], metalCloseDirtyButtonOver = nil; - - [_objectCountStringAttributes release], _objectCountStringAttributes = nil; - - [super dealloc]; + metalCloseButton = nil; + metalCloseButtonDown = nil; + metalCloseButtonOver = nil; + metalCloseDirtyButton = nil; + metalCloseDirtyButtonDown = nil; + metalCloseDirtyButtonOver = nil; + + _objectCountStringAttributes = nil; } #pragma mark - @@ -156,13 +162,13 @@ - (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type forTabCell:(MMT - (NSAttributedString *)attributedObjectCountStringValueForTabCell:(MMTabBarButtonCell *)cell { NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell objectCount]]; - return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease]; + return [[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes]; } - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)cell { NSMutableAttributedString *attrStr; NSString *contents = [cell title]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -171,7 +177,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)ce // Add shadow attribute NSShadow* shadow; - shadow = [[[NSShadow alloc] init] autorelease]; + shadow = [[NSShadow alloc] init]; CGFloat shadowAlpha; if (([cell state] == NSOnState) || [cell mouseHovered]) { shadowAlpha = 0.8; @@ -186,7 +192,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)ce // Paragraph Style for Truncating Long Text static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil; if (!TruncatingTailParagraphStyle) { - TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; [TruncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; } @@ -347,36 +353,6 @@ - (void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabB } } -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:metalCloseButton forKey:@"metalCloseButton"]; - [aCoder encodeObject:metalCloseButtonDown forKey:@"metalCloseButtonDown"]; - [aCoder encodeObject:metalCloseButtonOver forKey:@"metalCloseButtonOver"]; - [aCoder encodeObject:metalCloseDirtyButton forKey:@"metalCloseDirtyButton"]; - [aCoder encodeObject:metalCloseDirtyButtonDown forKey:@"metalCloseDirtyButtonDown"]; - [aCoder encodeObject:metalCloseDirtyButtonOver forKey:@"metalCloseDirtyButtonOver"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - // self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - metalCloseButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - metalCloseButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - metalCloseButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - metalCloseDirtyButton = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButton"] retain]; - metalCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonDown"] retain]; - metalCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonOver"] retain]; - } - //} - return self; -} - #pragma mark - #pragma mark Private Methods diff --git a/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.h index a922b8cd..7576a5d4 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.h @@ -9,17 +9,7 @@ #import #import "MMTabStyle.h" -@interface MMUnifiedTabStyle : NSObject { - - NSImage *unifiedCloseButton; - NSImage *unifiedCloseButtonDown; - NSImage *unifiedCloseButtonOver; - NSImage *unifiedCloseDirtyButton; - NSImage *unifiedCloseDirtyButtonDown; - NSImage *unifiedCloseDirtyButtonOver; - - CGFloat _leftMargin; -} +@interface MMUnifiedTabStyle : NSObject @property (assign) CGFloat leftMarginForTabBarView; diff --git a/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.m index d9c7894c..5f3c994d 100644 --- a/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/MMUnifiedTabStyle.m @@ -12,16 +12,18 @@ #import "NSView+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" -@interface MMUnifiedTabStyle (/*Private*/) - -- (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; -- (void)_drawBoxBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; - +@interface MMUnifiedTabStyle () @end @implementation MMUnifiedTabStyle - -@synthesize leftMarginForTabBarView = _leftMargin; +{ + NSImage *unifiedCloseButton; + NSImage *unifiedCloseButtonDown; + NSImage *unifiedCloseButtonOver; + NSImage *unifiedCloseDirtyButton; + NSImage *unifiedCloseDirtyButtonDown; + NSImage *unifiedCloseDirtyButtonOver; +} + (NSString *)name { return @"Unified"; @@ -34,7 +36,7 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if ((self = [super init])) { unifiedCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front"]]; unifiedCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; @@ -44,20 +46,19 @@ - (id) init { unifiedCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; unifiedCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; - _leftMargin = 0.0; + _leftMarginForTabBarView = 0.0; } return self; } - (void)dealloc { - [unifiedCloseButton release], unifiedCloseButton = nil; - [unifiedCloseButtonDown release], unifiedCloseButtonDown = nil; - [unifiedCloseButtonOver release], unifiedCloseButtonOver = nil; - [unifiedCloseDirtyButton release], unifiedCloseDirtyButton = nil; - [unifiedCloseDirtyButtonDown release], unifiedCloseDirtyButtonDown = nil; - [unifiedCloseDirtyButtonOver release], unifiedCloseDirtyButtonOver = nil; - - [super dealloc]; + unifiedCloseButton = nil; + unifiedCloseButtonDown = nil; + unifiedCloseButtonOver = nil; + unifiedCloseDirtyButton = nil; + unifiedCloseDirtyButtonDown = nil; + unifiedCloseDirtyButtonOver = nil; + } #pragma mark - @@ -65,14 +66,14 @@ - (void)dealloc { - (CGFloat)leftMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) - return _leftMargin; + return _leftMarginForTabBarView; else return 0.0f; } - (CGFloat)rightMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) - return _leftMargin; + return _leftMarginForTabBarView; else return 0.0f; } @@ -149,7 +150,6 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { } else { NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]]; [gradient drawInRect:gradientRect angle:90.0]; - [gradient release]; } [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set]; @@ -284,36 +284,6 @@ -(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBa } } -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:unifiedCloseButton forKey:@"unifiedCloseButton"]; - [aCoder encodeObject:unifiedCloseButtonDown forKey:@"unifiedCloseButtonDown"]; - [aCoder encodeObject:unifiedCloseButtonOver forKey:@"unifiedCloseButtonOver"]; - [aCoder encodeObject:unifiedCloseDirtyButton forKey:@"unifiedCloseDirtyButton"]; - [aCoder encodeObject:unifiedCloseDirtyButtonDown forKey:@"unifiedCloseDirtyButtonDown"]; - [aCoder encodeObject:unifiedCloseDirtyButtonOver forKey:@"unifiedCloseDirtyButtonOver"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - // self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain]; - unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain]; - unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain]; - unifiedCloseDirtyButton = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] retain]; - unifiedCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] retain]; - unifiedCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] retain]; - } - //} - return self; -} - #pragma mark - #pragma mark Private Methods @@ -332,13 +302,11 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap NSColor *endColor = [NSColor colorWithDeviceWhite:0.663 alpha:1.000]; NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; [gradient drawInBezierPath:fillPath angle:80.0]; - [gradient release]; } else if ([button mouseHovered]) { NSColor *startColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.000]; NSColor *endColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.000]; NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; [gradient drawInBezierPath:fillPath angle:80.0]; - [gradient release]; } } else { @@ -349,7 +317,6 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap [[NSGraphicsContext currentContext] setShouldAntialias:NO]; [gradient drawInBezierPath:fillPath angle:90.0]; [[NSGraphicsContext currentContext] setShouldAntialias:YES]; - [gradient release]; } } diff --git a/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.h b/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.h index d884778c..d382c6d5 100644 --- a/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.h @@ -9,10 +9,6 @@ #import #import "MMTabStyle.h" -@interface MMSafariTabStyle : NSObject { - - NSDictionary* _objectCountStringAttributes; - -} +@interface MMSafariTabStyle : NSObject @end diff --git a/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.m b/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.m index 6025b7a0..5f5d1c90 100644 --- a/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/Safari Tab Style/MMSafariTabStyle.m @@ -11,23 +11,13 @@ #import "MMTabBarView.h" #import "MMAttachedTabBarButton.h" #import "NSView+MMTabBarViewExtensions.h" - -@interface MMTabBarView(SharedPrivates) - -- (NSRect)_addTabButtonRect; -- (NSRect)_overflowButtonRect; - -@end - -@interface MMTabBarButtonCell(SharedPrivates) - -- (NSRect)_closeButtonRectForBounds:(NSRect)theRect; -- (CGFloat)_leftMargin; -- (CGFloat)_rightMargin; - -@end +#import "MMTabBarView.Private.h" +#import "MMTabBarButtonCell.Private.h" @implementation MMSafariTabStyle +{ + NSDictionary *_objectCountStringAttributes; +} StaticImage(SafariAWATClose) StaticImage(SafariAWATClosePressed) @@ -71,7 +61,7 @@ - (NSString *)name { #pragma mark - #pragma mark Creation/Destruction -- (id) init { +- (instancetype) init { if((self = [super init])) { _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName, [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName, @@ -81,9 +71,8 @@ - (id) init { } - (void)dealloc { - [_objectCountStringAttributes release], _objectCountStringAttributes = nil; + _objectCountStringAttributes = nil; - [super dealloc]; } #pragma mark - diff --git a/default.xcworkspace/xcshareddata/default.xccheckout b/default.xcworkspace/xcshareddata/default.xccheckout index 1a334e89..3be995df 100644 --- a/default.xcworkspace/xcshareddata/default.xccheckout +++ b/default.xcworkspace/xcshareddata/default.xccheckout @@ -10,29 +10,29 @@ default IDESourceControlProjectOriginsDictionary - B63C0D76-7988-44C3-920F-0F0E40F98A62 + B28F34E93FF7C34A6E2F490D54CBCF67304F4394 https://github.com/MiMo42/MMTabBarView.git IDESourceControlProjectPath default.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary - B63C0D76-7988-44C3-920F-0F0E40F98A62 + B28F34E93FF7C34A6E2F490D54CBCF67304F4394 .. IDESourceControlProjectURL https://github.com/MiMo42/MMTabBarView.git IDESourceControlProjectVersion - 110 + 111 IDESourceControlProjectWCCIdentifier - B63C0D76-7988-44C3-920F-0F0E40F98A62 + B28F34E93FF7C34A6E2F490D54CBCF67304F4394 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - B63C0D76-7988-44C3-920F-0F0E40F98A62 + B28F34E93FF7C34A6E2F490D54CBCF67304F4394 IDESourceControlWCCName MMTabBarView diff --git a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme index 99a0a33d..398424a5 100644 --- a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme +++ b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme @@ -1,6 +1,6 @@ - + - + + + + + From 4338f7222beb0cac2383b5ca3a24bfc5e3c33862 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 15:21:58 +0200 Subject: [PATCH 03/21] Modernizing code... --- .../MMTabBarView Demo/DemoFakeModel.h | 15 +-- .../MMTabBarView Demo/DemoFakeModel.m | 13 -- .../MMTabBarView.xcodeproj/project.pbxproj | 4 + .../MMTabBarView/MMOverflowPopUpButton.h | 10 +- .../MMTabBarView/MMOverflowPopUpButton.m | 18 +-- .../MMTabBarView/MMOverflowPopUpButtonCell.h | 9 +- .../MMTabBarView/MMOverflowPopUpButtonCell.m | 12 +- MMTabBarView/MMTabBarView/MMRolloverButton.h | 12 +- .../MMTabBarView/MMRolloverButtonCell.h | 9 +- .../MMTabBarView/MMRolloverButtonCell.m | 6 +- .../MMTabBarView/MMTabBarButton.Private.h | 13 ++ MMTabBarView/MMTabBarView/MMTabBarButton.m | 5 - .../MMTabBarView/MMTabBarController.h | 6 +- .../MMTabBarView/MMTabBarController.m | 10 +- MMTabBarView/MMTabBarView/MMTabBarItem.h | 10 +- .../MMTabBarView/MMTabBarView.Private.h | 7 +- MMTabBarView/MMTabBarView/MMTabBarView.h | 63 +-------- MMTabBarView/MMTabBarView/MMTabBarView.m | 122 +++++++++--------- .../MMTabBarView/MMTabDragAssistant.h | 33 +---- .../MMTabBarView/MMTabDragAssistant.m | 59 +++------ MMTabBarView/MMTabBarView/MMTabDragView.h | 16 +-- MMTabBarView/MMTabBarView/MMTabDragView.m | 22 ---- MMTabBarView/MMTabBarView/MMTabDragWindow.h | 9 +- MMTabBarView/MMTabBarView/MMTabDragWindow.m | 3 + .../MMTabBarView/MMTabDragWindowController.h | 22 ++-- .../MMTabBarView/MMTabDragWindowController.m | 13 +- .../MMTabBarView/MMTabPasteboardItem.h | 4 +- .../MMTabBarView/MMTabPasteboardItem.m | 2 - MMTabBarView/MMTabBarView/MMTabStyle.h | 3 +- 29 files changed, 168 insertions(+), 362 deletions(-) create mode 100644 MMTabBarView/MMTabBarView/MMTabBarButton.Private.h diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h index 7d8f204e..e13d1cac 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.h @@ -10,18 +10,7 @@ #import -@interface DemoFakeModel : NSObject { - NSString *_title; - BOOL _isProcessing; - NSImage *_icon; - NSImage *_largeImage; - NSString *_iconName; - NSInteger _objectCount; - NSColor *_objectCountColor; - BOOL _showObjectCount; - BOOL _isEdited; - BOOL _hasCloseButton; -} +@interface DemoFakeModel : NSObject @property (copy) NSString *title; @property (strong) NSImage *largeImage; @@ -36,6 +25,6 @@ @property (assign) BOOL hasCloseButton; // designated initializer -- (instancetype)init; +- (instancetype)init NS_DESIGNATED_INITIALIZER; @end diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m index 89f148a2..ad00dd51 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoFakeModel.m @@ -10,18 +10,6 @@ @implementation DemoFakeModel -@synthesize title = _title; -@synthesize largeImage = _largeImage; -@synthesize icon = _icon; -@synthesize iconName = _iconName; - -@synthesize isProcessing = _isProcessing; -@synthesize objectCount = _objectCount; -@synthesize objectCountColor = _objectCountColor; -@synthesize showObjectCount = _showObjectCount; -@synthesize isEdited = _isEdited; -@synthesize hasCloseButton = _hasCloseButton; - - (instancetype)init { if (self = [super init]) { _isProcessing = NO; @@ -45,7 +33,6 @@ -(void)dealloc { _iconName = nil; _largeImage = nil; _objectCountColor = nil; - } @end diff --git a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj index bec2f94c..1c59ac14 100644 --- a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj +++ b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj @@ -161,6 +161,7 @@ 06AE02301B10A21000C65A84 /* MMTabBarButton.Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 06AE02361B10AD5500C65A84 /* MMTabBarButton.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */; }; 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAF160B555F00153FA2 /* MMSafariTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */; }; 06DB23AA1609F5830071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23A91609F5830071BDA0 /* Cocoa.framework */; }; @@ -328,6 +329,7 @@ 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Common.h; sourceTree = ""; }; 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButtonCell.Private.h; sourceTree = ""; }; 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarView.Private.h; sourceTree = ""; }; + 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Private.h; sourceTree = ""; }; 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMSafariTabStyle.h; sourceTree = ""; }; 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMSafariTabStyle.m; sourceTree = ""; }; 06DB23A61609F5830071BDA0 /* MMTabBarView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MMTabBarView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -445,6 +447,7 @@ 0634EFE11609FC7F00A6C86A /* MMAttachedTabBarButtonCell.h */, 0634EFE21609FC7F00A6C86A /* MMAttachedTabBarButtonCell.m */, 0634EFED1609FC7F00A6C86A /* MMTabBarButton.h */, + 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */, 06AE022F1B10A19000C65A84 /* MMTabBarButton.Common.h */, 0634EFEE1609FC7F00A6C86A /* MMTabBarButton.m */, 0634EFEF1609FC7F00A6C86A /* MMTabBarButtonCell.h */, @@ -678,6 +681,7 @@ buildActionMask = 2147483647; files = ( 0634EFD91609FC4C00A6C86A /* MMAttachedTabBarButton.h in Headers */, + 06AE02361B10AD5500C65A84 /* MMTabBarButton.Private.h in Headers */, 0634F0031609FC7F00A6C86A /* NSView+MMTabBarViewExtensions.h in Headers */, 0634F0051609FC7F00A6C86A /* MMAttachedTabBarButtonCell.h in Headers */, 0634F0071609FC7F00A6C86A /* MMOverflowPopUpButton.h in Headers */, diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h index 0c555f32..f6276eb3 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h @@ -12,17 +12,9 @@ typedef void (^MMCellBezelDrawingBlock)(NSCell *cell, NSRect frame, NSView *controlView); @interface MMOverflowPopUpButton : NSPopUpButton { - - BOOL _isAnimating; // pulsating animation of image and second image } -// accessors -- (NSImage *)secondImage; -- (void)setSecondImage:(NSImage *)anImage; - -// archiving -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (instancetype)initWithCoder:(NSCoder *)aDecoder; +@property (strong) NSImage *secondImage; // bezel drawing - (MMCellBezelDrawingBlock)bezelDrawingBlock; diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m index 95a9b1c8..e89f07d8 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.m @@ -23,17 +23,11 @@ return image; \ } -@interface MMOverflowPopUpButton (/*Private*/) +@interface MMOverflowPopUpButton () @property (assign) CGFloat secondImageAlpha; -- (BOOL)isAnimating; -- (void)setIsAnimating:(BOOL)newState; - -- (void)_startCellAnimationIfNeeded; -- (void)_startCellAnimation; -- (void)_stopCellAnimationIfNeeded; -- (void)_stopCellAnimation; +@property (assign) BOOL isAnimating; // pulsating animation of image and second image @end @@ -200,14 +194,6 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { #pragma mark - #pragma mark Private Methods -- (BOOL)isAnimating { - return _isAnimating; -} - -- (void)setIsAnimating:(BOOL)newState { - _isAnimating = newState; -} - - (void)_startCellAnimationIfNeeded { if ([self window] == nil || [self isHidden] || NSEqualRects(NSZeroRect, [self frame])) diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h index 2aec6606..82778ef4 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h @@ -12,14 +12,7 @@ @class MMImageTransitionAnimation; -@interface MMOverflowPopUpButtonCell : NSPopUpButtonCell { - -@private - MMCellBezelDrawingBlock _bezelDrawingBlock; - NSImage *_image; - NSImage *_secondImage; - CGFloat _secondImageAlpha; -} +@interface MMOverflowPopUpButtonCell : NSPopUpButtonCell @property (copy) MMCellBezelDrawingBlock bezelDrawingBlock; @property (strong) NSImage *image; diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m index 2d908c76..bc652da0 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m @@ -9,18 +9,14 @@ #import "MMOverflowPopUpButtonCell.h" #import "NSCell+MMTabBarViewExtensions.h" -@interface MMOverflowPopUpButtonCell (/*Private*/) - -- (NSRect)_imageRectForBounds:(NSRect)theRect forImage:(NSImage *)anImage; +@interface MMOverflowPopUpButtonCell () @end @implementation MMOverflowPopUpButtonCell - -@dynamic image; -@synthesize secondImage = _secondImage; -@synthesize secondImageAlpha = _secondImageAlpha; -@synthesize bezelDrawingBlock = _bezelDrawingBlock; +{ + NSImage *_image; +} - (instancetype)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullDown { self = [super initTextCell:stringValue pullsDown:pullDown]; diff --git a/MMTabBarView/MMTabBarView/MMRolloverButton.h b/MMTabBarView/MMTabBarView/MMRolloverButton.h index 782f71b1..6261ec8d 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButton.h +++ b/MMTabBarView/MMTabBarView/MMRolloverButton.h @@ -13,15 +13,11 @@ #pragma mark Cell Interface -- (NSImage *)rolloverImage; -- (void)setRolloverImage:(NSImage *)image; +@property (strong) NSImage *rolloverImage; +@property (assign) MMRolloverButtonType rolloverButtonType; -- (MMRolloverButtonType)rolloverButtonType; -- (void)setRolloverButtonType:(MMRolloverButtonType)aType; +@property (readonly) BOOL mouseHovered; -- (BOOL)mouseHovered; - -- (BOOL)simulateClickOnMouseHovered; -- (void)setSimulateClickOnMouseHovered:(BOOL)flag; +@property (assign) BOOL simulateClickOnMouseHovered; @end \ No newline at end of file diff --git a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h index 833fe3a0..c8d6e0d8 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h @@ -13,14 +13,7 @@ typedef NS_ENUM(NSUInteger, MMRolloverButtonType) MMRolloverSwitchButton }; -@interface MMRolloverButtonCell : NSButtonCell { - -@private - NSImage *_rolloverImage; - BOOL _mouseHovered; - MMRolloverButtonType _rolloverButtonType; - BOOL _simulateClickOnMouseHovered; -} +@interface MMRolloverButtonCell : NSButtonCell @property (readonly) BOOL mouseHovered; @property (strong) NSImage *rolloverImage; diff --git a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m index 69c5c454..ee35c524 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.m @@ -8,11 +8,11 @@ #import "MMRolloverButtonCell.h" @implementation MMRolloverButtonCell +{ + MMRolloverButtonType _rolloverButtonType; +} -@synthesize mouseHovered = _mouseHovered; -@synthesize rolloverImage = _rolloverImage; @dynamic rolloverButtonType; -@synthesize simulateClickOnMouseHovered = _simulateClickOnMouseHovered; - (instancetype)init { diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h b/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h new file mode 100644 index 00000000..0b3210d5 --- /dev/null +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h @@ -0,0 +1,13 @@ +// +// MMTabBarButton.Private.h +// MMTabBarView +// +// Created by Michael Monscheuer on 23/05/15. +// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// + +@interface MMTabBarButton(PrivateDrawing) + +- (NSRect)_indicatorRectForBounds:(NSRect)theRect; + +@end diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.m b/MMTabBarView/MMTabBarView/MMTabBarButton.m index b63068e7..f732fe1a 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.m +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.m @@ -26,11 +26,6 @@ - (NSRect)_indicatorRectForBounds:(NSRect)bounds; @implementation MMTabBarButton -@synthesize stackingFrame = _stackingFrame; -@synthesize closeButton = _closeButton; -@dynamic closeButtonAction; -@synthesize indicator = _indicator; - + (void)initialize { if (self == [MMTabBarButton class]) { diff --git a/MMTabBarView/MMTabBarView/MMTabBarController.h b/MMTabBarView/MMTabBarView/MMTabBarController.h index e197f4d0..6ae6fa41 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarController.h +++ b/MMTabBarView/MMTabBarView/MMTabBarController.h @@ -11,14 +11,10 @@ @class MMTabBarView, MMAttachedTabBarButton; @interface MMTabBarController : NSObject -{ - MMTabBarView *_tabBarView; - NSMenu *_overflowMenu; -} - (instancetype)initWithTabBarView:(MMTabBarView *)aTabBarView; -- (NSMenu *)overflowMenu; +@property (readonly) NSMenu *overflowMenu; - (void)layoutButtons; diff --git a/MMTabBarView/MMTabBarView/MMTabBarController.m b/MMTabBarView/MMTabBarView/MMTabBarController.m index 563420d8..0ff878b6 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarController.m +++ b/MMTabBarView/MMTabBarView/MMTabBarController.m @@ -14,14 +14,14 @@ #define MAX_OVERFLOW_MENUITEM_TITLE_LENGTH 60 -@interface MMTabBarController (Private) -- (NSArray *)_generateWidthsFromAttachedButtons:(NSArray *)buttons; -- (void)_setupAttachedButtons:(NSArray *)buttons withWidths:(NSArray *)widths; -- (NSInteger)_shrinkWidths:(NSMutableArray *)newWidths towardMinimum:(NSInteger)minimum withAvailableWidth:(CGFloat)availableWidth; -- (void)_addItemToOverflowMenu:(NSTabViewItem *)anItem withTitle:(NSString *)title; +@interface MMTabBarController() @end @implementation MMTabBarController +{ + MMTabBarView *_tabBarView; + NSMenu *_overflowMenu; +} /*! @method initWithTabBarView: diff --git a/MMTabBarView/MMTabBarView/MMTabBarItem.h b/MMTabBarView/MMTabBarView/MMTabBarItem.h index e7445fec..a1abab3e 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarItem.h +++ b/MMTabBarView/MMTabBarView/MMTabBarItem.h @@ -12,11 +12,11 @@ @optional -@property (copy) NSString *title; -@property (retain) NSImage *icon; -@property (retain) NSImage *largeImage; -@property (assign) NSInteger objectCount; -@property (retain) NSColor *objectCountColor; +@property (copy) NSString *title; +@property (retain) NSImage *icon; +@property (retain) NSImage *largeImage; +@property (assign) NSInteger objectCount; +@property (retain) NSColor *objectCountColor; @property (assign) BOOL isProcessing; @property (assign) BOOL isEdited; diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h index 93e91e6d..adb8da18 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h @@ -9,7 +9,10 @@ @interface MMTabBarView (PrivateDrawing) - (void)_drawInteriorInRect:(NSRect)rect; -- (NSRect)_addTabButtonRect; -- (NSRect)_overflowButtonRect; + +@property (readonly) NSRect _addTabButtonRect; +@property (readonly) NSRect _overflowButtonRect; + +@property (assign) BOOL isReorderingTabViewItems; @end diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.h b/MMTabBarView/MMTabBarView/MMTabBarView.h index a45fe59b..7b0487c5 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.h @@ -38,7 +38,6 @@ static NSImage* _static##name##Image() \ return image; \ } -@class MMOverflowPopUpButton; @class MMRolloverButton; @class MMTabBarViewler; @class MMTabBarButton; @@ -70,69 +69,11 @@ typedef NS_ENUM(NSUInteger, MMAttachedButtonsEnumerationOptions) @protocol MMTabBarViewDelegate; -@interface MMTabBarView : NSView { - - // control basics - NSTabView *_tabView; // the tab view being navigated - MMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs - MMRolloverButton *_addTabButton; - MMTabBarController *_controller; - - // Spring-loading. - NSTimer *_springTimer; - NSTabViewItem *_tabViewItemWithSpring; - - // configuration - id _style; - BOOL _onlyShowCloseOnHover; - BOOL _canCloseOnlyTab; - BOOL _disableTabClose; - BOOL _hideForSingleTab; - BOOL _showAddTabButton; - BOOL _sizeButtonsToFit; - BOOL _useOverflowMenu; - BOOL _alwaysShowActiveTab; - BOOL _allowsScrubbing; - NSInteger _resizeAreaCompensation; - MMTabBarOrientation _orientation; - BOOL _automaticallyAnimates; - MMTabBarTearOffStyle _tearOffStyle; - BOOL _allowsBackgroundTabClosing; - BOOL _selectsTabsOnMouseDown; - BOOL _resizeTabsToFitTotalWidth; - - // vertical tab resizing - BOOL _allowsResizing; - BOOL _isResizing; - - // button width - NSInteger _buttonMinWidth; - NSInteger _buttonMaxWidth; - NSInteger _buttonOptimumWidth; - - // animation - MMSlideButtonsAnimation *_slideButtonsAnimation; - - // animation for hide/show - NSViewAnimation *_hideShowTabBarAnimation; - BOOL _isHidden; - NSView *_partnerView; // gets resized when hide/show - NSInteger _tabBarWidth; // stored width of vertical tab bar - - // states - BOOL _isReorderingTabViewItems; - BOOL _needsUpdate; - - // drag and drop - NSUInteger _destinationIndexForDraggedItem; // NSNotFound = none - - // delegate - id _delegate; -} +@interface MMTabBarView : NSView @property (strong) IBOutlet NSTabView *tabView; @property (strong) IBOutlet NSView *partnerView; -@property (unsafe_unretained) IBOutlet id delegate; +@property (weak) IBOutlet id delegate; @property (assign) NSUInteger destinationIndexForDraggedItem; @property (readonly) BOOL isResizing; @property (assign) BOOL needsUpdate; diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index b0b8546e..4c01611f 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -31,74 +31,74 @@ #define DIVIDER_WIDTH 3 -@interface MMTabBarView (/*Private*/) +@interface MMTabBarView () +// reordering @property (assign) BOOL isReorderingTabViewItems; -- (void)_commonInit; - -// providing defaults -- (BOOL)_supportsOrientation:(MMTabBarOrientation)orientation; -- (CGFloat)_heightOfTabBarButtons; -- (CGFloat)_rightMargin; -- (CGFloat)_leftMargin; -- (CGFloat)_topMargin; -- (CGFloat)_bottomMargin; -- (NSSize)_addTabButtonSize; -- (NSRect)_addTabButtonRect; -- (NSSize)_overflowButtonSize; -- (NSRect)_overflowButtonRect; -- (void)_drawTabBarViewInRect:(NSRect)aRect; -- (void)_drawBezelInRect:(NSRect)rect; -- (void)_drawButtonBezelsInRect:(NSRect)rect; -- (void)_drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)index inButtons:(NSArray *)buttons indexOfSelectedButton:(NSUInteger)selIndex inRect:(NSRect)rect; -- (void)_drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton inRect:(NSRect)rect; -- (void)_drawInteriorInRect:(NSRect)rect; - -// determine positions -- (void)_positionOverflowMenu; -- (void)_positionAddTabButton; -- (void)_checkWindowFrame; - -// convenience -- (void)_bindPropertiesOfAttachedButton:(MMAttachedTabBarButton *)aButton andTabViewItem:(NSTabViewItem *)item; -- (void)_unbindPropertiesOfAttachedButton:(MMAttachedTabBarButton *)aButton; - -// synchronize selection -- (void)_synchronizeSelection; - // resizing @property (assign) BOOL isResizing; -- (NSCursor *)_resizingMouseCursor; -- (void)_beginResizingWithMouseDownEvent:(NSEvent *)theEvent; - -// misc -- (BOOL)_shouldDisplayTabBar; +@property (readonly) NSCursor *resizingMouseCursor; // private actions -- (void)_overflowMenuAction:(id)sender; -- (void)_didClickTabButton:(id)sender; -- (void)_didClickCloseButton:(id)sender; - -// notification handlers -- (void)frameDidChange:(NSNotification *)notification; -- (void)windowDidMove:(NSNotification *)aNotification; - -// update buttons -- (void)_updateAddTabButton; -- (void)_updateOverflowPopUpButton; +- (IBAction)_overflowMenuAction:(id)sender; +- (IBAction)_didClickTabButton:(id)sender; +- (IBAction)_didClickCloseButton:(id)sender; @end @implementation MMTabBarView +{ + // control basics + NSTabView *_tabView; // the tab view being navigated + MMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs + MMRolloverButton *_addTabButton; + MMTabBarController *_controller; + + // Spring-loading. + NSTimer *_springTimer; + NSTabViewItem *_tabViewItemWithSpring; + + // configuration + id _style; + BOOL _onlyShowCloseOnHover; + BOOL _canCloseOnlyTab; + BOOL _disableTabClose; + BOOL _hideForSingleTab; + BOOL _showAddTabButton; + BOOL _sizeButtonsToFit; + BOOL _useOverflowMenu; + BOOL _alwaysShowActiveTab; + BOOL _allowsScrubbing; + NSInteger _resizeAreaCompensation; + MMTabBarOrientation _orientation; + BOOL _automaticallyAnimates; + MMTabBarTearOffStyle _tearOffStyle; + BOOL _allowsBackgroundTabClosing; + BOOL _selectsTabsOnMouseDown; + + // vertical tab resizing + BOOL _allowsResizing; + + // button width + NSInteger _buttonMinWidth; + NSInteger _buttonMaxWidth; + NSInteger _buttonOptimumWidth; + + // animation + MMSlideButtonsAnimation *_slideButtonsAnimation; + + // animation for hide/show + NSViewAnimation *_hideShowTabBarAnimation; + BOOL _isHidden; + NSInteger _tabBarWidth; // stored width of vertical tab bar + + // states + BOOL _needsUpdate; -@dynamic tabView; -@synthesize partnerView = _partnerView; -@dynamic delegate; -@synthesize destinationIndexForDraggedItem = _destinationIndexForDraggedItem; -@synthesize isResizing = _isResizing; -@dynamic needsUpdate; -@synthesize resizeTabsToFitTotalWidth = _resizeTabsToFitTotalWidth; + // delegate + id _delegate; +} static NSMutableDictionary *registeredStyleClasses = nil; @@ -226,7 +226,7 @@ - (void)resetCursorRects { if ([self orientation] == MMTabBarVerticalOrientation) { - NSCursor *cursor = [self _resizingMouseCursor]; + NSCursor *cursor = [self resizingMouseCursor]; [self addCursorRect:[self dividerRect] cursor:cursor]; } } @@ -2247,8 +2247,6 @@ - (void)frameDidChange:(NSNotification *)notification { #pragma mark - #pragma mark Private Methods -@synthesize isReorderingTabViewItems = _isReorderingTabViewItems; - - (void)_commonInit { _controller = [[MMTabBarController alloc] initWithTabBarView:self]; @@ -2643,7 +2641,7 @@ - (void)_synchronizeSelection { } } -- (NSCursor *)_resizingMouseCursor { +- (NSCursor *)resizingMouseCursor { if (NSWidth([self frame]) <= [self buttonMinWidth]) { return [NSCursor resizeRightCursor]; @@ -2668,7 +2666,7 @@ - (void)_beginResizingWithMouseDownEvent:(NSEvent *)theEvent { [self setIsResizing:YES]; - NSCursor *cursor = [self _resizingMouseCursor]; + NSCursor *cursor = [self resizingMouseCursor]; [cursor set]; while ((nextEvent = [[self window] nextEventMatchingMask:NSLeftMouseUpMask | NSLeftMouseDraggedMask untilDate:expiration inMode:NSEventTrackingRunLoopMode dequeue:YES]) != nil) { @@ -2686,7 +2684,7 @@ - (void)_beginResizingWithMouseDownEvent:(NSEvent *)theEvent { CGFloat resizeAmount = [nextEvent deltaX]; if ((currentPoint.x > frame.size.width && resizeAmount > 0) || (currentPoint.x < frame.size.width && resizeAmount < 0)) { - cursor = [self _resizingMouseCursor]; + cursor = [self resizingMouseCursor]; [cursor set]; NSRect partnerFrame = [_partnerView frame]; diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h index 678a0cfc..fe9b0c23 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h @@ -17,34 +17,12 @@ extern NSString *AttachedTabBarButtonUTI; -@interface MMTabDragAssistant : NSObject { +@interface MMTabDragAssistant : NSObject -@private - - NSPoint _currentMouseLocation; - - // standard drag & drop support - MMTabBarView *_sourceTabBar; - MMAttachedTabBarButton *_attachedTabBarButton; - - MMTabPasteboardItem *_pasteboardItem; - MMTabBarView *_destinationTabBar; - BOOL _isDragging; - - // sliding support - BOOL _isSliding; - - // Support for dragging into new windows - MMTabDragWindowController *_draggedTab; - MMTabDragWindowController *_draggedView; - NSSize _dragWindowOffset; - NSTimer *_fadeTimer; - BOOL _centersDragWindows; - MMTabBarTearOffStyle _currentTearOffStyle; +// Creation/destruction ++ (instancetype)sharedDragAssistant; - // Animation - MMSlideButtonsAnimation *_slideButtonsAnimation; -} +#pragma mark Properties @property (strong) MMTabBarView *sourceTabBar; @property (strong) MMAttachedTabBarButton *attachedTabBarButton; @@ -55,9 +33,6 @@ extern NSString *AttachedTabBarButtonUTI; @property (assign) BOOL isSliding; -// Creation/destruction -+ (instancetype)sharedDragAssistant; - #pragma mark Dragging Source Handling - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal ofTabBarView:(MMTabBarView *)tabBarView; diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index e85086bc..0d217138 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -14,56 +14,27 @@ #import "MMSlideButtonsAnimation.h" #import "NSView+MMTabBarViewExtensions.h" -@interface MMTabBarView (SharedPrivate) - -@property (assign) BOOL isReorderingTabViewItems; - -@end - -@interface MMTabBarButton (SharedPrivate) - -- (NSRect)_indicatorRectForBounds:(NSRect)theRect; - -@end - -@interface MMTabDragAssistant (/*Private*/) - -- (NSUInteger)_destinationIndexForButton:(MMAttachedTabBarButton *)aButton atPoint:(NSPoint)aPoint inTabBarView:(MMTabBarView *)tabBarView; - -- (NSImage *)_imageForViewOfAttachedButton:(MMAttachedTabBarButton *)aButton forTabBarView:(MMTabBarView *)tabBarView styleMask:(NSUInteger *)outMask; -- (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window; -- (void)_expandWindow:(NSWindow *)window atPoint:(NSPoint)point; - -- (void)_dragAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView at:(NSPoint)buttonLocation event:(NSEvent *)theEvent source:(id)sourceObject; - -- (void)_slideBackTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView; - -- (NSUInteger)_moveAttachedTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView fromIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex; - -- (void)_draggingExitedTabBarView:(MMTabBarView *)tabBarView withPasteboardItem:(MMTabPasteboardItem *)pasteboardItem; - -- (MMTabPasteboardItem *)_tabPasteboardItemOfDraggingInfo:(id )draggingInfo; - -- (void)_beginDraggingWindowForPasteboardItem:(MMTabPasteboardItem *)pasteboardItem isSourceWindow:(BOOL)isSourceWindow; -- (void)_endDraggingWindowForPasteboardItem:(MMTabPasteboardItem *)pasteboardItem; - -- (void)_fadeInDragWindow:(NSTimer *)timer; -- (void)_fadeOutDragWindow:(NSTimer *)timer; +#import "MMTabBarView.Private.h" +#import "MMTabBarButton.Private.h" +@interface MMTabDragAssistant () @end NSString *AttachedTabBarButtonUTI = @"de.monscheuer.mmtabbarview.attachedbutton"; @implementation MMTabDragAssistant - -@synthesize sourceTabBar = _sourceTabBar; -@synthesize attachedTabBarButton = _attachedTabBarButton; -@synthesize pasteboardItem = _pasteboardItem; -@synthesize destinationTabBar = _destinationTabBar; -@synthesize isDragging = _isDragging; -@synthesize currentMouseLocation = _currentMouseLocation; - -@synthesize isSliding = _isSliding; +{ + // Support for dragging into new windows + MMTabDragWindowController *_draggedTab; + MMTabDragWindowController *_draggedView; + NSSize _dragWindowOffset; + NSTimer *_fadeTimer; + BOOL _centersDragWindows; + MMTabBarTearOffStyle _currentTearOffStyle; + + // Animation + MMSlideButtonsAnimation *_slideButtonsAnimation; +} static MMTabDragAssistant *sharedDragAssistant = nil; diff --git a/MMTabBarView/MMTabBarView/MMTabDragView.h b/MMTabBarView/MMTabBarView/MMTabDragView.h index 29ef06d7..be3c9192 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragView.h +++ b/MMTabBarView/MMTabBarView/MMTabDragView.h @@ -8,14 +8,10 @@ #import -@interface MMTabDragView : NSView { - NSImage *_image; - NSImage *_alternateImage; - CGFloat _alpha; -} -- (void)setFadeValue:(CGFloat)value; -- (NSImage *)image; -- (void)setImage:(NSImage *)image; -- (NSImage *)alternateImage; -- (void)setAlternateImage:(NSImage *)image; +@interface MMTabDragView : NSView + +@property (assign) CGFloat alpha; +@property (strong) NSImage *image; +@property (strong) NSImage *alternateImage; + @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragView.m b/MMTabBarView/MMTabBarView/MMTabDragView.m index 1889ebd7..4aa7bac3 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragView.m +++ b/MMTabBarView/MMTabBarView/MMTabDragView.m @@ -8,7 +8,6 @@ #import "MMTabDragView.h" - @implementation MMTabDragView - (instancetype)initWithFrame:(NSRect)frame { @@ -18,7 +17,6 @@ - (instancetype)initWithFrame:(NSRect)frame { return self; } - - (void)drawRect:(NSRect)rect { //1.0 fade means show the primary image //0.0 fade means show the secondary image @@ -32,24 +30,4 @@ - (void)drawRect:(NSRect)rect { [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha respectFlipped:YES hints:nil]; } -- (void)setFadeValue:(CGFloat)value { - _alpha = value; -} - -- (NSImage *)image { - return _image; -} - -- (void)setImage:(NSImage *)image { - _image = image; -} - -- (NSImage *)alternateImage { - return _alternateImage; -} - -- (void)setAlternateImage:(NSImage *)image { - _alternateImage = image; -} - @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindow.h b/MMTabBarView/MMTabBarView/MMTabDragWindow.h index c34af082..266ca82c 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindow.h +++ b/MMTabBarView/MMTabBarView/MMTabDragWindow.h @@ -10,11 +10,12 @@ @class MMTabDragView; -@interface MMTabDragWindow : NSWindow { - MMTabDragView *_dragView; -} +@interface MMTabDragWindow : NSWindow + + (instancetype)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; - (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; -- (MMTabDragView *)dragView; + +@property (readonly) MMTabDragView *dragView; + @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindow.m b/MMTabBarView/MMTabBarView/MMTabDragWindow.m index 5bb430e7..7db41c06 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindow.m +++ b/MMTabBarView/MMTabBarView/MMTabDragWindow.m @@ -10,6 +10,9 @@ #import "MMTabDragView.h" @implementation MMTabDragWindow +{ + MMTabDragView *_dragView; +} + (instancetype)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask { return [[MMTabDragWindow alloc] initWithImage:image styleMask:styleMask]; diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindowController.h b/MMTabBarView/MMTabBarView/MMTabDragWindowController.h index f87a949f..c5ef6e26 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindowController.h +++ b/MMTabBarView/MMTabBarView/MMTabDragWindowController.h @@ -14,20 +14,16 @@ @class MMTabDragView; -@interface MMTabDragWindowController : NSWindowController { - MMTabBarTearOffStyle _tearOffStyle; - MMTabDragView *_view; - NSAnimation *_animation; - NSTimer *_timer; - - BOOL _showingAlternate; - NSRect _originalWindowFrame; -} +@interface MMTabDragWindowController : NSWindowController + - (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger) styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle; -- (NSImage *)image; -- (NSImage *)alternateImage; -- (void)setAlternateImage:(NSImage *)image; -- (BOOL)isAnimating; +@property (readonly) NSImage *image; + +@property (strong) NSImage *alternateImage; + +@property (readonly) BOOL isAnimating; + - (void)switchImages; + @end diff --git a/MMTabBarView/MMTabBarView/MMTabDragWindowController.m b/MMTabBarView/MMTabBarView/MMTabDragWindowController.m index 90c27dc0..66e5e465 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragWindowController.m +++ b/MMTabBarView/MMTabBarView/MMTabDragWindowController.m @@ -11,6 +11,15 @@ #import "MMTabDragView.h" @implementation MMTabDragWindowController +{ + MMTabBarTearOffStyle _tearOffStyle; + MMTabDragView *_view; + NSAnimation *_animation; + NSTimer *_timer; + + BOOL _showingAlternate; + NSRect _originalWindowFrame; +} - (instancetype)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(MMTabBarTearOffStyle)tearOffStyle { MMTabDragWindow *window = [MMTabDragWindow dragWindowWithImage:image styleMask:styleMask]; @@ -32,8 +41,6 @@ - (void)dealloc { if (_timer) { [_timer invalidate]; } - - } - (NSImage *)image { @@ -92,7 +99,7 @@ - (void)animateTimer:(NSTimer *)timer { frame.origin.x = mousePoint.x - (frame.size.width / 2); frame.origin.y = mousePoint.y - (frame.size.height / 2); - [_view setFadeValue:_showingAlternate ? 1.0f - animationValue : animationValue]; + [_view setAlpha:_showingAlternate ? 1.0f - animationValue : animationValue]; [[self window] setFrame:frame display:YES]; if (![_animation isAnimating]) { diff --git a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.h b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.h index 4e6fa030..9ae45772 100644 --- a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.h +++ b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.h @@ -11,9 +11,7 @@ @class MMAttachedTabBarButton; @class MMTabBarView; -@interface MMTabPasteboardItem : NSPasteboardItem { - NSUInteger _sourceIndex; -} +@interface MMTabPasteboardItem : NSPasteboardItem @property (assign) NSUInteger sourceIndex; diff --git a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m index acbf5d14..75815f0c 100644 --- a/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m +++ b/MMTabBarView/MMTabBarView/MMTabPasteboardItem.m @@ -10,8 +10,6 @@ @implementation MMTabPasteboardItem -@synthesize sourceIndex = _sourceIndex; - - (instancetype)init { self = [super init]; if (self) { diff --git a/MMTabBarView/MMTabBarView/MMTabStyle.h b/MMTabBarView/MMTabBarView/MMTabStyle.h index b31a5873..b9e065bf 100644 --- a/MMTabBarView/MMTabBarView/MMTabStyle.h +++ b/MMTabBarView/MMTabBarView/MMTabStyle.h @@ -19,7 +19,8 @@ // identity + (NSString *)name; -- (NSString *)name; + +@property (readonly) NSString *name; @optional From aed276116da7dd83a7eb3ecc3bf7ab085dc16a07 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 16:17:57 +0200 Subject: [PATCH 04/21] Some work on D&D --- MMTabBarView/MMTabBarView/MMTabBarView.m | 24 +++++------- .../MMTabBarView/MMTabDragAssistant.h | 8 ++-- .../MMTabBarView/MMTabDragAssistant.m | 38 ++++++++++++------- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index 4c01611f..b2bcf971 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -1637,29 +1637,25 @@ - (BOOL)isDragging { #pragma mark - #pragma mark NSDraggingSource -- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { - return NSDragOperationCopy; -} - -- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { - - return [[MMTabDragAssistant sharedDragAssistant] draggingSourceOperationMaskForLocal:isLocal ofTabBarView:self]; +- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context +{ + return [[MMTabDragAssistant sharedDragAssistant] draggingSession:session sourceOperationMaskForDraggingContext:context ofTabBarView:self]; } -- (BOOL)ignoreModifierKeysWhileDragging { +- (BOOL)ignoreModifierKeysForDraggingSession:(NSDraggingSession *)session { return YES; } -- (void)draggedImage:(NSImage *)anImage beganAt:(NSPoint)screenPoint { - [[MMTabDragAssistant sharedDragAssistant] draggedImageBeganAt:screenPoint withTabBarView:self]; +- (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint { + [[MMTabDragAssistant sharedDragAssistant] draggingSession:session willBeginAtPoint:screenPoint withTabBarView:self]; } -- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint { - [[MMTabDragAssistant sharedDragAssistant] draggedImageMovedTo:screenPoint]; +- (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint { + [[MMTabDragAssistant sharedDragAssistant] draggingSession:session movedToPoint:screenPoint]; } -- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { - [[MMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation]; +- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation { + [[MMTabDragAssistant sharedDragAssistant] draggingSession:session endedAtPoint:screenPoint operation:operation]; } #pragma mark - diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h index fe9b0c23..6f1cadfa 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.h +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.h @@ -35,15 +35,15 @@ extern NSString *AttachedTabBarButtonUTI; #pragma mark Dragging Source Handling -- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal ofTabBarView:(MMTabBarView *)tabBarView; +- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context ofTabBarView:(MMTabBarView *)tabBarView; - (BOOL)shouldStartDraggingAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView withMouseDownEvent:(NSEvent *)event; - (void)startDraggingAttachedTabBarButton:(MMAttachedTabBarButton *)aButton fromTabBarView:(MMTabBarView *)tabBarView withMouseDownEvent:(NSEvent *)event; -- (void)draggedImageBeganAt:(NSPoint)aPoint withTabBarView:(MMTabBarView *)tabBarView; -- (void)draggedImageMovedTo:(NSPoint)aPoint; -- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; +- (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint withTabBarView:(MMTabBarView *)tabBarView; +- (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint; +- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation; #pragma mark Dragging Destination Handling diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index 0d217138..5e37575a 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -75,9 +75,13 @@ - (void)dealloc { #pragma mark - #pragma mark Dragging Source Handling -- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal ofTabBarView:(MMTabBarView *)tabBarView { +- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context ofTabBarView:(MMTabBarView *)tabBarView { + if (context == NSDraggingContextOutsideApplication) + return NSDragOperationNone; + else if (context == NSDraggingContextWithinApplication) + return NSDragOperationMove; - return(isLocal ? NSDragOperationMove : NSDragOperationNone); + return NSDragOperationNone; } - (BOOL)shouldStartDraggingAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView withMouseDownEvent:(NSEvent *)event { @@ -94,9 +98,10 @@ - (void)startDraggingAttachedTabBarButton:(MMAttachedTabBarButton *)aButton from [self _dragAttachedTabBarButton:aButton ofTabBarView:tabBarView at:[aButton frame].origin event:event source:tabBarView]; } -- (void)draggedImageBeganAt:(NSPoint)aPoint withTabBarView:(MMTabBarView *)tabBarView { +- (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint withTabBarView:(MMTabBarView *)tabBarView { + if (_draggedTab) { - [[_draggedTab window] setFrameTopLeftPoint:aPoint]; + [[_draggedTab window] setFrameTopLeftPoint:screenPoint]; [[_draggedTab window] orderFront:nil]; if ([[tabBarView tabView] numberOfTabViewItems] == 1) { @@ -105,7 +110,7 @@ - (void)draggedImageBeganAt:(NSPoint)aPoint withTabBarView:(MMTabBarView *)tabBa } } -- (void)draggedImageMovedTo:(NSPoint)aPoint { +- (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint { if (_draggedTab) { if (_centersDragWindows) { if ([_draggedTab isAnimating]) { @@ -119,7 +124,7 @@ - (void)draggedImageMovedTo:(NSPoint)aPoint { frame.origin.y -= frame.size.height / 2; [[_draggedTab window] setFrame:frame display:NO]; } else { - [[_draggedTab window] setFrameTopLeftPoint:aPoint]; + [[_draggedTab window] setFrameTopLeftPoint:screenPoint]; } if (_draggedView) { @@ -127,15 +132,15 @@ - (void)draggedImageMovedTo:(NSPoint)aPoint { //the relative position of the dragged view window will be different //depending on the position of the tab bar relative to the controlled tab view - aPoint.y -= [[_draggedTab window] frame].size.height; - aPoint.x -= _dragWindowOffset.width; - aPoint.y += _dragWindowOffset.height; - [[_draggedView window] setFrameTopLeftPoint:aPoint]; + screenPoint.y -= [[_draggedTab window] frame].size.height; + screenPoint.x -= _dragWindowOffset.width; + screenPoint.y += _dragWindowOffset.height; + [[_draggedView window] setFrameTopLeftPoint:screenPoint]; } } } -- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { +- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation { MMTabPasteboardItem *pasteboardItem = [self pasteboardItem]; @@ -150,7 +155,7 @@ - (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation if ([self destinationTabBar] == nil && sourceDelegate && [sourceDelegate respondsToSelector:@selector(tabView:newTabBarViewForDraggedTabViewItem:atPoint:)]) { - MMTabBarView *tabBarView = [sourceDelegate tabView:sourceTabView newTabBarViewForDraggedTabViewItem:[_attachedTabBarButton tabViewItem] atPoint:aPoint]; + MMTabBarView *tabBarView = [sourceDelegate tabView:sourceTabView newTabBarViewForDraggedTabViewItem:[_attachedTabBarButton tabViewItem] atPoint:screenPoint]; if (tabBarView) { @@ -777,8 +782,13 @@ - (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTa _draggedTab = [[MMTabDragWindowController alloc] initWithImage:dragImage styleMask:NSBorderlessWindowMask tearOffStyle:_currentTearOffStyle]; NSPoint location = [aButton frame].origin; - - [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; + + NSDraggingItem *item = [[NSDraggingItem alloc] initWithPasteboardWriter:[NSString string]]; + [item setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dragImage]; + + [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:item] event:theEvent source:source]; + +// [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; } - (void)_slideBackTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView { From 313d58cce4db79a24bc894083a26d5490d0a2be4 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 16:47:48 +0200 Subject: [PATCH 05/21] Some work on D&D --- MMTabBarView/MMTabBarView/MMTabDragAssistant.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index 5e37575a..ff9c2a0a 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -116,14 +116,15 @@ - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)scree if ([_draggedTab isAnimating]) { return; } - +NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); //Ignore aPoint, as it seems to give wacky values NSRect frame = [[_draggedTab window] frame]; - frame.origin = [NSEvent mouseLocation]; + frame.origin = screenPoint; //[NSEvent mouseLocation]; frame.origin.x -= frame.size.width / 2; frame.origin.y -= frame.size.height / 2; [[_draggedTab window] setFrame:frame display:NO]; } else { +NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); [[_draggedTab window] setFrameTopLeftPoint:screenPoint]; } @@ -131,7 +132,7 @@ - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)scree //move the view representation with the tab //the relative position of the dragged view window will be different //depending on the position of the tab bar relative to the controlled tab view - +NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); screenPoint.y -= [[_draggedTab window] frame].size.height; screenPoint.x -= _dragWindowOffset.width; screenPoint.y += _dragWindowOffset.height; @@ -784,7 +785,8 @@ - (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTa NSPoint location = [aButton frame].origin; NSDraggingItem *item = [[NSDraggingItem alloc] initWithPasteboardWriter:[NSString string]]; - [item setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dragImage]; + NSImage *dummyImage = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; + [item setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dummyImage]; [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:item] event:theEvent source:source]; From 90afba7c69a70f49e6f78d862531afb65688c937 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 23 May 2015 17:26:19 +0200 Subject: [PATCH 06/21] Some work on D&D --- MMTabBarView/MMTabBarView/MMTabDragAssistant.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index ff9c2a0a..70451ba9 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -116,7 +116,6 @@ - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)scree if ([_draggedTab isAnimating]) { return; } -NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); //Ignore aPoint, as it seems to give wacky values NSRect frame = [[_draggedTab window] frame]; frame.origin = screenPoint; //[NSEvent mouseLocation]; @@ -124,7 +123,6 @@ - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)scree frame.origin.y -= frame.size.height / 2; [[_draggedTab window] setFrame:frame display:NO]; } else { -NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); [[_draggedTab window] setFrameTopLeftPoint:screenPoint]; } @@ -132,7 +130,6 @@ - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)scree //move the view representation with the tab //the relative position of the dragged view window will be different //depending on the position of the tab bar relative to the controlled tab view -NSLog(@"screen point:%@",NSStringFromPoint(screenPoint)); screenPoint.y -= [[_draggedTab window] frame].size.height; screenPoint.x -= _dragWindowOffset.width; screenPoint.y += _dragWindowOffset.height; @@ -788,9 +785,8 @@ - (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTa NSImage *dummyImage = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; [item setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dummyImage]; - [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:item] event:theEvent source:source]; - -// [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; +// [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:item] event:theEvent source:source]; + [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; } - (void)_slideBackTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView { From c674ec311a40f953a4f887d8ebe894b79f414c4d Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 28 May 2015 16:21:38 +0200 Subject: [PATCH 07/21] Use NSDraggingItem and dragging session --- .../MMTabBarView/MMTabDragAssistant.m | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m index 70451ba9..a3b54b87 100644 --- a/MMTabBarView/MMTabBarView/MMTabDragAssistant.m +++ b/MMTabBarView/MMTabBarView/MMTabDragAssistant.m @@ -633,13 +633,14 @@ - (void)_dragAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView NSDate *expiration = [NSDate distantFuture]; BOOL continueDetached = NO; - // write to pasteboard - NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; + // create pasteboard item MMTabPasteboardItem *pasteboardItem = [[MMTabPasteboardItem alloc] init]; [pasteboardItem setSourceIndex:[tabBarView indexOfTabViewItem:[aButton tabViewItem]]]; [pasteboardItem setString:[aButton title] forType:AttachedTabBarButtonUTI]; - [pboard clearContents]; - [pboard writeObjects:[NSArray arrayWithObject:pasteboardItem]]; + + // create dragging item + NSDraggingItem *draggingItem = [[NSDraggingItem alloc] initWithPasteboardWriter:pasteboardItem]; + [self setSourceTabBar:tabBarView]; [self setAttachedTabBarButton:aButton]; [self setPasteboardItem:pasteboardItem]; @@ -752,8 +753,7 @@ - (void)_dragAttachedTabBarButton:(MMAttachedTabBarButton *)aButton ofTabBarView [self setIsSliding:NO]; [aButton setIsInDraggedSlide:NO]; - - [self _dragDetachedButton:aButton ofTabBarView:tabBarView withEvent:firstEvent pasteboard:pboard source:sourceObject]; + [self _dragDetachedButton:aButton ofTabBarView:tabBarView withEvent:firstEvent draggingItem:draggingItem source:sourceObject]; } else { [self setPasteboardItem:nil]; @@ -765,7 +765,7 @@ - (void)_detachButton:(MMAttachedTabBarButton *)aButton fromTabBarView:(MMTabBar [tabBarView update]; } -- (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView withEvent:(NSEvent *)theEvent pasteboard:(NSPasteboard *)pboard source:(id)source { +- (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView withEvent:(NSEvent *)theEvent draggingItem:(NSDraggingItem *)draggingItem source:(id)source { [self setIsDragging:YES]; @@ -780,13 +780,11 @@ - (void)_dragDetachedButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTa _draggedTab = [[MMTabDragWindowController alloc] initWithImage:dragImage styleMask:NSBorderlessWindowMask tearOffStyle:_currentTearOffStyle]; NSPoint location = [aButton frame].origin; - - NSDraggingItem *item = [[NSDraggingItem alloc] initWithPasteboardWriter:[NSString string]]; + NSImage *dummyImage = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; - [item setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dummyImage]; + [draggingItem setDraggingFrame:NSMakeRect(location.x, location.y, 1, 1) contents:dummyImage]; -// [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:item] event:theEvent source:source]; - [tabBarView dragImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] at:location offset:NSZeroSize event:theEvent pasteboard:pboard source:source slideBack:NO]; + [tabBarView beginDraggingSessionWithItems:[NSArray arrayWithObject:draggingItem] event:theEvent source:source]; } - (void)_slideBackTabBarButton:(MMAttachedTabBarButton *)aButton inTabBarView:(MMTabBarView *)tabBarView { From 91e1a11960c5f7ed1687ad933749b9d626f5d448 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 28 May 2015 16:30:08 +0200 Subject: [PATCH 08/21] Additional use of NSIntegralRect in MMTabBarButtonCell --- MMTabBarView/MMTabBarView/MMTabBarButtonCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m index 45697bab..23ae135c 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m @@ -806,7 +806,7 @@ - (NSRect)_largeImageRectForBounds:(NSRect)theRect { result.origin.y += (constrainedDrawingRect.size.height - scaledImageSize.height) / 2.0; } - return result; + return NSIntegralRect(result); } - (NSRect)_indicatorRectForBounds:(NSRect)theRect { From 5a65c5565e4e43a1a7ff5713cb172ce6aa0355cd Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 28 May 2015 17:23:38 +0200 Subject: [PATCH 09/21] Initial merge and work on Yosemite style tabs --- .../MMTabBarView Demo/en.lproj/DemoWindow.xib | 591 +++++------------- .../MMTabBarView.xcodeproj/project.pbxproj | 48 ++ .../Images/YosemiteTabClose_Front.png | Bin 0 -> 1233 bytes .../Images/YosemiteTabClose_Front@2x.png | Bin 0 -> 1307 bytes .../Images/YosemiteTabClose_Front_Pressed.png | Bin 0 -> 1330 bytes .../YosemiteTabClose_Front_Pressed@2x.png | Bin 0 -> 1466 bytes .../YosemiteTabClose_Front_Rollover.png | Bin 0 -> 1367 bytes .../YosemiteTabClose_Front_Rollover@2x.png | Bin 0 -> 1613 bytes .../MMTabBarView/Images/YosemiteTabNew.png | Bin 0 -> 1210 bytes .../MMTabBarView/Images/YosemiteTabNew@2x.png | Bin 0 -> 1242 bytes MMTabBarView/MMTabBarView/MMTabBarView.m | 2 + .../MMTabBarView/Styles/MMYosemiteTabStyle.h | 28 + .../MMTabBarView/Styles/MMYosemiteTabStyle.m | 427 +++++++++++++ 13 files changed, 646 insertions(+), 450 deletions(-) create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front@2x.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed@2x.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover@2x.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabNew.png create mode 100755 MMTabBarView/MMTabBarView/Images/YosemiteTabNew@2x.png create mode 100755 MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h create mode 100755 MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m diff --git a/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib b/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib index 18e8658e..e43100d2 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib +++ b/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib @@ -1,14 +1,14 @@ - 1070 - 11G63 - 3084 - 1138.51 - 569.00 + 1090 + 14D136 + 7706 + 1347.57 + 758.70 com.apple.InterfaceBuilder.CocoaPlugin - 3084 + 7706 NSBox @@ -61,15 +61,17 @@ {213, 107} - + 256 274 + + public.item + {{13, 83}, {510, 525}} - @@ -78,11 +80,10 @@ - 256 + 274 {{10, 33}, {490, 479}} - - + Tab @@ -99,7 +100,7 @@ - LucidaGrande + YES 13 1044 @@ -115,15 +116,13 @@ 290 {{20, 20}, {493, 65}} - - YES 67108864 272629760 Observe the changes in the reference NSTabView above in response to adding (New Tab from the File menu), rearranging (drag tabs above), removing (close button on above tabs), and selecting (click a tab above). You can also resize the window, and create an overflow of tabs to view the overflow menu. - LucidaGrande + YES 10 2843 @@ -139,23 +138,22 @@ + NO + 1 266 {{0, 610}, {533, 22}} - MMTabBarView {533, 632} - - - {{0, 0}, {1280, 1002}} + {{0, 0}, {1280, 1001}} {213, 129} {10000000000000, 10000000000000} YES @@ -172,7 +170,7 @@ - + 256 @@ -205,10 +203,11 @@ + NO + 1 {461, 22} - NSView @@ -216,7 +215,7 @@ NSResponder - + 258 @@ -232,7 +231,6 @@ 256 {{16, 372}, {30, 13}} - YES @@ -244,20 +242,21 @@ + NO + 1 258 {{51, 367}, {130, 22}} - YES - -2076049856 + -2076180416 133120 - LucidaGrande + YES 11 3100 @@ -271,18 +270,17 @@ 400 75 - + - Adium + Yosemite - 1048576 2147483647 1 - + NSImage NSMenuCheckmark - + NSImage NSMenuMixedState @@ -295,15 +293,23 @@ OtherViews - + + + Adium + + 2147483647 + + + _popUpItemAction: + + Aqua - 1048576 2147483647 - - + + _popUpItemAction: @@ -312,8 +318,8 @@ Card 2147483647 - - + + _popUpItemAction: @@ -322,8 +328,8 @@ LiveChat 2147483647 - - + + _popUpItemAction: @@ -331,10 +337,9 @@ Metal - 1048576 2147483647 - - + + _popUpItemAction: @@ -343,8 +348,8 @@ Safari 2147483647 - - + + _popUpItemAction: @@ -352,28 +357,28 @@ Unified - 1048576 2147483647 - - + + _popUpItemAction: + - -1 + 7 3 YES YES 1 + NO 258 {{13, 307}, {167, 18}} - YES @@ -396,13 +401,13 @@ 200 25 + NO 258 {{13, 227}, {145, 18}} - YES @@ -420,13 +425,13 @@ 200 25 + NO 258 {{13, 207}, {162, 18}} - YES @@ -444,6 +449,7 @@ 200 25 + NO @@ -458,7 +464,6 @@ 256 {{44, 88}, {25, 13}} - YES @@ -470,13 +475,14 @@ + NO + 1 256 {{41, 67}, {28, 13}} - YES @@ -488,13 +494,14 @@ + NO + 1 256 {{16, 46}, {53, 13}} - YES @@ -506,13 +513,14 @@ + NO + 1 256 {{77, 86}, {43, 19}} - YES @@ -525,13 +533,14 @@ + NO + 1 256 {{77, 65}, {43, 19}} - YES @@ -544,13 +553,14 @@ + NO + 1 256 {{77, 44}, {43, 19}} - YES @@ -563,13 +573,14 @@ + NO + 1 258 {{12, 29}, {140, 5}} - {0, 0} @@ -578,9 +589,11 @@ Box - - 3 - MCAwLjgwMDAwMDAxMTkAA + + 6 + System + labelColor + 3 @@ -593,7 +606,6 @@ 256 {{33, 9}, {73, 16}} - YES @@ -611,17 +623,16 @@ 200 25 + NO {{2, 2}, {164, 115}} - {{13, 9}, {168, 132}} - {0, 0} @@ -630,10 +641,7 @@ Tab Width - - 3 - MCAwLjgwMDAwMDAxMTkAA - + 3 @@ -646,7 +654,6 @@ 258 {{13, 187}, {148, 18}} - YES @@ -663,13 +670,13 @@ 200 25 + NO 258 {{13, 287}, {167, 18}} - YES @@ -687,13 +694,13 @@ 200 25 + NO 258 {{13, 267}, {167, 18}} - YES @@ -711,13 +718,13 @@ 200 25 + NO 258 {{14, 247}, {167, 18}} - YES @@ -735,13 +742,13 @@ 200 25 + NO 256 {{16, 351}, {62, 13}} - YES @@ -753,17 +760,18 @@ + NO + 1 258 {{83, 346}, {98, 22}} - YES - -2076049856 + -2076180416 133120 @@ -783,8 +791,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -801,8 +809,8 @@ 1048576 2147483647 - - + + _popUpItemAction: 1 @@ -816,13 +824,13 @@ YES 1 + NO 258 {{13, 167}, {171, 18}} - YES @@ -839,13 +847,13 @@ 200 25 + NO 258 {{13, 147}, {171, 18}} - YES @@ -862,13 +870,13 @@ 200 25 + NO 256 {{16, 330}, {50, 13}} - YES @@ -880,17 +888,18 @@ + NO + 1 258 {{71, 325}, {110, 22}} - YES - -2076049856 + -2076180416 133120 @@ -910,8 +919,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -928,8 +937,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -940,17 +949,16 @@ YES 1 + NO {{2, 2}, {198, 398}} - {{15, 205}, {202, 415}} - {0, 0} @@ -959,10 +967,7 @@ Control Options - - 3 - MCAwLjgwMDAwMDAxMTkAA - + 3 @@ -983,7 +988,6 @@ 268 {{16, 141}, {28, 13}} - YES @@ -995,13 +999,14 @@ + NO + 1 268 {{16, 115}, {47, 13}} - YES @@ -1013,13 +1018,14 @@ + NO + 1 268 {{13, 71}, {80, 18}} - YES @@ -1036,17 +1042,17 @@ 200 25 + NO 266 {{45, 136}, {132, 22}} - YES - -2076049856 + -2076180416 133120 @@ -1066,8 +1072,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -1083,8 +1089,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1094,8 +1100,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1105,8 +1111,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1116,8 +1122,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1130,13 +1136,13 @@ YES 1 + NO 266 {{72, 113}, {50, 19}} - YES @@ -1149,13 +1155,14 @@ + NO + 1 268 {{13, 51}, {80, 18}} - YES @@ -1172,13 +1179,13 @@ 200 25 + NO 268 {{13, 31}, {88, 18}} - YES @@ -1195,14 +1202,13 @@ 200 25 + NO 268 {{13, 11}, {113, 18}} - - YES 67108864 @@ -1218,13 +1224,13 @@ 200 25 + NO 268 {{13, 91}, {86, 18}} - YES @@ -1241,6 +1247,7 @@ 200 25 + NO @@ -1250,10 +1257,10 @@ {{130, 112}, {44, 21}} - _NS:1116 YES + NO YES 1 @@ -1263,13 +1270,11 @@ {{2, 2}, {196, 168}} - {{17, 16}, {200, 185}} - {0, 0} @@ -1278,10 +1283,7 @@ Tab-specific Values - - 3 - MCAwLjgwMDAwMDAxMTkAA - + 3 @@ -1291,8 +1293,6 @@ {228, 630} - - NSView @@ -1301,7 +1301,7 @@ - + button_allowScrubbing @@ -2050,6 +2050,7 @@ + @@ -2534,6 +2535,11 @@ + + 241 + + + @@ -2570,6 +2576,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2648,337 +2655,21 @@ - 240 - - - - - DemoWindowController - NSWindowController - - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - addNewTab: - id - - - closeTab: - id - - - configAddTabButton: - id - - - configAllowBackgroundClosing: - id - - - configAllowsScrubbing: - id - - - configAutomaticallyAnimates: - id - - - configCanCloseOnlyTab: - id - - - configDisableTabClose: - id - - - configHideForSingleTab: - id - - - configOnlyShowCloseOnHover: - id - - - configStyle: - id - - - configTabMaxWidth: - id - - - configTabMinWidth: - id - - - configTabOptimumWidth: - id - - - configTabSizeToFit: - id - - - configTearOffStyle: - id - - - configUseOverflowMenu: - id - - - hasCloseButtonAction: - id - - - hasLargeImageAction: - id - - - isEditedAction: - id - - - isProcessingAction: - id - - - setIconNamed: - id - - - setObjectCount: - id - - - setObjectCountColor: - id - - - setTabLabel: - id - - - showObjectCountAction: - id - - - toggleToolbar: - id - - - - NSButton - NSButton - NSButton - NSButton - NSButton - NSButton - NSButton - NSButton - NSButton - NSButton - NSDrawer - NSButton - NSButton - NSPopUpButton - NSButton - NSButton - NSColorWell - NSTextField - NSPopUpButton - NSPopUpButton - NSPopUpButton - NSButton - MMTabBarView - NSTextField - NSTabView - NSTextField - NSTextField - NSTextField - - - - button_allowBackgroundClosing - NSButton - - - button_allowScrubbing - NSButton - - - button_automaticallyAnimate - NSButton - - - button_canCloseOnlyTab - NSButton - - - button_disableTabClosing - NSButton - - - button_hideForSingleTab - NSButton - - - button_onlyShowCloseOnHover - NSButton - - - button_showAddTab - NSButton - - - button_sizeToFit - NSButton - - - button_useOverflow - NSButton - - - drawer - NSDrawer - - - hasCloserButton - NSButton - - - hasLargeImageButton - NSButton - - - iconButton - NSPopUpButton - - - isEditedButton - NSButton - - - isProcessingButton - NSButton - - - objectCounterColorWell - NSColorWell - - - objectCounterField - NSTextField - - - popUp_orientation - NSPopUpButton - - - popUp_style - NSPopUpButton - - - popUp_tearOff - NSPopUpButton - - - showObjectCountButton - NSButton - - - tabBar - MMTabBarView - - - tabField - NSTextField - - - tabView - NSTabView - - - textField_maxWidth - NSTextField - - - textField_minWidth - NSTextField - - - textField_optimumWidth - NSTextField - - - - IBProjectSource - ./Classes/DemoWindowController.h - - - - MMTabBarView - NSView - - id - NSView - NSTabView - - - - delegate - id - - - partnerView - NSView - - - tabView - NSTabView - - - - IBProjectSource - ./Classes/MMTabBarView.h - - - + 241 + 0 IBCocoaFramework + NO + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + YES 3 - {11, 11} - {10, 3} + {12, 12} + {10, 2} {15, 15} diff --git a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj index 1c59ac14..7e75543a 100644 --- a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj +++ b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj @@ -162,6 +162,16 @@ 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02361B10AD5500C65A84 /* MMTabBarButton.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */; }; + 06AE02481B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */; }; + 06AE02491B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */; }; + 06AE024A1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */; }; + 06AE024B1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */; }; + 06AE024C1B175E0500C65A84 /* YosemiteTabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */; }; + 06AE024D1B175E0500C65A84 /* YosemiteTabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */; }; + 06AE024E1B175E0500C65A84 /* YosemiteTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */; }; + 06AE024F1B175E0500C65A84 /* YosemiteTabNew@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */; }; + 06AE025B1B17670F00C65A84 /* MMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */; }; + 06AE025C1B17670F00C65A84 /* MMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */; }; 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAF160B555F00153FA2 /* MMSafariTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */; }; 06DB23AA1609F5830071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23A91609F5830071BDA0 /* Cocoa.framework */; }; @@ -330,6 +340,16 @@ 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButtonCell.Private.h; sourceTree = ""; }; 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarView.Private.h; sourceTree = ""; }; 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Private.h; sourceTree = ""; }; + 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Pressed.png; sourceTree = ""; }; + 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Pressed@2x.png"; sourceTree = ""; }; + 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Rollover.png; sourceTree = ""; }; + 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Rollover@2x.png"; sourceTree = ""; }; + 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front.png; sourceTree = ""; }; + 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front@2x.png"; sourceTree = ""; }; + 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabNew.png; sourceTree = ""; }; + 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabNew@2x.png"; sourceTree = ""; }; + 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMYosemiteTabStyle.h; sourceTree = ""; }; + 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMYosemiteTabStyle.m; sourceTree = ""; }; 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMSafariTabStyle.h; sourceTree = ""; }; 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMSafariTabStyle.m; sourceTree = ""; }; 06DB23A61609F5830071BDA0 /* MMTabBarView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MMTabBarView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -418,6 +438,7 @@ 0634F0331609FD9000A6C86A /* MMUnifiedTabStyle.h */, 0634F0341609FD9000A6C86A /* MMUnifiedTabStyle.m */, 06B51CB2160B558700153FA2 /* Safari Tab Style */, + 06AE02501B175E2000C65A84 /* Yosemite Tab Style */, ); path = Styles; sourceTree = ""; @@ -520,6 +541,14 @@ 0634F06D160A0C8A00A6C86A /* TabNewMetal.png */, 0634F06E160A0C8A00A6C86A /* TabNewMetalPressed.png */, 0634F06F160A0C8A00A6C86A /* TabNewMetalRollover.png */, + 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */, + 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */, + 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */, + 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */, + 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */, + 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */, + 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */, + 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */, ); name = Images; path = MMTabBarView/Images; @@ -538,6 +567,15 @@ name = Configurations; sourceTree = ""; }; + 06AE02501B175E2000C65A84 /* Yosemite Tab Style */ = { + isa = PBXGroup; + children = ( + 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */, + 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */, + ); + name = "Yosemite Tab Style"; + sourceTree = ""; + }; 06B51CB2160B558700153FA2 /* Safari Tab Style */ = { isa = PBXGroup; children = ( @@ -696,6 +734,7 @@ 0634F01A1609FC7F00A6C86A /* MMTabDragAssistant.h in Headers */, 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */, 0634F01C1609FC7F00A6C86A /* MMTabDragView.h in Headers */, + 06AE025B1B17670F00C65A84 /* MMYosemiteTabStyle.h in Headers */, 0634F01E1609FC7F00A6C86A /* MMTabDragWindow.h in Headers */, 0634F0201609FC7F00A6C86A /* MMTabDragWindowController.h in Headers */, 0634F0221609FC7F00A6C86A /* MMTabPasteboardItem.h in Headers */, @@ -782,13 +821,18 @@ 0634F077160A0C8A00A6C86A /* AquaTabCloseDirty_Front.png in Resources */, 0634F078160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Pressed.png in Resources */, 0634F079160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Rollover.png in Resources */, + 06AE024E1B175E0500C65A84 /* YosemiteTabNew.png in Resources */, + 06AE024A1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */, 0634F07A160A0C8A00A6C86A /* AquaTabNew.png in Resources */, 0634F07B160A0C8A00A6C86A /* AquaTabNew@2x.png in Resources */, + 06AE02481B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */, 0634F07C160A0C8A00A6C86A /* AquaTabNewPressed.png in Resources */, + 06AE024C1B175E0500C65A84 /* YosemiteTabClose_Front.png in Resources */, 0634F07D160A0C8A00A6C86A /* AquaTabNewPressed@2x.png in Resources */, 0634F07E160A0C8A00A6C86A /* AquaTabNewRollover.png in Resources */, 0634F07F160A0C8A00A6C86A /* AquaTabNewRollover@2x.png in Resources */, 0634F080160A0C8A00A6C86A /* AquaTabsBackground.png in Resources */, + 06AE024F1B175E0500C65A84 /* YosemiteTabNew@2x.png in Resources */, 0634F081160A0C8A00A6C86A /* AquaTabsDown.png in Resources */, 0634F082160A0C8A00A6C86A /* AquaTabsDownGraphite.png in Resources */, 0634F083160A0C8A00A6C86A /* AquaTabsDownNonKey.png in Resources */, @@ -805,6 +849,7 @@ 0634F08E160A0C8A00A6C86A /* TabClose_Dirty_Pressed@2x.png in Resources */, 0634F08F160A0C8A00A6C86A /* TabClose_Dirty_Rollover.png in Resources */, 0634F090160A0C8A00A6C86A /* TabClose_Dirty_Rollover@2x.png in Resources */, + 06AE02491B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */, 0634F091160A0C8A00A6C86A /* TabClose_Front.png in Resources */, 0634F092160A0C8A00A6C86A /* TabClose_Front@2x.png in Resources */, 0634F093160A0C8A00A6C86A /* TabClose_Front_Pressed.png in Resources */, @@ -855,10 +900,12 @@ 066376161617493D004A1128 /* SafariIWAddTabButton.png in Resources */, 066376171617493D004A1128 /* SafariIWATFill.png in Resources */, 066376181617493D004A1128 /* SafariIWATLeftCap.png in Resources */, + 06AE024D1B175E0500C65A84 /* YosemiteTabClose_Front@2x.png in Resources */, 066376191617493D004A1128 /* SafariIWATLeftCap@2x.png in Resources */, 0663761A1617493D004A1128 /* SafariIWATRightCap.png in Resources */, 0663761B1617493D004A1128 /* SafariIWATRightCap@2x.png in Resources */, 0663761C1617493D004A1128 /* SafariIWBG.png in Resources */, + 06AE024B1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */, 0663761D1617493D004A1128 /* SafariIWITLeftCap.png in Resources */, 0663761E1617493D004A1128 /* SafariIWITLeftCap@2x.png in Resources */, 0663761F1617493D004A1128 /* SafariIWITRightCap.png in Resources */, @@ -877,6 +924,7 @@ 0634EFDC1609FC6300A6C86A /* MMAttachedTabBarButton.m in Sources */, 0634F0041609FC7F00A6C86A /* NSView+MMTabBarViewExtensions.m in Sources */, 0634F0061609FC7F00A6C86A /* MMAttachedTabBarButtonCell.m in Sources */, + 06AE025C1B17670F00C65A84 /* MMYosemiteTabStyle.m in Sources */, 0634F0081609FC7F00A6C86A /* MMOverflowPopUpButton.m in Sources */, 0634F00A1609FC7F00A6C86A /* MMProgressIndicator.m in Sources */, 0634F00C1609FC7F00A6C86A /* MMRolloverButton.m in Sources */, diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front.png new file mode 100755 index 0000000000000000000000000000000000000000..4550e413c6ae4015b1fc79da8b0b8cd9fcb131b6 GIT binary patch literal 1233 zcmZ`(O>5LZ7*0W@uI)(+e)JHcf}oq(Wc%Tc*?_z07r3=-SJ^@jn@y%|G|7ZymQ7D$ z@lrt$6rtjw-lcf(FDN~T)I;$sJ*Wu9pU|1?wjIMZkdJxa=b7hy-sH{t-0aj~=5j_5 zgu$6qjsyN(lneXBGyMm_W$mqExTUiDeujaa10W zbCRABMNtdwC0I2kyL7rLN-Kl}5P){OEw}SB4wr#aC=@_W1*)2*h-|d#6En{G(bdi- zhx-^PvO*^y4)#U1ui3;cQj{bnbaZs;B+k;Yk{@+#QG9ufa5GB$&bSklCfH;q*et0=;5i?!f^?+{(p5<}_m zaYs6=GWLQHMG>Xxqg@IgOXKUuGWz(T1|Lil?uQO_YO=a?r7OV4()fj50(_7ou-3yl zCq{1FaA-pl7YePaXCh53V;6_>foUODSVG}KX>=m9aFPs{;E1*bqgL|~vIzIK=sQck z{gSy1xUdF#qBZ&@zzVjVrB%ZuNLO>pNLEp@x$&B+LPdf3yarMjt^$@RhsY#2tYPfx zi3^V{#k|~Q^7$@R18j=8sp^bu5~VY%XQ<}k{Og&?_j|YLFJXGdxLdn1WHmOg)IY6! zf3o=I=j*@w`(JjRRR%sc?9o$Eh#*S2r6|IEz9tg%&UtQ`Q_Vs;z= literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front@2x.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..ac32b0f82a82423b966ded8be342934dd394d726 GIT binary patch literal 1307 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&a=au%h`kcg59UmvUF{9L`nl>DSry^7odplSvNn+hu+GdHy)QK2F?C$HG5 z!d3~a!V1U+3F|8Y3;nDA{o-C@9zzrKDK}xwt{K19`Se z86_nJR{Hwo<>h+i#(Mch>H3D2mX`VkM*2oZx=P7{9O-#x!EwNQn0$BtH5OLR{C|l=&b@WD^hbJTrz6SKtYEsly5OvsnYPG&#iIxBO6iipcZJ*y)TY-f%L`p^60`eV}a^z5c^ zWv7o_tzUO>K4tOpxVtbi`vHfAMAid=*Hg9E{BfOH*}3uVL4$kmYBd_AZ(D{lpi<;HsXMd|v6mX?-X(Gs7c7{+3kj2o|M`E)8SrADBDCn&MGAmMZB3v?o0Sfkop_z?7Rta>C&iOg{ zMZpD$$*CZRfwdqBp{oX46N$?jBnc#qDalsFrAb+-$t6g!1&lLr+ILD!*GCez(Z{OV z2AC48eDhN>(<)sOOH%EO3=BAn#!X9#_Vv$HaVEj?C%kz0st-cAs*%$ZgTUT8@+3{~w;1`urcy`F~NbyYKs- z3*xF|?wUXAVdmP4tt<^6OrFh25o|DQJ9(*yNg%moZ#iRQ+Z{QkhNdZ(#97iZqGD!o zDSry^7odplSvNn+hu+GdHy)QK2F?C$HG5 z!d3~a!V1U+3F|8Y3;nDA{o-C@9zzrKDK}xwt{K19`Se z86_nJR{Hwo<>h+i#(Mch>H3D2mX`VkM*2oZx=P7{9O-#x!EwNQn0$BtH5OLR{C|l=&b@WD^hbJTrz}GamIaFf^Q;{gP$w+^+i~%%(LM_-P7FO=978;K zw@!8BYcddVxwu0)rs=T2qeIy%v~9cIe2~&JQJm9iE$}U&{_G6SpIZVpa{k#?|BUx- zo5rutHyYxvf8CgSTj+Is)+CkdI;Xi3bDpL?n4T!XXB40LX7#FF9NFsnpP!nq%+UhI zo!t82YC-=(n{qaThJ!Zgyv>I5c@mVF6Q9^#Thzab4P@-XqJG;K-l5D22@KzkU0uHM zfAi91s#VW9k1d$6mAB*ZkDPyt`vn@F8LnAg>33-}W97W*wfFa%6h4Sct^4)e;l0sq Y>4o~4%l-0}{|6PQp00i_>zopr0C3Rf&;S4c literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover.png new file mode 100755 index 0000000000000000000000000000000000000000..78c3ab4272ad35ae67d522928f534cd9ba215e59 GIT binary patch literal 1367 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z81_llpi<;HsXMd|v6mX?-X(Gs7c7{+3kj2o|M`E)8SrADBDCn&MGAmMZB3v?o0Sfkop_z?7Rta>C&iOg{ zMZpD$$*CZRfwdqBp{oX46N$?jBnc#qDalsFrAb+-$t6g!1&lLr+ILD!*GCez(Z{OV z2AC48eDhN>(<)sOOH%EO3=B2kD_uMFnd5BbwwNYe&2Wa#-_DFRWF;CcV zCZ6H;MoX1TVi%;tvU4pACOnYxPd{+Euvgh}&h?DPx0*`tZT!lrdwS9T!=g=7CMB(Z cGXGf(qYX=Dr^LmM*`U(S)78&qol`;+01C6WxBvhE literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover@2x.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..a3223a1547d730477178e4358ba178c26784a200 GIT binary patch literal 1613 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&a=au%h`kcg59UmvUF{9L`nl>DSry^7odplSvNn+hu+GdHy)QK2F?C$HG5 z!d3~a!V1U+3F|8Y3;nDA{o-C@9zzrKDK}xwt{K19`Se z86_nJR{Hwo<>h+i#(Mch>H3D2mX`VkM*2oZx=P7{9O-#x!EwNQn0$BtH5OLR{C|l=&b@WD^hbJTrzf_%(d>)z1YMF=>%*;px(@6Qz0B@^;_d=ezuJIY-M6!H=$iBA@@( zy>D8Oq;w^7j-NU^ucW`{B%KWbTfbJtDkyAT;NQ?uE_W$G(VFwu-+i-v)Erq_ZO+TS zQ2O=z+xfK)k1K4PyluHGWcZ#JWSY(H)jRh1W9$Bx{qy_N3=O|X-qFtKI_zIKyZPNt zX4W74*UI=9#eQ7t+T3=C#q3>ziIm~-rI}G{cW$ujGEQ5|RHG$4OCjvevkm8N-I9%1 zAlk4&Kd=A#HNhg*72cZ!#157F%j^ti;QBK)l)-xCYdM8#9hSq_r<|9$vDXi(eZ{}!+Tl8q%iTs(*GYj!d~B! Yk6itme?xG!6R3>$boFyt=akR{00kl^fdBvi literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabNew.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabNew.png new file mode 100755 index 0000000000000000000000000000000000000000..8f41d820b6c6228d455881ee295e7999b7dbbbd1 GIT binary patch literal 1210 zcmZ`(&x_MQ6rM#XYjtHoDk>gA1W~Y=B;93cNCUQUw?(^_TA@9;X);}-NhT&!n&NG5 zo>ufGiuw<%=+&EeRR0PQ{13bc&ZNJ_&@H5y`QH2Hd*4f5p0##&*7BF~0D!ed-E7nQ z8Ma={(f>Es53BUH61R7%;ONKY-*j^-toLF7PM>4f3V8MU0stpPx6>uv<{iz(zGOML zkEFy8X*K|QqS2*~h$SSx7sOgp5z`Eft{DtPAx$BVD`L0V5^6X?!ltw#$)b@L1VN9S zfz~#+r*yijhz|(~H3&zeku)kvINFCwxm<>_3RSg8Gm7yzAXZWg;wzIwX6KkFwj(zr zE)E2CuGPmwQV~TaH2+QNB<^6L6vR_o)F5OLs7NwgMnj2v42?yOr8)N8RXB{i)RSXF z8x_CjbiK#Sqtt5E-_R+HI#)H9htCd*bgHV z$CPGlPANQ=&F?N`jIEgl4`vB>BbPe0SY3uP72vUKes7ro4{`+7dadOq$m^OeZD{I3 zp;avnWQjHG;pkpy*@zXEQaC7^oyzn$nG!F<1vsK(Yw@uE2-$>tTJ)Kv?|#+Vha9ZK zrP(@t6SO9F+`-ti2r^Vz*(fSXQQqpPvZg3nS=M1DhpT`^Y7w#sjyf27M(V<6TcIRT z2if?PszWwK+*D0QHbv>o8hOf`&A*ZVb@qixKM6|1yxF-{u=n1bUoRB?9)7=Z)jRm} xHTOQZ{ru^Z@%q~b^3U+1x>{*|dMWF->i~TIaN^sS`bUd>P#U*(&7XJ!BZ literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabNew@2x.png b/MMTabBarView/MMTabBarView/Images/YosemiteTabNew@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..fdfe8c2cb04eb61a863504319a94815d3e85e601 GIT binary patch literal 1242 zcmZ`(O>fgc5Oq;OG^hxP9-{JP8F2t9UfXFYu^b~Bha?gyB?OTo4t1SP>(usI_C|4U zh#p!l{D7(l{s6sl1aU* z9o0gvXtvQ36eHIsY>v|+l{~r-n|$OtUZ_SzA!exLnZiKeV+vj^3a$D)UqS)or^P8z z67&qu^IFjEs14)xKu%UgVFhDf1)$&Wi~YQaf@L5V3I!l3Kv8mpkqg&6Y(_aRyqs*Z zzmEY!E3kcRBaf&1noFpMi-JIn4t`0V*zO!UdEuZeQXrraAd3VcSx}-clD@m^m$S zX7Rf}Yc2x@*1%A$v&Prkjl@OftP*yb6IdvtDW;^F4suk?dcE6*7_vx`sn08fW@DF6Tf literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index b2bcf971..50a5f42a 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -21,6 +21,7 @@ #import "MMLiveChatTabStyle.h" #import "MMCardTabStyle.h" #import "MMSafariTabStyle.h" +#import "MMYosemiteTabStyle.h" #import "MMTabDragAssistant.h" #import "MMTabBarController.h" #import "MMAttachedTabBarButton.h" @@ -355,6 +356,7 @@ + (void)registerDefaultTabStyleClasses { [self registerTabStyleClass:[MMCardTabStyle class]]; [self registerTabStyleClass:[MMLiveChatTabStyle class]]; [self registerTabStyleClass:[MMSafariTabStyle class]]; + [self registerTabStyleClass:[MMYosemiteTabStyle class]]; } + (void)registerTabStyleClass:(Class )aStyleClass { diff --git a/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h b/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h new file mode 100755 index 00000000..f1f58790 --- /dev/null +++ b/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h @@ -0,0 +1,28 @@ +// +// MMYosemiteTabStyle.h +// -------------------- +// +// Based on MMUnifiedTabStyle.h by Keith Blount +// Created by Ajin Man Tuladhar on 04/11/2014. +// Copyright 2014 Ajin Man Tuladhar. All rights reserved. +// + +#import +#import "MMTabStyle.h" + +@interface MMYosemiteTabStyle : NSObject { + + NSImage *YosemiteCloseButton; + NSImage *YosemiteCloseButtonDown; + NSImage *YosemiteCloseButtonOver; + NSImage *YosemiteCloseDirtyButton; + NSImage *YosemiteCloseDirtyButtonDown; + NSImage *YosemiteCloseDirtyButtonOver; + NSImage *TabNewYosemite; + + CGFloat _leftMargin; +} + +@property (assign) CGFloat leftMarginForTabBarView; + +@end \ No newline at end of file diff --git a/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m b/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m new file mode 100755 index 00000000..8723f216 --- /dev/null +++ b/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m @@ -0,0 +1,427 @@ +// +// MMYosemiteTabStyle.m +// -------------------- +// +// Based on MMUnifiedTabStyle.m by Keith Blount +// Created by Ajin Man Tuladhar on 04/11/2014. +// Copyright 2014 Ajin Man Tuladhar. All rights reserved. +// + +#import "MMYosemiteTabStyle.h" +#import "MMAttachedTabBarButton.h" +#import "MMTabBarView.h" +#import "NSView+MMTabBarViewExtensions.h" +#import "NSBezierPath+MMTabBarViewExtensions.h" + +@interface MMYosemiteTabStyle (SharedPrivates) + +- (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; +- (void)_drawBoxBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; +- (NSRect)_addTabButtonRect; +- (NSRect)_overflowButtonRect; +@end + +@implementation MMYosemiteTabStyle +@synthesize leftMarginForTabBarView = _leftMargin; + ++ (NSString *)name { + return @"Yosemite"; +} + +- (NSString *)name { + return [[self class] name]; +} + +#pragma mark - +#pragma mark Creation/Destruction + +- (id) init { + if ((self = [super init])) { + YosemiteCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front"]]; + YosemiteCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front_Pressed"]]; + YosemiteCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front_Rollover"]]; + + YosemiteCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; + YosemiteCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; + YosemiteCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; + + TabNewYosemite = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabNew"]]; + + _leftMargin = -1.0f; + } + + return self; +} + +- (void)dealloc { + YosemiteCloseButton = nil; + YosemiteCloseButtonDown = nil; + YosemiteCloseButtonOver = nil; + YosemiteCloseDirtyButton = nil; + YosemiteCloseDirtyButtonDown = nil; + YosemiteCloseDirtyButtonOver = nil; + TabNewYosemite = nil; +} + +#pragma mark - +#pragma mark Tab View Specific + +- (CGFloat)leftMarginForTabBarView:(MMTabBarView *)tabBarView { + if ([tabBarView orientation] == MMTabBarHorizontalOrientation) + return -1.0f; + else + return 0.0f; +} + +- (CGFloat)rightMarginForTabBarView:(MMTabBarView *)tabBarView { + if ([tabBarView orientation] == MMTabBarHorizontalOrientation) + return -1.0f; + else + return 0.0f; +} + +- (CGFloat)topMarginForTabBarView:(MMTabBarView *)tabBarView { + if ([tabBarView orientation] == MMTabBarHorizontalOrientation) + return 0.0f; + + return 0.0f; +} + +- (CGFloat)heightOfTabBarButtonsForTabBarView:(MMTabBarView *)tabBarView { + return 25; +} + + +- (NSRect)addTabButtonRectForTabBarView:(MMTabBarView *)tabBarView { + NSRect window = [tabBarView frame]; + NSSize buttonSize = [tabBarView addTabButtonSize]; + NSRect rect = NSMakeRect(NSMaxX(window) - buttonSize.width - 5, 1, buttonSize.width, buttonSize.height); + return rect; +} + +- (NSSize)addTabButtonSizeForTabBarView:(MMTabBarView *)tabBarView { + return NSMakeSize(18,[tabBarView frame].size.height); +} + + +// +// +//- (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView { +// [tabBarView update]; +// NSRect window = [tabBarView frame]; +// NSSize buttonSize = [tabBarView addTabButtonSize]; +// NSRect rect = NSMakeRect(NSMaxX(window) - buttonSize.width - 5, 2, buttonSize.width, buttonSize.height); +// return NSZeroRect; +//} + + +//- (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView { +// NSRect rect = [tabBarView _overflowButtonRect]; +// +// //rect.origin.y += [tabBarView topMargin]; +// //rect.size.width = 60; +// return rect; +//} + +- (BOOL)supportsOrientation:(MMTabBarOrientation)orientation forTabBarView:(MMTabBarView *)tabBarView { + + if (orientation != MMTabBarHorizontalOrientation) + return NO; + + return YES; +} + +#pragma mark - +#pragma mark Drag Support + +- (NSRect)draggingRectForTabButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView { + + NSRect dragRect = [aButton stackingFrame]; + dragRect.size.width++; + return dragRect; + +} + +#pragma mark - +#pragma mark Add Tab Button + +- (void)updateAddButton:(MMRolloverButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView { + + [aButton setImage:TabNewYosemite]; + [aButton setAlternateImage:TabNewYosemite]; + [aButton setRolloverImage:TabNewYosemite]; +} + +#pragma mark - +#pragma mark Providing Images + +- (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type forTabCell:(MMTabBarButtonCell *)cell +{ + switch (type) { + case MMCloseButtonImageTypeStandard: + return YosemiteCloseButton; + case MMCloseButtonImageTypeRollover: + return YosemiteCloseButtonOver; + case MMCloseButtonImageTypePressed: + return YosemiteCloseButtonDown; + + case MMCloseButtonImageTypeDirty: + return YosemiteCloseDirtyButton; + case MMCloseButtonImageTypeDirtyRollover: + return YosemiteCloseDirtyButtonOver; + case MMCloseButtonImageTypeDirtyPressed: + return YosemiteCloseDirtyButtonDown; + + + default: + break; + } + +} + +#pragma mark - +#pragma mark Drawing + +- (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { + //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area + rect = [tabBarView bounds]; +// tabBarView.resizeTabsToFitTotalWidth= YES; + + NSRect gradientRect = rect; + + if ([tabBarView isWindowActive]) + { + NSColor *startColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.000]; + NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:startColor]; + [gradient drawInRect:gradientRect angle:90.0]; + } + + [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(rect), NSMinY(rect) + 0.5) + toPoint:NSMakePoint(NSMaxX(rect), NSMinY(rect) + 0.5)]; + + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(rect), NSMaxY(rect) - 0.5) + toPoint:NSMakePoint(NSMaxX(rect), NSMaxY(rect) - 0.5)]; +} + +- (void)drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)index inButtons:(NSArray *)buttons indexOfSelectedButton:(NSUInteger)selIndex tabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { + +// NSWindow *window = [tabBarView window]; +// NSToolbar *toolbar = [window toolbar]; +// if (toolbar && [toolbar isVisible]) +// return; + + NSRect aRect = [button frame]; + NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; + + // draw dividers + BOOL shouldDisplayRightDivider = [button shouldDisplayRightDivider]; + if ([button tabState] & MMTab_RightIsSelectedMask) { + if (([button tabState] & (MMTab_PlaceholderOnRight | MMTab_RightIsSliding)) == 0) + shouldDisplayRightDivider = NO; + } + + if (shouldDisplayRightDivider) { + [lineColor set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; + + [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) + toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; + + } + + if ([button shouldDisplayLeftDivider]) { + [lineColor set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMinY(aRect)) toPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMaxY(aRect))]; + + [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; + } +} + +-(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView +{ + MMTabBarView *tabBarView = [controlView enclosingTabBarView]; + MMAttachedTabBarButton *button = (MMAttachedTabBarButton *)controlView; +// NSWindow *window = [controlView window]; +// NSToolbar *toolbar = [window toolbar]; + + BOOL overflowMode = [button isOverflowButton]; + if ([button isSliding]) + overflowMode = NO; + +// if (toolbar && [toolbar isVisible]) { +// + NSRect aRect = NSZeroRect; + if (overflowMode) { + aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width +1, frame.size.height); + } else { + aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + } + + aRect.origin.y += 1; + aRect.size.height -= 2; + + if (overflowMode) { + [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeLeftCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; + } else { + [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeAllCaps|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; + } + +// } else { +// +// NSRect aRect = NSZeroRect; +// if (overflowMode) { +// aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); +// } else { +// aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); +// } +// +// if (overflowMode) { +// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeLeftCap usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; +// } else { +// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeAllCaps usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; +// } +// } +} + +-(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { + + MMAttachedTabBarButton *lastAttachedButton = [tabBarView lastAttachedButton]; + if ([lastAttachedButton isSliding]) + return; + +// NSWindow *window = [tabBarView window]; +// NSToolbar *toolbar = [window toolbar]; + + NSRect frame = [overflowButton frame]; + +// if (toolbar && [toolbar isVisible]) { +// + NSRect aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + aRect.size.width += 5.0; + aRect.origin.y += 1; + aRect.size.height -= 2; + + [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeRightCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:lastAttachedButton ofTabBarView:tabBarView]; + +// } else { +// NSRect aRect = NSMakeRect(frame.origin.x, frame.origin.y+0.5, frame.size.width-0.5f, frame.size.height-1.0); +// aRect.size.width += 5.0; +// +// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeRightCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:lastAttachedButton ofTabBarView:tabBarView]; +// +// if ([tabBarView showAddTabButton]) { +// +// NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; +// [lineColor set]; +// [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; +// +// [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; +// [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; +// } +// } +} + +#pragma mark - +#pragma mark Archiving + +- (void)encodeWithCoder:(NSCoder *)aCoder { + //[super encodeWithCoder:aCoder]; + if ([aCoder allowsKeyedCoding]) { + [aCoder encodeObject:YosemiteCloseButton forKey:@"YosemiteCloseButton"]; + [aCoder encodeObject:YosemiteCloseButtonDown forKey:@"YosemiteCloseButtonDown"]; + [aCoder encodeObject:YosemiteCloseButtonOver forKey:@"YosemiteCloseButtonOver"]; + [aCoder encodeObject:YosemiteCloseDirtyButton forKey:@"YosemiteCloseDirtyButton"]; + [aCoder encodeObject:YosemiteCloseDirtyButtonDown forKey:@"YosemiteCloseDirtyButtonDown"]; + [aCoder encodeObject:YosemiteCloseDirtyButtonOver forKey:@"YosemiteCloseDirtyButtonOver"]; + } +} + +- (id)initWithCoder:(NSCoder *)aDecoder { + // self = [super initWithCoder:aDecoder]; + //if (self) { + if ([aDecoder allowsKeyedCoding]) { + YosemiteCloseButton = [aDecoder decodeObjectForKey:@"YosemiteCloseButton"]; + YosemiteCloseButtonDown = [aDecoder decodeObjectForKey:@"YosemiteCloseButtonDown"]; + YosemiteCloseButtonOver = [aDecoder decodeObjectForKey:@"YosemiteCloseButtonOver"]; + YosemiteCloseDirtyButton = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButton"]; + YosemiteCloseDirtyButtonDown = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButtonDown"]; + YosemiteCloseDirtyButtonOver = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButtonOver"]; + } + //} + return self; +} + +#pragma mark - +#pragma mark Private Methods + +- (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView { + + NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; + CGFloat radius = 0.0f; + + //capMask &= ~MMBezierShapeFillPath; + + NSBezierPath *fillPath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask|MMBezierShapeFillPath]; + + if ([tabBarView isWindowActive]) { + if ([button state] == NSOnState) { + NSColor *startColor = [NSColor colorWithDeviceWhite:0.875 alpha:1.000]; + NSColor *endColor = [NSColor colorWithDeviceWhite:0.902 alpha:1.000]; + NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; + [[NSGraphicsContext currentContext] setShouldAntialias:NO]; + [gradient drawInBezierPath:fillPath angle:90.0]; + [[NSGraphicsContext currentContext] setShouldAntialias:YES]; + } else { + NSColor *startColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.000]; + NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:startColor]; + [gradient drawInBezierPath:fillPath angle:80.0]; + } + } else { + + if ([button state] == NSOnState) { + NSColor *startColor = [NSColor colorWithDeviceWhite:0.875 alpha:1.000]; + NSColor *endColor = [NSColor colorWithDeviceWhite:0.902 alpha:1.000]; + NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:endColor]; + [[NSGraphicsContext currentContext] setShouldAntialias:NO]; + [gradient drawInBezierPath:fillPath angle:90.0]; + [[NSGraphicsContext currentContext] setShouldAntialias:YES]; + } + } + + //NSBezierPath *strokePath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask]; + //[strokePath stroke]; + + NSBezierPath *bezier = [NSBezierPath bezierPath]; + [lineColor set]; + + BOOL shouldDisplayLeftDivider = [button shouldDisplayLeftDivider]; + if (shouldDisplayLeftDivider) { + //draw the tab divider + [bezier moveToPoint:NSMakePoint(NSMinX(aRect), NSMinY(aRect))]; + [bezier lineToPoint:NSMakePoint(NSMinX(aRect), NSMaxY(aRect))]; + } + + [bezier moveToPoint:NSMakePoint(NSMaxX(aRect), NSMinY(aRect))]; + [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))]; + [bezier stroke]; +} + +- (void)_drawBoxBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView { + + capMask &= ~MMBezierShapeFillPath; + + // fill + if ([button state] == NSOnState) { + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; + NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + } else + if ([button mouseHovered]) { + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; + NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + } +} + +@end \ No newline at end of file From ab19f5115089741684ce0192b66a8e7604c132aa Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 4 Jun 2015 09:34:42 +0200 Subject: [PATCH 10/21] MMTabStyle.h: Some more documentation --- MMTabBarView/MMTabBarView/MMTabStyle.h | 387 ++++++++++++++++++++++++- 1 file changed, 374 insertions(+), 13 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabStyle.h b/MMTabBarView/MMTabBarView/MMTabStyle.h index b9e065bf..b6f91e36 100644 --- a/MMTabBarView/MMTabBarView/MMTabStyle.h +++ b/MMTabBarView/MMTabBarView/MMTabStyle.h @@ -17,73 +17,434 @@ @protocol MMTabStyle -// identity +#pragma mark Style name + +/** + * Name of style + * + * @return Style name + */ + (NSString *)name; +/** + * Name of style + */ @property (readonly) NSString *name; @optional -// tab view specific parameters +#pragma mark General + +/** + * Get height of tab bar buttons + * + * @param tabBarView A tab bar view + * + * @return The height of tab bar buttons + */ +- (CGFloat)heightOfTabBarButtonsForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Check if tab style supports given orientation for specified tab bar view + * + * @param orientation An orientation + * @param tabBarView The tab bar view + * + * @return YES or NO + */ - (BOOL)supportsOrientation:(MMTabBarOrientation)orientation forTabBarView:(MMTabBarView *)tabBarView; + +#pragma mark Working with margins + +/** + * Get left margin for specified tab bar view + * + * @param tabBarView The tab bar view + * + * @return Margin value + */ - (CGFloat)leftMarginForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Get right margin for specified tab bar view + * + * @param tabBarView The tab bar view + * + * @return Margin value + */ - (CGFloat)rightMarginForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Get top margin for specified tab bar view + * + * @param tabBarView The tab bar view + * + * @return Margin value + */ - (CGFloat)topMarginForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Get bottom margin for specified tab bar view + * + * @param tabBarView The tab bar view + * + * @return Margin value + */ - (CGFloat)bottomMarginForTabBarView:(MMTabBarView *)tabBarView; + +#pragma mark Working with 'add button' + +/** + * Get size of tab bar view's 'add button' + * + * @param tabBarView A tab bar view + * + * @return Size of 'add button' + */ - (NSSize)addTabButtonSizeForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Get frame rect of tab bar view's 'add button' + * + * @param tabBarView A tab bar view + * + * @return Frame rect of 'add button' + */ - (NSRect)addTabButtonRectForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Update 'add button' + * + * @param aButton The 'add button' + * @param tabBarView The tab bar view + */ +- (void)updateAddButton:(MMRolloverButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView; + +#pragma mark Working with 'overflow button' + +/** + * Get size of tab bar view's 'overflow button' + * + * @param tabBarView A tab bar view + * + * @return Size of 'overflow button' + */ - (NSSize)overflowButtonSizeForTabBarView:(MMTabBarView *)tabBarView; + +/** + * Get frame rect of tab bar view's 'overflow button' + * + * @param tabBarView A tab bar view + * + * @return Frame rect of 'overflow button' + */ - (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView; -- (CGFloat)heightOfTabBarButtonsForTabBarView:(MMTabBarView *)tabBarView; -- (void)updateAddButton:(MMRolloverButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView; +/** + * Update 'overflow button' + * + * @param aButton The 'overflow button' + * @param tabBarView The tab bar view + */ - (void)updateOverflowPopUpButton:(MMOverflowPopUpButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView; -// cell values +#pragma mark Working with tab bar button cells + +/** + * Get attributed string representing object count + * + * @param cell A tab bar button cell + * + * @return Object count (attributed string) + */ - (NSAttributedString *)attributedObjectCountStringValueForTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get attributed string value + * + * @param cell A tab bar button cell + * + * @return Attributed string value + */ - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)cell; -// Constraints +/** + * Minimum width of tab bar button cell + * + * @param cell A tab bar button cell + * + * @return Minimum width + */ - (CGFloat)minimumWidthOfTabCell:(MMTabBarButtonCell *)cell; + +/** + * Desired width of tab bar button cell + * + * @param cell A tab bar button cell + * + * @return Desired width + */ - (CGFloat)desiredWidthOfTabCell:(MMTabBarButtonCell *)cell; -// Update Buttons -- (BOOL)updateCloseButton:(MMRolloverButton *)closeButton ofTabCell:(MMTabBarButtonCell *)cell; // returning NO will hide the close button +/** + * Update close button + * + * @param closeButton A close button (@see MMRolloverButton) + * @param cell A tab bar button cell + * + * @return YES or NO, returning NO will hide the close button + */ +- (BOOL)updateCloseButton:(MMRolloverButton *)closeButton ofTabCell:(MMTabBarButtonCell *)cell; -// Providing Images +/** + * Get close button image + * + * @param type Button image type (@see MMCloseButtonImageType) + * @param cell A tab bar button cell + * + * @return The close button image + */ - (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type forTabCell:(MMTabBarButtonCell *)cell; -// Determining Cell Size +#pragma mark Determining rects of tab bar button cell components + +/** + * Get drawing rect for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell Tab bar button cell + * + * @return A drawing rect + */ - (NSRect)drawingRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get size of close button for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Close button size + */ - (NSSize)closeButtonSizeForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get rect of close button for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Close button rect + */ - (NSRect)closeButtonRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; +/** + * Get rect of title for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Title rect + */ - (NSRect)titleRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get rect of icon for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Icon rect + */ - (NSRect)iconRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get rect of large image for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Large image rect + */ - (NSRect)largeImageRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get rect of progress indicator for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return Progress indicator rect + */ - (NSRect)indicatorRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get size of object counter for specified tab bar button cell + * + * @param cell A tab bar button cell + * + * @return Size of object counter + */ - (NSSize)objectCounterSizeOfTabCell:(MMTabBarButtonCell *)cell; + +/** + * Get rect of object counter for bounds of tab bar button cell + * + * @param theRect Bounds rect + * @param cell A tab bar button cell + * + * @return object counter rect + */ - (NSRect)objectCounterRectForBounds:(NSRect)theRect ofTabCell:(MMTabBarButtonCell *)cell; -// Drawing +#pragma mark Drawing the tab bar view + +/** + * Draw tab bar view + * + * @param tabBarView A tab bar view + * @param rect Drawing rect in tab bar view's coos + */ - (void)drawTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; + +/** + * Draw bezel of tab bar view + * + * @param tabBarView A tab bar view + * @param rect Drawing rect in tab bar view's coos + */ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; + +/** + * Draw button bezels of tab bar view + * + * @param tabBarView A tab bar view + * @param rect Drawing rect in tab bar view's coos + */ - (void)drawButtonBezelsOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; + +/** + * Draw interior of tab bar view + * + * @param tabBarView A tab bar view + * @param rect Drawing rect in tab bar view's coos + */ +- (void)drawInteriorOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; + +/** + * Draw bezel of tab bar button + * + * @param button A tab bar button + * @param index Index of tab bar button + * @param buttons Array of all buttons + * @param selIndex Index of selected button + * @param tabBarView Tab bar view to draw + * @param rect Drawing rect in tab bar view's coos + */ - (void)drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)index inButtons:(NSArray *)buttons indexOfSelectedButton:(NSUInteger)selIndex tabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; + +/** + * Draw bezel of overflow button + * + * @param overflowButton An overflow button + * @param tabBarView Tab bar view to draw + * @param rect Drawing rect in tab bar view's coos + */ - (void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; -- (void)drawInteriorOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect; +#pragma mark Drawing tab bar button cells + +/** + * Draw tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawTabBarCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw bezel of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw interior of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawInteriorOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw title of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawTitleOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw icon of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawIconOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw large image of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawLargeImageOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw progress indicator of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawIndicatorOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw object counter of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawObjectCounterOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; + +/** + * Draw close button of tab bar cell + * + * @param cell The tab bar button cell + * @param frame Frame of tab bar button cell + * @param controlView Cell's control view + */ - (void)drawCloseButtonOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView; -// Drag & Drop Support +#pragma mark Support Drag & Drop + +/** + * Get dragging rect for specified tab bar button + * + * @param aButton A tab bar button + * @param tabBarView A tab bar view + * + * @return The dragging rect + */ - (NSRect)draggingRectForTabButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView; @end \ No newline at end of file From 37af296688c92efd2de0920f48d60e4bcd44f899 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 4 Jun 2015 13:23:10 +0200 Subject: [PATCH 11/21] Documentation --- MMTabBarView/MMTabBarView/MMTabBarView.h | 532 +++++++++++++++++++---- 1 file changed, 447 insertions(+), 85 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.h b/MMTabBarView/MMTabBarView/MMTabBarView.h index 7b0487c5..596eced2 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.h @@ -47,173 +47,535 @@ static NSImage* _static##name##Image() \ @protocol MMTabStyle; -typedef NS_ENUM(NSUInteger, MMTabBarOrientation) -{ - MMTabBarHorizontalOrientation = 0, - MMTabBarVerticalOrientation +/** + * Tab bar orientation + */ +typedef NS_ENUM(NSUInteger, MMTabBarOrientation){ +/** + * Horizontal orientation + */ +MMTabBarHorizontalOrientation = 0, +/** + * Vertical orientation + */ +MMTabBarVerticalOrientation }; -typedef NS_ENUM(NSUInteger, MMTabBarTearOffStyle) -{ - MMTabBarTearOffAlphaWindow, - MMTabBarTearOffMiniwindow +/** + * Tear off style + */ +typedef NS_ENUM(NSUInteger, MMTabBarTearOffStyle){ +/** + * Show alpha window + */ +MMTabBarTearOffAlphaWindow, +/** + * Show mini window + */ +MMTabBarTearOffMiniwindow }; -typedef NS_ENUM(NSUInteger, MMAttachedButtonsEnumerationOptions) -{ - - MMAttachedButtonsEnumerationNone = 0, - MMAttachedButtonsEnumerationUpdateTabStateMask = 1 << 1, - MMAttachedButtonsEnumerationUpdateButtonState = 1 << 2 +/** + * Attached tab bar buttons enumeration options + */ +typedef NS_ENUM(NSUInteger, MMAttachedButtonsEnumerationOptions){ +/** + * No options + */ +MMAttachedButtonsEnumerationNone = 0, +/** + * Update tab state + */ +MMAttachedButtonsEnumerationUpdateTabStateMask = 1 << 1, +/** + * Update button state + */ +MMAttachedButtonsEnumerationUpdateButtonState = 1 << 2 }; @protocol MMTabBarViewDelegate; @interface MMTabBarView : NSView +#pragma mark Basics + +/** + * Get bundle of class + * + * @return The bundle + */ ++ (NSBundle *)bundle; + +#pragma mark Outlets + +/** + * Tab view + */ @property (strong) IBOutlet NSTabView *tabView; + +/** + * A partner view + */ @property (strong) IBOutlet NSView *partnerView; -@property (weak) IBOutlet id delegate; -@property (assign) NSUInteger destinationIndexForDraggedItem; + +/** + * Delegate + */ +@property (weak) IBOutlet id delegate; + +#pragma mark Working with View's current state + +/** + * Get available width for buttons + */ +@property (readonly) CGFloat availableWidthForButtons; + +/** + * Get available height for buttons + */ +@property (readonly) CGFloat availableHeightForButtons; + +/** + * Get generic button rect + * + * @return The button rect + */ +- (NSRect)genericButtonRect; + +/** + * Check if overflow button is currently visible + */ +@property (readonly) BOOL isOverflowButtonVisible; + +/** + * Get window's active state + */ +@property (readonly) BOOL isWindowActive; + +/** + * Check if in resize mode + */ @property (readonly) BOOL isResizing; + +/** + * Check if receiver needs update + */ @property (assign) BOOL needsUpdate; -@property (assign) BOOL resizeTabsToFitTotalWidth; -#pragma mark Control Characteristics +#pragma mark Drag & Drop Support -+ (NSBundle *)bundle; -- (CGFloat)availableWidthForButtons; -- (CGFloat)availableHeightForButtons; -- (NSRect)genericButtonRect; -- (BOOL)isWindowActive; +/** + * Check if detached dragging of tab view item is allowed + * + * @param anItem A Tab view item + * + * @return YES or NO + */ - (BOOL)allowsDetachedDraggingOfTabViewItem:(NSTabViewItem *)anItem; +/** + * Get destination index for dragged item + */ +@property (assign) NSUInteger destinationIndexForDraggedItem; + #pragma mark Style Class Registry +/** + * Register default tab style classes + */ + (void)registerDefaultTabStyleClasses; + +/** + * Register a tab style class + * + * @param aStyleClass A tab style class + */ + (void)registerTabStyleClass:(Class )aStyleClass; + +/** + * Unregister tab style class + * + * @param aStyleClass A tab style class + */ + (void)unregisterTabStyleClass:(Class )aStyleClass; + +/** + * Get registered tab style classes + * + * @return Array of all registered classes + */ + (NSArray *)registeredTabStyleClasses; + +/** + * Get registered class for specified tab style name + * + * @param name Name of a registered tab style + * + * @return The matching tab style class + */ + (Class )registeredClassForStyleName:(NSString *)name; #pragma mark Tab View Item Management -- (NSUInteger)numberOfTabViewItems; -- (NSUInteger)numberOfVisibleTabViewItems; -- (NSArray *)visibleTabViewItems; +/** + * Get number of tab view items + */ +@property (readonly) NSUInteger numberOfTabViewItems; + +/** + * Get number of visible tab view items + */ +@property (readonly) NSUInteger numberOfVisibleTabViewItems; + +/** + * Get array of visible tab view items + */ +@property (readonly) NSArray *visibleTabViewItems; + +/** + * Get index of specified tab view item + * + * @param anItem A tab view item + * + * @return The index into array of tab view items + */ - (NSUInteger)indexOfTabViewItem:(NSTabViewItem *)anItem; -- (NSTabViewItem *)selectedTabViewItem; + +/** + * Get selected tab view item + */ +@property (readonly) NSTabViewItem *selectedTabViewItem; + +/** + * Select specified tab view item + * + * @param anItem A tab view item + */ - (void)selectTabViewItem:(NSTabViewItem *)anItem; + +/** + * Move a tab view item to specified index + * + * @param anItem A tab view item + * @param index The destination index + */ - (void)moveTabViewItem:(NSTabViewItem *)anItem toIndex:(NSUInteger)index; + +/** + * Remove a tab view item + * + * @param anItem Tab view item to remove + */ - (void)removeTabViewItem:(NSTabViewItem *)anItem; -- (NSTabViewItem *)tabViewItemPinnedToOverflowButton; -- (void)setTabViewItemPinnedToOverflowButton:(NSTabViewItem *)item; +/** + * Tab view item currently pinned to overflow button + */ +@property (strong) NSTabViewItem *tabViewItemPinnedToOverflowButton; #pragma mark Attached Buttons Management -- (NSUInteger)numberOfAttachedButtons; -- (NSSet *)attachedButtons; -- (NSArray *)orderedAttachedButtons; +/** + * Get number of attached tab bar buttons + */ +@property (readonly) NSUInteger numberOfAttachedButtons; + +/** + * Get array of all attached tab bar buttons + */ +@property (readonly) NSSet *attachedButtons; + +/** + * Get ordered array of attached tab bar buttons + */ +@property (readonly) NSArray *orderedAttachedButtons; + +/** + * Get array of attached tab bar buttons sorted by using a comparator + * + * @param cmptr A comparator block + * + * @return The sorted array + */ - (NSArray *)sortedAttachedButtonsUsingComparator:(NSComparator)cmptr; + +/** + * INsert attached tab bar button for specified tab view item + * + * @param item A tab view item + * @param index Index to insert attached tab bar button at + */ - (void)insertAttachedButtonForTabViewItem:(NSTabViewItem *)item atIndex:(NSUInteger)index; + +/** + * Add attached tab bar button for specified tab view item + * + * @param tab view item to add attached tab bar button for + */ - (void)addAttachedButtonForTabViewItem:(NSTabViewItem *)item; + +/** + * Remove attached tab bar button + * + * @param aButton A tab bar button + */ - (void)removeAttachedButton:(MMAttachedTabBarButton *)aButton; + +/** + * Remove attached tab bar button and synchronize tab view items + * + * @param aButton A tab bar button + * @param syncTabViewItems YES: synchronize tab view items + */ - (void)removeAttachedButton:(MMAttachedTabBarButton *)aButton synchronizeTabViewItems:(BOOL)syncTabViewItems; + +/** + * Insert specified attached tab bar button at index + * + * @param aButton A tab bar button + * @param anIndex Destination index + */ - (void)insertAttachedButton:(MMAttachedTabBarButton *)aButton atTabItemIndex:(NSUInteger)anIndex; #pragma mark Find Attached Buttons -- (NSIndexSet *)viewIndexesOfAttachedButtons; +/** + * Get view indexes of attached buttons + */ +@property (readonly) NSIndexSet *viewIndexesOfAttachedButtons; -- (NSUInteger)viewIndexOfSelectedAttachedButton; +/** + * Get view index of selected attached button + */ +@property (readonly) NSUInteger viewIndexOfSelectedAttachedButton; -- (MMAttachedTabBarButton *)selectedAttachedButton; -- (MMAttachedTabBarButton *)lastAttachedButton; +/** + * Get selected attached tab bar button + */ +@property (readonly) MMAttachedTabBarButton *selectedAttachedButton; +/** + * Get last attached tab bar button + */ +@property (readonly) MMAttachedTabBarButton *lastAttachedButton; + +/** + * Get attached tab bar button at point + * + * @param aPoint A point in receiver's coos + * + * @return The matching attached tab bar button (or nil) + */ - (MMAttachedTabBarButton *)attachedButtonAtPoint:(NSPoint)aPoint; +/** + * Get attached tab bar button for specified tab view item + * + * @param anItem A tab view item + * + * @return Matching attached tab bar button (or nil) + */ - (MMAttachedTabBarButton *)attachedButtonForTabViewItem:(NSTabViewItem *)anItem; +/** + * Get index of specified attached tab bar button + * + * @param aButton A tab bar button + * + * @return Index of tab bar button + */ - (NSUInteger)indexOfAttachedButton:(MMAttachedTabBarButton *)aButton; #pragma mark Button State Management +/** + * Update tab state mask of specified attached tab bar button + * + * @param aButton An attached tab bar button + * @param index Button index + * @param prevButton Previous button + * @param nextButton Next Button + */ - (void)updateTabStateMaskOfAttachedButton:(MMAttachedTabBarButton *)aButton atIndex:(NSUInteger)index withPrevious:(MMAttachedTabBarButton *)prevButton next:(MMAttachedTabBarButton *)nextButton; + +/** + * Update tab state mask of specified attached tab bar button + * + * @param aButton An attached tab bar button + * @param index Button index + */ - (void)updateTabStateMaskOfAttachedButton:(MMAttachedTabBarButton *)aButton atIndex:(NSUInteger)index; + +/** + * Update tab state mask of all attached buttons + */ - (void)updateTabStateMaskOfAttachedButtons; #pragma mark Sending Messages to Attached Buttons +/** + * Enumerate attached tab bar buttons + * + * @param block Block to execute + */ - (void)enumerateAttachedButtonsUsingBlock:(void (^)(MMAttachedTabBarButton *aButton, NSUInteger idx, BOOL *stop))block; +/** + * Enumerate attached tab bar buttons with options + * + * @param opts Options (@see MMAttachedButtonsEnumerationOptions) + * @param block Block to execute + */ - (void)enumerateAttachedButtonsWithOptions:(MMAttachedButtonsEnumerationOptions)opts usingBlock:(void (^)(MMAttachedTabBarButton *aButton, NSUInteger idx, MMAttachedTabBarButton *previousButton, MMAttachedTabBarButton *nextButton, BOOL *stop))block; +/** + * Enumerate attached tab bar buttons in range with options + * + * @param buttons Array of attached tab bar buttons + * @param range Button index range + * @param opts Options (@see MMAttachedButtonsEnumerationOptions) + * @param block Block to execute + */ - (void)enumerateAttachedButtons:(NSArray *)buttons inRange:(NSRange)range withOptions:(MMAttachedButtonsEnumerationOptions)opts usingBlock:(void (^)(MMAttachedTabBarButton *aButton, NSUInteger idx, MMAttachedTabBarButton *previousButton, MMAttachedTabBarButton *nextButton, BOOL *stop))block; #pragma mark Find Tab Bar Buttons +/** + * Fin tab bar button at point + * + * @param point Point in receiver's coo system + * + * @return Matching tab bar button (or nil) + */ - (MMTabBarButton *)tabBarButtonAtPoint:(NSPoint)point; #pragma mark Control Configuration -- (id)style; -- (void)setStyle:(id )newStyle; -- (NSString *)styleName; +/** + * The tab style to use + */ +@property (strong) id style; + +/** + * Name of tab style + */ +@property (readonly) NSString *styleName; + +/** + * Set tab style by style name + * + * @param name Name of registered tab style + */ - (void)setStyleNamed:(NSString *)name; -- (MMTabBarOrientation)orientation; -- (void)setOrientation:(MMTabBarOrientation)value; -- (BOOL)onlyShowCloseOnHover; -- (void)setOnlyShowCloseOnHover:(BOOL)value; -- (BOOL)canCloseOnlyTab; -- (void)setCanCloseOnlyTab:(BOOL)value; -- (BOOL)disableTabClose; -- (void)setDisableTabClose:(BOOL)value; -- (BOOL)hideForSingleTab; -- (void)setHideForSingleTab:(BOOL)value; -- (BOOL)showAddTabButton; -- (void)setShowAddTabButton:(BOOL)value; -- (NSInteger)buttonMinWidth; -- (void)setButtonMinWidth:(NSInteger)value; -- (NSInteger)buttonMaxWidth; -- (void)setButtonMaxWidth:(NSInteger)value; -- (NSInteger)buttonOptimumWidth; -- (void)setButtonOptimumWidth:(NSInteger)value; -- (BOOL)sizeButtonsToFit; -- (void)setSizeButtonsToFit:(BOOL)value; -- (BOOL)useOverflowMenu; -- (void)setUseOverflowMenu:(BOOL)value; -- (BOOL)allowsBackgroundTabClosing; -- (void)setAllowsBackgroundTabClosing:(BOOL)value; -- (BOOL)allowsResizing; -- (void)setAllowsResizing:(BOOL)value; -- (BOOL)selectsTabsOnMouseDown; -- (void)setSelectsTabsOnMouseDown:(BOOL)value; -- (BOOL)automaticallyAnimates; -- (void)setAutomaticallyAnimates:(BOOL)value; -- (BOOL)alwaysShowActiveTab; -- (void)setAlwaysShowActiveTab:(BOOL)value; -- (BOOL)allowsScrubbing; -- (void)setAllowsScrubbing:(BOOL)value; -- (MMTabBarTearOffStyle)tearOffStyle; -- (void)setTearOffStyle:(MMTabBarTearOffStyle)tearOffStyle; +/** + * Reciever's layout orientation + */ +@property (assign) MMTabBarOrientation orientation; -#pragma mark Accessors +/** + * YES: only show close button on hover + */ +@property (assign) BOOL onlyShowCloseOnHover; -- (NSTabView *)tabView; -- (void)setTabView:(NSTabView *)view; -- (id)delegate; -- (void)setDelegate:(id)object; -- (CGFloat)heightOfTabBarButtons; +/** + * YES: can close last (single) tab available + */ +@property (assign) BOOL canCloseOnlyTab; + +/** + * Disable closing of tabs + */ +@property (assign) BOOL disableTabClose; + +/** + * Hide receiver if there is a single tab only + */ +@property (assign) BOOL hideForSingleTab; + +/** + * Visibilty of 'add' button + */ +@property (assign) BOOL showAddTabButton; + +/** + * Minimum width of tab bar buttons + */ +@property (assign) NSInteger buttonMinWidth; + +/** + * Minimum width of tab bar buttons + */ +@property (assign) NSInteger buttonMaxWidth; + +/** + * Optimum width of tab bar buttons + */ +@property (assign) NSInteger buttonOptimumWidth; + +/** + * Size tab bar buttons to fit + */ +@property (assign) BOOL sizeButtonsToFit; + +/** + * Should use of overflow menu + */ +@property (assign) BOOL useOverflowMenu; + +/** + * Allow background closing of tabs + */ +@property (assign) BOOL allowsBackgroundTabClosing; + +/** + * Allow resizing + */ +@property (assign) BOOL allowsResizing; + +/** + * Select tabs on mouse down event + */ +@property (assign) BOOL selectsTabsOnMouseDown; + +/** + * Automatically animates + */ +@property (assign) BOOL automaticallyAnimates; + +/** + * Assure that active tab is always visible + */ +@property (assign) BOOL alwaysShowActiveTab; + +/** + * Allow or disallow button scrubbing + */ +@property (assign) BOOL allowsScrubbing; + +/** + * Tear off style + */ +@property (assign) MMTabBarTearOffStyle tearOffStyle; + +/** + * Check if tabs should be resized to fit total width + */ +@property (assign) BOOL resizeTabsToFitTotalWidth; + +/** + * Check if receiver supports specified orientation + * + * @param orientation Orientation (@see MMTabBarOrientation) + * + * @return YES or NO + */ - (BOOL)supportsOrientation:(MMTabBarOrientation)orientation; -#pragma mark - -#pragma mark Visibility +#pragma mark Accessors -- (BOOL)isOverflowButtonVisible; +- (CGFloat)heightOfTabBarButtons; -#pragma mark - #pragma mark Resizing - (NSRect)dividerRect; From 39b5010d5b430f2c0113eb3eb2f85e3f50d69e00 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 4 Jun 2015 13:24:04 +0200 Subject: [PATCH 12/21] Some more work on Yosemite Tab Style --- .../MMTabBarView.xcodeproj/project.pbxproj | 94 ++++++++++-------- .../Images/YosemiteTabClose_Front.png | Bin .../Images/YosemiteTabClose_Front@2x.png | Bin .../Images/YosemiteTabClose_Front_Pressed.png | Bin .../YosemiteTabClose_Front_Pressed@2x.png | Bin .../YosemiteTabClose_Front_Rollover.png | Bin .../YosemiteTabClose_Front_Rollover@2x.png | Bin .../Images/YosemiteTabNew.png | Bin .../Images/YosemiteTabNew@2x.png | Bin .../MMYosemiteTabStyle.h | 0 .../MMYosemiteTabStyle.m | 0 11 files changed, 51 insertions(+), 43 deletions(-) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front@2x.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front_Pressed.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front_Pressed@2x.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front_Rollover.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabClose_Front_Rollover@2x.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabNew.png (100%) rename MMTabBarView/MMTabBarView/{ => Styles/Yosemite Tab Style}/Images/YosemiteTabNew@2x.png (100%) rename MMTabBarView/MMTabBarView/Styles/{ => Yosemite Tab Style}/MMYosemiteTabStyle.h (100%) rename MMTabBarView/MMTabBarView/Styles/{ => Yosemite Tab Style}/MMYosemiteTabStyle.m (100%) diff --git a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj index 7e75543a..05c18fa3 100644 --- a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj +++ b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj @@ -162,16 +162,16 @@ 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02361B10AD5500C65A84 /* MMTabBarButton.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */; }; - 06AE02481B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */; }; - 06AE02491B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */; }; - 06AE024A1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */; }; - 06AE024B1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */; }; - 06AE024C1B175E0500C65A84 /* YosemiteTabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */; }; - 06AE024D1B175E0500C65A84 /* YosemiteTabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */; }; - 06AE024E1B175E0500C65A84 /* YosemiteTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */; }; - 06AE024F1B175E0500C65A84 /* YosemiteTabNew@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */; }; - 06AE025B1B17670F00C65A84 /* MMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */; }; - 06AE025C1B17670F00C65A84 /* MMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */; }; + 06AE026C1B202F5800C65A84 /* YosemiteTabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */; }; + 06AE026D1B202F5800C65A84 /* YosemiteTabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */; }; + 06AE026E1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */; }; + 06AE026F1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */; }; + 06AE02701B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */; }; + 06AE02711B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */; }; + 06AE02721B202F5800C65A84 /* YosemiteTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */; }; + 06AE02731B202F5800C65A84 /* YosemiteTabNew@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */; }; + 06AE02741B202F5800C65A84 /* MMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */; }; + 06AE02751B202F5800C65A84 /* MMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */; }; 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAF160B555F00153FA2 /* MMSafariTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */; }; 06DB23AA1609F5830071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23A91609F5830071BDA0 /* Cocoa.framework */; }; @@ -340,16 +340,16 @@ 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButtonCell.Private.h; sourceTree = ""; }; 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarView.Private.h; sourceTree = ""; }; 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Private.h; sourceTree = ""; }; - 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Pressed.png; sourceTree = ""; }; - 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Pressed@2x.png"; sourceTree = ""; }; - 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Rollover.png; sourceTree = ""; }; - 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Rollover@2x.png"; sourceTree = ""; }; - 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front.png; sourceTree = ""; }; - 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front@2x.png"; sourceTree = ""; }; - 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabNew.png; sourceTree = ""; }; - 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabNew@2x.png"; sourceTree = ""; }; - 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMYosemiteTabStyle.h; sourceTree = ""; }; - 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMYosemiteTabStyle.m; sourceTree = ""; }; + 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front.png; sourceTree = ""; }; + 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front@2x.png"; sourceTree = ""; }; + 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Pressed.png; sourceTree = ""; }; + 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Pressed@2x.png"; sourceTree = ""; }; + 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Rollover.png; sourceTree = ""; }; + 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Rollover@2x.png"; sourceTree = ""; }; + 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabNew.png; sourceTree = ""; }; + 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabNew@2x.png"; sourceTree = ""; }; + 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMYosemiteTabStyle.h; sourceTree = ""; }; + 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMYosemiteTabStyle.m; sourceTree = ""; }; 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMSafariTabStyle.h; sourceTree = ""; }; 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMSafariTabStyle.m; sourceTree = ""; }; 06DB23A61609F5830071BDA0 /* MMTabBarView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MMTabBarView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -438,7 +438,7 @@ 0634F0331609FD9000A6C86A /* MMUnifiedTabStyle.h */, 0634F0341609FD9000A6C86A /* MMUnifiedTabStyle.m */, 06B51CB2160B558700153FA2 /* Safari Tab Style */, - 06AE02501B175E2000C65A84 /* Yosemite Tab Style */, + 06AE02601B202F5800C65A84 /* Yosemite Tab Style */, ); path = Styles; sourceTree = ""; @@ -541,14 +541,6 @@ 0634F06D160A0C8A00A6C86A /* TabNewMetal.png */, 0634F06E160A0C8A00A6C86A /* TabNewMetalPressed.png */, 0634F06F160A0C8A00A6C86A /* TabNewMetalRollover.png */, - 06AE02401B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png */, - 06AE02411B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */, - 06AE02421B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png */, - 06AE02431B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */, - 06AE02441B175E0500C65A84 /* YosemiteTabClose_Front.png */, - 06AE02451B175E0500C65A84 /* YosemiteTabClose_Front@2x.png */, - 06AE02461B175E0500C65A84 /* YosemiteTabNew.png */, - 06AE02471B175E0500C65A84 /* YosemiteTabNew@2x.png */, ); name = Images; path = MMTabBarView/Images; @@ -567,13 +559,29 @@ name = Configurations; sourceTree = ""; }; - 06AE02501B175E2000C65A84 /* Yosemite Tab Style */ = { + 06AE02601B202F5800C65A84 /* Yosemite Tab Style */ = { isa = PBXGroup; children = ( - 06AE02591B17670F00C65A84 /* MMYosemiteTabStyle.h */, - 06AE025A1B17670F00C65A84 /* MMYosemiteTabStyle.m */, + 06AE02611B202F5800C65A84 /* Images */, + 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */, + 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */, ); - name = "Yosemite Tab Style"; + path = "Yosemite Tab Style"; + sourceTree = ""; + }; + 06AE02611B202F5800C65A84 /* Images */ = { + isa = PBXGroup; + children = ( + 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */, + 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */, + 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */, + 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */, + 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */, + 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */, + 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */, + 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */, + ); + path = Images; sourceTree = ""; }; 06B51CB2160B558700153FA2 /* Safari Tab Style */ = { @@ -734,7 +742,7 @@ 0634F01A1609FC7F00A6C86A /* MMTabDragAssistant.h in Headers */, 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */, 0634F01C1609FC7F00A6C86A /* MMTabDragView.h in Headers */, - 06AE025B1B17670F00C65A84 /* MMYosemiteTabStyle.h in Headers */, + 06AE02741B202F5800C65A84 /* MMYosemiteTabStyle.h in Headers */, 0634F01E1609FC7F00A6C86A /* MMTabDragWindow.h in Headers */, 0634F0201609FC7F00A6C86A /* MMTabDragWindowController.h in Headers */, 0634F0221609FC7F00A6C86A /* MMTabPasteboardItem.h in Headers */, @@ -821,20 +829,18 @@ 0634F077160A0C8A00A6C86A /* AquaTabCloseDirty_Front.png in Resources */, 0634F078160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Pressed.png in Resources */, 0634F079160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Rollover.png in Resources */, - 06AE024E1B175E0500C65A84 /* YosemiteTabNew.png in Resources */, - 06AE024A1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */, + 06AE02721B202F5800C65A84 /* YosemiteTabNew.png in Resources */, 0634F07A160A0C8A00A6C86A /* AquaTabNew.png in Resources */, 0634F07B160A0C8A00A6C86A /* AquaTabNew@2x.png in Resources */, - 06AE02481B175E0500C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */, 0634F07C160A0C8A00A6C86A /* AquaTabNewPressed.png in Resources */, - 06AE024C1B175E0500C65A84 /* YosemiteTabClose_Front.png in Resources */, 0634F07D160A0C8A00A6C86A /* AquaTabNewPressed@2x.png in Resources */, 0634F07E160A0C8A00A6C86A /* AquaTabNewRollover.png in Resources */, 0634F07F160A0C8A00A6C86A /* AquaTabNewRollover@2x.png in Resources */, + 06AE02711B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */, 0634F080160A0C8A00A6C86A /* AquaTabsBackground.png in Resources */, - 06AE024F1B175E0500C65A84 /* YosemiteTabNew@2x.png in Resources */, 0634F081160A0C8A00A6C86A /* AquaTabsDown.png in Resources */, 0634F082160A0C8A00A6C86A /* AquaTabsDownGraphite.png in Resources */, + 06AE02731B202F5800C65A84 /* YosemiteTabNew@2x.png in Resources */, 0634F083160A0C8A00A6C86A /* AquaTabsDownNonKey.png in Resources */, 0634F084160A0C8A00A6C86A /* AquaTabsSeparator.png in Resources */, 0634F085160A0C8A00A6C86A /* AquaTabsSeparatorDown.png in Resources */, @@ -842,6 +848,7 @@ 0634F087160A0C8A00A6C86A /* overflowImage@2x.png in Resources */, 0634F088160A0C8A00A6C86A /* overflowImagePressed.png in Resources */, 0634F089160A0C8A00A6C86A /* overflowImagePressed@2x.png in Resources */, + 06AE026F1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */, 0634F08A160A0C8A00A6C86A /* pi.png in Resources */, 0634F08B160A0C8A00A6C86A /* TabClose_Dirty.png in Resources */, 0634F08C160A0C8A00A6C86A /* TabClose_Dirty@2x.png in Resources */, @@ -849,7 +856,6 @@ 0634F08E160A0C8A00A6C86A /* TabClose_Dirty_Pressed@2x.png in Resources */, 0634F08F160A0C8A00A6C86A /* TabClose_Dirty_Rollover.png in Resources */, 0634F090160A0C8A00A6C86A /* TabClose_Dirty_Rollover@2x.png in Resources */, - 06AE02491B175E0500C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */, 0634F091160A0C8A00A6C86A /* TabClose_Front.png in Resources */, 0634F092160A0C8A00A6C86A /* TabClose_Front@2x.png in Resources */, 0634F093160A0C8A00A6C86A /* TabClose_Front_Pressed.png in Resources */, @@ -858,8 +864,10 @@ 0634F096160A0C8A00A6C86A /* TabClose_Front_Rollover@2x.png in Resources */, 0634F097160A0C8A00A6C86A /* TabNewMetal.png in Resources */, 0634F098160A0C8A00A6C86A /* TabNewMetalPressed.png in Resources */, + 06AE02701B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */, 0634F099160A0C8A00A6C86A /* TabNewMetalRollover.png in Resources */, 066375F01617493D004A1128 /* SafariAWATClose.png in Resources */, + 06AE026C1B202F5800C65A84 /* YosemiteTabClose_Front.png in Resources */, 066375F11617493D004A1128 /* SafariAWATClose@2x.png in Resources */, 066375F21617493D004A1128 /* SafariAWATClosePressed.png in Resources */, 066375F31617493D004A1128 /* SafariAWATClosePressed@2x.png in Resources */, @@ -881,10 +889,12 @@ 066376031617493D004A1128 /* SafariIWITClose@2x.png in Resources */, 066376041617493D004A1128 /* SafariIWITClosePressed.png in Resources */, 066376051617493D004A1128 /* SafariIWITClosePressed@2x.png in Resources */, + 06AE026D1B202F5800C65A84 /* YosemiteTabClose_Front@2x.png in Resources */, 066376061617493D004A1128 /* SafariIWITCloseRollover.png in Resources */, 066376071617493D004A1128 /* SafariIWITCloseRollover@2x.png in Resources */, 066376081617493D004A1128 /* SafariAWAddTabButton.png in Resources */, 066376091617493D004A1128 /* SafariAWAddTabButtonPushed.png in Resources */, + 06AE026E1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */, 0663760A1617493D004A1128 /* SafariAWAddTabButtonRolloverPlus.png in Resources */, 0663760B1617493D004A1128 /* SafariAWATFill.png in Resources */, 0663760C1617493D004A1128 /* SafariAWATFill@2x.png in Resources */, @@ -900,12 +910,10 @@ 066376161617493D004A1128 /* SafariIWAddTabButton.png in Resources */, 066376171617493D004A1128 /* SafariIWATFill.png in Resources */, 066376181617493D004A1128 /* SafariIWATLeftCap.png in Resources */, - 06AE024D1B175E0500C65A84 /* YosemiteTabClose_Front@2x.png in Resources */, 066376191617493D004A1128 /* SafariIWATLeftCap@2x.png in Resources */, 0663761A1617493D004A1128 /* SafariIWATRightCap.png in Resources */, 0663761B1617493D004A1128 /* SafariIWATRightCap@2x.png in Resources */, 0663761C1617493D004A1128 /* SafariIWBG.png in Resources */, - 06AE024B1B175E0500C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */, 0663761D1617493D004A1128 /* SafariIWITLeftCap.png in Resources */, 0663761E1617493D004A1128 /* SafariIWITLeftCap@2x.png in Resources */, 0663761F1617493D004A1128 /* SafariIWITRightCap.png in Resources */, @@ -924,7 +932,7 @@ 0634EFDC1609FC6300A6C86A /* MMAttachedTabBarButton.m in Sources */, 0634F0041609FC7F00A6C86A /* NSView+MMTabBarViewExtensions.m in Sources */, 0634F0061609FC7F00A6C86A /* MMAttachedTabBarButtonCell.m in Sources */, - 06AE025C1B17670F00C65A84 /* MMYosemiteTabStyle.m in Sources */, + 06AE02751B202F5800C65A84 /* MMYosemiteTabStyle.m in Sources */, 0634F0081609FC7F00A6C86A /* MMOverflowPopUpButton.m in Sources */, 0634F00A1609FC7F00A6C86A /* MMProgressIndicator.m in Sources */, 0634F00C1609FC7F00A6C86A /* MMRolloverButton.m in Sources */, diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front@2x.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front@2x.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front@2x.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Pressed.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Pressed.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Pressed@2x.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Pressed@2x.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Pressed@2x.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Rollover.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Rollover.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Rollover@2x.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabClose_Front_Rollover@2x.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabClose_Front_Rollover@2x.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabNew.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabNew.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew.png diff --git a/MMTabBarView/MMTabBarView/Images/YosemiteTabNew@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew@2x.png similarity index 100% rename from MMTabBarView/MMTabBarView/Images/YosemiteTabNew@2x.png rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew@2x.png diff --git a/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h similarity index 100% rename from MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.h rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h diff --git a/MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m similarity index 100% rename from MMTabBarView/MMTabBarView/Styles/MMYosemiteTabStyle.m rename to MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m From a904a7954b90a6237db804276ccc6228655bf7d1 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 4 Jun 2015 13:24:46 +0200 Subject: [PATCH 13/21] Documentation, clean up and modernization --- .../MMTabBarView/MMOverflowPopUpButton.h | 13 ++++--- .../MMTabBarView/MMProgressIndicator.h | 3 +- .../MMTabBarView/MMRolloverButtonCell.h | 1 + .../MMTabBarView/MMSlideButtonsAnimation.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarItem.h | 36 +++++++++++++++++-- 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h index f6276eb3..47eebc2f 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButton.h @@ -11,13 +11,16 @@ typedef void (^MMCellBezelDrawingBlock)(NSCell *cell, NSRect frame, NSView *controlView); -@interface MMOverflowPopUpButton : NSPopUpButton { -} +@interface MMOverflowPopUpButton : NSPopUpButton +/** + * Second image + */ @property (strong) NSImage *secondImage; -// bezel drawing -- (MMCellBezelDrawingBlock)bezelDrawingBlock; -- (void)setBezelDrawingBlock:(MMCellBezelDrawingBlock)aBlock; +/** + * Block to be used for drawing the bezel + */ +@property (copy) MMCellBezelDrawingBlock bezelDrawingBlock; @end diff --git a/MMTabBarView/MMTabBarView/MMProgressIndicator.h b/MMTabBarView/MMTabBarView/MMProgressIndicator.h index 79fcd0c1..f63e2c54 100644 --- a/MMTabBarView/MMTabBarView/MMProgressIndicator.h +++ b/MMTabBarView/MMTabBarView/MMProgressIndicator.h @@ -8,7 +8,6 @@ #import -@interface MMProgressIndicator : NSProgressIndicator { -} +@interface MMProgressIndicator : NSProgressIndicator @end \ No newline at end of file diff --git a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h index c8d6e0d8..c5374a22 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMRolloverButtonCell.h @@ -21,6 +21,7 @@ typedef NS_ENUM(NSUInteger, MMRolloverButtonType) @property (assign) BOOL simulateClickOnMouseHovered; #pragma mark Tracking Area Support + - (void)addTrackingAreasForView:(NSView *)controlView inRect:(NSRect)cellFrame withUserInfo:(NSDictionary *)userInfo mouseLocation:(NSPoint)mouseLocation; - (void)mouseEntered:(NSEvent *)event; - (void)mouseExited:(NSEvent *)event; diff --git a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h index 47f03dd4..288f7e3f 100644 --- a/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h +++ b/MMTabBarView/MMTabBarView/MMSlideButtonsAnimation.h @@ -10,7 +10,7 @@ @interface MMSlideButtonsAnimation : NSViewAnimation -- (instancetype)initWithTabBarButtons:(NSSet *)buttons; +- (instancetype)initWithTabBarButtons:(NSSet *)buttons NS_DESIGNATED_INITIALIZER; - (void)addAnimationDictionary:(NSDictionary *)aDict; diff --git a/MMTabBarView/MMTabBarView/MMTabBarItem.h b/MMTabBarView/MMTabBarView/MMTabBarItem.h index a1abab3e..502551b9 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarItem.h +++ b/MMTabBarView/MMTabBarView/MMTabBarItem.h @@ -12,14 +12,44 @@ @optional +/** + * Title + */ @property (copy) NSString *title; -@property (retain) NSImage *icon; -@property (retain) NSImage *largeImage; + +/** + * Icon + */ +@property (strong) NSImage *icon; + +/** + * Large image + */ +@property (strong) NSImage *largeImage; + +/** + * Object count to display + */ @property (assign) NSInteger objectCount; -@property (retain) NSColor *objectCountColor; +/** + * Color of object count badge + */ +@property (strong) NSColor *objectCountColor; + +/** + * Processing state + */ @property (assign) BOOL isProcessing; + +/** + * Edited state + */ @property (assign) BOOL isEdited; + +/** + * Returns YES if item has close button + */ @property (assign) BOOL hasCloseButton; @end From d3e4624e3f9415cab36cf3f7a7d524289cdd0a94 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Thu, 4 Jun 2015 13:25:12 +0200 Subject: [PATCH 14/21] Update of DemoWindow.xib --- .../MMTabBarView Demo/en.lproj/DemoWindow.xib | 113 +++++++++--------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib b/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib index e43100d2..ae826f0d 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib +++ b/MMTabBarView Demo/MMTabBarView Demo/en.lproj/DemoWindow.xib @@ -270,23 +270,7 @@ 400 75 - - - Yosemite - - 2147483647 - 1 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - _popUpItemAction: - - + YES @@ -298,8 +282,14 @@ Adium 2147483647 - - + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + _popUpItemAction: @@ -308,8 +298,8 @@ Aqua 2147483647 - - + + _popUpItemAction: @@ -318,8 +308,8 @@ Card 2147483647 - - + + _popUpItemAction: @@ -328,8 +318,8 @@ LiveChat 2147483647 - - + + _popUpItemAction: @@ -338,8 +328,8 @@ Metal 2147483647 - - + + _popUpItemAction: @@ -348,8 +338,8 @@ Safari 2147483647 - - + + _popUpItemAction: @@ -358,15 +348,24 @@ Unified 2147483647 - - + + + _popUpItemAction: + + + + + Yosemite + + 2147483647 + + _popUpItemAction: - - 7 + -1 3 YES YES @@ -589,7 +588,7 @@ Box - + 6 System labelColor @@ -641,7 +640,7 @@ Tab Width - + 3 @@ -791,8 +790,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -809,8 +808,8 @@ 1048576 2147483647 - - + + _popUpItemAction: 1 @@ -919,8 +918,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -937,8 +936,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -967,7 +966,7 @@ Control Options - + 3 @@ -1072,8 +1071,8 @@ 1048576 2147483647 1 - - + + _popUpItemAction: @@ -1089,8 +1088,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1100,8 +1099,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1111,8 +1110,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1122,8 +1121,8 @@ 1048576 2147483647 - - + + _popUpItemAction: @@ -1283,7 +1282,7 @@ Tab-specific Values - + 3 @@ -2050,7 +2049,7 @@ - + @@ -2537,7 +2536,7 @@ 241 - + From f6ce6170370fcd3a75f75d9b9a6a6467d23f2b75 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Sat, 6 Jun 2015 12:04:44 +0200 Subject: [PATCH 15/21] Update of NSHumanReadableCopyright --- .../MMTabBarView Demo/MMTabBarView Demo-Info.plist | 2 +- MMTabBarView/MMTabBarView/MMTabBarView-Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist index b73d4053..392192a9 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist +++ b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist @@ -25,7 +25,7 @@ LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright - Copyright © 2012 Michael Monscheuer. All rights reserved. + Copyright © 2012-2015 Michael Monscheuer. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass diff --git a/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist b/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist index 423f0454..bb1eb1ac 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist +++ b/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist @@ -23,7 +23,7 @@ CFBundleVersion 1 NSHumanReadableCopyright - © 2012-2014 Michael Monscheuer. All rights reserved. + © 2012-2015 Michael Monscheuer. All rights reserved. NSPrincipalClass From 5899e3449fa489f746c06b852e8d148033937ebc Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Tue, 15 Mar 2016 15:26:28 +0100 Subject: [PATCH 16/21] Resolved compiler warning Resolved warning about invalid method parameter (-mouseExited:) --- MMTabBarView/MMTabBarView/MMRolloverButton.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MMTabBarView/MMTabBarView/MMRolloverButton.m b/MMTabBarView/MMTabBarView/MMRolloverButton.m index 168bedcc..00603639 100644 --- a/MMTabBarView/MMTabBarView/MMRolloverButton.m +++ b/MMTabBarView/MMTabBarView/MMRolloverButton.m @@ -87,7 +87,7 @@ -(void)updateTrackingAreas { } // force reset of mouse hovered state if ([self mouseHovered]) - [[self cell] mouseExited:nil]; + [[self cell] mouseExited:[NSApp currentEvent]]; // recreate tracking areas and tool tip rects From 3f60ea976a47ba4679fd824a42c083653a1acd33 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Tue, 15 Mar 2016 15:27:33 +0100 Subject: [PATCH 17/21] Some more work on Yosemite style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …and update of project files --- .../project.pbxproj | 5 +- .../MMTabBarView Demo-Info.plist | 2 +- .../MMTabBarView.xcodeproj/project.pbxproj | 112 ++++----- MMTabBarView/MMTabBarView/MMTabBarView.h | 11 +- .../Yosemite Tab Style/MMYosemiteTabStyle.h | 15 +- .../Yosemite Tab Style/MMYosemiteTabStyle.m | 227 +++++++----------- .../xcschemes/MMTabBarView.xcscheme | 13 +- 7 files changed, 173 insertions(+), 212 deletions(-) diff --git a/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj b/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj index 2cf2943a..06583067 100644 --- a/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj +++ b/MMTabBarView Demo/MMTabBarView Demo.xcodeproj/project.pbxproj @@ -208,7 +208,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = MM; - LastUpgradeCheck = 0630; + LastUpgradeCheck = 0720; ORGANIZATIONNAME = "Michael Monscheuer"; }; buildConfigurationList = 06DB23C31609F5B90071BDA0 /* Build configuration list for PBXProject "MMTabBarView Demo" */; @@ -300,6 +300,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -345,6 +346,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MMTabBarView Demo/MMTabBarView Demo-Prefix.pch"; INFOPLIST_FILE = "MMTabBarView Demo/MMTabBarView Demo-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "de.monscheuer.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -359,6 +361,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MMTabBarView Demo/MMTabBarView Demo-Prefix.pch"; INFOPLIST_FILE = "MMTabBarView Demo/MMTabBarView Demo-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "de.monscheuer.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist index 392192a9..61ff5ac3 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist +++ b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - de.monscheuer.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj index 05c18fa3..273bfd64 100644 --- a/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj +++ b/MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj @@ -162,18 +162,18 @@ 06AE02321B10A50200C65A84 /* MMTabBarButtonCell.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06AE02361B10AD5500C65A84 /* MMTabBarButton.Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */; }; - 06AE026C1B202F5800C65A84 /* YosemiteTabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */; }; - 06AE026D1B202F5800C65A84 /* YosemiteTabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */; }; - 06AE026E1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */; }; - 06AE026F1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */; }; - 06AE02701B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */; }; - 06AE02711B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */; }; - 06AE02721B202F5800C65A84 /* YosemiteTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */; }; - 06AE02731B202F5800C65A84 /* YosemiteTabNew@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */; }; - 06AE02741B202F5800C65A84 /* MMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */; }; - 06AE02751B202F5800C65A84 /* MMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */; }; 06B51CAE160B555F00153FA2 /* MMSafariTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 06B51CAF160B555F00153FA2 /* MMSafariTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */; }; + 06C9569F1C984932000AAF9D /* MMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 06C9569D1C984932000AAF9D /* MMYosemiteTabStyle.h */; }; + 06C956A01C984932000AAF9D /* MMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 06C9569E1C984932000AAF9D /* MMYosemiteTabStyle.m */; }; + 06C956BA1C984E85000AAF9D /* YosemiteTabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B21C984E85000AAF9D /* YosemiteTabClose_Front_Pressed.png */; }; + 06C956BB1C984E85000AAF9D /* YosemiteTabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B31C984E85000AAF9D /* YosemiteTabClose_Front_Pressed@2x.png */; }; + 06C956BC1C984E85000AAF9D /* YosemiteTabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B41C984E85000AAF9D /* YosemiteTabClose_Front_Rollover.png */; }; + 06C956BD1C984E85000AAF9D /* YosemiteTabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B51C984E85000AAF9D /* YosemiteTabClose_Front_Rollover@2x.png */; }; + 06C956BE1C984E85000AAF9D /* YosemiteTabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B61C984E85000AAF9D /* YosemiteTabClose_Front.png */; }; + 06C956BF1C984E85000AAF9D /* YosemiteTabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B71C984E85000AAF9D /* YosemiteTabClose_Front@2x.png */; }; + 06C956C01C984E85000AAF9D /* YosemiteTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B81C984E85000AAF9D /* YosemiteTabNew.png */; }; + 06C956C11C984E85000AAF9D /* YosemiteTabNew@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 06C956B91C984E85000AAF9D /* YosemiteTabNew@2x.png */; }; 06DB23AA1609F5830071BDA0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB23A91609F5830071BDA0 /* Cocoa.framework */; }; 06DB23B41609F5830071BDA0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 06DB23B21609F5830071BDA0 /* InfoPlist.strings */; }; 06DB23B81609F5830071BDA0 /* MMTabBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 06DB23B71609F5830071BDA0 /* MMTabBarView.m */; }; @@ -340,18 +340,18 @@ 06AE02311B10A50200C65A84 /* MMTabBarButtonCell.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButtonCell.Private.h; sourceTree = ""; }; 06AE02331B10A6F500C65A84 /* MMTabBarView.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarView.Private.h; sourceTree = ""; }; 06AE02351B10AD5500C65A84 /* MMTabBarButton.Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTabBarButton.Private.h; sourceTree = ""; }; - 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front.png; sourceTree = ""; }; - 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front@2x.png"; sourceTree = ""; }; - 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Pressed.png; sourceTree = ""; }; - 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Pressed@2x.png"; sourceTree = ""; }; - 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Rollover.png; sourceTree = ""; }; - 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Rollover@2x.png"; sourceTree = ""; }; - 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabNew.png; sourceTree = ""; }; - 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabNew@2x.png"; sourceTree = ""; }; - 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMYosemiteTabStyle.h; sourceTree = ""; }; - 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMYosemiteTabStyle.m; sourceTree = ""; }; 06B51CAC160B555F00153FA2 /* MMSafariTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMSafariTabStyle.h; sourceTree = ""; }; 06B51CAD160B555F00153FA2 /* MMSafariTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMSafariTabStyle.m; sourceTree = ""; }; + 06C9569D1C984932000AAF9D /* MMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMYosemiteTabStyle.h; sourceTree = ""; }; + 06C9569E1C984932000AAF9D /* MMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMYosemiteTabStyle.m; sourceTree = ""; }; + 06C956B21C984E85000AAF9D /* YosemiteTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Pressed.png; sourceTree = ""; }; + 06C956B31C984E85000AAF9D /* YosemiteTabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Pressed@2x.png"; sourceTree = ""; }; + 06C956B41C984E85000AAF9D /* YosemiteTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front_Rollover.png; sourceTree = ""; }; + 06C956B51C984E85000AAF9D /* YosemiteTabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front_Rollover@2x.png"; sourceTree = ""; }; + 06C956B61C984E85000AAF9D /* YosemiteTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabClose_Front.png; sourceTree = ""; }; + 06C956B71C984E85000AAF9D /* YosemiteTabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabClose_Front@2x.png"; sourceTree = ""; }; + 06C956B81C984E85000AAF9D /* YosemiteTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = YosemiteTabNew.png; sourceTree = ""; }; + 06C956B91C984E85000AAF9D /* YosemiteTabNew@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "YosemiteTabNew@2x.png"; sourceTree = ""; }; 06DB23A61609F5830071BDA0 /* MMTabBarView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MMTabBarView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 06DB23A91609F5830071BDA0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 06DB23AC1609F5830071BDA0 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; @@ -438,7 +438,7 @@ 0634F0331609FD9000A6C86A /* MMUnifiedTabStyle.h */, 0634F0341609FD9000A6C86A /* MMUnifiedTabStyle.m */, 06B51CB2160B558700153FA2 /* Safari Tab Style */, - 06AE02601B202F5800C65A84 /* Yosemite Tab Style */, + 06C9569C1C984912000AAF9D /* Yosemite Tab Style */, ); path = Styles; sourceTree = ""; @@ -559,31 +559,6 @@ name = Configurations; sourceTree = ""; }; - 06AE02601B202F5800C65A84 /* Yosemite Tab Style */ = { - isa = PBXGroup; - children = ( - 06AE02611B202F5800C65A84 /* Images */, - 06AE026A1B202F5800C65A84 /* MMYosemiteTabStyle.h */, - 06AE026B1B202F5800C65A84 /* MMYosemiteTabStyle.m */, - ); - path = "Yosemite Tab Style"; - sourceTree = ""; - }; - 06AE02611B202F5800C65A84 /* Images */ = { - isa = PBXGroup; - children = ( - 06AE02621B202F5800C65A84 /* YosemiteTabClose_Front.png */, - 06AE02631B202F5800C65A84 /* YosemiteTabClose_Front@2x.png */, - 06AE02641B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png */, - 06AE02651B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png */, - 06AE02661B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png */, - 06AE02671B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png */, - 06AE02681B202F5800C65A84 /* YosemiteTabNew.png */, - 06AE02691B202F5800C65A84 /* YosemiteTabNew@2x.png */, - ); - path = Images; - sourceTree = ""; - }; 06B51CB2160B558700153FA2 /* Safari Tab Style */ = { isa = PBXGroup; children = ( @@ -650,6 +625,31 @@ path = Images; sourceTree = ""; }; + 06C9569C1C984912000AAF9D /* Yosemite Tab Style */ = { + isa = PBXGroup; + children = ( + 06C956A11C98493F000AAF9D /* Images */, + 06C9569D1C984932000AAF9D /* MMYosemiteTabStyle.h */, + 06C9569E1C984932000AAF9D /* MMYosemiteTabStyle.m */, + ); + path = "Yosemite Tab Style"; + sourceTree = ""; + }; + 06C956A11C98493F000AAF9D /* Images */ = { + isa = PBXGroup; + children = ( + 06C956B21C984E85000AAF9D /* YosemiteTabClose_Front_Pressed.png */, + 06C956B31C984E85000AAF9D /* YosemiteTabClose_Front_Pressed@2x.png */, + 06C956B41C984E85000AAF9D /* YosemiteTabClose_Front_Rollover.png */, + 06C956B51C984E85000AAF9D /* YosemiteTabClose_Front_Rollover@2x.png */, + 06C956B61C984E85000AAF9D /* YosemiteTabClose_Front.png */, + 06C956B71C984E85000AAF9D /* YosemiteTabClose_Front@2x.png */, + 06C956B81C984E85000AAF9D /* YosemiteTabNew.png */, + 06C956B91C984E85000AAF9D /* YosemiteTabNew@2x.png */, + ); + path = Images; + sourceTree = ""; + }; 06DB239A1609F5820071BDA0 = { isa = PBXGroup; children = ( @@ -742,7 +742,7 @@ 0634F01A1609FC7F00A6C86A /* MMTabDragAssistant.h in Headers */, 06AE02341B10A6F500C65A84 /* MMTabBarView.Private.h in Headers */, 0634F01C1609FC7F00A6C86A /* MMTabDragView.h in Headers */, - 06AE02741B202F5800C65A84 /* MMYosemiteTabStyle.h in Headers */, + 06C9569F1C984932000AAF9D /* MMYosemiteTabStyle.h in Headers */, 0634F01E1609FC7F00A6C86A /* MMTabDragWindow.h in Headers */, 0634F0201609FC7F00A6C86A /* MMTabDragWindowController.h in Headers */, 0634F0221609FC7F00A6C86A /* MMTabPasteboardItem.h in Headers */, @@ -829,18 +829,20 @@ 0634F077160A0C8A00A6C86A /* AquaTabCloseDirty_Front.png in Resources */, 0634F078160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Pressed.png in Resources */, 0634F079160A0C8A00A6C86A /* AquaTabCloseDirty_Front_Rollover.png in Resources */, - 06AE02721B202F5800C65A84 /* YosemiteTabNew.png in Resources */, + 06C956C01C984E85000AAF9D /* YosemiteTabNew.png in Resources */, + 06C956BC1C984E85000AAF9D /* YosemiteTabClose_Front_Rollover.png in Resources */, 0634F07A160A0C8A00A6C86A /* AquaTabNew.png in Resources */, 0634F07B160A0C8A00A6C86A /* AquaTabNew@2x.png in Resources */, + 06C956BA1C984E85000AAF9D /* YosemiteTabClose_Front_Pressed.png in Resources */, 0634F07C160A0C8A00A6C86A /* AquaTabNewPressed.png in Resources */, + 06C956BE1C984E85000AAF9D /* YosemiteTabClose_Front.png in Resources */, 0634F07D160A0C8A00A6C86A /* AquaTabNewPressed@2x.png in Resources */, 0634F07E160A0C8A00A6C86A /* AquaTabNewRollover.png in Resources */, 0634F07F160A0C8A00A6C86A /* AquaTabNewRollover@2x.png in Resources */, - 06AE02711B202F5800C65A84 /* YosemiteTabClose_Front_Rollover@2x.png in Resources */, 0634F080160A0C8A00A6C86A /* AquaTabsBackground.png in Resources */, + 06C956C11C984E85000AAF9D /* YosemiteTabNew@2x.png in Resources */, 0634F081160A0C8A00A6C86A /* AquaTabsDown.png in Resources */, 0634F082160A0C8A00A6C86A /* AquaTabsDownGraphite.png in Resources */, - 06AE02731B202F5800C65A84 /* YosemiteTabNew@2x.png in Resources */, 0634F083160A0C8A00A6C86A /* AquaTabsDownNonKey.png in Resources */, 0634F084160A0C8A00A6C86A /* AquaTabsSeparator.png in Resources */, 0634F085160A0C8A00A6C86A /* AquaTabsSeparatorDown.png in Resources */, @@ -848,7 +850,6 @@ 0634F087160A0C8A00A6C86A /* overflowImage@2x.png in Resources */, 0634F088160A0C8A00A6C86A /* overflowImagePressed.png in Resources */, 0634F089160A0C8A00A6C86A /* overflowImagePressed@2x.png in Resources */, - 06AE026F1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed@2x.png in Resources */, 0634F08A160A0C8A00A6C86A /* pi.png in Resources */, 0634F08B160A0C8A00A6C86A /* TabClose_Dirty.png in Resources */, 0634F08C160A0C8A00A6C86A /* TabClose_Dirty@2x.png in Resources */, @@ -856,6 +857,7 @@ 0634F08E160A0C8A00A6C86A /* TabClose_Dirty_Pressed@2x.png in Resources */, 0634F08F160A0C8A00A6C86A /* TabClose_Dirty_Rollover.png in Resources */, 0634F090160A0C8A00A6C86A /* TabClose_Dirty_Rollover@2x.png in Resources */, + 06C956BB1C984E85000AAF9D /* YosemiteTabClose_Front_Pressed@2x.png in Resources */, 0634F091160A0C8A00A6C86A /* TabClose_Front.png in Resources */, 0634F092160A0C8A00A6C86A /* TabClose_Front@2x.png in Resources */, 0634F093160A0C8A00A6C86A /* TabClose_Front_Pressed.png in Resources */, @@ -864,10 +866,8 @@ 0634F096160A0C8A00A6C86A /* TabClose_Front_Rollover@2x.png in Resources */, 0634F097160A0C8A00A6C86A /* TabNewMetal.png in Resources */, 0634F098160A0C8A00A6C86A /* TabNewMetalPressed.png in Resources */, - 06AE02701B202F5800C65A84 /* YosemiteTabClose_Front_Rollover.png in Resources */, 0634F099160A0C8A00A6C86A /* TabNewMetalRollover.png in Resources */, 066375F01617493D004A1128 /* SafariAWATClose.png in Resources */, - 06AE026C1B202F5800C65A84 /* YosemiteTabClose_Front.png in Resources */, 066375F11617493D004A1128 /* SafariAWATClose@2x.png in Resources */, 066375F21617493D004A1128 /* SafariAWATClosePressed.png in Resources */, 066375F31617493D004A1128 /* SafariAWATClosePressed@2x.png in Resources */, @@ -889,12 +889,10 @@ 066376031617493D004A1128 /* SafariIWITClose@2x.png in Resources */, 066376041617493D004A1128 /* SafariIWITClosePressed.png in Resources */, 066376051617493D004A1128 /* SafariIWITClosePressed@2x.png in Resources */, - 06AE026D1B202F5800C65A84 /* YosemiteTabClose_Front@2x.png in Resources */, 066376061617493D004A1128 /* SafariIWITCloseRollover.png in Resources */, 066376071617493D004A1128 /* SafariIWITCloseRollover@2x.png in Resources */, 066376081617493D004A1128 /* SafariAWAddTabButton.png in Resources */, 066376091617493D004A1128 /* SafariAWAddTabButtonPushed.png in Resources */, - 06AE026E1B202F5800C65A84 /* YosemiteTabClose_Front_Pressed.png in Resources */, 0663760A1617493D004A1128 /* SafariAWAddTabButtonRolloverPlus.png in Resources */, 0663760B1617493D004A1128 /* SafariAWATFill.png in Resources */, 0663760C1617493D004A1128 /* SafariAWATFill@2x.png in Resources */, @@ -910,10 +908,12 @@ 066376161617493D004A1128 /* SafariIWAddTabButton.png in Resources */, 066376171617493D004A1128 /* SafariIWATFill.png in Resources */, 066376181617493D004A1128 /* SafariIWATLeftCap.png in Resources */, + 06C956BF1C984E85000AAF9D /* YosemiteTabClose_Front@2x.png in Resources */, 066376191617493D004A1128 /* SafariIWATLeftCap@2x.png in Resources */, 0663761A1617493D004A1128 /* SafariIWATRightCap.png in Resources */, 0663761B1617493D004A1128 /* SafariIWATRightCap@2x.png in Resources */, 0663761C1617493D004A1128 /* SafariIWBG.png in Resources */, + 06C956BD1C984E85000AAF9D /* YosemiteTabClose_Front_Rollover@2x.png in Resources */, 0663761D1617493D004A1128 /* SafariIWITLeftCap.png in Resources */, 0663761E1617493D004A1128 /* SafariIWITLeftCap@2x.png in Resources */, 0663761F1617493D004A1128 /* SafariIWITRightCap.png in Resources */, @@ -932,7 +932,7 @@ 0634EFDC1609FC6300A6C86A /* MMAttachedTabBarButton.m in Sources */, 0634F0041609FC7F00A6C86A /* NSView+MMTabBarViewExtensions.m in Sources */, 0634F0061609FC7F00A6C86A /* MMAttachedTabBarButtonCell.m in Sources */, - 06AE02751B202F5800C65A84 /* MMYosemiteTabStyle.m in Sources */, + 06C956A01C984932000AAF9D /* MMYosemiteTabStyle.m in Sources */, 0634F0081609FC7F00A6C86A /* MMOverflowPopUpButton.m in Sources */, 0634F00A1609FC7F00A6C86A /* MMProgressIndicator.m in Sources */, 0634F00C1609FC7F00A6C86A /* MMRolloverButton.m in Sources */, diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.h b/MMTabBarView/MMTabBarView/MMTabBarView.h index 596eced2..2b951e89 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.h @@ -38,6 +38,15 @@ static NSImage* _static##name##Image() \ return image; \ } +#define StaticImageWithFilename(name, filename) \ +static NSImage* _static##name##Image() \ +{ \ + static NSImage* image = nil; \ + if (!image) \ + image = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@#filename]]; \ + return image; \ +} + @class MMRolloverButton; @class MMTabBarViewler; @class MMTabBarButton; @@ -642,7 +651,7 @@ MMAttachedButtonsEnumerationUpdateButtonState = 1 << 2 @optional - // Standard NSTabView delegate methods + // Additional NSTabView delegate methods - (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem; - (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem; - (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem; diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h index f1f58790..f19eadc0 100755 --- a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h @@ -10,19 +10,8 @@ #import #import "MMTabStyle.h" -@interface MMYosemiteTabStyle : NSObject { - - NSImage *YosemiteCloseButton; - NSImage *YosemiteCloseButtonDown; - NSImage *YosemiteCloseButtonOver; - NSImage *YosemiteCloseDirtyButton; - NSImage *YosemiteCloseDirtyButtonDown; - NSImage *YosemiteCloseDirtyButtonOver; - NSImage *TabNewYosemite; - - CGFloat _leftMargin; -} +@interface MMYosemiteTabStyle : NSObject @property (assign) CGFloat leftMarginForTabBarView; -@end \ No newline at end of file +@end diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m index 8723f216..106b626b 100755 --- a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m @@ -22,45 +22,32 @@ - (NSRect)_overflowButtonRect; @end @implementation MMYosemiteTabStyle -@synthesize leftMarginForTabBarView = _leftMargin; + +StaticImage(YosemiteTabClose_Front) +StaticImage(YosemiteTabClose_Front_Pressed) +StaticImage(YosemiteTabClose_Front_Rollover) +StaticImageWithFilename(YosemiteTabCloseDirty_Front, AquaTabCloseDirty_Front) +StaticImageWithFilename(YosemiteTabCloseDirty_Front_Pressed, AquaTabCloseDirty_Front_Pressed) +StaticImageWithFilename(YosemiteTabCloseDirty_Front_Rollover, AquaTabCloseDirty_Front_Rollover) +StaticImage(YosemiteTabNew) + (NSString *)name { return @"Yosemite"; } - (NSString *)name { - return [[self class] name]; + return [[self class] name]; } #pragma mark - #pragma mark Creation/Destruction - (id) init { - if ((self = [super init])) { - YosemiteCloseButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front"]]; - YosemiteCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front_Pressed"]]; - YosemiteCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabClose_Front_Rollover"]]; - - YosemiteCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]]; - YosemiteCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]]; - YosemiteCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]]; - - TabNewYosemite = [[NSImage alloc] initByReferencingFile:[[MMTabBarView bundle] pathForImageResource:@"YosemiteTabNew"]]; - - _leftMargin = -1.0f; - } + if ((self = [super init])) { + _leftMarginForTabBarView = -1.0f; + } - return self; -} - -- (void)dealloc { - YosemiteCloseButton = nil; - YosemiteCloseButtonDown = nil; - YosemiteCloseButtonOver = nil; - YosemiteCloseDirtyButton = nil; - YosemiteCloseDirtyButtonDown = nil; - YosemiteCloseDirtyButtonOver = nil; - TabNewYosemite = nil; + return self; } #pragma mark - @@ -83,7 +70,7 @@ - (CGFloat)rightMarginForTabBarView:(MMTabBarView *)tabBarView { - (CGFloat)topMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) return 0.0f; - + return 0.0f; } @@ -117,14 +104,14 @@ - (NSSize)addTabButtonSizeForTabBarView:(MMTabBarView *)tabBarView { //- (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView { // NSRect rect = [tabBarView _overflowButtonRect]; -// +// // //rect.origin.y += [tabBarView topMargin]; // //rect.size.width = 60; // return rect; //} - (BOOL)supportsOrientation:(MMTabBarOrientation)orientation forTabBarView:(MMTabBarView *)tabBarView { - + if (orientation != MMTabBarHorizontalOrientation) return NO; @@ -135,10 +122,10 @@ - (BOOL)supportsOrientation:(MMTabBarOrientation)orientation forTabBarView:(MMTa #pragma mark Drag Support - (NSRect)draggingRectForTabButton:(MMAttachedTabBarButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView { - - NSRect dragRect = [aButton stackingFrame]; - dragRect.size.width++; - return dragRect; + + NSRect dragRect = [aButton stackingFrame]; + dragRect.size.width++; + return dragRect; } @@ -147,9 +134,9 @@ - (NSRect)draggingRectForTabButton:(MMAttachedTabBarButton *)aButton ofTabBarVie - (void)updateAddButton:(MMRolloverButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView { - [aButton setImage:TabNewYosemite]; - [aButton setAlternateImage:TabNewYosemite]; - [aButton setRolloverImage:TabNewYosemite]; + [aButton setImage:_staticYosemiteTabNewImage()]; + [aButton setAlternateImage:_staticYosemiteTabNewImage()]; + [aButton setRolloverImage:_staticYosemiteTabNewImage()]; } #pragma mark - @@ -159,19 +146,18 @@ - (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type forTabCell:(MMT { switch (type) { case MMCloseButtonImageTypeStandard: - return YosemiteCloseButton; + return _staticYosemiteTabClose_FrontImage(); case MMCloseButtonImageTypeRollover: - return YosemiteCloseButtonOver; + return _staticYosemiteTabClose_Front_RolloverImage(); case MMCloseButtonImageTypePressed: - return YosemiteCloseButtonDown; + return _staticYosemiteTabClose_Front_PressedImage(); case MMCloseButtonImageTypeDirty: - return YosemiteCloseDirtyButton; + return _staticYosemiteTabCloseDirty_FrontImage(); case MMCloseButtonImageTypeDirtyRollover: - return YosemiteCloseDirtyButtonOver; + return _staticYosemiteTabCloseDirty_Front_RolloverImage(); case MMCloseButtonImageTypeDirtyPressed: - return YosemiteCloseDirtyButtonDown; - + return _staticYosemiteTabCloseDirty_Front_PressedImage(); default: break; @@ -183,20 +169,21 @@ - (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type forTabCell:(MMT #pragma mark Drawing - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { - //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area - rect = [tabBarView bounds]; -// tabBarView.resizeTabsToFitTotalWidth= YES; - - NSRect gradientRect = rect; - - if ([tabBarView isWindowActive]) - { + //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area + rect = [tabBarView bounds]; + tabBarView.resizeTabsToFitTotalWidth= YES; + + NSRect gradientRect = rect; + + if (![tabBarView isWindowActive]) { + [[NSColor windowBackgroundColor] set]; + } else { NSColor *startColor = [NSColor colorWithDeviceWhite:0.8 alpha:1.000]; NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:startColor endingColor:startColor]; [gradient drawInRect:gradientRect angle:90.0]; } - - [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set]; + + [[NSColor colorWithCalibratedRed:0.642 green:0.633 blue:0.642 alpha:1.000] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(rect), NSMinY(rect) + 0.5) toPoint:NSMakePoint(NSMaxX(rect), NSMinY(rect) + 0.5)]; @@ -204,17 +191,18 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { toPoint:NSMakePoint(NSMaxX(rect), NSMaxY(rect) - 0.5)]; } +/* - (void)drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)index inButtons:(NSArray *)buttons indexOfSelectedButton:(NSUInteger)selIndex tabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { - -// NSWindow *window = [tabBarView window]; -// NSToolbar *toolbar = [window toolbar]; + + NSWindow *window = [tabBarView window]; + NSToolbar *toolbar = [window toolbar]; // if (toolbar && [toolbar isVisible]) -// return; - + return; + NSRect aRect = [button frame]; - NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; + NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; - // draw dividers + // draw dividers BOOL shouldDisplayRightDivider = [button shouldDisplayRightDivider]; if ([button tabState] & MMTab_RightIsSelectedMask) { if (([button tabState] & (MMTab_PlaceholderOnRight | MMTab_RightIsSliding)) == 0) @@ -222,24 +210,24 @@ - (void)drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)i } if (shouldDisplayRightDivider) { - [lineColor set]; + [lineColor set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; - + [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) - toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; - + toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; + } - + if ([button shouldDisplayLeftDivider]) { - [lineColor set]; + [lineColor set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMinY(aRect)) toPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMaxY(aRect))]; - + [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; - } + } } - +*/ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView { MMTabBarView *tabBarView = [controlView enclosingTabBarView]; @@ -250,9 +238,9 @@ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inV BOOL overflowMode = [button isOverflowButton]; if ([button isSliding]) overflowMode = NO; - + // if (toolbar && [toolbar isVisible]) { -// + NSRect aRect = NSZeroRect; if (overflowMode) { aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width +1, frame.size.height); @@ -268,16 +256,16 @@ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inV } else { [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeAllCaps|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; } - -// } else { -// + +// } else { +// // NSRect aRect = NSZeroRect; // if (overflowMode) { // aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); // } else { // aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); // } -// +// // if (overflowMode) { // [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeLeftCap usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; // } else { @@ -287,18 +275,18 @@ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inV } -(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { - + MMAttachedTabBarButton *lastAttachedButton = [tabBarView lastAttachedButton]; if ([lastAttachedButton isSliding]) return; -// NSWindow *window = [tabBarView window]; -// NSToolbar *toolbar = [window toolbar]; + NSWindow *window = [tabBarView window]; + NSToolbar *toolbar = [window toolbar]; NSRect frame = [overflowButton frame]; -// if (toolbar && [toolbar isVisible]) { -// + if (toolbar && [toolbar isVisible]) { + NSRect aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); aRect.size.width += 5.0; aRect.origin.y += 1; @@ -306,66 +294,36 @@ -(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBa [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeRightCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:lastAttachedButton ofTabBarView:tabBarView]; -// } else { -// NSRect aRect = NSMakeRect(frame.origin.x, frame.origin.y+0.5, frame.size.width-0.5f, frame.size.height-1.0); -// aRect.size.width += 5.0; -// -// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeRightCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:lastAttachedButton ofTabBarView:tabBarView]; -// -// if ([tabBarView showAddTabButton]) { -// -// NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; -// [lineColor set]; -// [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; -// -// [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; -// [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; -// } -// } -} - -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:YosemiteCloseButton forKey:@"YosemiteCloseButton"]; - [aCoder encodeObject:YosemiteCloseButtonDown forKey:@"YosemiteCloseButtonDown"]; - [aCoder encodeObject:YosemiteCloseButtonOver forKey:@"YosemiteCloseButtonOver"]; - [aCoder encodeObject:YosemiteCloseDirtyButton forKey:@"YosemiteCloseDirtyButton"]; - [aCoder encodeObject:YosemiteCloseDirtyButtonDown forKey:@"YosemiteCloseDirtyButtonDown"]; - [aCoder encodeObject:YosemiteCloseDirtyButtonOver forKey:@"YosemiteCloseDirtyButtonOver"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - // self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - YosemiteCloseButton = [aDecoder decodeObjectForKey:@"YosemiteCloseButton"]; - YosemiteCloseButtonDown = [aDecoder decodeObjectForKey:@"YosemiteCloseButtonDown"]; - YosemiteCloseButtonOver = [aDecoder decodeObjectForKey:@"YosemiteCloseButtonOver"]; - YosemiteCloseDirtyButton = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButton"]; - YosemiteCloseDirtyButtonDown = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButtonDown"]; - YosemiteCloseDirtyButtonOver = [aDecoder decodeObjectForKey:@"YosemiteCloseDirtyButtonOver"]; + } else { + NSRect aRect = NSMakeRect(frame.origin.x, frame.origin.y+0.5, frame.size.width-0.5f, frame.size.height-1.0); + aRect.size.width += 5.0; + + [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeRightCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:lastAttachedButton ofTabBarView:tabBarView]; + + if ([tabBarView showAddTabButton]) { + + NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; + [lineColor set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; + + [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; + [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; + } } - //} - return self; } #pragma mark - #pragma mark Private Methods - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView { - + NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; CGFloat radius = 0.0f; - + //capMask &= ~MMBezierShapeFillPath; - + NSBezierPath *fillPath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask|MMBezierShapeFillPath]; - + if ([tabBarView isWindowActive]) { if ([button state] == NSOnState) { NSColor *startColor = [NSColor colorWithDeviceWhite:0.875 alpha:1.000]; @@ -389,7 +347,7 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap [gradient drawInBezierPath:fillPath angle:90.0]; [[NSGraphicsContext currentContext] setShouldAntialias:YES]; } - } + } //NSBezierPath *strokePath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask]; //[strokePath stroke]; @@ -410,18 +368,17 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap } - (void)_drawBoxBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView { - + capMask &= ~MMBezierShapeFillPath; - // fill + // fill if ([button state] == NSOnState) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); - } else - if ([button mouseHovered]) { + } else if ([button mouseHovered]) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); } } -@end \ No newline at end of file +@end diff --git a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView.xcscheme b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView.xcscheme index 97941684..c9a00445 100644 --- a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView.xcscheme +++ b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> + + Date: Tue, 15 Mar 2016 15:31:59 +0100 Subject: [PATCH 18/21] Update of Copyright dates --- MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.h | 2 +- MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m | 2 +- .../MMTabBarView Demo/MMTabBarView Demo-Info.plist | 2 +- MMTabBarView Demo/MMTabBarView Demo/main.m | 2 +- .../MMTabBarView/MMOverflowPopUpButtonCell.h | 2 +- .../MMTabBarView/MMOverflowPopUpButtonCell.m | 2 +- MMTabBarView/MMTabBarView/MMTabBarButton.Common.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarButton.Private.h | 2 +- .../MMTabBarView/MMTabBarButtonCell.Private.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarItem.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarView-Info.plist | 2 +- MMTabBarView/MMTabBarView/MMTabBarView.Private.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarView.h | 2 +- MMTabBarView/MMTabBarView/MMTabBarView.m | 2 +- .../NSAffineTransform+MMTabBarViewExtensions.h | 2 +- .../NSAffineTransform+MMTabBarViewExtensions.m | 2 +- .../NSBezierPath+MMTabBarViewExtensions.h | 2 +- .../NSBezierPath+MMTabBarViewExtensions.m | 2 +- .../MMTabBarView/NSCell+MMTabBarViewExtensions.h | 2 +- .../MMTabBarView/NSCell+MMTabBarViewExtensions.m | 2 +- .../MMTabBarView/NSString+MMTabBarViewExtensions.h | 2 +- .../MMTabBarView/NSString+MMTabBarViewExtensions.m | 2 +- .../NSTabViewItem+MMTabBarViewExtensions.h | 2 +- .../NSTabViewItem+MMTabBarViewExtensions.m | 2 +- .../xcschemes/MMTabBarView Demo.xcscheme | 13 ++++++++----- 25 files changed, 32 insertions(+), 29 deletions(-) diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.h b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.h index 6b263f7c..f5648c86 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.h +++ b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.h @@ -3,7 +3,7 @@ // MMTabBarView Demo // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m index 35d0962e..2451af2d 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m +++ b/MMTabBarView Demo/MMTabBarView Demo/MMAppDelegate.m @@ -3,7 +3,7 @@ // MMTabBarView Demo // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "MMAppDelegate.h" diff --git a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist index 61ff5ac3..8567382a 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist +++ b/MMTabBarView Demo/MMTabBarView Demo/MMTabBarView Demo-Info.plist @@ -25,7 +25,7 @@ LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright - Copyright © 2012-2015 Michael Monscheuer. All rights reserved. + Copyright © 2012-2016 Michael Monscheuer. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass diff --git a/MMTabBarView Demo/MMTabBarView Demo/main.m b/MMTabBarView Demo/MMTabBarView Demo/main.m index afdd7b34..58a558a9 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/main.m +++ b/MMTabBarView Demo/MMTabBarView Demo/main.m @@ -3,7 +3,7 @@ // MMTabBarView Demo // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h index 82778ef4..c396cd9a 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/24/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m index bc652da0..b2664fa1 100644 --- a/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMOverflowPopUpButtonCell.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/24/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "MMOverflowPopUpButtonCell.h" diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h index 29720a39..112c9987 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.Common.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 23/05/15. -// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // typedef NS_ENUM(NSUInteger, MMCloseButtonImageType) diff --git a/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h b/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h index 0b3210d5..728694ed 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButton.Private.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 23/05/15. -// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // @interface MMTabBarButton(PrivateDrawing) diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h index 939277f1..e5e80443 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.Private.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 23/05/15. -// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // @interface MMTabBarButtonCell (PrivateDrawing) diff --git a/MMTabBarView/MMTabBarView/MMTabBarItem.h b/MMTabBarView/MMTabBarView/MMTabBarItem.h index 502551b9..d0c430aa 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarItem.h +++ b/MMTabBarView/MMTabBarView/MMTabBarItem.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/29/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist b/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist index bb1eb1ac..43670037 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist +++ b/MMTabBarView/MMTabBarView/MMTabBarView-Info.plist @@ -23,7 +23,7 @@ CFBundleVersion 1 NSHumanReadableCopyright - © 2012-2015 Michael Monscheuer. All rights reserved. + © 2012-2016 Michael Monscheuer. All rights reserved. NSPrincipalClass diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h index adb8da18..e9d36848 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.Private.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.Private.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 23/05/15. -// Copyright (c) 2015 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // @interface MMTabBarView (PrivateDrawing) diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.h b/MMTabBarView/MMTabBarView/MMTabBarView.h index 2b951e89..a9941949 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.h +++ b/MMTabBarView/MMTabBarView/MMTabBarView.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // /* diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index 50a5f42a..d1e2e43d 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // diff --git a/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.h index b02c31eb..6773db8d 100644 --- a/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/26/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.m index f1a21918..f8b8da4b 100644 --- a/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSAffineTransform+MMTabBarViewExtensions.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/26/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "NSAffineTransform+MMTabBarViewExtensions.h" diff --git a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h index 4c590135..cdff4612 100644 --- a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/26/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.m index a495ae83..f7c930ec 100644 --- a/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSBezierPath+MMTabBarViewExtensions.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/26/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "NSBezierPath+MMTabBarViewExtensions.h" diff --git a/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.h index 74c320be..351fafa7 100644 --- a/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/25/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.m index 6ebef845..0934060e 100644 --- a/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSCell+MMTabBarViewExtensions.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/25/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "NSCell+MMTabBarViewExtensions.h" diff --git a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.h index c956fc96..e0f2c529 100644 --- a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m index 8a7a1472..2cdcc53e 100644 --- a/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSString+MMTabBarViewExtensions.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/19/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import "NSString+MMTabBarViewExtensions.h" diff --git a/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.h b/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.h index c1131142..a1b05e1a 100644 --- a/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.h +++ b/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.h @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/29/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.m b/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.m index 35eee5d0..698d32e1 100644 --- a/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.m +++ b/MMTabBarView/MMTabBarView/NSTabViewItem+MMTabBarViewExtensions.m @@ -3,7 +3,7 @@ // MMTabBarView // // Created by Michael Monscheuer on 9/29/12. -// Copyright (c) 2012 Michael Monscheuer. All rights reserved. +// Copyright (c) 2016 Michael Monscheuer. All rights reserved. // #import diff --git a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme index 398424a5..9580674c 100644 --- a/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme +++ b/default.xcworkspace/xcshareddata/xcschemes/MMTabBarView Demo.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,15 +38,18 @@ ReferencedContainer = "container:MMTabBarView Demo/MMTabBarView Demo.xcodeproj"> + + @@ -62,10 +65,10 @@ From 2b51a825a1a8b7f272dfea70aae554d785caedcd Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Tue, 15 Mar 2016 16:33:40 +0100 Subject: [PATCH 19/21] Additional optional style method Added optional - (NSSize)intrinsicContentSizeOfTabBarView:(MMTabBarView *)tabBarView; --- .../MMTabBarView Demo/DemoWindowController.m | 13 +++++++++---- MMTabBarView/MMTabBarView/MMTabBarView.m | 14 +++++++++++++- MMTabBarView/MMTabBarView/MMTabStyle.h | 9 +++++++++ .../Styles/Yosemite Tab Style/MMYosemiteTabStyle.m | 5 +++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m b/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m index d9d25070..7eada1b8 100644 --- a/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m +++ b/MMTabBarView Demo/MMTabBarView Demo/DemoWindowController.m @@ -211,8 +211,12 @@ -(void)_updateForOrientation:(MMTabBarOrientation)newOrientation { NSRect tabBarFrame = [tabBar frame], tabViewFrame = [tabView frame]; NSRect totalFrame = NSUnionRect(tabBarFrame, tabViewFrame); + NSSize intrinsicTabBarContentSize = [tabBar intrinsicContentSize]; + if (newOrientation == MMTabBarHorizontalOrientation) { - tabBarFrame.size.height = [tabBar isTabBarHidden] ? 1 : 22; + if (intrinsicTabBarContentSize.height == NSViewNoIntrinsicMetric) + intrinsicTabBarContentSize.height = 22; + tabBarFrame.size.height = [tabBar isTabBarHidden] ? 1 : intrinsicTabBarContentSize.height; tabBarFrame.size.width = totalFrame.size.width; tabBarFrame.origin.y = totalFrame.origin.y + totalFrame.size.height - tabBarFrame.size.height; tabViewFrame.origin.x = 13; @@ -267,7 +271,9 @@ - (void)configStyle:(id)sender { [tabBar setStyleNamed:[sender titleOfSelectedItem]]; [[NSUserDefaults standardUserDefaults] setObject:[sender titleOfSelectedItem] - forKey:@"Style"]; + forKey:@"Style"]; + + [self _updateForOrientation:[tabBar orientation]]; } - (void)configOnlyShowCloseOnHover:(id)sender { @@ -660,8 +666,7 @@ - (void)configureTabBarInitially { [button_allowScrubbing setState:[defaults boolForKey:@"AllowScrubbing"]]; [self configStyle:popUp_style]; - [tabBar setOrientation:[popUp_orientation selectedTag]]; -// [self _updateForOrientation:[popUp_orientation selectedTag]]; + [tabBar setOrientation:[popUp_orientation selectedTag]]; [self configOnlyShowCloseOnHover:button_onlyShowCloseOnHover]; [self configCanCloseOnlyTab:button_canCloseOnlyTab]; diff --git a/MMTabBarView/MMTabBarView/MMTabBarView.m b/MMTabBarView/MMTabBarView/MMTabBarView.m index d1e2e43d..05fb4292 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarView.m +++ b/MMTabBarView/MMTabBarView/MMTabBarView.m @@ -236,6 +236,14 @@ - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent { return YES; } +- (NSSize)intrinsicContentSize +{ + if ([_style respondsToSelector:@selector(intrinsicContentSizeOfTabBarView:)]) + return [_style intrinsicContentSizeOfTabBarView:self]; + + return NSMakeSize(NSViewNoIntrinsicMetric, NSViewNoIntrinsicMetric); +} + #pragma mark - #pragma mark Characteristics @@ -857,11 +865,15 @@ - (void)setStyle:(id )newStyle { if (![self supportsOrientation:MMTabBarVerticalOrientation] && _orientation == MMTabBarVerticalOrientation) [self setOrientation:MMTabBarHorizontalOrientation]; + // update buttons [self _updateAddTabButton]; [self _updateOverflowPopUpButton]; + // set style of attached buttons [[self attachedButtons] makeObjectsPerformSelector:@selector(setStyle:) withObject:_style]; + [self invalidateIntrinsicContentSize]; + [self update:NO]; } } @@ -1104,7 +1116,7 @@ - (void)setTabView:(NSTabView *)view { } } --(CGFloat)heightOfTabBarButtons +- (CGFloat)heightOfTabBarButtons { if ([_style respondsToSelector:@selector(heightOfTabBarButtonsForTabBarView:)]) return [_style heightOfTabBarButtonsForTabBarView:self]; diff --git a/MMTabBarView/MMTabBarView/MMTabStyle.h b/MMTabBarView/MMTabBarView/MMTabStyle.h index b6f91e36..216ee682 100644 --- a/MMTabBarView/MMTabBarView/MMTabStyle.h +++ b/MMTabBarView/MMTabBarView/MMTabStyle.h @@ -35,6 +35,15 @@ #pragma mark General +/** + * Get intrinsic content size of tab bar + * + * @param tabBarView A tab bar view + * + * @return Intrinsic content size + */ +- (NSSize)intrinsicContentSizeOfTabBarView:(MMTabBarView *)tabBarView; + /** * Get height of tab bar buttons * diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m index 106b626b..da81508b 100755 --- a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m @@ -53,6 +53,11 @@ - (id) init { #pragma mark - #pragma mark Tab View Specific +- (NSSize)intrinsicContentSizeOfTabBarView:(MMTabBarView *)tabBarView +{ + return NSMakeSize(NSViewNoIntrinsicMetric, 25); +} + - (CGFloat)leftMarginForTabBarView:(MMTabBarView *)tabBarView { if ([tabBarView orientation] == MMTabBarHorizontalOrientation) return -1.0f; From 617adf6f4da7a98661dfa6449e4c9ae3b5f5a32b Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Tue, 15 Mar 2016 17:03:22 +0100 Subject: [PATCH 20/21] MMTabBarItem protocol: showObjectCount property added --- MMTabBarView/MMTabBarView/MMTabBarButtonCell.m | 2 +- MMTabBarView/MMTabBarView/MMTabBarItem.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m index 23ae135c..6f359af8 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m +++ b/MMTabBarView/MMTabBarView/MMTabBarButtonCell.m @@ -827,7 +827,7 @@ - (NSRect)_indicatorRectForBounds:(NSRect)theRect { - (NSSize)_objectCounterSize { - if ([self showObjectCount] == 0) { + if (![self showObjectCount]) { return NSZeroSize; } diff --git a/MMTabBarView/MMTabBarView/MMTabBarItem.h b/MMTabBarView/MMTabBarView/MMTabBarItem.h index d0c430aa..b4a908cf 100644 --- a/MMTabBarView/MMTabBarView/MMTabBarItem.h +++ b/MMTabBarView/MMTabBarView/MMTabBarItem.h @@ -32,6 +32,11 @@ */ @property (assign) NSInteger objectCount; +/** + * YES: show object count, NO: do not show + */ +@property (assign) BOOL showObjectCount; + /** * Color of object count badge */ From f181c11d24742e3963bfdaedb43912587c86a4b6 Mon Sep 17 00:00:00 2001 From: Michael Monscheuer Date: Wed, 16 Mar 2016 08:50:21 +0100 Subject: [PATCH 21/21] Some more work on Yosemite Tab Style --- .../Images/YosemiteTabNew.png | Bin 1210 -> 1017 bytes .../Images/YosemiteTabNew@2x.png | Bin 1242 -> 1036 bytes .../Images/YosemiteTabNewPressed.png | Bin 0 -> 1017 bytes .../Images/YosemiteTabNewPressed@2x.png | Bin 0 -> 1037 bytes .../Yosemite Tab Style/MMYosemiteTabStyle.h | 3 +- .../Yosemite Tab Style/MMYosemiteTabStyle.m | 124 +++--------------- 6 files changed, 20 insertions(+), 107 deletions(-) create mode 100755 MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed.png create mode 100755 MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed@2x.png diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew.png index 8f41d820b6c6228d455881ee295e7999b7dbbbd1..d1c8a42bb89814f83b7f5fb486edca308645e120 100755 GIT binary patch literal 1017 zcmbVLJ#W)M7&Zb`sL%}w(E*)Yi4T?7K09{eQ%sfkgIdC+N+Xexi+ydZ);?ojiQA2C zo%jPxY)FWSjR98v0vjU;sVj(~obv@kRU|CiclX}=Jn#4M=Ej4i#pOjo5SILPr_0wX z)pvP;|6jiu-Qvp)=JweZ-DV@46QLc^0Reu3cSx7u=-}xm(h`J=!?@RH{oo-AX(HiD zM=FzyqXnV0R%STdB@7J6PMlie$@>o?h$BmUtOrVv*<={6ALeB1aHAIG_mx-{!B~auTH?g1ey|B_niHT)S}jx{1co8Ox^5Wo9#9pi z$_jst8muGTKxzX_ACX(jqixi6ys0gIvcw@{8ItAEXe5m^iRL>pG)=SOP}LgOs1*k( z!(}ZkR%Q$iDZ)I?SWHt;G2#K;XO_r4orI8NK`=fko3{kqEs z>$dN-d*$cBkJHn&i%42s{q-VvdHnp6vVKiFYT56;eYv?TTv!l3UhVw!PrkmYhS7I7 KoVT4PN526<*EhQW literal 1210 zcmZ`(&x_MQ6rM#XYjtHoDk>gA1W~Y=B;93cNCUQUw?(^_TA@9;X);}-NhT&!n&NG5 zo>ufGiuw<%=+&EeRR0PQ{13bc&ZNJ_&@H5y`QH2Hd*4f5p0##&*7BF~0D!ed-E7nQ z8Ma={(f>Es53BUH61R7%;ONKY-*j^-toLF7PM>4f3V8MU0stpPx6>uv<{iz(zGOML zkEFy8X*K|QqS2*~h$SSx7sOgp5z`Eft{DtPAx$BVD`L0V5^6X?!ltw#$)b@L1VN9S zfz~#+r*yijhz|(~H3&zeku)kvINFCwxm<>_3RSg8Gm7yzAXZWg;wzIwX6KkFwj(zr zE)E2CuGPmwQV~TaH2+QNB<^6L6vR_o)F5OLs7NwgMnj2v42?yOr8)N8RXB{i)RSXF z8x_CjbiK#Sqtt5E-_R+HI#)H9htCd*bgHV z$CPGlPANQ=&F?N`jIEgl4`vB>BbPe0SY3uP72vUKes7ro4{`+7dadOq$m^OeZD{I3 zp;avnWQjHG;pkpy*@zXEQaC7^oyzn$nG!F<1vsK(Yw@uE2-$>tTJ)Kv?|#+Vha9ZK zrP(@t6SO9F+`-ti2r^Vz*(fSXQQqpPvZg3nS=M1DhpT`^Y7w#sjyf27M(V<6TcIRT z2if?PszWwK+*D0QHbv>o8hOf`&A*ZVb@qixKM6|1yxF-{u=n1bUoRB?9)7=Z)jRm} xHTOQZ{ru^Z@%q~b^3U+1x>{*|dMWF->i~TIaN^sS`bUd>P#U*(&7XJ!BZ diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNew@2x.png index fdfe8c2cb04eb61a863504319a94815d3e85e601..5dfc389eab12c4324dddc22363ed91f2b2f3e498 100755 GIT binary patch literal 1036 zcmbVL&ui0A91jkLj16{@Id*ttAj;MxFKN;yww5+&Tw$4|D_X?E(&TlGYw}|9X0zQC zJP3k_|A63CMA&W)MDXI#n|Spq=*5$R`O;r{7!wRh-h1Eo{d~T^AJ;do&&@2(Fbp$S zTQeGTy^wzAr|JL0VecwkE|O}CY~l{-+Yw^QE^Z@G^X+ZaK(@Pg?;|QO%v9HFwn)ob z*BtC~cB;cAen`;_Qz#{&?d%`|+GyJgitP8d?^xiuMfR3#30A11uD7-yq0Rk`rnA4} zs4iQ&1`3Hr34BCskodhI){-JS;MM3p74s|@sF0l^J9MgL)q##91Y}OiI0A$~Q8<{D z6$P#WQGg;Z&{xU8tR^d(m;4+kJ+wA*->6j|!&Fa$retO;=tj}k>w#wT{jLr&m* zKaFdk9g_z7Gb|dm=QS6?9on0RVq-GRZ zdc(P%tC{(n31KcPfgc5Oq;OG^hxP9-{JP8F2t9UfXFYu^b~Bha?gyB?OTo4t1SP>(usI_C|4U zh#p!l{D7(l{s6sl1aU* z9o0gvXtvQ36eHIsY>v|+l{~r-n|$OtUZ_SzA!exLnZiKeV+vj^3a$D)UqS)or^P8z z67&qu^IFjEs14)xKu%UgVFhDf1)$&Wi~YQaf@L5V3I!l3Kv8mpkqg&6Y(_aRyqs*Z zzmEY!E3kcRBaf&1noFpMi-JIn4t`0V*zO!UdEuZeQXrraAd3VcSx}-clD@m^m$S zX7Rf}Yc2x@*1%A$v&Prkjl@OftP*yb6IdvtDW;^F4suk?dcE6*7_vx`sn08fW@DF6Tf diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed.png new file mode 100755 index 0000000000000000000000000000000000000000..56d83131e16d4772d1129547fa2d54494499adb6 GIT binary patch literal 1017 zcmbVLKX21O6gMiWP*Is!=zy-S1XLon&yJn=6cbWArjc-|(x_yk7yH^+t$oJ65~my8 zI`IYg0!RoJHYzdm4G>72yNYCO8;A|4eFvu+R@XUDov;BcDbR zE^MScN;p~&YV|z9{vlzYM-IZ+5`TRBB!V!o#HYHac!^E=;pRz7c22fB{>hrSfe;vm1k1W%!23W| zpeif;HA=9IbOWgsFnL7oEe-Zj+i@qp_|6jhj3r2x2ZMn$&?K53$j~&+fpkTy3ddw`5M>AjMis)UQq@eosa4^I35|+2<(P-vC>yX@ZZ=HKEkiCfRMoZ3s@>Fe+cwl0 zwiRa#$3B_*4Y}V5*1Qyp?37?e(+;Ia(+=3~Q%18sO@O^)fO{VH!?;ka7Z)_n*CA>6 zf&^|#BQUBk3g<-NHvX0Q7#sXg)np!wT(rku?J`yI9xTLJ^YhJYd`Qe^CgsC%{_K2( z57yn5)9B=1dp|EO>I-OhclXyT@AcWstIFn0?X+fp`2Owoig0C7SbzWU#@_JDYB7wh L=9cqrWAF4gN>(=8 literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed@2x.png b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/Images/YosemiteTabNewPressed@2x.png new file mode 100755 index 0000000000000000000000000000000000000000..b5a87db681dcf3d89111598c0a1683e3254f53cd GIT binary patch literal 1037 zcmbVL&1=*^6b}?XD3l_IXir0WQE-z?vdM1J#=4siyI^YFU2u=hCez)}O(rH&H{Daw zlhA)bP`r2$556U0<}+(w`lx*b$UuD^BvJz8X#scz70 zk(P5?^Ki(yxeb?vF-0@X;!+m7-UcF|jXFW3v)}gKvLNtv_MYqrPHdoVusldmW3bZn z1{ZX0{i|%x`OGvEoe81o4`Vxne4i8mT z%{fG|KrIUCRz%#a5T)~D1{0-T62v6H5y%lcCaiVqF+=>xjM=9P+JbEAN^J6fr-RX{ULmG{CCkg1KxIGhln<0uw z&D2?X!uf%(+2xWAVW}vTL_sM-SQg5XDqB(+R#m8!q%p@y*lJOMR?$*a$u2@FRYcJ? z)Usj8vSBFV1Y3(z;zk}C`wggHiWO{25>LfyMuJ>|lP1Q!aR;n+F~MmU$G~VP;Hu+# zL6j@55U^=D^}4%R}=tTeMv?O#VnOH=TsWu1BX{lk-mo&6V`_R|ZO;*BZf%>HV)nLYcivo_&4-<-Su5tN>e|EK7;r_F literal 0 HcmV?d00001 diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h index f19eadc0..82c698cb 100755 --- a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h +++ b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.h @@ -4,7 +4,8 @@ // // Based on MMUnifiedTabStyle.h by Keith Blount // Created by Ajin Man Tuladhar on 04/11/2014. -// Copyright 2014 Ajin Man Tuladhar. All rights reserved. +// Some clean up and adjustment by Michael Monscheuer on 03/16/2016 +// Copyright 2016 Ajin Man Tuladhar. All rights reserved. // #import diff --git a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m index da81508b..77da5adb 100755 --- a/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m +++ b/MMTabBarView/MMTabBarView/Styles/Yosemite Tab Style/MMYosemiteTabStyle.m @@ -13,14 +13,6 @@ #import "NSView+MMTabBarViewExtensions.h" #import "NSBezierPath+MMTabBarViewExtensions.h" -@interface MMYosemiteTabStyle (SharedPrivates) - -- (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; -- (void)_drawBoxBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)capMask usingStatesOfAttachedButton:(MMAttachedTabBarButton *)button ofTabBarView:(MMTabBarView *)tabBarView; -- (NSRect)_addTabButtonRect; -- (NSRect)_overflowButtonRect; -@end - @implementation MMYosemiteTabStyle StaticImage(YosemiteTabClose_Front) @@ -30,6 +22,7 @@ @implementation MMYosemiteTabStyle StaticImageWithFilename(YosemiteTabCloseDirty_Front_Pressed, AquaTabCloseDirty_Front_Pressed) StaticImageWithFilename(YosemiteTabCloseDirty_Front_Rollover, AquaTabCloseDirty_Front_Rollover) StaticImage(YosemiteTabNew) +StaticImage(YosemiteTabNewPressed) + (NSString *)name { return @"Yosemite"; @@ -95,26 +88,6 @@ - (NSSize)addTabButtonSizeForTabBarView:(MMTabBarView *)tabBarView { return NSMakeSize(18,[tabBarView frame].size.height); } - -// -// -//- (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView { -// [tabBarView update]; -// NSRect window = [tabBarView frame]; -// NSSize buttonSize = [tabBarView addTabButtonSize]; -// NSRect rect = NSMakeRect(NSMaxX(window) - buttonSize.width - 5, 2, buttonSize.width, buttonSize.height); -// return NSZeroRect; -//} - - -//- (NSRect)overflowButtonRectForTabBarView:(MMTabBarView *)tabBarView { -// NSRect rect = [tabBarView _overflowButtonRect]; -// -// //rect.origin.y += [tabBarView topMargin]; -// //rect.size.width = 60; -// return rect; -//} - - (BOOL)supportsOrientation:(MMTabBarOrientation)orientation forTabBarView:(MMTabBarView *)tabBarView { if (orientation != MMTabBarHorizontalOrientation) @@ -140,7 +113,7 @@ - (NSRect)draggingRectForTabButton:(MMAttachedTabBarButton *)aButton ofTabBarVie - (void)updateAddButton:(MMRolloverButton *)aButton ofTabBarView:(MMTabBarView *)tabBarView { [aButton setImage:_staticYosemiteTabNewImage()]; - [aButton setAlternateImage:_staticYosemiteTabNewImage()]; + [aButton setAlternateImage:_staticYosemiteTabNewPressedImage()]; [aButton setRolloverImage:_staticYosemiteTabNewImage()]; } @@ -196,87 +169,31 @@ - (void)drawBezelOfTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { toPoint:NSMakePoint(NSMaxX(rect), NSMaxY(rect) - 0.5)]; } -/* -- (void)drawBezelOfButton:(MMAttachedTabBarButton *)button atIndex:(NSUInteger)index inButtons:(NSArray *)buttons indexOfSelectedButton:(NSUInteger)selIndex tabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { - NSWindow *window = [tabBarView window]; - NSToolbar *toolbar = [window toolbar]; -// if (toolbar && [toolbar isVisible]) - return; - - NSRect aRect = [button frame]; - NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; - - // draw dividers - BOOL shouldDisplayRightDivider = [button shouldDisplayRightDivider]; - if ([button tabState] & MMTab_RightIsSelectedMask) { - if (([button tabState] & (MMTab_PlaceholderOnRight | MMTab_RightIsSliding)) == 0) - shouldDisplayRightDivider = NO; - } - - if (shouldDisplayRightDivider) { - [lineColor set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+.5, NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect)+0.5, NSMaxY(aRect))]; - - [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMinY(aRect)+1.0) - toPoint:NSMakePoint(NSMaxX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; - - } - - if ([button shouldDisplayLeftDivider]) { - [lineColor set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMinY(aRect)) toPoint:NSMakePoint(NSMinX(aRect)+0.5f, NSMaxY(aRect))]; - - [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMinY(aRect)+1.0) toPoint:NSMakePoint(NSMinX(aRect)+1.5f, NSMaxY(aRect)-1.0)]; - } -} -*/ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView { MMTabBarView *tabBarView = [controlView enclosingTabBarView]; MMAttachedTabBarButton *button = (MMAttachedTabBarButton *)controlView; -// NSWindow *window = [controlView window]; -// NSToolbar *toolbar = [window toolbar]; BOOL overflowMode = [button isOverflowButton]; if ([button isSliding]) overflowMode = NO; - -// if (toolbar && [toolbar isVisible]) { - - NSRect aRect = NSZeroRect; - if (overflowMode) { - aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width +1, frame.size.height); - } else { - aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - } - - aRect.origin.y += 1; - aRect.size.height -= 2; - - if (overflowMode) { - [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeLeftCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; - } else { - [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeAllCaps|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; - } - -// } else { -// -// NSRect aRect = NSZeroRect; -// if (overflowMode) { -// aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); -// } else { -// aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); -// } -// -// if (overflowMode) { -// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeLeftCap usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; -// } else { -// [self _drawBoxBezelInRect:aRect withCapMask:MMBezierShapeAllCaps usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; -// } -// } + + NSRect aRect = NSZeroRect; + if (overflowMode) { + aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width +1, frame.size.height); + } else { + aRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + } + + aRect.origin.y += 1; + aRect.size.height -= 2; + + if (overflowMode) { + [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeLeftCap|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; + } else { + [self _drawCardBezelInRect:aRect withCapMask:MMBezierShapeAllCaps|MMBezierShapeFlippedVertically usingStatesOfAttachedButton:button ofTabBarView:tabBarView]; + } } -(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBarView:(MMTabBarView *)tabBarView inRect:(NSRect)rect { @@ -324,8 +241,6 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap NSColor *lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; CGFloat radius = 0.0f; - - //capMask &= ~MMBezierShapeFillPath; NSBezierPath *fillPath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask|MMBezierShapeFillPath]; @@ -353,9 +268,6 @@ - (void)_drawCardBezelInRect:(NSRect)aRect withCapMask:(MMBezierShapeCapMask)cap [[NSGraphicsContext currentContext] setShouldAntialias:YES]; } } - - //NSBezierPath *strokePath = [NSBezierPath bezierPathWithCardInRect:aRect radius:radius capMask:capMask]; - //[strokePath stroke]; NSBezierPath *bezier = [NSBezierPath bezierPath]; [lineColor set];