├── .gitignore ├── FOTWindow.gif ├── FOTWindow ├── FOTWindow.h └── FOTWindow.m ├── FadeOut Titlebar.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── FadeOut Titlebar ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── MainMenu.xib ├── FadeOut Titlebar-Info.plist ├── FadeOut Titlebar-Prefix.pch ├── en.lproj │ └── InfoPlist.strings └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __MACOSX 3 | 4 | # Xcode 5 | */build/* 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | *.hmap 20 | *.xccheckout 21 | 22 | #CocoaPods 23 | Pods 24 | -------------------------------------------------------------------------------- /FOTWindow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insidegui/FOTWindow/504124cd2a1515118b092db9aeb425c3140c9e91/FOTWindow.gif -------------------------------------------------------------------------------- /FOTWindow/FOTWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // FOTWindow.h 3 | // 4 | // Created by Guilherme Rambo on 27/10/13. 5 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class FOTWindowFrame; 11 | 12 | /** 13 | View responsible for title bar drawing. 14 | */ 15 | @interface FOTWindowTitle : NSView 16 | 17 | @end 18 | 19 | /** 20 | View acting as the window's frame and responsible for mouse tracking. 21 | */ 22 | @interface FOTWindowFrame : NSView 23 | 24 | @end 25 | 26 | /** 27 | NSWindow subclass to make auto hiding and showing a window's title bar (a la QuickTime X) easier. 28 | */ 29 | @interface FOTWindow : NSWindow 30 | 31 | @property (nonatomic, strong) FOTWindowFrame *fullContentView; 32 | 33 | /** 34 | Adds a subview that stays below the title bar. 35 | 36 | @warning All views in this window will get wantsLayer = YES. 37 | */ 38 | - (void)addSubviewBelowTitleBar:(NSView *)subview; 39 | 40 | /** 41 | The alpha value the title bar view will be set to when it fades in. 42 | */ 43 | @property CGFloat titleBarFadeInAlphaValue; 44 | 45 | /** 46 | The alpha value the title bar view will be set to when it fades out. 47 | */ 48 | @property CGFloat titleBarFadeOutAlphaValue; 49 | 50 | /** 51 | Block used to specify custom drawing code for a window's title bar. 52 | @param drawsAsMainWindow Whether the window is in its main state. 53 | @param drawingRect The entire drawing area of the title bar. 54 | @param clippingPath Path with the shape of the window title bar's rounded corners (can be used to clip to). 55 | */ 56 | typedef void (^FOTWindowTitleBarDrawingBlock)(BOOL drawsAsMainWindow, NSRect drawingRect, NSBezierPath *clippingPath); 57 | 58 | /** 59 | Specify custom title bar background drawing code. If none is specified, the standard OS X title bar background will be drawn. 60 | */ 61 | @property (nonatomic, strong) FOTWindowTitleBarDrawingBlock titleBarDrawingBlock; 62 | 63 | /** 64 | Block used to specify custom drawing code for a window's title. 65 | @param drawsAsMainWindow Whether the window is in its main state. 66 | @param drawingRect The entire drawing area of the title bar. 67 | */ 68 | typedef void (^FOTWindowTitleDrawingBlock)(BOOL drawsAsMainWindow, NSRect titleBarRect); 69 | 70 | /** 71 | Specify custom title text drawing code. If none is specified, the standard OS X-style window title will be drawn. 72 | */ 73 | @property (nonatomic, strong) FOTWindowTitleDrawingBlock titleDrawingBlock; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /FOTWindow/FOTWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // FOTWindow.m 3 | // 4 | // Created by Guilherme Rambo on 27/10/13. 5 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 6 | // 7 | 8 | #import "FOTWindow.h" 9 | 10 | #define kTitleBarHeight 22.0 11 | 12 | @implementation FOTWindowTitle 13 | 14 | // Draws the title bar background and window title 15 | - (void)drawRect:(NSRect)dirtyRect 16 | { 17 | FOTWindow* window = (FOTWindow*)self.window; 18 | 19 | CGFloat roundedRectangleCornerRadius = 4; 20 | NSRect roundedRectangleRect = NSMakeRect(0, 0, NSWidth(self.frame), kTitleBarHeight); 21 | NSRect roundedRectangleInnerRect = NSInsetRect(roundedRectangleRect, roundedRectangleCornerRadius, roundedRectangleCornerRadius); 22 | NSBezierPath* clippingPath = [NSBezierPath bezierPath]; 23 | [clippingPath moveToPoint: NSMakePoint(NSMinX(roundedRectangleRect), NSMinY(roundedRectangleRect))]; 24 | [clippingPath lineToPoint: NSMakePoint(NSMaxX(roundedRectangleRect), NSMinY(roundedRectangleRect))]; 25 | [clippingPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(roundedRectangleInnerRect), NSMaxY(roundedRectangleInnerRect)) radius: roundedRectangleCornerRadius startAngle: 0 endAngle: 90]; 26 | [clippingPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(roundedRectangleInnerRect), NSMaxY(roundedRectangleInnerRect)) radius: roundedRectangleCornerRadius startAngle: 90 endAngle: 180]; 27 | [clippingPath closePath]; 28 | 29 | BOOL drawsAsMainWindow = (window.isMainWindow && [NSApplication sharedApplication].isActive); 30 | NSRect drawingRect = NSMakeRect(0, 0, NSWidth(self.frame), kTitleBarHeight); 31 | 32 | if (window.titleBarDrawingBlock) { 33 | // Draw custom titlebar background 34 | window.titleBarDrawingBlock(drawsAsMainWindow, drawingRect, clippingPath); 35 | } else { 36 | // Draw default titlebar background 37 | NSGradient* gradient; 38 | if (drawsAsMainWindow) { 39 | gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceWhite:0.66 alpha:1.0] endingColor:[NSColor colorWithDeviceWhite:0.9 alpha:1.0]]; 40 | } else { 41 | gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceWhite:0.878 alpha:1.0] endingColor:[NSColor colorWithDeviceWhite:0.976 alpha:1.0]]; 42 | } 43 | 44 | [gradient drawInBezierPath:clippingPath angle:90]; 45 | 46 | // 1px line 47 | NSRect shadowRect = NSMakeRect(0, 0, NSWidth(self.frame), 1); 48 | [[NSColor colorWithDeviceWhite:(drawsAsMainWindow)? 0.408 : 0.655 alpha:1.0] set]; 49 | NSRectFill(shadowRect); 50 | } 51 | 52 | if (window.titleDrawingBlock) { 53 | // Draw custom title 54 | window.titleDrawingBlock(drawsAsMainWindow, drawingRect); 55 | } else { 56 | // Draw default title 57 | 58 | // Rect 59 | NSRect textRect; 60 | if (window.representedURL) { 61 | textRect = NSMakeRect(20, -2, NSWidth(self.frame)-20, NSHeight(self.frame)); 62 | } else { 63 | textRect = NSMakeRect(0, -2, NSWidth(self.frame), NSHeight(self.frame)); 64 | } 65 | 66 | // Paragraph style 67 | NSMutableParagraphStyle* textStyle = [NSMutableParagraphStyle defaultParagraphStyle].mutableCopy; 68 | [textStyle setAlignment: NSCenterTextAlignment]; 69 | 70 | // Shadow 71 | NSShadow* titleTextShadow = [[NSShadow alloc] init]; 72 | titleTextShadow.shadowBlurRadius = 0.0; 73 | titleTextShadow.shadowOffset = NSMakeSize(0, -1); 74 | titleTextShadow.shadowColor = [NSColor colorWithDeviceWhite:1.0 alpha:0.5]; 75 | 76 | NSColor *textColor = [NSColor colorWithDeviceWhite:56.0/255.0 alpha:drawsAsMainWindow? 1.0 : 0.5]; 77 | 78 | // Draw the title 79 | NSDictionary* textFontAttributes = @{NSFontAttributeName: [NSFont titleBarFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]], 80 | NSForegroundColorAttributeName: textColor, 81 | NSParagraphStyleAttributeName: textStyle, 82 | NSShadowAttributeName: titleTextShadow}; 83 | 84 | [window.title drawInRect: textRect withAttributes: textFontAttributes]; 85 | } 86 | } 87 | 88 | @end 89 | 90 | #pragma mark - 91 | 92 | @interface FOTWindowFrame () 93 | 94 | @property (strong) FOTWindowTitle *titleBar; 95 | 96 | @end 97 | 98 | @implementation FOTWindowFrame 99 | 100 | - (id)initWithFrame:(NSRect)frameRect 101 | { 102 | self = [super initWithFrame:frameRect]; 103 | 104 | if (self) { 105 | _titleBar = [[FOTWindowTitle alloc] initWithFrame:NSMakeRect(0, NSHeight(self.frame)-kTitleBarHeight, NSWidth(self.frame), kTitleBarHeight)]; 106 | [_titleBar setAutoresizingMask:NSViewWidthSizable|NSViewMinYMargin|NSViewMinXMargin]; 107 | [_titleBar setAlphaValue:0]; 108 | [self addSubview:_titleBar]; 109 | } 110 | 111 | return self; 112 | } 113 | 114 | - (void)updateTrackingAreas 115 | { 116 | [super updateTrackingAreas]; 117 | 118 | [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:self.frame options:NSTrackingActiveAlways|NSTrackingInVisibleRect|NSTrackingMouseEnteredAndExited owner:self userInfo:nil]]; 119 | } 120 | 121 | - (void)mouseEntered:(NSEvent *)theEvent 122 | { 123 | FOTWindow* window = (FOTWindow*)self.window; 124 | [[window standardWindowButton:NSWindowCloseButton].animator setAlphaValue:window.titleBarFadeInAlphaValue]; 125 | [[window standardWindowButton:NSWindowZoomButton].animator setAlphaValue:window.titleBarFadeInAlphaValue]; 126 | [[window standardWindowButton:NSWindowMiniaturizeButton].animator setAlphaValue:window.titleBarFadeInAlphaValue]; 127 | [[window standardWindowButton:NSWindowDocumentIconButton].animator setAlphaValue:window.titleBarFadeInAlphaValue]; 128 | [[window standardWindowButton:NSWindowFullScreenButton].animator setAlphaValue:window.titleBarFadeInAlphaValue]; 129 | [[window standardWindowButton:NSWindowDocumentIconButton] setAlphaValue:window.titleBarFadeInAlphaValue]; 130 | [_titleBar.animator setAlphaValue:window.titleBarFadeInAlphaValue]; 131 | } 132 | 133 | - (void)mouseExited:(NSEvent *)theEvent 134 | { 135 | FOTWindow* window = (FOTWindow*)self.window; 136 | [[window standardWindowButton:NSWindowCloseButton].animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 137 | [[window standardWindowButton:NSWindowZoomButton].animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 138 | [[window standardWindowButton:NSWindowMiniaturizeButton].animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 139 | [[window standardWindowButton:NSWindowDocumentIconButton].animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 140 | [[window standardWindowButton:NSWindowFullScreenButton].animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 141 | [[window standardWindowButton:NSWindowDocumentIconButton] setAlphaValue:window.titleBarFadeOutAlphaValue]; 142 | [_titleBar.animator setAlphaValue:window.titleBarFadeOutAlphaValue]; 143 | } 144 | 145 | - (void)drawRect:(NSRect)dirtyRect 146 | { 147 | [self.window.backgroundColor set]; 148 | NSRectFillUsingOperation(dirtyRect, NSCompositeCopy); 149 | } 150 | 151 | @end 152 | 153 | #pragma mark - 154 | 155 | @implementation FOTWindow 156 | { 157 | NSView *_originalThemeFrame; 158 | } 159 | 160 | - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag 161 | { 162 | self = [super initWithContentRect:contentRect styleMask:aStyle backing:bufferingType defer:NO]; 163 | 164 | if (self) { 165 | _titleBarFadeInAlphaValue = 1.0; 166 | _titleBarFadeOutAlphaValue = 0.0; 167 | 168 | _originalThemeFrame = [self.contentView superview]; 169 | _originalThemeFrame.wantsLayer = YES; 170 | 171 | _fullContentView = [[FOTWindowFrame alloc] initWithFrame:self.frame]; 172 | _fullContentView.wantsLayer = YES; 173 | [_originalThemeFrame addSubview:_fullContentView positioned:NSWindowBelow relativeTo:_originalThemeFrame.subviews[0]]; 174 | 175 | [[self standardWindowButton:NSWindowCloseButton] setAlphaValue:_titleBarFadeOutAlphaValue]; 176 | [[self standardWindowButton:NSWindowZoomButton] setAlphaValue:_titleBarFadeOutAlphaValue]; 177 | [[self standardWindowButton:NSWindowMiniaturizeButton] setAlphaValue:_titleBarFadeOutAlphaValue]; 178 | 179 | [_fullContentView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; 180 | [_fullContentView setFrame:_originalThemeFrame.frame]; 181 | } 182 | 183 | return self; 184 | } 185 | 186 | - (void)awakeFromNib 187 | { 188 | [[self standardWindowButton:NSWindowFullScreenButton] setAlphaValue:_titleBarFadeOutAlphaValue]; 189 | } 190 | 191 | - (void)becomeKeyWindow 192 | { 193 | [super becomeKeyWindow]; 194 | [_fullContentView.titleBar setNeedsDisplay:YES]; 195 | } 196 | 197 | - (void)resignKeyWindow 198 | { 199 | [super resignKeyWindow]; 200 | [_fullContentView.titleBar setNeedsDisplay:YES]; 201 | } 202 | 203 | - (void)becomeMainWindow 204 | { 205 | [super becomeMainWindow]; 206 | [_fullContentView.titleBar setNeedsDisplay:YES]; 207 | } 208 | 209 | - (void)resignMainWindow 210 | { 211 | [super resignMainWindow]; 212 | [_fullContentView.titleBar setNeedsDisplay:YES]; 213 | } 214 | 215 | - (void)setTitle:(NSString *)aString 216 | { 217 | [super setTitle:aString]; 218 | 219 | [self.fullContentView setNeedsDisplay:YES]; 220 | [_fullContentView.titleBar setNeedsDisplay:YES]; 221 | } 222 | 223 | - (void)setRepresentedURL:(NSURL *)url 224 | { 225 | [super setRepresentedURL:url]; 226 | 227 | //Match the document icon button to the alpha value of the close button (and the other buttons, essentially) 228 | [[self standardWindowButton:NSWindowDocumentIconButton] setAlphaValue:[self standardWindowButton:NSWindowCloseButton].alphaValue]; 229 | 230 | [_fullContentView.titleBar setNeedsDisplay:YES]; 231 | } 232 | 233 | - (void)addSubviewBelowTitleBar:(NSView *)subview 234 | { 235 | [_fullContentView addSubview:subview positioned:NSWindowBelow relativeTo:_fullContentView.titleBar]; 236 | } 237 | 238 | @end -------------------------------------------------------------------------------- /FadeOut Titlebar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 96F86A7818E0E2F3006E55B2 /* FOTWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 96F86A7718E0E2F3006E55B2 /* FOTWindow.m */; }; 11 | DD830104181D74D30012369F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD830103181D74D30012369F /* Cocoa.framework */; }; 12 | DD83010E181D74D30012369F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD83010C181D74D30012369F /* InfoPlist.strings */; }; 13 | DD830110181D74D30012369F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DD83010F181D74D30012369F /* main.m */; }; 14 | DD830117181D74D40012369F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DD830116181D74D40012369F /* AppDelegate.m */; }; 15 | DD83011A181D74D40012369F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = DD830118181D74D40012369F /* MainMenu.xib */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 96F86A7618E0E2F3006E55B2 /* FOTWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FOTWindow.h; sourceTree = ""; }; 20 | 96F86A7718E0E2F3006E55B2 /* FOTWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FOTWindow.m; sourceTree = ""; }; 21 | DD830100181D74D30012369F /* FadeOut Titlebar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FadeOut Titlebar.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | DD830103181D74D30012369F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 23 | DD830106181D74D30012369F /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 24 | DD830107181D74D30012369F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 25 | DD830108181D74D30012369F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 26 | DD83010B181D74D30012369F /* FadeOut Titlebar-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FadeOut Titlebar-Info.plist"; sourceTree = ""; }; 27 | DD83010D181D74D30012369F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 28 | DD83010F181D74D30012369F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | DD830111181D74D30012369F /* FadeOut Titlebar-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FadeOut Titlebar-Prefix.pch"; sourceTree = ""; }; 30 | DD830115181D74D30012369F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | DD830116181D74D40012369F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | DD830119181D74D40012369F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | DD8300FD181D74D30012369F /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | DD830104181D74D30012369F /* Cocoa.framework in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 96F86A7518E0E2F3006E55B2 /* FOTWindow */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 96F86A7618E0E2F3006E55B2 /* FOTWindow.h */, 51 | 96F86A7718E0E2F3006E55B2 /* FOTWindow.m */, 52 | ); 53 | path = FOTWindow; 54 | sourceTree = SOURCE_ROOT; 55 | }; 56 | DD8300F7181D74D30012369F = { 57 | isa = PBXGroup; 58 | children = ( 59 | DD830109181D74D30012369F /* FadeOut Titlebar */, 60 | DD830102181D74D30012369F /* Frameworks */, 61 | DD830101181D74D30012369F /* Products */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | DD830101181D74D30012369F /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | DD830100181D74D30012369F /* FadeOut Titlebar.app */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | DD830102181D74D30012369F /* Frameworks */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | DD830103181D74D30012369F /* Cocoa.framework */, 77 | DD830105181D74D30012369F /* Other Frameworks */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | DD830105181D74D30012369F /* Other Frameworks */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | DD830106181D74D30012369F /* AppKit.framework */, 86 | DD830107181D74D30012369F /* CoreData.framework */, 87 | DD830108181D74D30012369F /* Foundation.framework */, 88 | ); 89 | name = "Other Frameworks"; 90 | sourceTree = ""; 91 | }; 92 | DD830109181D74D30012369F /* FadeOut Titlebar */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 96F86A7518E0E2F3006E55B2 /* FOTWindow */, 96 | DD830115181D74D30012369F /* AppDelegate.h */, 97 | DD830116181D74D40012369F /* AppDelegate.m */, 98 | DD830118181D74D40012369F /* MainMenu.xib */, 99 | DD83010A181D74D30012369F /* Supporting Files */, 100 | ); 101 | path = "FadeOut Titlebar"; 102 | sourceTree = ""; 103 | }; 104 | DD83010A181D74D30012369F /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | DD83010B181D74D30012369F /* FadeOut Titlebar-Info.plist */, 108 | DD83010C181D74D30012369F /* InfoPlist.strings */, 109 | DD83010F181D74D30012369F /* main.m */, 110 | DD830111181D74D30012369F /* FadeOut Titlebar-Prefix.pch */, 111 | ); 112 | name = "Supporting Files"; 113 | sourceTree = ""; 114 | }; 115 | /* End PBXGroup section */ 116 | 117 | /* Begin PBXNativeTarget section */ 118 | DD8300FF181D74D30012369F /* FadeOut Titlebar */ = { 119 | isa = PBXNativeTarget; 120 | buildConfigurationList = DD830131181D74D40012369F /* Build configuration list for PBXNativeTarget "FadeOut Titlebar" */; 121 | buildPhases = ( 122 | DD8300FC181D74D30012369F /* Sources */, 123 | DD8300FD181D74D30012369F /* Frameworks */, 124 | DD8300FE181D74D30012369F /* Resources */, 125 | ); 126 | buildRules = ( 127 | ); 128 | dependencies = ( 129 | ); 130 | name = "FadeOut Titlebar"; 131 | productName = "FadeOut Titlebar"; 132 | productReference = DD830100181D74D30012369F /* FadeOut Titlebar.app */; 133 | productType = "com.apple.product-type.application"; 134 | }; 135 | /* End PBXNativeTarget section */ 136 | 137 | /* Begin PBXProject section */ 138 | DD8300F8181D74D30012369F /* Project object */ = { 139 | isa = PBXProject; 140 | attributes = { 141 | LastUpgradeCheck = 0500; 142 | ORGANIZATIONNAME = "Guilherme Rambo"; 143 | }; 144 | buildConfigurationList = DD8300FB181D74D30012369F /* Build configuration list for PBXProject "FadeOut Titlebar" */; 145 | compatibilityVersion = "Xcode 3.2"; 146 | developmentRegion = English; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | en, 150 | Base, 151 | ); 152 | mainGroup = DD8300F7181D74D30012369F; 153 | productRefGroup = DD830101181D74D30012369F /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | DD8300FF181D74D30012369F /* FadeOut Titlebar */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | DD8300FE181D74D30012369F /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | DD83010E181D74D30012369F /* InfoPlist.strings in Resources */, 168 | DD83011A181D74D40012369F /* MainMenu.xib in Resources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXResourcesBuildPhase section */ 173 | 174 | /* Begin PBXSourcesBuildPhase section */ 175 | DD8300FC181D74D30012369F /* Sources */ = { 176 | isa = PBXSourcesBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | DD830117181D74D40012369F /* AppDelegate.m in Sources */, 180 | DD830110181D74D30012369F /* main.m in Sources */, 181 | 96F86A7818E0E2F3006E55B2 /* FOTWindow.m in Sources */, 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | }; 185 | /* End PBXSourcesBuildPhase section */ 186 | 187 | /* Begin PBXVariantGroup section */ 188 | DD83010C181D74D30012369F /* InfoPlist.strings */ = { 189 | isa = PBXVariantGroup; 190 | children = ( 191 | DD83010D181D74D30012369F /* en */, 192 | ); 193 | name = InfoPlist.strings; 194 | sourceTree = ""; 195 | }; 196 | DD830118181D74D40012369F /* MainMenu.xib */ = { 197 | isa = PBXVariantGroup; 198 | children = ( 199 | DD830119181D74D40012369F /* Base */, 200 | ); 201 | name = MainMenu.xib; 202 | sourceTree = ""; 203 | }; 204 | /* End PBXVariantGroup section */ 205 | 206 | /* Begin XCBuildConfiguration section */ 207 | DD83012F181D74D40012369F /* Debug */ = { 208 | isa = XCBuildConfiguration; 209 | buildSettings = { 210 | ALWAYS_SEARCH_USER_PATHS = NO; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | COPY_PHASE_STRIP = NO; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 232 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 233 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 234 | GCC_WARN_UNDECLARED_SELECTOR = YES; 235 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 236 | GCC_WARN_UNUSED_FUNCTION = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | MACOSX_DEPLOYMENT_TARGET = 10.8; 239 | ONLY_ACTIVE_ARCH = YES; 240 | SDKROOT = macosx; 241 | }; 242 | name = Debug; 243 | }; 244 | DD830130181D74D40012369F /* Release */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BOOL_CONVERSION = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | COPY_PHASE_STRIP = YES; 260 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 261 | ENABLE_NS_ASSERTIONS = NO; 262 | GCC_C_LANGUAGE_STANDARD = gnu99; 263 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 264 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 266 | GCC_WARN_UNDECLARED_SELECTOR = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 268 | GCC_WARN_UNUSED_FUNCTION = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | MACOSX_DEPLOYMENT_TARGET = 10.8; 271 | SDKROOT = macosx; 272 | }; 273 | name = Release; 274 | }; 275 | DD830132181D74D40012369F /* Debug */ = { 276 | isa = XCBuildConfiguration; 277 | buildSettings = { 278 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 279 | COMBINE_HIDPI_IMAGES = YES; 280 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 281 | GCC_PREFIX_HEADER = "FadeOut Titlebar/FadeOut Titlebar-Prefix.pch"; 282 | INFOPLIST_FILE = "FadeOut Titlebar/FadeOut Titlebar-Info.plist"; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | WRAPPER_EXTENSION = app; 285 | }; 286 | name = Debug; 287 | }; 288 | DD830133181D74D40012369F /* Release */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | COMBINE_HIDPI_IMAGES = YES; 293 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 294 | GCC_PREFIX_HEADER = "FadeOut Titlebar/FadeOut Titlebar-Prefix.pch"; 295 | INFOPLIST_FILE = "FadeOut Titlebar/FadeOut Titlebar-Info.plist"; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | WRAPPER_EXTENSION = app; 298 | }; 299 | name = Release; 300 | }; 301 | /* End XCBuildConfiguration section */ 302 | 303 | /* Begin XCConfigurationList section */ 304 | DD8300FB181D74D30012369F /* Build configuration list for PBXProject "FadeOut Titlebar" */ = { 305 | isa = XCConfigurationList; 306 | buildConfigurations = ( 307 | DD83012F181D74D40012369F /* Debug */, 308 | DD830130181D74D40012369F /* Release */, 309 | ); 310 | defaultConfigurationIsVisible = 0; 311 | defaultConfigurationName = Release; 312 | }; 313 | DD830131181D74D40012369F /* Build configuration list for PBXNativeTarget "FadeOut Titlebar" */ = { 314 | isa = XCConfigurationList; 315 | buildConfigurations = ( 316 | DD830132181D74D40012369F /* Debug */, 317 | DD830133181D74D40012369F /* Release */, 318 | ); 319 | defaultConfigurationIsVisible = 0; 320 | defaultConfigurationName = Release; 321 | }; 322 | /* End XCConfigurationList section */ 323 | }; 324 | rootObject = DD8300F8181D74D30012369F /* Project object */; 325 | } 326 | -------------------------------------------------------------------------------- /FadeOut Titlebar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FadeOut Titlebar/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FadeOut Titlebar 4 | // 5 | // Created by Guilherme Rambo on 27/10/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FOTWindow; 12 | 13 | @interface AppDelegate : NSObject 14 | 15 | @property (assign) IBOutlet FOTWindow *window; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FadeOut Titlebar/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FadeOut Titlebar 4 | // 5 | // Created by Guilherme Rambo on 27/10/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "FOTWindow.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 15 | { 16 | // The same as a normal window 17 | [_window setTitle:@"FadeOut Titlebar"]; 18 | // [_window setRepresentedURL:[NSURL URLWithString:@"~/Users/ . . ."]]; 19 | 20 | // Easy to customize the title bar 21 | /* 22 | _window.titleBarDrawingBlock = ^(BOOL drawsAsMainWindow, NSRect drawingRect, NSBezierPath *clippingPath){ 23 | [[NSColor lightGrayColor] set]; 24 | [clippingPath fill]; 25 | };*/ 26 | 27 | // Easy to customize the title text 28 | /* 29 | _window.titleDrawingBlock = ^(BOOL drawsAsMainWindow, NSRect titleBarRect){ 30 | // draw custom title here 31 | };*/ 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /FadeOut Titlebar/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Default 523 | 524 | 525 | 526 | 527 | 528 | 529 | Left to Right 530 | 531 | 532 | 533 | 534 | 535 | 536 | Right to Left 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | Default 548 | 549 | 550 | 551 | 552 | 553 | 554 | Left to Right 555 | 556 | 557 | 558 | 559 | 560 | 561 | Right to Left 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | -------------------------------------------------------------------------------- /FadeOut Titlebar/FadeOut Titlebar-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | br.com.guilhermerambo.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Guilherme Rambo. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /FadeOut Titlebar/FadeOut Titlebar-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /FadeOut Titlebar/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FadeOut Titlebar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FadeOut Titlebar 4 | // 5 | // Created by Guilherme Rambo on 27/10/13. 6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Guilherme Rambo 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FOTWindow 2 | 3 | A ```NSWindow``` subclass that makes auto hiding and showing the title bar (à la QuickTime X) a lot easier, and allows for a custom title bar drawing block. 4 | 5 | ![Animated preview of FOTWindow in action](https://raw.github.com/insidegui/FOTWindow/master/FOTWindow.gif) 6 | 7 | ## Usage 8 | 9 | Just replace your ```NSWindow``` with a ```FOTWindow```. This can be done in your ```.xib``` file (see example project). --------------------------------------------------------------------------------