├── screenshot_1.png
├── screenshot_2.png
├── screenshot_3.png
├── screenshot_4.png
├── screenshot_5.png
├── GRProKit Demo App
├── en.lproj
│ ├── InfoPlist.strings
│ └── Credits.rtf
├── edit.png
├── grab.png
├── xcode.png
├── ICONS.txt
├── GRProKit Demo App-Prefix.pch
├── main.m
├── AppDelegate.h
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── GRProKit Demo App-Info.plist
└── AppDelegate.m
├── GRProKit
├── GRProKit
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── GRProTheme.pack
│ ├── GRProKit-Prefix.pch
│ ├── GRProTableView.h
│ ├── GRProLabel.h
│ ├── GRProBox.h
│ ├── GRProToolbar.h
│ ├── GRProSlider.h
│ ├── NSData+ZLib.h
│ ├── GRProSplitView.m
│ ├── GRProMenu.h
│ ├── GRProColor.h
│ ├── GRProSplitView.h
│ ├── GRProKit.m
│ ├── GRProKit.h
│ ├── GRThemePiece.h
│ ├── GRThemePiece.m
│ ├── ThemeFile.h
│ ├── GRProButton.h
│ ├── GRProKit-Info.plist
│ ├── GRProFont.h
│ ├── GRProLabel.m
│ ├── GRProAlert.h
│ ├── GRThemeStore.h
│ ├── GRProSlider.m
│ ├── GRProColor.m
│ ├── GRProProgressIndicator.h
│ ├── GRProBox.m
│ ├── NSData+ZLib.m
│ ├── GRProAlert.m
│ ├── GRProToolbar.m
│ ├── GRProFont.m
│ ├── GRProWindow.h
│ ├── GRProMenu.m
│ ├── GRThemeStore.m
│ ├── xibs
│ │ └── GRProAlert.xib
│ ├── GRProTableView.m
│ ├── GRProButton.m
│ ├── GRProProgressIndicator.m
│ └── GRProWindow.m
└── GRProKit.xcodeproj
│ ├── xcuserdata
│ └── inside.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── GRProKit.xcscheme
│ └── project.pbxproj
├── GRProKit Demo App.xcodeproj
├── xcuserdata
│ └── inside.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── GRProKit Demo App.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── inside.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── project.pbxproj
├── .gitignore
├── README.md
└── LICENSE
/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/screenshot_1.png
--------------------------------------------------------------------------------
/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/screenshot_2.png
--------------------------------------------------------------------------------
/screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/screenshot_3.png
--------------------------------------------------------------------------------
/screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/screenshot_4.png
--------------------------------------------------------------------------------
/screenshot_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/screenshot_5.png
--------------------------------------------------------------------------------
/GRProKit Demo App/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/GRProKit Demo App/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/GRProKit Demo App/edit.png
--------------------------------------------------------------------------------
/GRProKit Demo App/grab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/GRProKit Demo App/grab.png
--------------------------------------------------------------------------------
/GRProKit Demo App/xcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/GRProKit Demo App/xcode.png
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProTheme.pack:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/GRProKit/GRProKit/GRProTheme.pack
--------------------------------------------------------------------------------
/GRProKit Demo App/ICONS.txt:
--------------------------------------------------------------------------------
1 | Sample toolbar icons found at iconfinder.net
2 |
3 | Created by Prax_08 - http://prax-08.deviantart.com/
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/xcuserdata/inside.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GRProKit Demo App/GRProKit Demo App-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 |
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/project.xcworkspace/xcuserdata/inside.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insidegui/GRProKit/HEAD/GRProKit Demo App.xcodeproj/project.xcworkspace/xcuserdata/inside.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProKit-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 | #import "GRThemeStore.h"
10 | #endif
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | __MACOSX
3 | *.pbxuser
4 | !default.pbxuser
5 | *.mode1v3
6 | !default.mode1v3
7 | *.mode2v3
8 | !default.mode2v3
9 | *.perspectivev3
10 | !default.perspectivev3
11 | *.xcworkspace
12 | !default.xcworkspace
13 | xcuserdata
14 | profile
15 | *.moved-aside
16 | DerivedData
17 | .idea/
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProTableView.h
3 | // TableViewTest
4 | //
5 | // Created by Guilherme Rambo on 17/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GRProTableView : NSTableView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProLabel.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 02/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GRProLabel : NSTextField
12 |
13 | + (NSShadow *)proFontShadow;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProBox.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProBox.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 02/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GRProBox : NSView
12 |
13 | @property (nonatomic, copy) NSString *title;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProToolbar.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProToolbar.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // currently this class doesn't override anything
12 | @interface GRProToolbar : NSToolbar
13 |
14 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProSlider.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProSlider.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GRProSlider : NSSlider
12 |
13 | @end
14 |
15 | @interface GRProSliderCell : NSSliderCell
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/NSData+ZLib.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSData+ZLib.h
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSData (ZLib)
12 |
13 | - (NSData *)zlibDeflate;
14 | - (NSData *)zlibInflate;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/GRProKit Demo App/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // GRProKit Demo App
4 | //
5 | // Created by Guilherme Rambo on 31/10/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | int main(int argc, const char * argv[])
13 | {
14 | return GRProApplicationMain(argc, argv);
15 | }
16 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProSplitView.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProSplitView.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProSplitView.h"
10 |
11 | @implementation GRProSplitView
12 |
13 | // "invisible" divider
14 | - (void)drawDividerInRect:(NSRect)rect
15 | {
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProMenu.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProMenu.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 25/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSMenu (Dark)
12 | @property (readwrite, nonatomic, setter=setDark:) BOOL isDark;
13 | @end
14 |
15 | @interface GRProMenu : NSMenu
16 |
17 | + (void)installGRProMenuImpl:(NSMenu *)menu;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProColor.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProColor.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 26/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface GRProColor : NSColor
12 |
13 | + (void)drawNoiseTextureInRect:(NSRect)rect;
14 | + (void)drawBackgroundHighlightInRect:(NSRect)rect;
15 |
16 | @end
17 |
18 | // we use this category to override _focusRingCGColor, changing the default focus ring's color
19 | @interface NSColor (GRProKitOverrides)
20 |
21 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProSplitView.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProSplitView.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | /*
10 | This is a subclass of NSSplitView that basically hides the divider, so we keep only the functionality but not the look.
11 | Designed specifically to use with GRProBox, which already has kind of a bottom divider (a black line)
12 | */
13 |
14 | #import
15 |
16 | @interface GRProSplitView : NSSplitView
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/GRProKit Demo App/en.lproj/Credits.rtf:
--------------------------------------------------------------------------------
1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2 | {\colortbl;\red255\green255\blue255;}
3 | \paperw9840\paperh8400
4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5 |
6 | \f0\b\fs24 \cf0 Engineering:
7 | \b0 \
8 | Some people\
9 | \
10 |
11 | \b Human Interface Design:
12 | \b0 \
13 | Some other people\
14 | \
15 |
16 | \b Testing:
17 | \b0 \
18 | Hopefully not nobody\
19 | \
20 |
21 | \b Documentation:
22 | \b0 \
23 | Whoever\
24 | \
25 |
26 | \b With special thanks to:
27 | \b0 \
28 | Mom\
29 | }
30 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProKit.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProKit.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProKit.h"
10 |
11 | int GRProApplicationMain(int argc, const char **argv)
12 | {
13 | [GRProKit install];
14 |
15 | return NSApplicationMain(argc, argv);
16 | }
17 |
18 | @implementation GRProKit
19 |
20 | + (void)install
21 | {
22 | [[NSUserDefaults standardUserDefaults] setVolatileDomain:@{@"AppleAquaColorVariant": @6} forName:NSArgumentDomain];
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProKit.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "GRProWindow.h"
12 | #import "GRProToolbar.h"
13 | #import "GRProLabel.h"
14 | #import "GRProSplitView.h"
15 | #import "GRProBox.h"
16 | #import "GRProButton.h"
17 | #import "GRProAlert.h"
18 | #import "GRProProgressIndicator.h"
19 | #import "GRProTableView.h"
20 | #import "GRProMenu.h"
21 | #import "GRProColor.h"
22 |
23 | int GRProApplicationMain(int argc, const char **argv);
24 |
25 | @interface GRProKit : NSObject
26 |
27 | + (void)install;
28 |
29 | @end
30 |
31 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit.xcodeproj/xcuserdata/inside.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GRProKit.xcscheme
8 |
9 | orderHint
10 | 1
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | DD7718181822AC7800482CBE
16 |
17 | primary
18 |
19 |
20 | DD77182F1822AC7800482CBE
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/xcuserdata/inside.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GRProKit Demo App.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | DD7717D71822AC5D00482CBE
16 |
17 | primary
18 |
19 |
20 | DD7717F81822AC5D00482CBE
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GRProKit Demo App/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // GRProKit Demo App
4 | //
5 | // Created by Guilherme Rambo on 31/10/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface AppDelegate : NSObject
13 |
14 | @property (assign) IBOutlet GRProWindow *window;
15 | @property (weak) IBOutlet GRProBox *box;
16 |
17 | @property (nonatomic, strong) GRProAlert *alert;
18 | @property (weak) IBOutlet GRProButton *runModalCheck;
19 | @property (weak) IBOutlet GRProProgressIndicator *progressBar;
20 | @property (unsafe_unretained) IBOutlet GRProWindow *preferencesWindow;
21 | @property (weak) IBOutlet GRProTableView *tableView;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRThemePiece.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRThemePiece.h
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | /*
10 | GRThemePiece - Represents an image inside a theme
11 | name - Image filename without extension
12 | filename - Original image filename
13 | image - The image itself
14 |
15 | You will probably never use this class directly, It is used internally by GRThemeStore
16 | */
17 |
18 | #import
19 |
20 | @interface GRThemePiece : NSObject
21 |
22 | @property (nonatomic, strong) NSString *name;
23 | @property (nonatomic, strong) NSString *filename;
24 | @property (nonatomic, strong) NSImage *image;
25 |
26 | + (GRThemePiece *)themePieceWithFilename:(NSString *)aFilename image:(NSImage *)anImage;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GRProKit
2 |
3 | Open-source ProKit clone.
4 |
5 | ## How the images are stored
6 |
7 | To manage the theme's images I've created a file format which encapsulates all the images used by the custom controls,
8 | this is good because:
9 | - It is compressed, so the framework size is smaller
10 | - It keeps all files inside this container, making organization easier
11 |
12 | For more information check out [GRThemeStore](https://github.com/insidegui/GRThemeStore)
13 |
14 | ## Screenshots
15 |
16 | 
17 | 
18 | 
19 | 
20 | 
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRThemePiece.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRThemePiece.m
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRThemePiece.h"
10 |
11 | @implementation GRThemePiece
12 |
13 | + (GRThemePiece *)themePieceWithFilename:(NSString *)aFilename image:(NSImage *)anImage
14 | {
15 | GRThemePiece *instance = [[GRThemePiece alloc] init];
16 |
17 | if (!instance) return nil;
18 |
19 | instance.filename = aFilename;
20 | instance.image = anImage;
21 |
22 | return instance;
23 | }
24 |
25 | - (void)setFilename:(NSString *)filename
26 | {
27 | _filename = filename;
28 |
29 | // populate our "name" automatically, removing the extension from the filename
30 | NSURL *url = [NSURL URLWithString:_filename];
31 | self.name = [[url URLByDeletingPathExtension] path];
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/ThemeFile.h:
--------------------------------------------------------------------------------
1 | //
2 | // ThemeFile.h
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #ifndef packtheme_ThemeFile_h
10 | #define packtheme_ThemeFile_h
11 |
12 | /*
13 | Theme file format definition:
14 |
15 | The theme file starts with a master header containing a signature 'TPKG',
16 | followed by the version number (currently 1),
17 | entries_offset is the offset for the archived data containing an array of dictionaries with information about each image
18 | start_offset is the offset for the data of the first image file inside the package
19 |
20 | The file is compressed/decompressed using zlib
21 | */
22 |
23 | typedef struct __attribute__((__packed__)) master_header {
24 | char signature[4];
25 | char version;
26 | unsigned long entries_offset;
27 | unsigned long start_offset;
28 | char reserved[16];
29 | } master_header_t;
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProButton.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProButton.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | /*
10 | GRProButton - This class should be used in the place of NSButtons.
11 | You need to set the button's cell to be a GRProButtonCell (for buttons), GRProCheckboxCell (for checkboxes) or GRProRadioCell (for radio buttons)
12 | The cell class can be set in interface builder
13 | */
14 |
15 | #import
16 |
17 | @interface GRProButton : NSButton
18 |
19 | @property (nonatomic, assign, setter = setDefault:) BOOL isDefault;
20 |
21 | @end
22 |
23 | // regular button cell
24 | @interface GRProButtonCell : NSButtonCell
25 |
26 | @end
27 |
28 | // checkbox button cell
29 | @interface GRProCheckboxCell : NSButtonCell
30 |
31 | @end
32 |
33 | // radio button cell
34 | @interface GRProRadioButtonCell : GRProCheckboxCell
35 |
36 | @end
37 |
38 | // popup button cell
39 | @interface GRProPopUpButtonCell : NSPopUpButtonCell
40 |
41 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProKit-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
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 | FMWK
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | NSHumanReadableCopyright
26 | Copyright © 2013 Guilherme Rambo. All rights reserved.
27 | NSPrincipalClass
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/GRProKit Demo App/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProFont.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProFont.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 25/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // default font for controls, labels, etc
12 | #define kGRProKitFontName "Helvetica"
13 | // fallback font if default font is not available
14 | #define kGRProKitFallbackFontName "LucidaGrande"
15 | // default font size for labels
16 | #define kGRProKitDefaultFontSize 13.0
17 |
18 | // this is used to identify the default font's availability when using CoreText
19 | #define kGRProKitPreferredFontBoundingBox NSMakeRect(-13.3095703125, -6.7333984375, 33.55078125, 22.435546875)
20 |
21 | // offset for window's titles according to the font being used
22 | #define kGRProKitDefaultFontTitleHeightOffset 0.0
23 | #define kGRProKitFallbackFontTitleHeightOffset 0.0
24 |
25 | @interface GRProFont : NSFont
26 |
27 | + (BOOL)CTFontIsDefaultProFont:(CTFontRef)font;
28 | + (CGFloat)menuFontSize;
29 | + (NSFont *)proLabelFont;
30 | + (NSFont *)proLabelFontWithSize:(CGFloat) size;
31 | + (NSFont *)proControlFont;
32 | + (NSFont *)proTitleFont;
33 | + (NSFont *)proToolbarFont;
34 | + (CGFloat)windowTitleHeightOffsetForFont:(NSFont *)font;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/GRProKit Demo App/GRProKit Demo App-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 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProLabel.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 02/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProLabel.h"
10 | #import "GRProFont.h"
11 |
12 | @implementation GRProLabel
13 |
14 | - (id)initWithFrame:(NSRect)frame
15 | {
16 | self = [super initWithFrame:frame];
17 |
18 | if (!self) return nil;
19 |
20 | [self updateLabelLook];
21 |
22 | return self;
23 | }
24 |
25 | - (void)awakeFromNib
26 | {
27 | [self updateLabelLook];
28 | }
29 |
30 | - (void)updateLabelLook
31 | {
32 | [self setShadow:[GRProLabel proFontShadow]];
33 |
34 | [self setBordered:NO];
35 | [self setDrawsBackground:NO];
36 | [self setEditable:NO];
37 |
38 | if(self.refusesFirstResponder) {
39 | [self setFont:[GRProFont proLabelFontWithSize:self.font.pointSize]];
40 | } else {
41 | [self setFont:[GRProFont proLabelFont]];
42 | }
43 | }
44 |
45 | + (NSShadow *)proFontShadow
46 | {
47 | NSShadow *proShadow = [[NSShadow alloc] init];
48 | proShadow.shadowBlurRadius = 0;
49 | proShadow.shadowColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.4];
50 | proShadow.shadowOffset = NSMakeSize(0, 1);
51 |
52 | return proShadow;
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProAlert.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProAlert.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "GRProWindow.h"
11 | #import "GRProButton.h"
12 | #import "GRProLabel.h"
13 |
14 | typedef void(^AlertCompletionHandlerBlockType)(NSUInteger);
15 |
16 | @interface GRProAlert : NSObject
17 |
18 | - (void)runModal;
19 | - (void)beginSheetModalForWindow:(NSWindow *)hostWindow completionHandler:(void (^)(NSUInteger))handler;
20 |
21 | @property (nonatomic, assign) NSUInteger result;
22 |
23 | @property (nonatomic, copy) NSString *title;
24 | @property (nonatomic, copy) NSString *informativeText;
25 | @property (nonatomic, assign) BOOL showCancelButton;
26 |
27 | @property (nonatomic, assign) AlertCompletionHandlerBlockType completionHandler;
28 |
29 | @property (nonatomic, copy) NSString *okButtonTitle;
30 | @property (nonatomic, copy) NSString *cancelButtonTitle;
31 |
32 | @property (weak) IBOutlet GRProLabel *titleLabel;
33 | @property (weak) IBOutlet GRProLabel *informativeTextLabel;
34 |
35 | @property (strong) IBOutlet GRProWindow *window;
36 | @property (weak) IBOutlet GRProButton *cancelButton;
37 | @property (weak) IBOutlet GRProButton *okButton;
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRThemeStore.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRThemeStore.h
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | /*
10 | GRThemeStore - represents a collection of images for a theme
11 | This is essentially a class for reading ".pack" files created with "packtheme" and using the images
12 | */
13 |
14 | #import
15 | #import "NSData+ZLib.h"
16 | #import "ThemeFile.h"
17 | #import "GRThemePiece.h"
18 |
19 | @interface GRThemeStore : NSObject
20 |
21 | // returns a shared instance of GRThemeStore reading from "GRProTheme.pack" inside this framework's resources folder
22 | + (GRThemeStore *)proThemeStore;
23 |
24 | // initializes the ThemeStore using the data from a given file
25 | - (id)initWithCompressedPackageData:(NSData *)data;
26 |
27 | // replacement for NSImage's "imageNamed" method
28 | // works exactly the same, but searches for the image inside the ThemeStore
29 | // if the device has a retina display, this method will try to use the 2x version of the image
30 | // and fall back to the default if a 2x is not found in the theme file
31 | - (NSImage *)imageNamed:(NSString *)name;
32 |
33 | // an array of GRThemePiece objects, used to find the current theme's images
34 | @property (nonatomic, copy) NSArray *themePieces;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProSlider.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProSlider.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProSlider.h"
10 |
11 | @implementation GRProSlider
12 |
13 | @end
14 |
15 | @implementation GRProSliderCell
16 |
17 | - (void)drawBarInside:(NSRect)aRect flipped:(BOOL)flipped
18 | {
19 | NSRect endRect = NSMakeRect(aRect.origin.x+2, aRect.origin.y, NSWidth(aRect)-4, NSHeight(aRect));
20 | NSImage *startCap = [[GRThemeStore proThemeStore] imageNamed:@"slider_startCap"];
21 | NSImage *centerFill = [[GRThemeStore proThemeStore] imageNamed:@"slider_centerFill"];
22 | NSImage *endCap = [[GRThemeStore proThemeStore] imageNamed:@"slider_endCap"];
23 |
24 | CGFloat fraction = 1.0;
25 | if (![self isEnabled]) fraction = 0.5;
26 |
27 | NSDrawThreePartImage(endRect, startCap, centerFill, endCap, NO, NSCompositeSourceOver, fraction, YES);
28 | }
29 |
30 | - (void)drawKnob:(NSRect)knobRect
31 | {
32 | NSImage *knobImage = [[GRThemeStore proThemeStore] imageNamed:@"slider_knob"];
33 | if (self.isHighlighted) {
34 | knobImage = [[GRThemeStore proThemeStore] imageNamed:@"slider_knob_highlighted"];
35 | }
36 |
37 | CGFloat fraction = 1.0;
38 | if (![self isEnabled]) fraction = 0.5;
39 |
40 | [knobImage drawInRect:knobRect fromRect:NSMakeRect(0, 0, knobImage.size.width, knobImage.size.height) operation:NSCompositeSourceOver fraction:fraction respectFlipped:YES hints:nil];
41 | }
42 |
43 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProColor.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProColor.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 26/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProColor.h"
10 |
11 | @implementation GRProColor
12 |
13 | + (void)drawNoiseTextureInRect:(NSRect)rect
14 | {
15 | NSBezierPath *noiseFillPath = [NSBezierPath bezierPathWithRect:rect];
16 | [noiseFillPath addClip];
17 | [[NSColor colorWithPatternImage:[[GRThemeStore proThemeStore] imageNamed:@"noise"]] setFill];
18 | [noiseFillPath fill];
19 | }
20 |
21 | + (void)drawBackgroundHighlightInRect:(NSRect)rect
22 | {
23 | [[NSGraphicsContext currentContext] saveGraphicsState];
24 |
25 | NSGradient *backgroundLightGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.08] endingColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.0]];
26 |
27 | NSPoint centerPoint = NSMakePoint(NSMidX(rect), NSMidY(rect));
28 | CGFloat radius = MAX(NSHeight(rect), NSWidth(rect))/2;
29 | [backgroundLightGradient drawFromCenter:centerPoint radius:0 toCenter:centerPoint radius:radius options:NSGradientDrawsAfterEndingLocation|NSGradientDrawsBeforeStartingLocation];
30 |
31 | [self drawNoiseTextureInRect:rect];
32 |
33 | [[NSGraphicsContext currentContext] restoreGraphicsState];
34 | }
35 |
36 | @end
37 |
38 | @implementation NSColor (GRProKitOverrides)
39 |
40 | + (CGColorRef)_focusRingCGColor
41 | {
42 | CGColorRef color = [[NSColor colorWithCalibratedRed:0.113725 green:0.376471 blue:0.74902 alpha:0.501961] CGColor];
43 | return CGColorRetain(color);
44 | }
45 |
46 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProProgressIndicator.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProProgressIndicator.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*
12 | GRProProgressIndicator - NSProgressIndicator replacement
13 | Original project with more features: https://github.com/insidegui/GRProgressIndicator
14 | */
15 |
16 | // progress bar gradient colors from top to bottom, graphite
17 | #define kProgressBarProGradientColor0 [NSColor colorWithCalibratedRed:0.261 green:0.415 blue:0.677 alpha:1.000]
18 | #define kProgressBarProGradientColor1 [NSColor colorWithCalibratedRed:0.120 green:0.284 blue:0.597 alpha:1.000]
19 | #define kProgressBarProGradientColor2 [NSColor colorWithCalibratedRed:0.095 green:0.258 blue:0.580 alpha:1.000]
20 | #define kProgressBarProGradientColor3 [NSColor colorWithCalibratedRed:0.119 green:0.325 blue:0.727 alpha:1.000]
21 | #define kProgressBarProGradientColor4 [NSColor colorWithCalibratedRed:0.159 green:0.402 blue:0.839 alpha:1.000]
22 |
23 | // progress bar gradient colors from top to bottom, inactive window
24 | #define kProgressBarInactiveGradientColor0 [NSColor colorWithCalibratedRed:0.435 green:0.446 blue:0.467 alpha:1.000]
25 | #define kProgressBarInactiveGradientColor1 [NSColor colorWithCalibratedRed:0.308 green:0.325 blue:0.348 alpha:1.000]
26 | #define kProgressBarInactiveGradientColor2 [NSColor colorWithCalibratedRed:0.297 green:0.314 blue:0.337 alpha:1.000]
27 | #define kProgressBarInactiveGradientColor3 [NSColor colorWithCalibratedRed:0.400 green:0.426 blue:0.459 alpha:1.000]
28 | #define kProgressBarInactiveGradientColor4 [NSColor colorWithCalibratedRed:0.423 green:0.450 blue:0.484 alpha:1.000]
29 |
30 | // line after progress bar gradient colors from bottom to top
31 | #define kProgressBarProgressLineGradient0 [NSColor colorWithCalibratedWhite:0.3 alpha:1.0f]
32 | #define kProgressBarProgressLineGradient1 [NSColor colorWithCalibratedWhite:0.2 alpha:1.0f]
33 |
34 | @interface GRProProgressIndicator : NSView
35 |
36 | @property (nonatomic, assign) double doubleValue;
37 | @property (nonatomic, assign) double minValue;
38 | @property (nonatomic, assign) double maxValue;
39 |
40 | @property (nonatomic, assign, getter = isIndeterminate) BOOL indeterminate;
41 |
42 | - (void)startAnimation:(id)sender;
43 | - (void)stopAnimation:(id)sender;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProBox.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProBox.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 02/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProBox.h"
10 | #import "GRProLabel.h"
11 |
12 | #define kProBoxBackgroundColor [NSColor colorWithCalibratedWhite:0.121 alpha:1.000]
13 |
14 | @implementation GRProBox
15 | {
16 | GRProLabel *_titleLabel;
17 | }
18 |
19 | - (id)initWithFrame:(NSRect)frameRect
20 | {
21 | self = [super initWithFrame:frameRect];
22 |
23 | if(!self) return nil;
24 |
25 | [self setupLabel];
26 |
27 | return self;
28 | }
29 |
30 | - (void)setupLabel
31 | {
32 | _titleLabel = [[GRProLabel alloc] initWithFrame:NSMakeRect(8, NSHeight(self.frame)-20, NSWidth(self.frame)*0.8, 20)];
33 | [_titleLabel setAutoresizingMask:NSViewMinXMargin|NSViewMaxYMargin];
34 | [_titleLabel setTextColor:[NSColor colorWithCalibratedWhite:0.642 alpha:1.000]];
35 |
36 | NSShadow *titleShadow = [[NSShadow alloc] init];
37 | titleShadow.shadowBlurRadius = 0.5;
38 | titleShadow.shadowOffset = NSMakeSize(0, 1);
39 | titleShadow.shadowColor = [NSColor colorWithCalibratedWhite:0 alpha:0.7];
40 | [_titleLabel setShadow:titleShadow];
41 |
42 | NSString *title = (self.title)? self.title : @"";
43 | [_titleLabel setStringValue:title];
44 | [_titleLabel setAutoresizingMask:NSViewMaxXMargin|NSViewMinYMargin];
45 |
46 | [self addSubview:_titleLabel];
47 | }
48 |
49 | - (void)setTitle:(NSString *)title
50 | {
51 | _title = [title copy];
52 |
53 | _titleLabel.stringValue = self.title;
54 | }
55 |
56 | - (void)drawRect:(NSRect)dirtyRect
57 | {
58 | NSBezierPath *shape = [NSBezierPath bezierPathWithRect:self.bounds];
59 | [kProBoxBackgroundColor setFill];
60 | [shape fill];
61 |
62 | NSImage *topImage = [[GRThemeStore proThemeStore] imageNamed:@"box_top"];
63 | [topImage drawInRect:NSMakeRect(0, NSHeight(self.frame)-21, NSWidth(self.frame), 21.0) fromRect:NSMakeRect(0, 0, 2.0, 21.0) operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
64 |
65 | NSImage *bottomImage = [[GRThemeStore proThemeStore] imageNamed:@"box_bottom"];
66 | [bottomImage drawInRect:NSMakeRect(0, 0, NSWidth(self.frame), 30.0) fromRect:NSMakeRect(0, 0, 2.0, 30.0) operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit.xcodeproj/xcuserdata/inside.xcuserdatad/xcschemes/GRProKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
52 |
53 |
54 |
55 |
61 |
62 |
64 |
65 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/NSData+ZLib.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSData+ZLib.m
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "NSData+ZLib.h"
10 | #import
11 |
12 | @implementation NSData (ZLib)
13 |
14 | - (NSData *)zlibDeflate
15 | {
16 | if ([self length] == 0) return self;
17 |
18 | z_stream strm;
19 |
20 | strm.zalloc = Z_NULL;
21 | strm.zfree = Z_NULL;
22 | strm.opaque = Z_NULL;
23 | strm.total_out = 0;
24 | strm.next_in=(Bytef *)[self bytes];
25 | strm.avail_in = (uInt)[self length];
26 |
27 | // Compresssion Levels:
28 | // Z_NO_COMPRESSION
29 | // Z_BEST_SPEED
30 | // Z_BEST_COMPRESSION
31 | // Z_DEFAULT_COMPRESSION
32 |
33 | if (deflateInit(&strm, Z_DEFAULT_COMPRESSION) != Z_OK) return nil;
34 |
35 | NSMutableData *compressed = [NSMutableData dataWithLength:16384]; // 16K chuncks for expansion
36 |
37 | do {
38 |
39 | if (strm.total_out >= [compressed length])
40 | [compressed increaseLengthBy: 16384];
41 |
42 | strm.next_out = [compressed mutableBytes] + strm.total_out;
43 | strm.avail_out = (uInt)([compressed length] - strm.total_out);
44 |
45 | deflate(&strm, Z_FINISH);
46 |
47 | } while (strm.avail_out == 0);
48 |
49 | deflateEnd(&strm);
50 |
51 | [compressed setLength: strm.total_out];
52 | return [NSData dataWithData: compressed];
53 | }
54 |
55 | - (NSData *)zlibInflate
56 | {
57 | if ([self length] == 0) return self;
58 |
59 | unsigned full_length = (uInt)[self length];
60 | unsigned half_length = (uInt)[self length] / 2;
61 |
62 | NSMutableData *decompressed = [NSMutableData dataWithLength: full_length + half_length];
63 | BOOL done = NO;
64 | int status;
65 |
66 | z_stream strm;
67 | strm.next_in = (Bytef *)[self bytes];
68 | strm.avail_in = (uInt)[self length];
69 | strm.total_out = 0;
70 | strm.zalloc = Z_NULL;
71 | strm.zfree = Z_NULL;
72 |
73 | if (inflateInit (&strm) != Z_OK) return nil;
74 |
75 | while (!done)
76 | {
77 | // Make sure we have enough room and reset the lengths.
78 | if (strm.total_out >= [decompressed length])
79 | [decompressed increaseLengthBy: half_length];
80 | strm.next_out = [decompressed mutableBytes] + strm.total_out;
81 | strm.avail_out = (uInt)([decompressed length] - strm.total_out);
82 |
83 | // Inflate another chunk.
84 | status = inflate (&strm, Z_SYNC_FLUSH);
85 | if (status == Z_STREAM_END) done = YES;
86 | else if (status != Z_OK) break;
87 | }
88 | if (inflateEnd (&strm) != Z_OK) return nil;
89 |
90 | // Set real length.
91 | if (done)
92 | {
93 | [decompressed setLength: strm.total_out];
94 | return [NSData dataWithData: decompressed];
95 | }
96 | else return nil;
97 | }
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProAlert.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProAlert.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProAlert.h"
10 |
11 |
12 |
13 | @implementation GRProAlert
14 | {
15 | NSModalSession _modalSession;
16 | }
17 | - (id)init
18 | {
19 | self = [super init];
20 | if(!self) return nil;
21 |
22 | self.okButtonTitle = @"Ok";
23 | self.cancelButtonTitle = @"Cancel";
24 |
25 | return self;
26 | }
27 |
28 | - (void)setupPanel
29 | {
30 | [[NSBundle bundleForClass:[GRProAlert class]] loadNibNamed:@"GRProAlert" owner:self topLevelObjects:nil];
31 |
32 | [self.okButton setDefault:YES];
33 |
34 | NSColor *labelColor = [NSColor colorWithCalibratedWhite:0.642 alpha:1.000];
35 | NSShadow *labelShadow = [[NSShadow alloc] init];
36 | labelShadow.shadowBlurRadius = 0.5;
37 | labelShadow.shadowOffset = NSMakeSize(0, 1);
38 | labelShadow.shadowColor = [NSColor colorWithCalibratedWhite:0 alpha:0.7];
39 |
40 | [self.titleLabel setTextColor:labelColor];
41 | [self.titleLabel setShadow:labelShadow];
42 | [self.informativeTextLabel setTextColor:labelColor];
43 | [self.informativeTextLabel setShadow:labelShadow];
44 |
45 | self.window.hideTrafficLights = YES;
46 | }
47 |
48 | - (void)runModal
49 | {
50 | [self setupPanel];
51 |
52 | _modalSession = [[NSApplication sharedApplication] beginModalSessionForWindow:self.window];
53 |
54 | [self.window makeKeyAndOrderFront:self];
55 | }
56 |
57 | - (void)beginSheetModalForWindow:(NSWindow *)hostWindow completionHandler:(void (^)(NSUInteger))handler
58 | {
59 | [self setupPanel];
60 | self.completionHandler = handler;
61 | [[NSApplication sharedApplication] beginSheet:self.window modalForWindow:hostWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
62 | }
63 |
64 | - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
65 | {
66 | // when the sheet finishes, we call the completion handler, if available
67 | if(self.completionHandler) self.completionHandler(self.result);
68 | }
69 |
70 | - (IBAction)okAction:(id)sender {
71 | self.result = 1;
72 | [self doCloseWindow];
73 | }
74 |
75 | - (IBAction)cancelAction:(id)sender {
76 | self.result = 0;
77 | [self doCloseWindow];
78 | }
79 |
80 | - (void)doCloseWindow
81 | {
82 | if ([self.window isSheet]) {
83 | [[NSApplication sharedApplication] endSheet:self.window];
84 | [self.window close];
85 | } else {
86 | // if we have a completion handler, we call It
87 | if(self.completionHandler) self.completionHandler(self.result);
88 |
89 | [[NSApplication sharedApplication] endModalSession:_modalSession];
90 | [self.window close];
91 | }
92 | }
93 |
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProToolbar.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProToolbar.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProToolbar.h"
10 | #import "GRProWindow.h"
11 | #import "GRProLabel.h"
12 | #import "GRProFont.h"
13 |
14 | @implementation GRProToolbar
15 |
16 | @end
17 |
18 | @interface NSToolbarItemViewer : NSView
19 | @end
20 |
21 | @interface NSToolbarItemViewer (GRProKitOverrides)
22 |
23 | @end
24 |
25 | // we use a category to override NSToolbarItemViewer,
26 | // this is the view responsible for drawing the toolbar item,
27 | // we need to change the look of selected items
28 | @implementation NSToolbarItemViewer (GRProKitOverrides)
29 |
30 | - (void)drawSelectionIndicatorInRect:(NSRect)rect
31 | {
32 | // background gradient
33 | NSColor *bgGrad0 = [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.3];
34 | NSColor *bgGrad1 = [NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0];
35 | NSGradient *selectionIndicatorGrad = [[NSGradient alloc] initWithColorsAndLocations:bgGrad1, 0.0, bgGrad0, 0.53, bgGrad1, 1.0, nil];
36 |
37 | // draw background gradient
38 | NSBezierPath *rectanglePath = [NSBezierPath bezierPathWithRect:rect];
39 | [selectionIndicatorGrad drawInBezierPath:rectanglePath angle:-90];
40 |
41 | // draw left and right borders
42 | NSRect leftBorderRect = NSMakeRect(0, 0, 1.0, NSHeight(rect));
43 | [selectionIndicatorGrad drawInRect:leftBorderRect angle:-90];
44 |
45 | NSRect rightBorderRect = NSMakeRect(NSWidth(rect)-1.0, 0, 1.0, NSHeight(rect));
46 | [selectionIndicatorGrad drawInRect:rightBorderRect angle:-90];
47 | }
48 |
49 | @end
50 |
51 | @interface _NSToolbarItemViewerLabelCellPopUpCell : NSPopUpButtonCell
52 | @end
53 |
54 | // we use a category to override the toolbar's label cell drawing
55 | @interface _NSToolbarItemViewerLabelCellPopUpCell (GRProKitOverrides)
56 |
57 | @end
58 |
59 | @implementation _NSToolbarItemViewerLabelCellPopUpCell (GRProKitOverrides)
60 |
61 | // draw toolbar's label title
62 | - (void)drawWithFrame:(NSRect)frame inView:(NSView *)view;
63 | {
64 | if(![self title]) return;
65 |
66 | NSShadow *titleShadow = [[NSShadow alloc] init];
67 | titleShadow.shadowBlurRadius = 0;
68 | titleShadow.shadowOffset = NSMakeSize(0, -1);
69 | titleShadow.shadowColor = (view.window.isKeyWindow) ? kProWindowTitleShadowColor : kProWindowTitleShadowColorNoKey;
70 |
71 | NSColor *titleColor = (view.window.isKeyWindow) ? kProWindowTitleColor : kProWindowTitleColorNoKey;
72 |
73 | NSDictionary *attributes = @{NSFontAttributeName: [GRProFont proToolbarFont], NSForegroundColorAttributeName : titleColor, NSShadowAttributeName : titleShadow};
74 |
75 | NSAttributedString *titleString = [[NSAttributedString alloc] initWithString:[self title] attributes:attributes];
76 |
77 | CGFloat centerX = frame.size.width/2-titleString.size.width/2;
78 | [titleString drawAtPoint:NSMakePoint(centerX, 0)];
79 | }
80 |
81 | @end
--------------------------------------------------------------------------------
/GRProKit Demo App/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // GRProKit Demo App
4 | //
5 | // Created by Guilherme Rambo on 31/10/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @implementation AppDelegate
12 | {
13 | double currentProgress;
14 | NSTimer *_progressTimer;
15 | NSArray *_people;
16 | }
17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
18 | {
19 | _people = @[
20 | @{@"name": @"John Appleseed", @"email" : @"johnappleseed@apple.com"},
21 | @{@"name": @"Steve Jobs", @"email" : @"sjobs@apple.com"},
22 | @{@"name": @"Phil Schiller", @"email" : @"pschiller@apple.com"},
23 | @{@"name": @"Jonathan Ive", @"email" : @"ive@apple.com"},
24 | @{@"name": @"Joe Bloggs", @"email" : @"joe@apple.com"}
25 | ];
26 | [self.tableView setDataSource:self];
27 | [self.tableView reloadData];
28 |
29 | self.box.title = @"Hello, Pro World!";
30 | }
31 |
32 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
33 | {
34 | return _people.count;
35 | }
36 |
37 | - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
38 | {
39 | if ([tableView.identifier isEqualToString:@"name"]) {
40 | return _people[row][@"name"];
41 | } else {
42 | return _people[row][@"email"];
43 | }
44 | }
45 |
46 | - (IBAction)proButtonClicked:(id)sender {
47 | self.alert = [[GRProAlert alloc] init];
48 |
49 | self.alert.title = @"This is a Pro Alert!";
50 | self.alert.informativeText = @"The Pro Alert has the beautiful Pro Window look, and works just like a NSAlert :)";
51 |
52 | if (self.runModalCheck.intValue) {
53 | self.alert.completionHandler = ^(NSUInteger result){
54 | NSLog(@"alert modal finished with result %ld", result);
55 | };
56 | [self.alert runModal];
57 | } else {
58 | [self.alert beginSheetModalForWindow:self.window completionHandler:^(NSUInteger result) {
59 | NSLog(@"alert sheet finished with result %ld", result);
60 | }];
61 | }
62 | }
63 | - (IBAction)preferences:(id)sender {
64 | [self.preferencesWindow makeKeyAndOrderFront:sender];
65 | }
66 |
67 | - (void)updateProgress:(NSTimer *)timer
68 | {
69 | currentProgress++;
70 | self.progressBar.doubleValue = currentProgress;
71 | if (currentProgress >= 100) {
72 | currentProgress = 0;
73 | [timer invalidate];
74 | [self.progressBar stopAnimation:nil];
75 | }
76 | }
77 |
78 | - (IBAction)startProgress:(id)sender {
79 | [self.progressBar startAnimation:sender];
80 | _progressTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateProgress:) userInfo:nil repeats:YES];
81 | }
82 | - (IBAction)proItem:(id)sender {
83 | }
84 | - (IBAction)otherItem:(id)sender {
85 | }
86 | - (IBAction)submenuItemAction:(id)sender {
87 | }
88 | - (IBAction)anotherSubitemAction:(id)sender {
89 | }
90 | - (IBAction)tableMenuItem1:(id)sender {
91 | NSRunAlertPanel(@"Alert Panel", @"Standard Alert Panel :D", @"Ok", @"Cancel", nil);
92 | }
93 | - (IBAction)tableMenuItem2:(id)sender {
94 | NSRunAlertPanel(@"Alert Panel 2", @"Standard Alert Panel Second Edition :D", @"Ok", @"Cancel", nil);
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProFont.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProFont.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 25/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProFont.h"
10 | #import
11 |
12 | @implementation GRProFont
13 |
14 | + (void)load
15 | {
16 | Method m0 = class_getClassMethod([NSFont class], @selector(systemFontOfSize:));
17 | Method m1 = class_getClassMethod([self class], @selector(systemFontOfSize:));
18 | method_exchangeImplementations(m0, m1);
19 | }
20 |
21 | + (NSRect)preferredFontBoundingBox
22 | {
23 | return kGRProKitPreferredFontBoundingBox;
24 | }
25 |
26 | + (BOOL)CTFontIsDefaultProFont:(CTFontRef)font
27 | {
28 |
29 | NSRect bbox = CTFontGetBoundingBox(font);
30 | NSRect pbbox = [self preferredFontBoundingBox];
31 |
32 | return bbox.size.width == pbbox.size.width && bbox.size.height == pbbox.size.height;
33 | }
34 |
35 | + (NSFontDescriptor *)proFontDescriptorWithSize:(CGFloat)size
36 | {
37 | NSFont *testFont;
38 | NSFontDescriptor *outputDescriptor = [NSFontDescriptor fontDescriptorWithName:[NSString stringWithUTF8String:kGRProKitFontName] size:size];
39 | testFont = [NSFont fontWithDescriptor:outputDescriptor size:size];
40 | if(!testFont) outputDescriptor = [NSFontDescriptor fontDescriptorWithName:[NSString stringWithUTF8String:kGRProKitFallbackFontName] size:size];
41 |
42 | return outputDescriptor;
43 | }
44 |
45 | + (CGFloat)menuFontSize
46 | {
47 | return kGRProKitDefaultFontSize+1;
48 | }
49 |
50 | + (NSFont *)systemFontOfSize:(CGFloat)fontSize
51 | {
52 | return [NSFont fontWithName:[NSString stringWithUTF8String:kGRProKitFontName] size:kGRProKitDefaultFontSize];
53 | }
54 |
55 | + (NSFont *)proLabelFont
56 | {
57 | NSFontDescriptor *descriptor = [[self class] proFontDescriptorWithSize:kGRProKitDefaultFontSize+1];
58 | return [NSFont fontWithDescriptor:[descriptor fontDescriptorWithSymbolicTraits:NSFontBoldTrait] size:kGRProKitDefaultFontSize];
59 | }
60 |
61 | + (NSFont *)proLabelFontWithSize:(CGFloat) size {
62 | NSFontDescriptor *descriptor = [[self class] proFontDescriptorWithSize:size+1];
63 | return [NSFont fontWithDescriptor:[descriptor fontDescriptorWithSymbolicTraits:NSFontBoldTrait] size:size];
64 | }
65 |
66 | + (NSFont *)proControlFont
67 | {
68 | NSFontDescriptor *descriptor = [[self class] proFontDescriptorWithSize:kGRProKitDefaultFontSize+1];
69 | return [NSFont fontWithDescriptor:descriptor size:kGRProKitDefaultFontSize-1];
70 | }
71 |
72 | + (NSFont *)proToolbarFont
73 | {
74 | NSFontDescriptor *descriptor = [[self class] proFontDescriptorWithSize:kGRProKitDefaultFontSize-1];
75 | return [NSFont fontWithDescriptor:[descriptor fontDescriptorWithSymbolicTraits:NSFontBoldTrait] size:kGRProKitDefaultFontSize-2];
76 | }
77 |
78 | + (NSFont *)proTitleFont
79 | {
80 | NSFontDescriptor *descriptor = [[self class] proFontDescriptorWithSize:kGRProKitDefaultFontSize+1];
81 | return [NSFont fontWithDescriptor:descriptor size:kGRProKitDefaultFontSize+1];
82 | }
83 |
84 | + (CGFloat)windowTitleHeightOffsetForFont:(NSFont *)font
85 | {
86 | if ([[font fontName] isEqualToString:[NSString stringWithUTF8String:kGRProKitFontName]]) {
87 | return kGRProKitDefaultFontTitleHeightOffset;
88 | } else {
89 | return kGRProKitFallbackFontTitleHeightOffset;
90 | }
91 | }
92 |
93 | @end
94 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProWindow.h:
--------------------------------------------------------------------------------
1 | //
2 | // GRProWindow.h
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 31/10/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | /*
10 | GRProWindow - a NSWindow subclass that draws a window with the "pro" look
11 | */
12 |
13 | #import
14 |
15 | // the following constants define the look and layout for the window, have fun messing around with them :)
16 |
17 | // the height for the title bar
18 | // changing this will not really work because we are assuming the titlebar will have the standard window titlebar size
19 | #define kProWindowTitlebarHeight 22
20 |
21 | // window background color
22 | #define kProWindowBackgroundColor [NSColor colorWithCalibratedWhite:0.151 alpha:1.000]
23 |
24 | // titlebar gradient colors - key window
25 | #define kProWindowTitleGradientTopActive [NSColor colorWithCalibratedWhite:0.459 alpha:1.000]
26 | #define kProWindowTitleGradientBottomActive [NSColor colorWithCalibratedWhite:0.330 alpha:1.000]
27 | // titlebar gradient colors - not key window
28 | #define kProWindowTitleGradientTop [NSColor colorWithCalibratedWhite:0.300 alpha:1.000]
29 | #define kProWindowTitleGradientBottom [NSColor colorWithCalibratedWhite:0.215 alpha:1.000]
30 | // titlebar bottom separator color
31 | #define kProWindowTitleSeparatorColor [NSColor blackColor]
32 | // titlebar top highlight color - key window
33 | #define kProWindowTitleBarHighlightColorActive [NSColor colorWithCalibratedWhite:0.647 alpha:1.000]
34 | // titlebar top highlight color - not key window
35 | #define kProWindowTitleBarHighlightColor [NSColor colorWithCalibratedWhite:0.435 alpha:1.000]
36 |
37 | #define kProWindowTitleColor [NSColor colorWithCalibratedWhite:0.038 alpha:1.000]
38 | #define kProWindowTitleColorNoKey [NSColor colorWithCalibratedWhite:0.141 alpha:1.000]
39 | #define kProWindowTitleShadowColor [NSColor colorWithCalibratedWhite:0.5 alpha:1.000]
40 | #define kProWindowTitleShadowColorNoKey [NSColor colorWithCalibratedWhite:0.5 alpha:0]
41 |
42 | // window footer gradient - key window
43 | #define kProWindowBottomGradientTopActive [NSColor colorWithCalibratedWhite:0.341 alpha:1.000]
44 | #define kProWindowBottomGradientBottomActive [NSColor colorWithCalibratedWhite:0.257 alpha:1.000]
45 | // window footer gradient - not key window
46 | #define kProWindowBottomGradientTop [NSColor colorWithCalibratedWhite:0.260 alpha:1.000]
47 | #define kProWindowBottomGradientBottom [NSColor colorWithCalibratedWhite:0.219 alpha:1.000]
48 | // window footer highlight and shadowlet colors
49 | #define kProWindowBottomHighlightColor [NSColor colorWithCalibratedWhite:0.427 alpha:1.000]
50 | #define kProWindowBottomShadowletColor [NSColor colorWithCalibratedWhite:0.225 alpha:1.000]
51 |
52 | // window widget types
53 | typedef enum {
54 | GRProThemeWidgetTypeClose = 1,
55 | GRProThemeWidgetTypeMiniaturize = 2,
56 | GRProThemeWidgetTypeZoom = 3
57 | } GRProThemeWidgetType;
58 |
59 | @interface GRProWindow : NSWindow
60 |
61 | // property to define whether or not we should display the traffic light widgets
62 | @property (nonatomic, assign) BOOL hideTrafficLights;
63 |
64 | @end
65 |
66 | // window widget: close, miniaturize and zoom buttons
67 | @interface GRProThemeWidget : NSButton
68 |
69 | @property (nonatomic, assign) GRProThemeWidgetType type;
70 | @property (nonatomic, assign) BOOL hover;
71 |
72 | @end
73 |
74 | // this is a private interface we're using
75 | @interface NSThemeFrame : NSView
76 | - (void)_drawTitleStringInClip:(NSRect)rect;
77 | - (NSAttributedString *)_currentTitleTextFieldAttributedString;
78 | - (NSButton *)autosaveButton;
79 | - (NSTextField *)_autosaveButtonSeparatorField;
80 | - (NSRect)_titlebarTitleRect;
81 | @end
82 |
83 | // window theme frame: container class we use to swizzle some drawing methods to draw a custom window frame
84 | @interface GRProThemeFrame : NSThemeFrame
85 |
86 | - (void)resetWidgets;
87 |
88 | @end
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/xcuserdata/inside.xcuserdatad/xcschemes/GRProKit Demo App.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProMenu.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProMenu.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 25/12/13.
6 | // Based on NSMenu+Dark by Seth Willits - https://github.com/swillits/NSMenu-Dark
7 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
8 | //
9 |
10 | #import "GRProMenu.h"
11 | #import "GRProFont.h"
12 | #import
13 |
14 | #import
15 |
16 | // This method is not public in 64-bit, but still exists within
17 | // the Carbon framework so we just declare it exists and link to Carbon.
18 | #if __LP64__
19 | extern void SetMenuItemProperty(MenuRef menu,
20 | MenuItemIndex item,
21 | OSType propertyCreator,
22 | OSType propertyTag,
23 | ByteCount propertySize,
24 | const void * propertyData);
25 | extern void HIMenuSetFont(MenuRef menu, MenuItemIndex item, CTFontRef font);
26 | #endif
27 |
28 | // Menus have a private implementation object, which is "always" a
29 | // NSCarbonMenuImpl instance.
30 | @interface NSMenu (Private)
31 | - (id)_menuImpl;
32 | @end
33 |
34 |
35 | // NSCarbonMenuImpl is a class, but since it's not public, using
36 | // a protocol to get at the method we want works easily.
37 | @protocol NSCarbonMenuImplProtocol
38 | - (MenuRef)_principalMenuRef;
39 | @end
40 |
41 |
42 | // Private method which sets the Dark property
43 | @interface NSMenu (DarkPrivate)
44 | - (void)makeDark;
45 | @end
46 |
47 |
48 | // Helper class used to set darkness after the Carbon MenuRef has been created.
49 | // (The MenuRef doesn't exist until tracking starts.)
50 | @interface NSMenuDarkMaker : NSObject {
51 | NSMenu * mMenu;
52 | }
53 | - (id)initWithMenu:(NSMenu *)menu;
54 | @end
55 |
56 | #pragma mark -
57 | @implementation NSMenu (Dark)
58 | static int MAKE_DARK_KEY;
59 |
60 | - (void)setDark:(BOOL)isDark;
61 | {
62 | if (isDark) {
63 | NSMenuDarkMaker * maker = [[NSMenuDarkMaker alloc] initWithMenu:self];
64 | objc_setAssociatedObject(self, &MAKE_DARK_KEY, maker, OBJC_ASSOCIATION_RETAIN);
65 | } else {
66 | objc_setAssociatedObject(self, &MAKE_DARK_KEY, nil, OBJC_ASSOCIATION_RETAIN);
67 | }
68 | }
69 |
70 |
71 | - (BOOL)isDark;
72 | {
73 | return (objc_getAssociatedObject(self, &MAKE_DARK_KEY) != nil);
74 | }
75 |
76 |
77 | - (void)makeDark;
78 | {
79 | // Make it dark
80 | id impl = [self _menuImpl];
81 | if ([impl respondsToSelector:@selector(_principalMenuRef)]) {
82 | MenuRef m = [impl _principalMenuRef];
83 | if (m) {
84 | char on = 1;
85 | SetMenuItemProperty(m, 0, 'dock', 'dark', 1, &on);
86 |
87 | CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, kGRProKitFontName, kCFStringEncodingASCII);
88 |
89 | // get a font ref with our preferred default font
90 | CTFontRef font = CTFontCreateWithName(fontName, [GRProFont menuFontSize], NULL);
91 |
92 | // if the font doesn't match our preffered font's appearance (i.e. It's not found), use the fallback
93 | if (![GRProFont CTFontIsDefaultProFont:font]) {
94 | NSLog(@"GRProKit: %s not found, using fallback font %s", kGRProKitFontName, kGRProKitFallbackFontName);
95 | fontName = CFStringCreateWithCString(kCFAllocatorDefault, kGRProKitFallbackFontName, kCFStringEncodingASCII);
96 | font = CTFontCreateWithName(fontName, [GRProFont menuFontSize], NULL);
97 | }
98 |
99 | // set the menu's font
100 | HIMenuSetFont(m, 0, font);
101 | }
102 | }
103 |
104 | // Make all submenus dark too
105 | for (NSMenuItem * item in self.itemArray) {
106 | [item.submenu makeDark];
107 | }
108 | }
109 |
110 | @end
111 |
112 | #pragma mark -
113 | @implementation NSMenuDarkMaker
114 |
115 | - (id)initWithMenu:(NSMenu *)menu;
116 | {
117 | if (!(self = [super init])) return nil;
118 | mMenu = menu;
119 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginTracking:) name:NSMenuDidBeginTrackingNotification object:mMenu];
120 | return self;
121 | }
122 |
123 |
124 | - (void)beginTracking:(NSNotification *)note;
125 | {
126 | [mMenu makeDark];
127 | }
128 |
129 | @end
130 |
131 | @implementation GRProMenu
132 |
133 | + (void)installGRProMenuImpl:(NSMenu *)menu
134 | {
135 |
136 | }
137 |
138 | - (id)init
139 | {
140 | self = [super init];
141 | if(!self) return nil;
142 |
143 | self.isDark = YES;
144 |
145 | return self;
146 | }
147 |
148 | - (id)initWithCoder:(NSCoder *)aDecoder
149 | {
150 | self = [super initWithCoder:aDecoder];
151 | if(!self) return nil;
152 |
153 | self.isDark = YES;
154 |
155 | return self;
156 | }
157 |
158 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRThemeStore.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRThemeStore.m
3 | // packtheme
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRThemeStore.h"
10 |
11 | @implementation GRThemeStore
12 | {
13 | NSData __strong *_compressedData;
14 | NSData __strong *_data;
15 | NSData __strong *_plistData;
16 | NSArray __strong *_entries;
17 | master_header_t *_themeHeader;
18 | }
19 |
20 | + (GRThemeStore *)proThemeStore
21 | {
22 | static GRThemeStore *_sharedInstance;
23 | static dispatch_once_t onceToken;
24 | dispatch_once(&onceToken, ^{
25 | // get a pointer to the framework's bundle
26 | NSBundle *bundle = [NSBundle bundleForClass:[GRThemeStore class]];
27 | // read the theme file inside the framework's resources
28 | NSData *themeFile = [NSData dataWithContentsOfFile:[bundle pathForResource:@"GRProTheme" ofType:@"pack"]];
29 |
30 | _sharedInstance = [[GRThemeStore alloc] initWithCompressedPackageData:themeFile];
31 | });
32 |
33 | return _sharedInstance;
34 | }
35 |
36 | - (id)initWithCompressedPackageData:(NSData *)data
37 | {
38 | self = [super init];
39 |
40 | if (!self) return nil;
41 |
42 | _compressedData = data;
43 |
44 | [self parseData];
45 |
46 | return self;
47 | }
48 |
49 | // parses a theme file and retrieves It's images, storing them in GRThemePiece objects inside our themePieces array
50 | - (void)parseData
51 | {
52 | // decompress file
53 | _data = [_compressedData zlibInflate];
54 |
55 | if (!_data) {
56 | NSLog(@"ThemeStore: failed to decompress theme file!");
57 | return;
58 | }
59 |
60 | // retrieve header and check
61 | _themeHeader = (master_header_t *)[[_data subdataWithRange:NSMakeRange(0, sizeof(master_header_t))] bytes];
62 | if (![self headerSanityCheck]) {
63 | NSLog(@"ThemeStore: Header sanity check failed!");
64 | return;
65 | }
66 |
67 | // retrieve the archived data
68 | _plistData = [_data subdataWithRange:NSMakeRange(_themeHeader->entries_offset, _themeHeader->start_offset-sizeof(master_header_t))];
69 | if (!_plistData) {
70 | NSLog(@"ThemeStore: Failed to read plist data!");
71 | return;
72 | }
73 |
74 | // unarchive the data, which is an NSArray of NSDictionary objects containing basic image information
75 | _entries = [NSKeyedUnarchiver unarchiveObjectWithData:_plistData];
76 | if (!_entries) {
77 | NSLog(@"ThemeStore: Failed to unarchive plist data!");
78 | return;
79 | }
80 |
81 | NSMutableArray *pieces = [[NSMutableArray alloc] init];
82 | for (NSDictionary *entry in _entries) {
83 | // get this image's offset
84 | unsigned long offset = [entry[@"offset"] unsignedLongValue];
85 | // get this image's data length
86 | unsigned long length = [entry[@"length"] unsignedLongValue];
87 | // read this image's data
88 | NSData *file = [_data subdataWithRange:NSMakeRange(_themeHeader->start_offset+offset, length)];
89 | // initialize a NSImage with the data read from the theme
90 | NSImage *image = [[NSImage alloc] initWithData:file];
91 |
92 | // create a theme piece with this information
93 | GRThemePiece *piece = [GRThemePiece themePieceWithFilename:entry[@"filename"] image:image];
94 |
95 | // add do the pieces array
96 | [pieces addObject:piece];
97 | }
98 |
99 | // save pieces in our array
100 | self.themePieces = [[NSArray alloc] initWithArray:pieces];
101 | }
102 |
103 | - (NSImage *)imageNamed:(NSString *)name
104 | {
105 | BOOL isRetina = NO;
106 | // detect retina display
107 | if ([[NSScreen mainScreen] backingScaleFactor] > 1) isRetina = YES;
108 |
109 | GRThemePiece *piece;
110 |
111 | // try to get a @2x version of the image if we are on retina
112 | if (isRetina) piece = [[self.themePieces filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"name = %@", [name stringByAppendingString:@"@2x"]]] lastObject];
113 |
114 | // fallback to default image if @2x is not found, or if we are not on retina
115 | if (!piece) piece = [[self.themePieces filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"name = %@", name]] lastObject];
116 |
117 | return [piece image];
118 | }
119 |
120 | // performs a basic sanity check to see if the theme file is valid
121 | - (BOOL)headerSanityCheck
122 | {
123 | if (_themeHeader->signature[3] != 'G' || !_themeHeader->entries_offset || !_themeHeader->start_offset) {
124 | return NO;
125 | } else {
126 | return YES;
127 | }
128 | }
129 |
130 | @end
131 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/xibs/GRProAlert.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 |
48 |
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 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProTableView.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProTableView.m
3 | // TableViewTest
4 | //
5 | // Created by Guilherme Rambo on 17/12/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProTableView.h"
10 | #import "GRThemeStore.h"
11 | #import "GRProLabel.h"
12 | #import "GRProFont.h"
13 | #import "GRProColor.h"
14 |
15 | #define kProTableViewTextLeftMargin 12.0
16 | #define kProTableViewStandardRowHeight 22.0
17 |
18 | @interface GRProTextFieldCell : NSTextFieldCell
19 | + (NSShadow *)proTextFieldShadow;
20 | + (NSParagraphStyle *)proParagraphStyle;
21 | @end
22 |
23 | @implementation NSTableHeaderCell (GRProKit)
24 |
25 | - (void)drawWithFrame:(CGRect)cellFrame highlighted:(BOOL)isHighlighted inView:(NSView *)view
26 | {
27 | CGRect fillRect, borderRect;
28 | CGRectDivide(cellFrame, &borderRect, &fillRect, 1.0, CGRectMaxYEdge);
29 |
30 | NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.265 green:0.265 blue:0.272 alpha:1.000] endingColor:[NSColor colorWithCalibratedRed:0.185 green:0.185 blue:0.195 alpha:1.000]];
31 | [gradient drawInRect:fillRect angle:90.0];
32 |
33 | [NSGraphicsContext saveGraphicsState];
34 | [GRProColor drawNoiseTextureInRect:fillRect];
35 | [NSGraphicsContext restoreGraphicsState];
36 |
37 | [[NSColor colorWithCalibratedRed:0.115 green:0.114 blue:0.123 alpha:1.000] set];
38 | NSRectFill(borderRect);
39 |
40 | NSRectFill(NSMakeRect(cellFrame.origin.x+NSWidth(cellFrame), 0, 1.0, NSHeight(cellFrame)));
41 |
42 | [[NSColor colorWithCalibratedRed:0.112 green:0.112 blue:0.115 alpha:1.000] set];
43 | NSRectFill(NSMakeRect(0, 0, NSWidth(view.frame), 1.0));
44 |
45 | [self drawInteriorWithFrame:CGRectInset(fillRect, kProTableViewTextLeftMargin, 6.0) inView:view];
46 | }
47 |
48 | - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
49 | {
50 | NSDictionary *attributes = @{NSFontAttributeName: [GRProFont proLabelFont], NSForegroundColorAttributeName : [NSColor colorWithCalibratedRed:0.81f green:0.81f blue:0.81f alpha:1.0f], NSShadowAttributeName : [GRProTextFieldCell proTextFieldShadow], NSParagraphStyleAttributeName : [GRProTextFieldCell proParagraphStyle]};
51 | [self.stringValue drawInRect:cellFrame withAttributes:attributes];
52 | }
53 |
54 | - (void)drawWithFrame:(CGRect)cellFrame inView:(NSView *)view
55 | {
56 | [self drawWithFrame:cellFrame highlighted:NO inView:view];
57 | }
58 |
59 | - (void)highlight:(BOOL)isHighlighted withFrame:(NSRect)cellFrame inView:(NSView *)view
60 | {
61 | [self drawWithFrame:cellFrame highlighted:isHighlighted inView:view];
62 | }
63 |
64 | @end
65 |
66 | @implementation GRProTextFieldCell
67 |
68 | + (NSShadow *)proTextFieldShadow
69 | {
70 | NSShadow *shadow = [[NSShadow alloc] init];
71 | shadow.shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.3];
72 | shadow.shadowOffset = NSMakeSize(0,0);
73 | shadow.shadowBlurRadius = 2.0;
74 | return shadow;
75 | }
76 |
77 | + (NSParagraphStyle *)proParagraphStyle
78 | {
79 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
80 | style.lineBreakMode = NSLineBreakByTruncatingTail;
81 |
82 | return [style copy];
83 | }
84 |
85 | - (id)initTextCell:(NSString *)aString
86 | {
87 | self = [super initTextCell:aString];
88 | if(!self) return nil;
89 |
90 | [self initializeCustomLook];
91 |
92 | return self;
93 | }
94 |
95 | - (id)initWithCoder:(NSCoder *)aDecoder
96 | {
97 | self = [super initWithCoder:aDecoder];
98 | if(!self) return nil;
99 |
100 | [self initializeCustomLook];
101 |
102 | return self;
103 | }
104 |
105 | - (void)initializeCustomLook
106 | {
107 | self.textColor = [NSColor colorWithCalibratedRed:0.84f green:0.84f blue:0.84f alpha:1.0f];
108 | [self setTruncatesLastVisibleLine:YES];
109 | }
110 |
111 | - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
112 | {
113 | NSShadow *shadow = [GRProTextFieldCell proTextFieldShadow];
114 | shadow.shadowColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.4];
115 |
116 | NSColor *textColor;
117 |
118 | NSFont *font = [GRProFont proLabelFont];
119 |
120 | NSRect finalTextRect = cellFrame;
121 | finalTextRect.size.width -= kProTableViewTextLeftMargin;
122 | finalTextRect.origin.x += kProTableViewTextLeftMargin;
123 |
124 | if (self.isHighlighted) {
125 | textColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0];
126 | } else {
127 | textColor = [NSColor colorWithCalibratedRed:0.81f green:0.81f blue:0.81f alpha:1.0f];
128 | }
129 |
130 | NSDictionary *attributes = @{NSFontAttributeName: font, NSForegroundColorAttributeName : textColor, NSShadowAttributeName : shadow, NSParagraphStyleAttributeName : [GRProTextFieldCell proParagraphStyle]};
131 | [self.stringValue drawInRect:finalTextRect withAttributes:attributes];
132 | }
133 |
134 | @end
135 |
136 | @implementation GRProTableView
137 |
138 | - (id)initWithFrame:(NSRect)frameRect
139 | {
140 | self = [super initWithFrame:frameRect];
141 | if(!self) return nil;
142 |
143 | [self initializeCustomLook];
144 |
145 | return self;
146 | }
147 |
148 | - (id)initWithCoder:(NSCoder *)aDecoder
149 | {
150 | self = [super initWithCoder:aDecoder];
151 | if(!self) return nil;
152 |
153 | [self initializeCustomLook];
154 | [self setIntercellSpacing:NSMakeSize(0, 8)];
155 |
156 | return self;
157 | }
158 |
159 | // based on: http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa
160 | - (void)highlightSelectionInClipRect:(NSRect)theClipRect
161 | {
162 | NSRange visibleRowIndexes = [self rowsInRect:theClipRect];
163 | NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
164 | unsigned long row = visibleRowIndexes.location;
165 | unsigned long endRow = row + visibleRowIndexes.length;
166 | NSGradient *gradient;
167 |
168 | // if the view is focused, use highlight color, otherwise use the out-of-focus highlight color
169 | if (self == [[self window] firstResponder] && [[self window] isMainWindow] && [[self window] isKeyWindow])
170 | {
171 | gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.202 green:0.341 blue:0.580 alpha:1.000] endingColor:[NSColor colorWithCalibratedRed:0.157 green:0.265 blue:0.446 alpha:1.000]];
172 | } else {
173 | gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.350 green:0.391 blue:0.423 alpha:1.000] endingColor:[NSColor colorWithCalibratedRed:0.272 green:0.296 blue:0.329 alpha:1.000]];
174 | }
175 |
176 | // draw highlight for the visible, selected rows
177 | for (row = row; row < endRow; row++)
178 | {
179 | if([selectedRowIndexes containsIndex:row])
180 | {
181 | NSRect selectionRect = [self rectOfRow:row];
182 | NSBezierPath *path = [NSBezierPath bezierPathWithRect:selectionRect]; //6.0
183 |
184 | [gradient drawInBezierPath:path angle:90];
185 | }
186 | }
187 | }
188 |
189 | - (void)initializeCustomLook
190 | {
191 | NSRect headerRect = self.headerView.frame;
192 | headerRect.size.height = 32.0;
193 | self.headerView.frame = headerRect;
194 | self.backgroundColor = [NSColor colorWithCalibratedRed:0.16f green:0.16f blue:0.17f alpha:1.0f];
195 | self.rowHeight = kProTableViewStandardRowHeight;
196 |
197 | // cause scroll view to draw correctly
198 | self.enclosingScrollView.backgroundColor = self.backgroundColor;
199 | }
200 |
201 | - (void)drawBackgroundInClipRect:(NSRect)dirtyRect
202 | {
203 | [self.backgroundColor setFill];
204 | NSRectFill(self.frame);
205 | }
206 |
207 | @end
208 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProButton.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProButton.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProButton.h"
10 | #import
11 | #import "GRProFont.h"
12 | #import "GRProMenu.h"
13 |
14 | @interface GRProButtonOverlayView : NSView
15 | @end
16 |
17 | @implementation GRProButton
18 | {
19 | GRProButtonOverlayView *_overlayView;
20 | }
21 |
22 | - (void)setDefault:(BOOL)isDefault
23 | {
24 | _isDefault = isDefault;
25 |
26 | // if the button is the default, we need to setup the overlay view,
27 | // this view will be animated to creat that flashing button effect
28 | if (isDefault) {
29 | // this is required for the animation to work correctly
30 | self.wantsLayer = YES;
31 |
32 | if (!_overlayView) {
33 | // create the overlay view and add It as a subview
34 | _overlayView = [[GRProButtonOverlayView alloc] initWithFrame:NSMakeRect(0, 0, NSWidth(self.frame), NSHeight(self.frame))];
35 | _overlayView.alphaValue = 0;
36 | [self addSubview:_overlayView];
37 |
38 | // start overlay animation
39 | [self animateOverlay];
40 | }
41 | } else {
42 | if (_overlayView) [_overlayView removeFromSuperview];
43 | }
44 | }
45 |
46 | // animate overlay in
47 | - (void)animateOverlay
48 | {
49 | [NSAnimationContext beginGrouping];
50 | [[NSAnimationContext currentContext] setDuration:1.5];
51 |
52 | [[NSAnimationContext currentContext] setCompletionHandler:^{
53 | [self animateOverlayReverse];
54 | }];
55 |
56 | _overlayView.animator.alphaValue = 1;
57 |
58 | [NSAnimationContext endGrouping];
59 | }
60 | // animate overlay out
61 | - (void)animateOverlayReverse
62 | {
63 | [NSAnimationContext beginGrouping];
64 | [[NSAnimationContext currentContext] setDuration:1.5];
65 | [[NSAnimationContext currentContext] setCompletionHandler:^{
66 | [self animateOverlay];
67 | }];
68 |
69 | _overlayView.animator.alphaValue = 0;
70 |
71 | [NSAnimationContext endGrouping];
72 | }
73 |
74 | @end
75 |
76 | @implementation GRProButtonCell
77 |
78 | // this method is responsible for drawing the title of the button
79 | // we override It so we can change the font's attributes
80 | - (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
81 | {
82 | NSMutableParagraphStyle *pstyle = [[NSMutableParagraphStyle alloc] init];
83 | pstyle.alignment = NSCenterTextAlignment;
84 |
85 | // text shadow
86 | NSShadow *shadow = [[NSShadow alloc] init];
87 | if (self.isHighlighted) {
88 | // text shadow for button pressed state
89 | shadow.shadowBlurRadius = 6;
90 | shadow.shadowColor = [NSColor colorWithCalibratedRed:0.085 green:0.206 blue:0.820 alpha:1.000];
91 | shadow.shadowOffset = NSMakeSize(0, 0);
92 | } else {
93 | // text shadow for normal button state
94 | shadow.shadowBlurRadius = 1;
95 | shadow.shadowColor = [NSColor colorWithCalibratedWhite:0 alpha:0.7];
96 | shadow.shadowOffset = NSMakeSize(0, -1);
97 | }
98 |
99 | // text color
100 | NSColor *textColor;
101 | if (self.isHighlighted) {
102 | // text color for pressed state
103 | textColor = [NSColor colorWithCalibratedWhite:0.715 alpha:1.000];
104 | } else {
105 | // text color for normal state
106 | textColor = [NSColor colorWithCalibratedWhite:0.415 alpha:1.000];
107 | }
108 |
109 | if (![self isEnabled]) {
110 | textColor = [NSColor colorWithCalibratedWhite:0.415 alpha:0.500];
111 | }
112 |
113 | // configure font attributes (font name and size, color, paragraph style and shadow)
114 | NSDictionary *fontAttributes = @{NSFontAttributeName: [GRProFont proLabelFont],
115 | NSForegroundColorAttributeName: textColor,
116 | NSParagraphStyleAttributeName: pstyle,
117 | NSShadowAttributeName: shadow};
118 |
119 | // create a new attributed string with our custom attributes and the original text
120 | NSAttributedString *modifiedTitle = [[NSAttributedString alloc] initWithString:title.string attributes:fontAttributes];
121 |
122 | return [super drawTitle:modifiedTitle withFrame:frame inView:controlView];
123 | }
124 |
125 | // draws the button's bezel
126 | - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
127 | {
128 | NSImage *startCap;
129 | NSImage *centerFill;
130 | NSImage *endCap;
131 |
132 | if (self.isHighlighted) {
133 | // images for pressed state
134 | startCap = [[GRThemeStore proThemeStore] imageNamed:@"startCap_highlighted"];
135 | centerFill = [[GRThemeStore proThemeStore] imageNamed:@"centerFill_highlighted"];
136 | endCap = [[GRThemeStore proThemeStore] imageNamed:@"endCap_highlighted"];
137 | } else {
138 | // images for normal state
139 | startCap = [[GRThemeStore proThemeStore] imageNamed:@"startCap"];
140 | centerFill = [[GRThemeStore proThemeStore] imageNamed:@"centerFill"];
141 | endCap = [[GRThemeStore proThemeStore] imageNamed:@"endCap"];
142 | }
143 |
144 | // draw the images
145 | NSDrawThreePartImage(frame, startCap, centerFill, endCap, NO, NSCompositeSourceOver, 1.0, YES);
146 | }
147 |
148 | - (NSRect)titleRectForBounds:(NSRect)theRect
149 | {
150 | // we basically make the title occupy the whole button, and center It using paragraph styles (see drawTitle:... above)
151 | return NSMakeRect(0, 0, NSWidth(theRect), NSHeight(theRect));
152 | }
153 |
154 | @end
155 |
156 | @implementation GRProCheckboxCell
157 |
158 | - (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
159 | {
160 | NSString *imageBasename = @"checkbox";
161 | NSString *imageSuffix1 = @"";
162 | NSString *imageSuffix2 = @"";
163 |
164 | if (self.intValue == 0) {
165 | imageSuffix1 = @"_off";
166 | } else {
167 | imageSuffix1 = @"_on";
168 | }
169 |
170 | if (self.isHighlighted) {
171 | imageSuffix2 = @"_highlighted";
172 | }
173 |
174 | CGFloat fraction = 1.0;
175 | // if the control is disabled, we draw the image with half the alpha
176 | if (!self.isEnabled) fraction = 0.5;
177 |
178 | NSString *imageName = [NSString stringWithFormat:@"%@%@%@", imageBasename, imageSuffix1, imageSuffix2];
179 |
180 | NSImage *theImage = [[GRThemeStore proThemeStore] imageNamed:imageName];
181 |
182 | NSRect finalRect = NSMakeRect(frame.origin.x, frame.origin.y-1, NSWidth(frame), NSHeight(frame));
183 |
184 | [theImage drawInRect:finalRect fromRect:NSMakeRect(0, 0, theImage.size.width-1, theImage.size.height) operation:NSCompositeSourceOver fraction:fraction respectFlipped:YES hints:nil];
185 | }
186 |
187 | - (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
188 | {
189 | // text color
190 | NSColor *textColor = [NSColor colorWithCalibratedWhite:0.415 alpha:1.000];
191 |
192 | if (![self isEnabled]) textColor = [NSColor colorWithCalibratedWhite:0.415 alpha:0.500];
193 |
194 | NSMutableParagraphStyle *pstyle = [[NSMutableParagraphStyle alloc] init];
195 | pstyle.alignment = NSLeftTextAlignment;
196 |
197 | NSShadow *shadow = [[NSShadow alloc] init];
198 | shadow.shadowBlurRadius = 1;
199 | shadow.shadowColor = [NSColor colorWithCalibratedWhite:0 alpha:0.7];
200 | shadow.shadowOffset = NSMakeSize(0, -1);
201 |
202 | // configure font attributes (font name and size, color, paragraph style and shadow)
203 | NSDictionary *fontAttributes = @{NSFontAttributeName: [GRProFont proLabelFont],
204 | NSForegroundColorAttributeName: textColor,
205 | NSParagraphStyleAttributeName: pstyle,
206 | NSShadowAttributeName: shadow};
207 |
208 | // create a new attributed string with our custom attributes and the original text
209 | NSAttributedString *modifiedTitle = [[NSAttributedString alloc] initWithString:title.string attributes:fontAttributes];
210 |
211 | return [super drawTitle:modifiedTitle withFrame:frame inView:controlView];
212 | }
213 |
214 | @end
215 |
216 | @implementation GRProRadioButtonCell
217 |
218 | - (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
219 | {
220 | NSString *imageBasename = @"radio";
221 | NSString *imageSuffix1 = @"";
222 | NSString *imageSuffix2 = @"";
223 |
224 | if (self.intValue == 0) {
225 | imageSuffix1 = @"_off";
226 | } else {
227 | imageSuffix1 = @"_on";
228 | }
229 |
230 | if (self.isHighlighted) {
231 | imageSuffix2 = @"_highlighted";
232 | }
233 |
234 | CGFloat fraction = 1.0;
235 | // if the control is disabled, we draw the image with half the alpha
236 | if (!self.isEnabled) fraction = 0.5;
237 |
238 | NSString *imageName = [NSString stringWithFormat:@"%@%@%@", imageBasename, imageSuffix1, imageSuffix2];
239 |
240 | NSImage *theImage = [[GRThemeStore proThemeStore] imageNamed:imageName];
241 |
242 | NSRect finalRect = NSMakeRect(frame.origin.x, frame.origin.y-1, NSWidth(frame), NSHeight(frame));
243 |
244 | [theImage drawInRect:finalRect fromRect:NSMakeRect(0, 0, theImage.size.width, theImage.size.height) operation:NSCompositeSourceOver fraction:fraction respectFlipped:YES hints:nil];
245 |
246 | // draw focus
247 | if ([[self.controlView.window firstResponder] isEqual:self.controlView]) {
248 | NSImage *focusImage = [[GRThemeStore proThemeStore] imageNamed:@"radio_focus"];
249 | [focusImage drawInRect:finalRect fromRect:NSMakeRect(0, 0, focusImage.size.width, focusImage.size.height) operation:NSCompositePlusLighter fraction:1.0 respectFlipped:YES hints:nil];
250 | }
251 | }
252 |
253 | @end
254 |
255 | @implementation GRProPopUpButtonCell
256 |
257 | - (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView
258 | {
259 | NSMutableParagraphStyle *pstyle = [[NSMutableParagraphStyle alloc] init];
260 | pstyle.alignment = NSLeftTextAlignment;
261 |
262 | // text shadow
263 | NSShadow *shadow = [[NSShadow alloc] init];
264 | // text shadow for normal button state
265 | shadow.shadowBlurRadius = 1;
266 | shadow.shadowColor = [NSColor colorWithCalibratedWhite:0 alpha:0.7];
267 | shadow.shadowOffset = NSMakeSize(0, -1);
268 |
269 | // text color
270 | NSColor *textColor;
271 | // text color for normal state
272 | textColor = [NSColor colorWithCalibratedWhite:0.765 alpha:1.000];
273 |
274 | if (![self isEnabled]) {
275 | textColor = [NSColor colorWithCalibratedWhite:0.415 alpha:0.500];
276 | }
277 |
278 | // configure font attributes (font name and size, color, paragraph style and shadow)
279 | NSDictionary *fontAttributes = @{NSFontAttributeName: [GRProFont proLabelFont],
280 | NSForegroundColorAttributeName: textColor,
281 | NSParagraphStyleAttributeName: pstyle,
282 | NSShadowAttributeName: shadow};
283 |
284 | // create a new attributed string with our custom attributes and the original text
285 | NSAttributedString *modifiedTitle = [[NSAttributedString alloc] initWithString:title.string attributes:fontAttributes];
286 | frame.origin.y -= 1;
287 | return [super drawTitle:modifiedTitle withFrame:frame inView:controlView];
288 | }
289 |
290 | - (NSRect)titleRectForBounds:(NSRect)theRect
291 | {
292 | return NSMakeRect(8, 5, NSWidth(theRect), NSHeight(theRect));
293 | }
294 |
295 | - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
296 | {
297 | NSImage *startCap;
298 | NSImage *centerFill;
299 | NSImage *endCap;
300 |
301 | if (self.isHighlighted) {
302 | // images for pressed state
303 | startCap = [[GRThemeStore proThemeStore] imageNamed:@"popup_startCap_highlighted"];
304 | centerFill = [[GRThemeStore proThemeStore] imageNamed:@"popup_centerFill_highlighted"];
305 | endCap = [[GRThemeStore proThemeStore] imageNamed:@"popup_endCap_highlighted"];
306 | } else {
307 | // images for normal state
308 | startCap = [[GRThemeStore proThemeStore] imageNamed:@"popup_startCap"];
309 | centerFill = [[GRThemeStore proThemeStore] imageNamed:@"popup_centerFill"];
310 | endCap = [[GRThemeStore proThemeStore] imageNamed:@"popup_endCap"];
311 | }
312 |
313 | // draw the images
314 | NSDrawThreePartImage(frame, startCap, centerFill, endCap, NO, NSCompositeSourceOver, 1.0, YES);
315 | }
316 |
317 |
318 | - (id)initWithCoder:(NSCoder *)aDecoder
319 | {
320 | self = [super initWithCoder:aDecoder];
321 | if(!self) return nil;
322 |
323 | [GRProMenu installGRProMenuImpl:self.menu];
324 |
325 | return self;
326 | }
327 |
328 | @end
329 |
330 | // just a blue overlay view to use with GRProButton when It's set to default
331 | @implementation GRProButtonOverlayView
332 |
333 | - (id)initWithFrame:(NSRect)frameRect
334 | {
335 | self = [super initWithFrame:frameRect];
336 | if(!self) return nil;
337 |
338 | return self;
339 | }
340 |
341 | - (void)drawRect:(NSRect)dirtyRect
342 | {
343 | NSBezierPath *bezierPath = [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(0, 1, NSWidth(self.frame), NSHeight(self.frame)-1) xRadius:4 yRadius:4];
344 | [bezierPath addClip];
345 |
346 | [[NSColor colorWithCalibratedRed:0 green:0 blue:1.0 alpha:0.3] setFill];
347 | NSRectFill(dirtyRect);
348 | }
349 |
350 | @end
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProProgressIndicator.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProProgressIndicator.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 03/11/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProProgressIndicator.h"
10 | #import
11 |
12 | // progress bar corner radius
13 | #define kProgressBarCornerRadius 3.0
14 |
15 | // defines the width and spacing of the "water" particles
16 | #define kParticleWidth 34.0
17 | #define kParticleSpacing 15.0
18 |
19 | // defines the duration of each animation step,
20 | // tweak this to change animation behavior
21 | #define kProgressIndicatorAnimationSleepInterval 0.02
22 |
23 | // defines the duration of the animation used
24 | // when doubleValue is changed
25 | #define kDoubleValueAnimationDuration 0.3
26 |
27 | @interface GRProProgressIndicator ()
28 |
29 | @property (nonatomic, assign) double internalDoubleValue;
30 |
31 | @end
32 |
33 | @implementation GRProProgressIndicator
34 | {
35 | // cached data
36 | NSColor *_particleGrad1;
37 | NSColor *_particleGrad2;
38 | NSGradient *_particleGradient;
39 | NSImage *_bezelTopLeftCorner;
40 | NSImage *_bezelTopEdgeFill;
41 | NSImage *_bezelTopRightCorner;
42 | NSImage *_bezelLeftEdgeFill;
43 | NSImage *_bezelCenterFill;
44 | NSImage *_bezelRightEdgeFill;
45 | NSImage *_bezelBottomLeftCorner;
46 | NSImage *_bezelBottomEdgeFill;
47 | NSImage *_bezelBottomRightCorner;
48 | NSGradient *_progressBarGradient;
49 | NSGradient *_progressBarLineGradient;
50 | NSColor *_indeterminateGradientColor0;
51 | NSColor *_indeterminateGradientColor1;
52 | NSColor *_indeterminateGradientColor2;
53 | NSColor *_indeterminateGradientColor3;
54 | NSGradient *_indeterminateGradient;
55 |
56 | // theme colors
57 | NSColor *_gradientColor0;
58 | NSColor *_gradientColor1;
59 | NSColor *_gradientColor2;
60 | NSColor *_gradientColor3;
61 | NSColor *_gradientColor4;
62 | NSColor *_inactiveGradientColor0;
63 | NSColor *_inactiveGradientColor1;
64 | NSColor *_inactiveGradientColor2;
65 | NSColor *_inactiveGradientColor3;
66 | NSColor *_inactiveGradientColor4;
67 |
68 | // defines if we are currently animating or not
69 | BOOL _animating;
70 |
71 | // animation counter
72 | int _currentAnimationStep;
73 | }
74 |
75 | - (id)initWithFrame:(NSRect)frame
76 | {
77 | self = [super initWithFrame:frame];
78 | if (self) {
79 | // initialize images used to draw our bezel
80 | _bezelTopLeftCorner = [[GRThemeStore proThemeStore] imageNamed:@"pi_topLeft"];
81 | _bezelTopEdgeFill = [[GRThemeStore proThemeStore] imageNamed:@"pi_topFill"];
82 | _bezelTopRightCorner = [[GRThemeStore proThemeStore] imageNamed:@"pi_topRight"];
83 | _bezelLeftEdgeFill = [[GRThemeStore proThemeStore] imageNamed:@"pi_leftFill"];
84 | _bezelCenterFill = [[GRThemeStore proThemeStore] imageNamed:@"pi_centerFill"];
85 | _bezelRightEdgeFill = [[GRThemeStore proThemeStore] imageNamed:@"pi_rightFill"];
86 | _bezelBottomLeftCorner = [[GRThemeStore proThemeStore] imageNamed:@"pi_bottomLeft"];
87 | _bezelBottomEdgeFill = [[GRThemeStore proThemeStore] imageNamed:@"pi_bottomFill"];
88 | _bezelBottomRightCorner = [[GRThemeStore proThemeStore] imageNamed:@"pi_bottomRight"];
89 |
90 | // setup defaults
91 | self.minValue = 0;
92 | self.maxValue = 100;
93 | self.doubleValue = 0;
94 | [self setupTheme];
95 | }
96 | return self;
97 | }
98 |
99 | - (void)setupTheme
100 | {
101 | _gradientColor0 = kProgressBarProGradientColor0;
102 | _gradientColor1 = kProgressBarProGradientColor1;
103 | _gradientColor2 = kProgressBarProGradientColor2;
104 | _gradientColor3 = kProgressBarProGradientColor3;
105 | _gradientColor4 = kProgressBarProGradientColor4;
106 | _inactiveGradientColor0 = kProgressBarInactiveGradientColor0;
107 | _inactiveGradientColor1 = kProgressBarInactiveGradientColor1;
108 | _inactiveGradientColor2 = kProgressBarInactiveGradientColor2;
109 | _inactiveGradientColor3 = kProgressBarInactiveGradientColor3;
110 | _inactiveGradientColor4 = kProgressBarInactiveGradientColor4;
111 |
112 | if(!_animating) [self setNeedsDisplay:YES];
113 | }
114 |
115 | // setup our observation of the window's properties
116 | - (void)viewDidMoveToWindow
117 | {
118 | [[NSNotificationCenter defaultCenter] removeObserver:self];
119 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyChanged:) name:NSWindowDidBecomeKeyNotification object:self.window];
120 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowKeyChanged:) name:NSWindowDidResignKeyNotification object:self.window];
121 | }
122 |
123 | - (void)windowKeyChanged:(NSNotification *)notification
124 | {
125 | _progressBarGradient = nil;
126 |
127 | // we avoid calling setNeedsDisplay: while animation is on to prevent glitches
128 | if(!_animating) [self setNeedsDisplay:YES];
129 | }
130 |
131 | - (void)setDoubleValue:(double)doubleValue
132 | {
133 | // the setting of the doubleValue is not animated if the new value is less than
134 | // the current value and if the PI is indeterminate
135 | if (doubleValue > _doubleValue && !self.isIndeterminate) {
136 | self.animator.internalDoubleValue = doubleValue;
137 | } else {
138 | self.internalDoubleValue = doubleValue;
139 | }
140 |
141 | _doubleValue = doubleValue;
142 | }
143 |
144 | - (void)setInternalDoubleValue:(double)internalDoubleValue
145 | {
146 | _internalDoubleValue = internalDoubleValue;
147 |
148 | // we only call setNeedsDisplay: if the animation is not in progress,
149 | // if we where to call It during animation, this could cause glitches
150 | if(!_animating) [self setNeedsDisplay:YES];
151 | }
152 |
153 | - (void)setIndeterminate:(BOOL)indeterminate
154 | {
155 | _indeterminate = indeterminate;
156 | }
157 |
158 | // calculate the rect of the progress bar inside based on the current doubleValue
159 | - (NSRect)progressBarRect
160 | {
161 | double scaledDoubleValue;
162 |
163 | if (_indeterminate) {
164 | scaledDoubleValue = _maxValue;
165 | } else {
166 | scaledDoubleValue = _internalDoubleValue*(_maxValue-_minValue)/_maxValue-_minValue;
167 | }
168 |
169 | return NSMakeRect(1, 2, round(scaledDoubleValue/_maxValue*NSWidth(self.frame)), NSHeight(self.frame)-3);
170 | }
171 |
172 | - (void)startAnimation:(id)sender
173 | {
174 | if(_animating) return;
175 |
176 | // detach a new thread to handle animation updates
177 | [NSThread detachNewThreadSelector:@selector(render:) toTarget:self withObject:nil];
178 | }
179 |
180 | - (void)stopAnimation:(id)sender
181 | {
182 | if(!_animating) return;
183 |
184 | _animating = NO;
185 | [self setNeedsDisplay:YES];
186 | }
187 |
188 | - (id)animationForKey:(NSString *)key
189 | {
190 | // our internalDoubleValue is used to make the value increments smoother
191 | if ([key isEqualToString:@"internalDoubleValue"]) {
192 | CABasicAnimation *animation = [CABasicAnimation animation];
193 | animation.duration = kDoubleValueAnimationDuration;
194 |
195 | return animation;
196 | }
197 |
198 | return [super animationForKey:key];
199 | }
200 |
201 | // animation thread loop
202 | - (void)render:(id)sender
203 | {
204 | @autoreleasepool {
205 |
206 | // we are now animating
207 | _animating = YES;
208 |
209 | // animation loop
210 | while (_animating) {
211 | // the animation happens until it's walked back the width of a particle,
212 | // when this is the case, the frame will look the same as in the start, so we go back and loop
213 | if(_currentAnimationStep >= kParticleWidth) _currentAnimationStep = 0;
214 |
215 | _currentAnimationStep++;
216 |
217 | // render the view
218 | [self setNeedsDisplay:YES];
219 |
220 | // delay to control framerate
221 | [NSThread sleepForTimeInterval:kProgressIndicatorAnimationSleepInterval];
222 | }
223 |
224 | }
225 |
226 | [NSThread exit];
227 | }
228 |
229 | - (void)drawRect:(NSRect)dirtyRect
230 | {
231 | // draw bezel using nine images
232 | NSDrawNinePartImage(dirtyRect, _bezelTopLeftCorner, _bezelTopEdgeFill, _bezelTopRightCorner, _bezelLeftEdgeFill, _bezelCenterFill, _bezelRightEdgeFill, _bezelBottomLeftCorner, _bezelBottomEdgeFill, _bezelBottomRightCorner, NSCompositeSourceOver, 1.0, NO);
233 |
234 | // this will limit our drawing to the inside of the bezel
235 | NSRect clipRect = NSMakeRect(1, 2, NSWidth(self.frame)-2, NSHeight([self progressBarRect]));
236 | [[NSBezierPath bezierPathWithRoundedRect:clipRect xRadius:kProgressBarCornerRadius yRadius:kProgressBarCornerRadius] addClip];
237 |
238 | // draw progress bar
239 | [self drawProgressBar];
240 |
241 | // draw particle animation step if needed
242 | if(_animating) {
243 | if (!self.isIndeterminate) {
244 | [self drawAnimationStep];
245 | } else {
246 | [self drawIndeterminateAnimationStep];
247 | }
248 | }
249 | }
250 |
251 | // this method is responsible of drawing the progress bar itself
252 | - (void)drawProgressBar
253 | {
254 | if (self.doubleValue <= 0) return;
255 |
256 | NSRect progressBarRect = [self progressBarRect];
257 |
258 | // determine the correct gradient and shadow colors based on
259 | // the window's key state, the system's appearance preferences and current theme
260 | if(!_progressBarGradient) {
261 | if ([self.window isKeyWindow]) {
262 | _progressBarGradient = [[NSGradient alloc] initWithColorsAndLocations:
263 | _gradientColor0, 0.0,
264 | _gradientColor1, 0.48,
265 | _gradientColor2, 0.49,
266 | _gradientColor3, 0.82,
267 | _gradientColor4, 1.0, nil];
268 | } else {
269 | _progressBarGradient = [[NSGradient alloc] initWithColorsAndLocations:
270 | _inactiveGradientColor0, 0.0,
271 | _inactiveGradientColor1, 0.48,
272 | _inactiveGradientColor2, 0.49,
273 | _inactiveGradientColor3, 1.0, nil];
274 | }
275 | }
276 |
277 | // the progress bar rectangle
278 | NSBezierPath *rectanglePath = [NSBezierPath bezierPathWithRect:progressBarRect];
279 | [_progressBarGradient drawInBezierPath: rectanglePath angle: -90];
280 | }
281 |
282 |
283 | // this method is responsible of drawing the aqua "water" particles animation
284 | - (void)drawAnimationStep
285 | {
286 | // initialize colors and gradient only once
287 | if(!_particleGrad1) {
288 | _particleGrad1 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 0.07];
289 | _particleGrad2 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 0];
290 | _particleGradient = [[NSGradient alloc] initWithStartingColor: _particleGrad1 endingColor: _particleGrad2];
291 | }
292 |
293 | // get progress rect and check if it's empty
294 | NSRect progressBarRect = [self progressBarRect];
295 | NSBezierPath *progressPath = [NSBezierPath bezierPathWithRoundedRect:progressBarRect xRadius:kProgressBarCornerRadius yRadius:kProgressBarCornerRadius];
296 | // if the rect is empty we don't do anything
297 | if ([progressPath isEmpty]) return;
298 |
299 | // limits the drawing of the particles to be only inside the progress area
300 | [progressPath addClip];
301 |
302 | // calculate how many particles we can fit inside the progress rect and add some extra for good luck :P
303 | int particlePitch = round(NSWidth(progressBarRect)/kParticleWidth)+2;
304 |
305 | // value used to calculate the X position of a particle
306 | CGFloat particleDelta = kParticleWidth+kParticleSpacing-kParticleWidth/2;
307 |
308 | for (int i = 0; i < particlePitch; i++) {
309 | // calculate X position of particle
310 | CGFloat particleX = (i*particleDelta)-_currentAnimationStep;
311 |
312 | // make circle used do draw the particle's gradient
313 | NSBezierPath *particlePath = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(particleX, 3, kParticleWidth, 15)];
314 | [NSGraphicsContext saveGraphicsState];
315 | [[NSGraphicsContext currentContext] setCompositingOperation:NSCompositePlusLighter];
316 | [particlePath addClip];
317 |
318 | // draw particle gradient
319 | NSPoint gradientPoint = NSMakePoint(particleX+17, NSHeight(self.frame)/2.0);
320 | NSGradientDrawingOptions options = NSGradientDrawsBeforeStartingLocation | NSGradientDrawsAfterEndingLocation;
321 | [_particleGradient drawFromCenter: gradientPoint radius: 0
322 | toCenter: gradientPoint radius: 12.72
323 | options: options];
324 |
325 | [NSGraphicsContext restoreGraphicsState];
326 | }
327 | }
328 |
329 | // this method is responsible of drawing the stripes animation when the PI is indeterminate
330 | - (void)drawIndeterminateAnimationStep
331 | {
332 | #define kIndeterminateParticleWidth 34.0
333 | #define kIndeterminateParticleSpacing 16.0
334 |
335 | if(!_indeterminateGradient) {
336 | _indeterminateGradientColor0 = [NSColor colorWithCalibratedRed: 0.917 green: 0.917 blue: 0.916 alpha: 1];
337 | _indeterminateGradientColor1 = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 1];
338 | _indeterminateGradientColor2 = [NSColor colorWithCalibratedRed: 0.951 green: 0.951 blue: 0.951 alpha: 1];
339 | _indeterminateGradientColor3 = [NSColor colorWithCalibratedRed: 0.907 green: 0.907 blue: 0.907 alpha: 1];
340 |
341 | _indeterminateGradient = [[NSGradient alloc] initWithColorsAndLocations:
342 | _indeterminateGradientColor0, 0.0,
343 | _indeterminateGradientColor1, 0.48,
344 | _indeterminateGradientColor2, 0.49,
345 | _indeterminateGradientColor3, 1.0, nil];
346 | }
347 |
348 | NSRect progressBarRect = [self progressBarRect];
349 | int particlePitch = round(NSWidth(progressBarRect)/kIndeterminateParticleWidth)+2;
350 |
351 | CGFloat particleDelta = kIndeterminateParticleWidth+kIndeterminateParticleSpacing-kIndeterminateParticleWidth/2;
352 |
353 | for (int i = 0; i < particlePitch; i++) {
354 | CGFloat particleX = (i*particleDelta)+_currentAnimationStep;
355 |
356 | NSBezierPath *particlePath = [NSBezierPath bezierPath];
357 | [particlePath moveToPoint: NSMakePoint(particleX-10, NSHeight(self.frame))];
358 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth/2-30, NSHeight(self.frame))];
359 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth-30, 0)];
360 | [particlePath lineToPoint: NSMakePoint(particleX+kIndeterminateParticleWidth/2-30, 0)];
361 | [particlePath lineToPoint: NSMakePoint(particleX-30, NSHeight(self.frame))];
362 | [particlePath closePath];
363 | [_indeterminateGradient drawInBezierPath:particlePath angle:-90];
364 | }
365 | }
366 |
367 | @end
--------------------------------------------------------------------------------
/GRProKit Demo App.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | DD7717DC1822AC5D00482CBE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD7717DB1822AC5D00482CBE /* Cocoa.framework */; };
11 | DD7717E61822AC5D00482CBE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD7717E41822AC5D00482CBE /* InfoPlist.strings */; };
12 | DD7717E81822AC5D00482CBE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7717E71822AC5D00482CBE /* main.m */; };
13 | DD7717EC1822AC5D00482CBE /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = DD7717EA1822AC5D00482CBE /* Credits.rtf */; };
14 | DD7717EF1822AC5D00482CBE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7717EE1822AC5D00482CBE /* AppDelegate.m */; };
15 | DD7717F21822AC5D00482CBE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = DD7717F01822AC5D00482CBE /* MainMenu.xib */; };
16 | DD7717F41822AC5D00482CBE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD7717F31822AC5D00482CBE /* Images.xcassets */; };
17 | DD7718531822ACC000482CBE /* GRProKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = DD77184D1822AC7900482CBE /* GRProKit.framework */; };
18 | DD7718541822AD0500482CBE /* GRProKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD77184D1822AC7900482CBE /* GRProKit.framework */; };
19 | DD882486186CDDE2002975DE /* edit.png in Resources */ = {isa = PBXBuildFile; fileRef = DD882483186CDDE2002975DE /* edit.png */; };
20 | DD882487186CDDE2002975DE /* grab.png in Resources */ = {isa = PBXBuildFile; fileRef = DD882484186CDDE2002975DE /* grab.png */; };
21 | DD882488186CDDE2002975DE /* xcode.png in Resources */ = {isa = PBXBuildFile; fileRef = DD882485186CDDE2002975DE /* xcode.png */; };
22 | DD88248A186CDDFC002975DE /* ICONS.txt in Resources */ = {isa = PBXBuildFile; fileRef = DD882489186CDDFC002975DE /* ICONS.txt */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | DD77184C1822AC7900482CBE /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = DD7718471822AC7800482CBE /* GRProKit.xcodeproj */;
29 | proxyType = 2;
30 | remoteGlobalIDString = DD7718191822AC7800482CBE;
31 | remoteInfo = GRProKit;
32 | };
33 | DD7718501822ACAB00482CBE /* PBXContainerItemProxy */ = {
34 | isa = PBXContainerItemProxy;
35 | containerPortal = DD7718471822AC7800482CBE /* GRProKit.xcodeproj */;
36 | proxyType = 1;
37 | remoteGlobalIDString = DD7718181822AC7800482CBE;
38 | remoteInfo = GRProKit;
39 | };
40 | /* End PBXContainerItemProxy section */
41 |
42 | /* Begin PBXCopyFilesBuildPhase section */
43 | DD7718521822ACB800482CBE /* CopyFiles */ = {
44 | isa = PBXCopyFilesBuildPhase;
45 | buildActionMask = 2147483647;
46 | dstPath = "";
47 | dstSubfolderSpec = 10;
48 | files = (
49 | DD7718531822ACC000482CBE /* GRProKit.framework in CopyFiles */,
50 | );
51 | runOnlyForDeploymentPostprocessing = 0;
52 | };
53 | /* End PBXCopyFilesBuildPhase section */
54 |
55 | /* Begin PBXFileReference section */
56 | DD7717D81822AC5D00482CBE /* GRProKit Demo App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "GRProKit Demo App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
57 | DD7717DB1822AC5D00482CBE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
58 | DD7717DE1822AC5D00482CBE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
59 | DD7717DF1822AC5D00482CBE /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
60 | DD7717E01822AC5D00482CBE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
61 | DD7717E31822AC5D00482CBE /* GRProKit Demo App-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GRProKit Demo App-Info.plist"; sourceTree = ""; };
62 | DD7717E51822AC5D00482CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
63 | DD7717E71822AC5D00482CBE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
64 | DD7717E91822AC5D00482CBE /* GRProKit Demo App-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRProKit Demo App-Prefix.pch"; sourceTree = ""; };
65 | DD7717EB1822AC5D00482CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; };
66 | DD7717ED1822AC5D00482CBE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
67 | DD7717EE1822AC5D00482CBE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
68 | DD7717F11822AC5D00482CBE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
69 | DD7717F31822AC5D00482CBE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
70 | DD7717FA1822AC5D00482CBE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
71 | DD7718471822AC7800482CBE /* GRProKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRProKit.xcodeproj; path = GRProKit/GRProKit.xcodeproj; sourceTree = ""; };
72 | DD882483186CDDE2002975DE /* edit.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = edit.png; sourceTree = ""; };
73 | DD882484186CDDE2002975DE /* grab.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grab.png; sourceTree = ""; };
74 | DD882485186CDDE2002975DE /* xcode.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = xcode.png; sourceTree = ""; };
75 | DD882489186CDDFC002975DE /* ICONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ICONS.txt; sourceTree = ""; };
76 | /* End PBXFileReference section */
77 |
78 | /* Begin PBXFrameworksBuildPhase section */
79 | DD7717D51822AC5D00482CBE /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | DD7717DC1822AC5D00482CBE /* Cocoa.framework in Frameworks */,
84 | DD7718541822AD0500482CBE /* GRProKit.framework in Frameworks */,
85 | );
86 | runOnlyForDeploymentPostprocessing = 0;
87 | };
88 | /* End PBXFrameworksBuildPhase section */
89 |
90 | /* Begin PBXGroup section */
91 | DD7717CF1822AC5D00482CBE = {
92 | isa = PBXGroup;
93 | children = (
94 | DD7718471822AC7800482CBE /* GRProKit.xcodeproj */,
95 | DD7717E11822AC5D00482CBE /* GRProKit Demo App */,
96 | DD7717DA1822AC5D00482CBE /* Frameworks */,
97 | DD7717D91822AC5D00482CBE /* Products */,
98 | );
99 | sourceTree = "";
100 | };
101 | DD7717D91822AC5D00482CBE /* Products */ = {
102 | isa = PBXGroup;
103 | children = (
104 | DD7717D81822AC5D00482CBE /* GRProKit Demo App.app */,
105 | );
106 | name = Products;
107 | sourceTree = "";
108 | };
109 | DD7717DA1822AC5D00482CBE /* Frameworks */ = {
110 | isa = PBXGroup;
111 | children = (
112 | DD7717DB1822AC5D00482CBE /* Cocoa.framework */,
113 | DD7717FA1822AC5D00482CBE /* XCTest.framework */,
114 | DD7717DD1822AC5D00482CBE /* Other Frameworks */,
115 | );
116 | name = Frameworks;
117 | sourceTree = "";
118 | };
119 | DD7717DD1822AC5D00482CBE /* Other Frameworks */ = {
120 | isa = PBXGroup;
121 | children = (
122 | DD7717DE1822AC5D00482CBE /* AppKit.framework */,
123 | DD7717DF1822AC5D00482CBE /* CoreData.framework */,
124 | DD7717E01822AC5D00482CBE /* Foundation.framework */,
125 | );
126 | name = "Other Frameworks";
127 | sourceTree = "";
128 | };
129 | DD7717E11822AC5D00482CBE /* GRProKit Demo App */ = {
130 | isa = PBXGroup;
131 | children = (
132 | DD7717ED1822AC5D00482CBE /* AppDelegate.h */,
133 | DD7717EE1822AC5D00482CBE /* AppDelegate.m */,
134 | DD7717F01822AC5D00482CBE /* MainMenu.xib */,
135 | DD7717F31822AC5D00482CBE /* Images.xcassets */,
136 | DD7717E21822AC5D00482CBE /* Supporting Files */,
137 | );
138 | path = "GRProKit Demo App";
139 | sourceTree = "";
140 | };
141 | DD7717E21822AC5D00482CBE /* Supporting Files */ = {
142 | isa = PBXGroup;
143 | children = (
144 | DD882475186CBCB2002975DE /* Images */,
145 | DD7717E31822AC5D00482CBE /* GRProKit Demo App-Info.plist */,
146 | DD7717E41822AC5D00482CBE /* InfoPlist.strings */,
147 | DD7717E71822AC5D00482CBE /* main.m */,
148 | DD7717E91822AC5D00482CBE /* GRProKit Demo App-Prefix.pch */,
149 | DD7717EA1822AC5D00482CBE /* Credits.rtf */,
150 | );
151 | name = "Supporting Files";
152 | sourceTree = "";
153 | };
154 | DD7718481822AC7800482CBE /* Products */ = {
155 | isa = PBXGroup;
156 | children = (
157 | DD77184D1822AC7900482CBE /* GRProKit.framework */,
158 | );
159 | name = Products;
160 | sourceTree = "";
161 | };
162 | DD882475186CBCB2002975DE /* Images */ = {
163 | isa = PBXGroup;
164 | children = (
165 | DD882483186CDDE2002975DE /* edit.png */,
166 | DD882484186CDDE2002975DE /* grab.png */,
167 | DD882485186CDDE2002975DE /* xcode.png */,
168 | DD882489186CDDFC002975DE /* ICONS.txt */,
169 | );
170 | name = Images;
171 | sourceTree = "";
172 | };
173 | /* End PBXGroup section */
174 |
175 | /* Begin PBXNativeTarget section */
176 | DD7717D71822AC5D00482CBE /* GRProKit Demo App */ = {
177 | isa = PBXNativeTarget;
178 | buildConfigurationList = DD7718091822AC5D00482CBE /* Build configuration list for PBXNativeTarget "GRProKit Demo App" */;
179 | buildPhases = (
180 | DD7717D41822AC5D00482CBE /* Sources */,
181 | DD7717D51822AC5D00482CBE /* Frameworks */,
182 | DD7717D61822AC5D00482CBE /* Resources */,
183 | DD7718521822ACB800482CBE /* CopyFiles */,
184 | );
185 | buildRules = (
186 | );
187 | dependencies = (
188 | DD7718511822ACAB00482CBE /* PBXTargetDependency */,
189 | );
190 | name = "GRProKit Demo App";
191 | productName = "GRProKit Demo App";
192 | productReference = DD7717D81822AC5D00482CBE /* GRProKit Demo App.app */;
193 | productType = "com.apple.product-type.application";
194 | };
195 | /* End PBXNativeTarget section */
196 |
197 | /* Begin PBXProject section */
198 | DD7717D01822AC5D00482CBE /* Project object */ = {
199 | isa = PBXProject;
200 | attributes = {
201 | LastUpgradeCheck = 0500;
202 | ORGANIZATIONNAME = "Guilherme Rambo";
203 | };
204 | buildConfigurationList = DD7717D31822AC5D00482CBE /* Build configuration list for PBXProject "GRProKit Demo App" */;
205 | compatibilityVersion = "Xcode 3.2";
206 | developmentRegion = English;
207 | hasScannedForEncodings = 0;
208 | knownRegions = (
209 | en,
210 | Base,
211 | );
212 | mainGroup = DD7717CF1822AC5D00482CBE;
213 | productRefGroup = DD7717D91822AC5D00482CBE /* Products */;
214 | projectDirPath = "";
215 | projectReferences = (
216 | {
217 | ProductGroup = DD7718481822AC7800482CBE /* Products */;
218 | ProjectRef = DD7718471822AC7800482CBE /* GRProKit.xcodeproj */;
219 | },
220 | );
221 | projectRoot = "";
222 | targets = (
223 | DD7717D71822AC5D00482CBE /* GRProKit Demo App */,
224 | );
225 | };
226 | /* End PBXProject section */
227 |
228 | /* Begin PBXReferenceProxy section */
229 | DD77184D1822AC7900482CBE /* GRProKit.framework */ = {
230 | isa = PBXReferenceProxy;
231 | fileType = wrapper.framework;
232 | path = GRProKit.framework;
233 | remoteRef = DD77184C1822AC7900482CBE /* PBXContainerItemProxy */;
234 | sourceTree = BUILT_PRODUCTS_DIR;
235 | };
236 | /* End PBXReferenceProxy section */
237 |
238 | /* Begin PBXResourcesBuildPhase section */
239 | DD7717D61822AC5D00482CBE /* Resources */ = {
240 | isa = PBXResourcesBuildPhase;
241 | buildActionMask = 2147483647;
242 | files = (
243 | DD7717E61822AC5D00482CBE /* InfoPlist.strings in Resources */,
244 | DD882488186CDDE2002975DE /* xcode.png in Resources */,
245 | DD882486186CDDE2002975DE /* edit.png in Resources */,
246 | DD88248A186CDDFC002975DE /* ICONS.txt in Resources */,
247 | DD7717F41822AC5D00482CBE /* Images.xcassets in Resources */,
248 | DD7717EC1822AC5D00482CBE /* Credits.rtf in Resources */,
249 | DD7717F21822AC5D00482CBE /* MainMenu.xib in Resources */,
250 | DD882487186CDDE2002975DE /* grab.png in Resources */,
251 | );
252 | runOnlyForDeploymentPostprocessing = 0;
253 | };
254 | /* End PBXResourcesBuildPhase section */
255 |
256 | /* Begin PBXSourcesBuildPhase section */
257 | DD7717D41822AC5D00482CBE /* Sources */ = {
258 | isa = PBXSourcesBuildPhase;
259 | buildActionMask = 2147483647;
260 | files = (
261 | DD7717EF1822AC5D00482CBE /* AppDelegate.m in Sources */,
262 | DD7717E81822AC5D00482CBE /* main.m in Sources */,
263 | );
264 | runOnlyForDeploymentPostprocessing = 0;
265 | };
266 | /* End PBXSourcesBuildPhase section */
267 |
268 | /* Begin PBXTargetDependency section */
269 | DD7718511822ACAB00482CBE /* PBXTargetDependency */ = {
270 | isa = PBXTargetDependency;
271 | name = GRProKit;
272 | targetProxy = DD7718501822ACAB00482CBE /* PBXContainerItemProxy */;
273 | };
274 | /* End PBXTargetDependency section */
275 |
276 | /* Begin PBXVariantGroup section */
277 | DD7717E41822AC5D00482CBE /* InfoPlist.strings */ = {
278 | isa = PBXVariantGroup;
279 | children = (
280 | DD7717E51822AC5D00482CBE /* en */,
281 | );
282 | name = InfoPlist.strings;
283 | sourceTree = "";
284 | };
285 | DD7717EA1822AC5D00482CBE /* Credits.rtf */ = {
286 | isa = PBXVariantGroup;
287 | children = (
288 | DD7717EB1822AC5D00482CBE /* en */,
289 | );
290 | name = Credits.rtf;
291 | sourceTree = "";
292 | };
293 | DD7717F01822AC5D00482CBE /* MainMenu.xib */ = {
294 | isa = PBXVariantGroup;
295 | children = (
296 | DD7717F11822AC5D00482CBE /* Base */,
297 | );
298 | name = MainMenu.xib;
299 | sourceTree = "";
300 | };
301 | /* End PBXVariantGroup section */
302 |
303 | /* Begin XCBuildConfiguration section */
304 | DD7718071822AC5D00482CBE /* Debug */ = {
305 | isa = XCBuildConfiguration;
306 | buildSettings = {
307 | ALWAYS_SEARCH_USER_PATHS = NO;
308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
309 | CLANG_CXX_LIBRARY = "libc++";
310 | CLANG_ENABLE_OBJC_ARC = YES;
311 | CLANG_WARN_BOOL_CONVERSION = YES;
312 | CLANG_WARN_CONSTANT_CONVERSION = YES;
313 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
314 | CLANG_WARN_EMPTY_BODY = YES;
315 | CLANG_WARN_ENUM_CONVERSION = YES;
316 | CLANG_WARN_INT_CONVERSION = YES;
317 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
318 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
319 | COPY_PHASE_STRIP = NO;
320 | GCC_C_LANGUAGE_STANDARD = gnu99;
321 | GCC_DYNAMIC_NO_PIC = NO;
322 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
323 | GCC_OPTIMIZATION_LEVEL = 0;
324 | GCC_PREPROCESSOR_DEFINITIONS = (
325 | "DEBUG=1",
326 | "$(inherited)",
327 | );
328 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
329 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
330 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
331 | GCC_WARN_UNDECLARED_SELECTOR = YES;
332 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
333 | GCC_WARN_UNUSED_FUNCTION = YES;
334 | GCC_WARN_UNUSED_VARIABLE = YES;
335 | MACOSX_DEPLOYMENT_TARGET = 10.8;
336 | ONLY_ACTIVE_ARCH = YES;
337 | SDKROOT = macosx;
338 | };
339 | name = Debug;
340 | };
341 | DD7718081822AC5D00482CBE /* Release */ = {
342 | isa = XCBuildConfiguration;
343 | buildSettings = {
344 | ALWAYS_SEARCH_USER_PATHS = NO;
345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
346 | CLANG_CXX_LIBRARY = "libc++";
347 | CLANG_ENABLE_OBJC_ARC = YES;
348 | CLANG_WARN_BOOL_CONVERSION = YES;
349 | CLANG_WARN_CONSTANT_CONVERSION = YES;
350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
351 | CLANG_WARN_EMPTY_BODY = YES;
352 | CLANG_WARN_ENUM_CONVERSION = YES;
353 | CLANG_WARN_INT_CONVERSION = YES;
354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
356 | COPY_PHASE_STRIP = YES;
357 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
358 | ENABLE_NS_ASSERTIONS = NO;
359 | GCC_C_LANGUAGE_STANDARD = gnu99;
360 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
363 | GCC_WARN_UNDECLARED_SELECTOR = YES;
364 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
365 | GCC_WARN_UNUSED_FUNCTION = YES;
366 | GCC_WARN_UNUSED_VARIABLE = YES;
367 | MACOSX_DEPLOYMENT_TARGET = 10.8;
368 | SDKROOT = macosx;
369 | };
370 | name = Release;
371 | };
372 | DD77180A1822AC5D00482CBE /* Debug */ = {
373 | isa = XCBuildConfiguration;
374 | buildSettings = {
375 | COMBINE_HIDPI_IMAGES = YES;
376 | FRAMEWORK_SEARCH_PATHS = "";
377 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
378 | GCC_PREFIX_HEADER = "GRProKit Demo App/GRProKit Demo App-Prefix.pch";
379 | INFOPLIST_FILE = "GRProKit Demo App/GRProKit Demo App-Info.plist";
380 | MACOSX_DEPLOYMENT_TARGET = 10.7;
381 | PRODUCT_NAME = "$(TARGET_NAME)";
382 | WRAPPER_EXTENSION = app;
383 | };
384 | name = Debug;
385 | };
386 | DD77180B1822AC5D00482CBE /* Release */ = {
387 | isa = XCBuildConfiguration;
388 | buildSettings = {
389 | COMBINE_HIDPI_IMAGES = YES;
390 | FRAMEWORK_SEARCH_PATHS = "";
391 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
392 | GCC_PREFIX_HEADER = "GRProKit Demo App/GRProKit Demo App-Prefix.pch";
393 | INFOPLIST_FILE = "GRProKit Demo App/GRProKit Demo App-Info.plist";
394 | MACOSX_DEPLOYMENT_TARGET = 10.7;
395 | PRODUCT_NAME = "$(TARGET_NAME)";
396 | WRAPPER_EXTENSION = app;
397 | };
398 | name = Release;
399 | };
400 | /* End XCBuildConfiguration section */
401 |
402 | /* Begin XCConfigurationList section */
403 | DD7717D31822AC5D00482CBE /* Build configuration list for PBXProject "GRProKit Demo App" */ = {
404 | isa = XCConfigurationList;
405 | buildConfigurations = (
406 | DD7718071822AC5D00482CBE /* Debug */,
407 | DD7718081822AC5D00482CBE /* Release */,
408 | );
409 | defaultConfigurationIsVisible = 0;
410 | defaultConfigurationName = Release;
411 | };
412 | DD7718091822AC5D00482CBE /* Build configuration list for PBXNativeTarget "GRProKit Demo App" */ = {
413 | isa = XCConfigurationList;
414 | buildConfigurations = (
415 | DD77180A1822AC5D00482CBE /* Debug */,
416 | DD77180B1822AC5D00482CBE /* Release */,
417 | );
418 | defaultConfigurationIsVisible = 0;
419 | defaultConfigurationName = Release;
420 | };
421 | /* End XCConfigurationList section */
422 | };
423 | rootObject = DD7717D01822AC5D00482CBE /* Project object */;
424 | }
425 |
--------------------------------------------------------------------------------
/GRProKit/GRProKit/GRProWindow.m:
--------------------------------------------------------------------------------
1 | //
2 | // GRProWindow.m
3 | // GRProKit
4 | //
5 | // Created by Guilherme Rambo on 31/10/13.
6 | // Copyright (c) 2013 Guilherme Rambo. All rights reserved.
7 | //
8 |
9 | #import "GRProWindow.h"
10 | #import "GRProFont.h"
11 | #import "GRProColor.h"
12 | #import "GRProLabel.h"
13 | #import
14 |
15 | float toolbarHeightForWindow(NSWindow *window);
16 |
17 | @implementation GRProWindow
18 | {
19 | GRProThemeWidget *_closeButton;
20 | GRProThemeWidget *_zoomButton;
21 | GRProThemeWidget *_miniaturizeButton;
22 |
23 | GRProLabel *_titleLabel;
24 |
25 | id _autosaveButton;
26 | }
27 |
28 | - (void)windowWillEnterFullScreen:(NSNotification *)notification
29 | {
30 | [_closeButton setAlphaValue:0];
31 | [_zoomButton setAlphaValue:0];
32 | [_miniaturizeButton setAlphaValue:0];
33 | }
34 |
35 | - (void)windowWillExitFullScreen:(NSNotification *)notification
36 | {
37 | [_closeButton setAlphaValue:1];
38 | [_zoomButton setAlphaValue:1];
39 | [_miniaturizeButton setAlphaValue:1];
40 | }
41 |
42 | - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
43 | {
44 | self = [super initWithContentRect:contentRect styleMask:aStyle backing:bufferingType defer:flag];
45 |
46 | if(!self) return nil;
47 |
48 | // hide standard traffic light buttons
49 | [[self standardWindowButton:NSWindowCloseButton] setHidden:YES];
50 | [[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
51 | [[self standardWindowButton:NSWindowZoomButton] setHidden:YES];
52 |
53 | [self layoutTrafficLights];
54 |
55 | // lol transparent windows
56 | [self setOpaque:YES];
57 | [self setBackgroundColor:kProWindowBackgroundColor];
58 |
59 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:self];
60 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:self];
61 |
62 | return self;
63 | }
64 |
65 | - (BOOL)_usesCustomDrawing
66 | {
67 | return NO;
68 | }
69 |
70 | + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
71 | {
72 | return [GRProThemeFrame class];
73 | }
74 |
75 | // traffic light margin from the top of the window
76 | #define kTrafficlightMargin 2.0
77 | // traffic light distance from the window left
78 | #define kTrafficlightDistanceFromWindow 6.0
79 | // size of the traffic light image (width and height are assumed to be equal)
80 | #define kTrafficLightSize 18.0
81 | // traffic light distance from another
82 | #define kTrafficLightPadding 3.0
83 |
84 | - (void)layoutTrafficLights
85 | {
86 | // calculate correct traffic light Y position
87 | CGFloat buttonY = round(NSHeight(self.frame)-kTrafficLightSize-kTrafficlightMargin);
88 |
89 | // setup close button
90 | NSRect closeButtonRect = NSMakeRect(kTrafficlightDistanceFromWindow, buttonY, kTrafficLightSize, kTrafficLightSize);
91 | _closeButton = [[GRProThemeWidget alloc] initWithFrame:closeButtonRect];
92 | [_closeButton setType:GRProThemeWidgetTypeClose];
93 | [_closeButton setAutoresizingMask:NSViewMinYMargin|NSViewMaxXMargin];
94 | [_closeButton setTarget:_closeButton];
95 | [_closeButton setAction:@selector(performAction:)];
96 | [_closeButton setEnabled:(self.styleMask & NSClosableWindowMask)];
97 | [[self.contentView superview] addSubview:_closeButton];
98 |
99 | // setup miniaturize button
100 | NSRect miniaturizeButtonRect = NSMakeRect(closeButtonRect.origin.x+kTrafficLightSize+kTrafficLightPadding, buttonY, kTrafficLightSize, kTrafficLightSize);
101 | _miniaturizeButton = [[GRProThemeWidget alloc] initWithFrame:miniaturizeButtonRect];
102 | [_miniaturizeButton setType:GRProThemeWidgetTypeMiniaturize];
103 | [_miniaturizeButton setAutoresizingMask:NSViewMinYMargin|NSViewMaxXMargin];
104 | [_miniaturizeButton setTarget:_miniaturizeButton];
105 | [_miniaturizeButton setAction:@selector(performAction:)];
106 | [_miniaturizeButton setEnabled:(self.styleMask & NSMiniaturizableWindowMask)];
107 | [[self.contentView superview] addSubview:_miniaturizeButton];
108 |
109 | // setup zoom button
110 | NSRect zoomButtonRect = NSMakeRect(miniaturizeButtonRect.origin.x+kTrafficLightSize+kTrafficLightPadding, buttonY, kTrafficLightSize, kTrafficLightSize);
111 | _zoomButton = [[GRProThemeWidget alloc] initWithFrame:zoomButtonRect];
112 | [_zoomButton setType:GRProThemeWidgetTypeZoom];
113 | [_zoomButton setAutoresizingMask:NSViewMinYMargin|NSViewMaxXMargin];
114 | [_zoomButton setTarget:_zoomButton];
115 | [_zoomButton setAction:@selector(performAction:)];
116 | [_zoomButton setEnabled:(self.styleMask & NSResizableWindowMask)];
117 | [[self.contentView superview] addSubview:_zoomButton];
118 |
119 | if (self.hideTrafficLights) [self doHideTrafficLights];
120 | }
121 |
122 | - (void)doHideTrafficLights {
123 | [_closeButton setHidden:YES];
124 | [_miniaturizeButton setHidden:YES];
125 | [_zoomButton setHidden:YES];
126 | }
127 | - (void)doShowTrafficLights
128 | {
129 | [_closeButton setHidden:NO];
130 | [_miniaturizeButton setHidden:NO];
131 | [_zoomButton setHidden:NO];
132 | }
133 | - (void)setHideTrafficLights:(BOOL)hideTrafficLights
134 | {
135 | _hideTrafficLights = hideTrafficLights;
136 | if (_hideTrafficLights) {
137 | [self doHideTrafficLights];
138 | } else {
139 | [self doShowTrafficLights];
140 | }
141 | }
142 |
143 | @end
144 |
145 | @implementation GRProThemeWidget
146 |
147 | - (id)initWithFrame:(NSRect)frameRect
148 | {
149 | self = [super initWithFrame:frameRect];
150 |
151 | if (!self) return nil;
152 |
153 | return self;
154 | }
155 |
156 | - (void)performAction:(id)sender
157 | {
158 | switch (self.type) {
159 | case GRProThemeWidgetTypeClose:
160 | [self.window close];
161 | break;
162 | case GRProThemeWidgetTypeMiniaturize:
163 | [self.window miniaturize:self];
164 | break;
165 | default:
166 | [self.window zoom:self];
167 | break;
168 | }
169 |
170 | [(GRProThemeFrame *)self.superview resetWidgets];
171 | }
172 |
173 | - (void)setHover:(BOOL)hover
174 | {
175 | _hover = hover;
176 | [self setNeedsDisplay];
177 | }
178 |
179 | - (void)mouseEntered:(NSEvent *)theEvent
180 | {
181 | // update ourselves to be active
182 | self.hover = YES;
183 | }
184 |
185 | - (void)mouseExited:(NSEvent *)theEvent
186 | {
187 | // update ourselves to be inactive
188 | self.hover = NO;
189 | }
190 |
191 | - (void)setType:(GRProThemeWidgetType)type
192 | {
193 | _type = type;
194 |
195 | // if our type changes we need to update our look
196 | [self setNeedsDisplay];
197 | }
198 |
199 | // here's where the magic happens
200 | - (void)drawRect:(NSRect)dirtyRect
201 | {
202 | NSString *imageBasename;
203 |
204 | // we start by determining what the start of the name should be, according to our type
205 | switch (self.type) {
206 | case GRProThemeWidgetTypeClose:
207 | imageBasename = @"close";
208 | break;
209 | case GRProThemeWidgetTypeMiniaturize:
210 | imageBasename = @"miniaturize";
211 | break;
212 | default:
213 | imageBasename = @"zoom";
214 | break;
215 | }
216 |
217 | NSString *imageName = imageBasename;
218 |
219 | NSString *imageSuffix = @"";
220 |
221 | if ([self.cell isHighlighted]) {
222 | // if we are pressed, we need to add a "highlighted" suffix to the image's name
223 | imageSuffix = @"highlighted";
224 | } else if (self.hover) {
225 | // if we are active (mouse over), we need to add an "active" suffix to the image's name
226 | imageSuffix = @"active";
227 | }
228 |
229 | // if we should have a suffix, we append It to our original basename, with an underscore
230 | if(![imageSuffix isEqualToString:@""]) imageName = [imageBasename stringByAppendingFormat:@"_%@", imageSuffix];
231 |
232 | // if the our window is not the key window and we are not active, we draw the boring greyed out widget image
233 | if ((![self.window isKeyWindow] && !self.hover) || !self.isEnabled) imageName = @"widget_nokey";
234 |
235 | // get the correct image from the theme
236 | NSImage *image = [[GRThemeStore proThemeStore] imageNamed:imageName];
237 |
238 | // draw the image in the correct frame
239 | [image drawInRect:NSMakeRect(0, 0, NSWidth(self.frame), NSHeight(self.frame)) fromRect:NSMakeRect(0, 0, 36, 36) operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
240 | }
241 |
242 | @end
243 |
244 | @implementation GRProThemeFrame
245 | {
246 | NSTrackingArea *_widgetTrackingArea;
247 | }
248 |
249 | + (NSDictionary *)widgetUserInfo
250 | {
251 | static NSDictionary *_widgetUserInfo;
252 |
253 | static dispatch_once_t onceToken;
254 | dispatch_once(&onceToken, ^{
255 | _widgetUserInfo = @{@"isWidget": @1};
256 | });
257 |
258 | return _widgetUserInfo;
259 | }
260 |
261 | - (NSBezierPath *)windowPath
262 | {
263 | return [NSBezierPath bezierPathWithRoundedRect:self.bounds xRadius:4.0 yRadius:4.0];
264 | }
265 |
266 | - (void)drawRect:(NSRect)dirtyRect
267 | {
268 | [super drawRect:dirtyRect];
269 |
270 | if (self.window.styleMask & NSTexturedBackgroundWindowMask) {
271 | [[self windowPath] addClip];
272 | [self _drawTexturedThemeBackgroundRect:dirtyRect];
273 | }
274 | }
275 |
276 | - (void)_drawTitleBarBackgroundInClipRect:(NSRect)rect
277 | {
278 | [[NSColor clearColor] setFill];
279 | NSRectFill(rect);
280 |
281 | [NSGraphicsContext saveGraphicsState];
282 |
283 | CGFloat toolbarHeight = toolbarHeightForWindow(self.window);
284 | CGFloat titlebarHeight = toolbarHeight+kProWindowTitlebarHeight;
285 |
286 | NSRect titleBarRect = NSMakeRect(0, NSHeight(self.frame)-titlebarHeight, NSWidth(self.frame), titlebarHeight);
287 |
288 | [[self windowPath] addClip];
289 |
290 | // paint the background color
291 | [kProWindowBackgroundColor setFill];
292 | NSRectFill(rect);
293 |
294 | // we don't draw anything else if this window is inside a sheet
295 | if([self.window isSheet]) return;
296 |
297 | // draw the title gradient according to the window's current status
298 | NSGradient *titleGrad;
299 | if ([self.window isKeyWindow]) {
300 | // key window
301 | titleGrad = [[NSGradient alloc] initWithStartingColor:kProWindowTitleGradientTopActive endingColor:kProWindowTitleGradientBottomActive];
302 | } else {
303 | // not key window
304 | titleGrad = [[NSGradient alloc] initWithStartingColor:kProWindowTitleGradientTop endingColor:kProWindowTitleGradientBottom];
305 | }
306 |
307 | // draw gradient
308 | [titleGrad drawInRect:titleBarRect angle:-90];
309 |
310 | // draw titlebar highlight
311 | NSRect highlightRect = NSMakeRect(0, NSHeight(self.frame)-1, NSWidth(self.frame), 1);
312 | if ([self.window isKeyWindow]) {
313 | [kProWindowTitleBarHighlightColorActive setFill];
314 | } else {
315 | [kProWindowTitleBarHighlightColor setFill];
316 | }
317 | NSRectFill(highlightRect);
318 |
319 | // draw gradient separator
320 | CGFloat separatorOffset = (self.window.toolbar) ? 1.0 : 0.0;
321 | NSRect separatorRect = NSMakeRect(0, NSHeight(self.frame)-titlebarHeight-separatorOffset, NSWidth(self.frame), 1);
322 | [kProWindowTitleSeparatorColor setFill];
323 | NSRectFill(separatorRect);
324 |
325 | [GRProColor drawNoiseTextureInRect:rect];
326 |
327 | [NSGraphicsContext restoreGraphicsState];
328 | }
329 |
330 | - (void)drawWindowBackgroundRect:(NSRect)rect
331 | {
332 | [[NSColor clearColor] set];
333 | NSRectFill(rect);
334 |
335 | [NSGraphicsContext saveGraphicsState];
336 |
337 | [[self windowPath] addClip];
338 |
339 | if(!(self.window.styleMask & NSTexturedBackgroundWindowMask)) {
340 | [kProWindowBackgroundColor setFill];
341 | NSRectFill(rect);
342 |
343 | [self drawContentBorder];
344 | }
345 |
346 | [NSGraphicsContext restoreGraphicsState];
347 | }
348 |
349 | - (void)drawContentBorder
350 | {
351 | [NSGraphicsContext saveGraphicsState];
352 |
353 | [[self windowPath] addClip];
354 |
355 | // the following code will draw the window's footer, if needed
356 | CGFloat windowContentBorderHeight = round([self.window contentBorderThicknessForEdge:NSMinYEdge]);
357 | if (windowContentBorderHeight == 0) return;
358 |
359 | // footer gradient
360 | NSGradient *bottomGrad;
361 | if ([self.window isKeyWindow]) {
362 | // key window
363 | bottomGrad = [[NSGradient alloc] initWithStartingColor:kProWindowBottomGradientTopActive endingColor:kProWindowBottomGradientBottomActive];
364 | } else {
365 | // not key window
366 | bottomGrad = [[NSGradient alloc] initWithStartingColor:kProWindowBottomGradientTop endingColor:kProWindowBottomGradientBottom];
367 | }
368 |
369 | // define a path for the footer
370 | NSRect bottomRect = NSMakeRect(0, -0.5, NSWidth(self.frame), windowContentBorderHeight+1);
371 | [bottomGrad drawInRect:bottomRect angle:-90];
372 |
373 | // draw the separator between the window's content and footer
374 | NSRect bottomSeparatorRect = NSMakeRect(0, windowContentBorderHeight-1, NSWidth(self.frame), 1);
375 | [kProWindowTitleSeparatorColor setFill];
376 | NSRectFill(bottomSeparatorRect);
377 |
378 | // draw footer highlight
379 | NSRect bottomHighlightRect = NSMakeRect(0, windowContentBorderHeight-2, NSWidth(self.frame), 1);
380 | [kProWindowBottomHighlightColor setFill];
381 | NSRectFill(bottomHighlightRect);
382 |
383 | // draw footer shadowlet
384 | NSRect bottomShadowLetRect = NSMakeRect(0, -0.5, NSWidth(self.frame), 1.5);
385 | [kProWindowBottomShadowletColor setFill];
386 | NSRectFill(bottomShadowLetRect);
387 |
388 | [GRProColor drawNoiseTextureInRect:bottomRect];
389 |
390 | [NSGraphicsContext restoreGraphicsState];
391 |
392 | // re-fill the content area to avoid drawing glitches
393 | NSRect fillerRect = NSMakeRect(0, windowContentBorderHeight, NSWidth(self.frame), NSHeight(self.frame)-kProWindowTitlebarHeight-windowContentBorderHeight-1);
394 | [kProWindowBackgroundColor setFill];
395 | NSRectFill(fillerRect);
396 | }
397 |
398 | - (void)_drawTexturedThemeBackgroundRect:(NSRect)rect
399 | {
400 | [[NSColor clearColor] setFill];
401 | NSRectFill(rect);
402 |
403 | [NSGraphicsContext saveGraphicsState];
404 |
405 | NSGradient *titleGrad;
406 | if ([self.window isKeyWindow]) {
407 | // key window
408 | titleGrad = [[NSGradient alloc] initWithStartingColor:kProWindowTitleGradientTopActive endingColor:kProWindowTitleGradientBottomActive];
409 | } else {
410 | // not key window
411 | titleGrad = [[NSGradient alloc] initWithStartingColor:kProWindowTitleGradientTop endingColor:kProWindowTitleGradientBottom];
412 | }
413 |
414 | // draw gradient
415 | [titleGrad drawInRect:self.bounds angle:-90];
416 |
417 | [GRProColor drawNoiseTextureInRect:self.bounds];
418 |
419 | [NSGraphicsContext restoreGraphicsState];
420 | }
421 |
422 | // this is for the traffic lights
423 | - (void)updateTrackingAreas
424 | {
425 | for (NSTrackingArea *area in self.trackingAreas) {
426 | if (area.userInfo == [[self class] widgetUserInfo]) [self removeTrackingArea:area];
427 | }
428 |
429 | _widgetTrackingArea = [[NSTrackingArea alloc] initWithRect:NSMakeRect(8.0, NSHeight(self.frame)-6.0-15, 55.0, 15.0) options:NSTrackingActiveAlways|NSTrackingMouseEnteredAndExited|NSTrackingEnabledDuringMouseDrag owner:self userInfo:[[self class] widgetUserInfo]];
430 | [self addTrackingArea:_widgetTrackingArea];
431 |
432 | [super updateTrackingAreas];
433 | }
434 |
435 | - (BOOL)isWidgetEvent:(NSEvent *)theEvent
436 | {
437 | if(theEvent.userData) {
438 | if (theEvent.userData == (__bridge void *)([[self class] widgetUserInfo])) {
439 | return YES;
440 | } else {
441 | return NO;
442 | }
443 | } else {
444 | return NO;
445 | }
446 | }
447 |
448 | // pass event to traffic lights
449 | - (void)mouseEntered:(NSEvent *)theEvent
450 | {
451 | [super mouseEntered:theEvent];
452 |
453 | if (![self isWidgetEvent:theEvent]) return;
454 |
455 | for (id widget in self.subviews) {
456 | if ([widget isKindOfClass:[GRProThemeWidget class]]) {
457 | [widget mouseEntered:theEvent];
458 | }
459 | }
460 | }
461 |
462 | // pass event to traffic lights
463 | - (void)mouseExited:(NSEvent *)theEvent
464 | {
465 | [super mouseExited:theEvent];
466 |
467 | if (![self isWidgetEvent:theEvent]) return;
468 |
469 | for (id widget in self.subviews) {
470 | if ([widget isKindOfClass:[GRProThemeWidget class]]) {
471 | [widget mouseExited:theEvent];
472 | }
473 | }
474 | }
475 |
476 | - (void)resetWidgets
477 | {
478 | for (id widget in self.subviews) {
479 | if ([widget isKindOfClass:[GRProThemeWidget class]]) {
480 | [widget setHover:NO];
481 | }
482 | }
483 | }
484 |
485 | - (NSRect) _titlebarTitleRect {
486 | NSRect r = [super _titlebarTitleRect];
487 | r.size.width += 4;
488 | return r;
489 | }
490 |
491 | - (NSTextFieldCell *)_customTitleCell
492 | {
493 | NSString *title = self.window.title;
494 | if (!title) title = @"";
495 |
496 | NSTextFieldCell *cell = [[NSTextFieldCell alloc] initTextCell:title];
497 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
498 | style.alignment = NSLeftTextAlignment;
499 | NSShadow *titleShadow = [[NSShadow alloc] init];
500 | titleShadow.shadowBlurRadius = 0;
501 | titleShadow.shadowOffset = NSMakeSize(0, -1);
502 | titleShadow.shadowColor = (self.window.isKeyWindow) ? kProWindowTitleShadowColor : kProWindowTitleShadowColorNoKey;
503 |
504 | NSColor *titleColor = (self.window.isKeyWindow) ? kProWindowTitleColor : kProWindowTitleColorNoKey;
505 |
506 | NSDictionary *attributes = @{NSFontAttributeName: [GRProFont proTitleFont], NSParagraphStyleAttributeName : style, NSForegroundColorAttributeName : titleColor, NSShadowAttributeName : titleShadow};
507 | cell.attributedStringValue = [[NSAttributedString alloc] initWithString:title attributes:attributes];
508 |
509 | // also update our "edited" label's attributes
510 | if ([[self autosaveButton] title]) {
511 | [[self autosaveButton] setAttributedTitle:[[NSAttributedString alloc] initWithString:[[self autosaveButton] title] attributes:attributes]];
512 | NSRect autosaveRect = [[self autosaveButton] frame];
513 |
514 | NSRect titleRect = [super _titlebarTitleRect];
515 | titleRect.size.width += cell.attributedStringValue.size.width+4.0;
516 | titleRect.size.height += [GRProFont windowTitleHeightOffsetForFont:[GRProFont proTitleFont]];
517 |
518 | autosaveRect.size.height = titleRect.size.height;
519 | autosaveRect.origin.y = titleRect.origin.y-1;
520 | [[self autosaveButton] setFrame:autosaveRect];
521 | }
522 |
523 |
524 | // update the "--" label
525 | [[self _autosaveButtonSeparatorField] setFont:[GRProFont proTitleFont]];
526 | [[self _autosaveButtonSeparatorField] setTextColor:titleColor];
527 | [[self _autosaveButtonSeparatorField] setShadow:titleShadow];
528 |
529 | return cell;
530 | }
531 |
532 | @end
533 |
534 | // utility function
535 |
536 | float toolbarHeightForWindow(NSWindow *window)
537 | {
538 | NSToolbar *toolbar;
539 |
540 | float toolbarHeight = 0.0;
541 |
542 | NSRect windowFrame;
543 |
544 | toolbar = [window toolbar];
545 |
546 | if(toolbar && [toolbar isVisible]) {
547 | windowFrame = [NSWindow contentRectForFrameRect:[window frame] styleMask:[window styleMask]];
548 | toolbarHeight = NSHeight(windowFrame) - NSHeight([[window contentView] frame]) - 1;
549 | }
550 |
551 | return toolbarHeight;
552 | }
--------------------------------------------------------------------------------
/GRProKit/GRProKit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | DD5187E8186101CC008C10CD /* GRProTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5187E6186101CC008C10CD /* GRProTableView.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | DD5187E9186101CC008C10CD /* GRProTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5187E7186101CC008C10CD /* GRProTableView.m */; };
12 | DD5A2BFA1825DEBF00332C2F /* GRProLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5A2BF81825DEBF00332C2F /* GRProLabel.h */; settings = {ATTRIBUTES = (Public, ); }; };
13 | DD5A2BFB1825DEBF00332C2F /* GRProLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5A2BF91825DEBF00332C2F /* GRProLabel.m */; };
14 | DD5A2C021825E1B100332C2F /* GRProBox.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5A2C001825E1B100332C2F /* GRProBox.h */; settings = {ATTRIBUTES = (Public, ); }; };
15 | DD5A2C031825E1B100332C2F /* GRProBox.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5A2C011825E1B100332C2F /* GRProBox.m */; };
16 | DD5A2C061825E7B900332C2F /* GRProSplitView.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5A2C041825E7B800332C2F /* GRProSplitView.h */; settings = {ATTRIBUTES = (Public, ); }; };
17 | DD5A2C071825E7B900332C2F /* GRProSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5A2C051825E7B800332C2F /* GRProSplitView.m */; };
18 | DD5A2C0A1825E99400332C2F /* GRProButton.h in Headers */ = {isa = PBXBuildFile; fileRef = DD5A2C081825E99400332C2F /* GRProButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
19 | DD5A2C0B1825E99400332C2F /* GRProButton.m in Sources */ = {isa = PBXBuildFile; fileRef = DD5A2C091825E99400332C2F /* GRProButton.m */; };
20 | DD754DCE1884636700B7B877 /* GRProTheme.pack in Resources */ = {isa = PBXBuildFile; fileRef = DD754DCD1884636700B7B877 /* GRProTheme.pack */; };
21 | DD77181D1822AC7800482CBE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD77181C1822AC7800482CBE /* Cocoa.framework */; };
22 | DD7718271822AC7800482CBE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD7718251822AC7800482CBE /* InfoPlist.strings */; };
23 | DD7718581822B09E00482CBE /* GRProWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = DD7718561822B09E00482CBE /* GRProWindow.h */; settings = {ATTRIBUTES = (Public, ); }; };
24 | DD7718591822B09E00482CBE /* GRProWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7718571822B09E00482CBE /* GRProWindow.m */; };
25 | DD7EC7AE186BBD4900AA527C /* GRProMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = DD7EC7AC186BBD4900AA527C /* GRProMenu.h */; settings = {ATTRIBUTES = (Public, ); }; };
26 | DD7EC7AF186BBD4900AA527C /* GRProMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7EC7AD186BBD4900AA527C /* GRProMenu.m */; };
27 | DD7EC7B1186BBDA000AA527C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD7EC7B0186BBDA000AA527C /* Carbon.framework */; };
28 | DD7EC7B4186BC09F00AA527C /* GRProFont.h in Headers */ = {isa = PBXBuildFile; fileRef = DD7EC7B2186BC09F00AA527C /* GRProFont.h */; };
29 | DD7EC7B5186BC09F00AA527C /* GRProFont.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7EC7B3186BC09F00AA527C /* GRProFont.m */; };
30 | DD88248D186CEDC9002975DE /* GRProColor.h in Headers */ = {isa = PBXBuildFile; fileRef = DD88248B186CEDC9002975DE /* GRProColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
31 | DD88248E186CEDC9002975DE /* GRProColor.m in Sources */ = {isa = PBXBuildFile; fileRef = DD88248C186CEDC9002975DE /* GRProColor.m */; };
32 | DDBDA3601826B0F1006D744F /* GRThemePiece.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA3591826B0F1006D744F /* GRThemePiece.h */; settings = {ATTRIBUTES = (Public, ); }; };
33 | DDBDA3611826B0F1006D744F /* GRThemePiece.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA35A1826B0F1006D744F /* GRThemePiece.m */; };
34 | DDBDA3621826B0F1006D744F /* GRThemeStore.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA35B1826B0F1006D744F /* GRThemeStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
35 | DDBDA3631826B0F1006D744F /* GRThemeStore.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA35C1826B0F1006D744F /* GRThemeStore.m */; };
36 | DDBDA3641826B0F1006D744F /* NSData+ZLib.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA35D1826B0F1006D744F /* NSData+ZLib.h */; settings = {ATTRIBUTES = (Public, ); }; };
37 | DDBDA3651826B0F1006D744F /* NSData+ZLib.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA35E1826B0F1006D744F /* NSData+ZLib.m */; };
38 | DDBDA3661826B0F1006D744F /* ThemeFile.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA35F1826B0F1006D744F /* ThemeFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
39 | DDBDA3681826B0FB006D744F /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DDBDA3671826B0FB006D744F /* libz.dylib */; };
40 | DDBDA3731826C552006D744F /* GRProAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA3711826C552006D744F /* GRProAlert.h */; settings = {ATTRIBUTES = (Public, ); }; };
41 | DDBDA3741826C552006D744F /* GRProAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA3721826C552006D744F /* GRProAlert.m */; };
42 | DDBDA3771826C7D8006D744F /* GRProAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = DDBDA3761826C7D8006D744F /* GRProAlert.xib */; };
43 | DDBDA3791826CE90006D744F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDBDA3781826CE90006D744F /* QuartzCore.framework */; };
44 | DDBDA3821826EBF5006D744F /* GRProSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA3801826EBF5006D744F /* GRProSlider.h */; settings = {ATTRIBUTES = (Public, ); }; };
45 | DDBDA3831826EBF5006D744F /* GRProSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA3811826EBF5006D744F /* GRProSlider.m */; };
46 | DDBDA3921826F92D006D744F /* GRProProgressIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA3901826F92D006D744F /* GRProProgressIndicator.h */; settings = {ATTRIBUTES = (Public, ); }; };
47 | DDBDA3931826F92D006D744F /* GRProProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA3911826F92D006D744F /* GRProProgressIndicator.m */; };
48 | DDBDA396182705E0006D744F /* GRProToolbar.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA394182705E0006D744F /* GRProToolbar.h */; settings = {ATTRIBUTES = (Public, ); }; };
49 | DDBDA397182705E0006D744F /* GRProToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA395182705E0006D744F /* GRProToolbar.m */; };
50 | DDBDA39E1827231E006D744F /* GRProKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBDA39C1827231E006D744F /* GRProKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
51 | DDBDA39F1827231E006D744F /* GRProKit.m in Sources */ = {isa = PBXBuildFile; fileRef = DDBDA39D1827231E006D744F /* GRProKit.m */; };
52 | /* End PBXBuildFile section */
53 |
54 | /* Begin PBXFileReference section */
55 | DD5187E6186101CC008C10CD /* GRProTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProTableView.h; sourceTree = ""; };
56 | DD5187E7186101CC008C10CD /* GRProTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProTableView.m; sourceTree = ""; };
57 | DD5A2BF81825DEBF00332C2F /* GRProLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProLabel.h; sourceTree = ""; };
58 | DD5A2BF91825DEBF00332C2F /* GRProLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProLabel.m; sourceTree = ""; };
59 | DD5A2C001825E1B100332C2F /* GRProBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProBox.h; sourceTree = ""; };
60 | DD5A2C011825E1B100332C2F /* GRProBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProBox.m; sourceTree = ""; };
61 | DD5A2C041825E7B800332C2F /* GRProSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProSplitView.h; sourceTree = ""; };
62 | DD5A2C051825E7B800332C2F /* GRProSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProSplitView.m; sourceTree = ""; };
63 | DD5A2C081825E99400332C2F /* GRProButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProButton.h; sourceTree = ""; };
64 | DD5A2C091825E99400332C2F /* GRProButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProButton.m; sourceTree = ""; };
65 | DD754DCD1884636700B7B877 /* GRProTheme.pack */ = {isa = PBXFileReference; lastKnownFileType = file; path = GRProTheme.pack; sourceTree = ""; };
66 | DD7718191822AC7800482CBE /* GRProKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRProKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
67 | DD77181C1822AC7800482CBE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
68 | DD77181F1822AC7800482CBE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
69 | DD7718201822AC7800482CBE /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
70 | DD7718211822AC7800482CBE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
71 | DD7718241822AC7800482CBE /* GRProKit-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GRProKit-Info.plist"; sourceTree = ""; };
72 | DD7718261822AC7800482CBE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
73 | DD7718281822AC7800482CBE /* GRProKit-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRProKit-Prefix.pch"; sourceTree = ""; };
74 | DD7718311822AC7800482CBE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
75 | DD7718561822B09E00482CBE /* GRProWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProWindow.h; sourceTree = ""; };
76 | DD7718571822B09E00482CBE /* GRProWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProWindow.m; sourceTree = ""; };
77 | DD7EC7AC186BBD4900AA527C /* GRProMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProMenu.h; sourceTree = ""; };
78 | DD7EC7AD186BBD4900AA527C /* GRProMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProMenu.m; sourceTree = ""; };
79 | DD7EC7B0186BBDA000AA527C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
80 | DD7EC7B2186BC09F00AA527C /* GRProFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProFont.h; sourceTree = ""; };
81 | DD7EC7B3186BC09F00AA527C /* GRProFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProFont.m; sourceTree = ""; };
82 | DD88248B186CEDC9002975DE /* GRProColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProColor.h; sourceTree = ""; };
83 | DD88248C186CEDC9002975DE /* GRProColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProColor.m; sourceTree = ""; };
84 | DDBDA3591826B0F1006D744F /* GRThemePiece.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRThemePiece.h; sourceTree = ""; };
85 | DDBDA35A1826B0F1006D744F /* GRThemePiece.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRThemePiece.m; sourceTree = ""; };
86 | DDBDA35B1826B0F1006D744F /* GRThemeStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRThemeStore.h; sourceTree = ""; };
87 | DDBDA35C1826B0F1006D744F /* GRThemeStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRThemeStore.m; sourceTree = ""; };
88 | DDBDA35D1826B0F1006D744F /* NSData+ZLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ZLib.h"; sourceTree = ""; };
89 | DDBDA35E1826B0F1006D744F /* NSData+ZLib.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ZLib.m"; sourceTree = ""; };
90 | DDBDA35F1826B0F1006D744F /* ThemeFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeFile.h; sourceTree = ""; };
91 | DDBDA3671826B0FB006D744F /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
92 | DDBDA3711826C552006D744F /* GRProAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProAlert.h; sourceTree = ""; };
93 | DDBDA3721826C552006D744F /* GRProAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProAlert.m; sourceTree = ""; };
94 | DDBDA3761826C7D8006D744F /* GRProAlert.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = GRProAlert.xib; path = xibs/GRProAlert.xib; sourceTree = ""; };
95 | DDBDA3781826CE90006D744F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
96 | DDBDA3801826EBF5006D744F /* GRProSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProSlider.h; sourceTree = ""; };
97 | DDBDA3811826EBF5006D744F /* GRProSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProSlider.m; sourceTree = ""; };
98 | DDBDA3901826F92D006D744F /* GRProProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProProgressIndicator.h; sourceTree = ""; };
99 | DDBDA3911826F92D006D744F /* GRProProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProProgressIndicator.m; sourceTree = ""; };
100 | DDBDA394182705E0006D744F /* GRProToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProToolbar.h; sourceTree = ""; };
101 | DDBDA395182705E0006D744F /* GRProToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProToolbar.m; sourceTree = ""; };
102 | DDBDA39C1827231E006D744F /* GRProKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRProKit.h; sourceTree = ""; };
103 | DDBDA39D1827231E006D744F /* GRProKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRProKit.m; sourceTree = ""; };
104 | /* End PBXFileReference section */
105 |
106 | /* Begin PBXFrameworksBuildPhase section */
107 | DD7718151822AC7800482CBE /* Frameworks */ = {
108 | isa = PBXFrameworksBuildPhase;
109 | buildActionMask = 2147483647;
110 | files = (
111 | DD7EC7B1186BBDA000AA527C /* Carbon.framework in Frameworks */,
112 | DDBDA3791826CE90006D744F /* QuartzCore.framework in Frameworks */,
113 | DDBDA3681826B0FB006D744F /* libz.dylib in Frameworks */,
114 | DD77181D1822AC7800482CBE /* Cocoa.framework in Frameworks */,
115 | );
116 | runOnlyForDeploymentPostprocessing = 0;
117 | };
118 | /* End PBXFrameworksBuildPhase section */
119 |
120 | /* Begin PBXGroup section */
121 | DD5A2B961825AEC100332C2F /* Resources */ = {
122 | isa = PBXGroup;
123 | children = (
124 | DD754DCD1884636700B7B877 /* GRProTheme.pack */,
125 | DDBDA3761826C7D8006D744F /* GRProAlert.xib */,
126 | );
127 | name = Resources;
128 | sourceTree = "";
129 | };
130 | DD77180F1822AC7800482CBE = {
131 | isa = PBXGroup;
132 | children = (
133 | DD7718221822AC7800482CBE /* GRProKit */,
134 | DD77181B1822AC7800482CBE /* Frameworks */,
135 | DD77181A1822AC7800482CBE /* Products */,
136 | );
137 | sourceTree = "";
138 | };
139 | DD77181A1822AC7800482CBE /* Products */ = {
140 | isa = PBXGroup;
141 | children = (
142 | DD7718191822AC7800482CBE /* GRProKit.framework */,
143 | );
144 | name = Products;
145 | sourceTree = "";
146 | };
147 | DD77181B1822AC7800482CBE /* Frameworks */ = {
148 | isa = PBXGroup;
149 | children = (
150 | DD7EC7B0186BBDA000AA527C /* Carbon.framework */,
151 | DDBDA3781826CE90006D744F /* QuartzCore.framework */,
152 | DDBDA3671826B0FB006D744F /* libz.dylib */,
153 | DD77181C1822AC7800482CBE /* Cocoa.framework */,
154 | DD7718311822AC7800482CBE /* XCTest.framework */,
155 | DD77181E1822AC7800482CBE /* Other Frameworks */,
156 | );
157 | name = Frameworks;
158 | sourceTree = "";
159 | };
160 | DD77181E1822AC7800482CBE /* Other Frameworks */ = {
161 | isa = PBXGroup;
162 | children = (
163 | DD77181F1822AC7800482CBE /* Foundation.framework */,
164 | DD7718201822AC7800482CBE /* CoreData.framework */,
165 | DD7718211822AC7800482CBE /* AppKit.framework */,
166 | );
167 | name = "Other Frameworks";
168 | sourceTree = "";
169 | };
170 | DD7718221822AC7800482CBE /* GRProKit */ = {
171 | isa = PBXGroup;
172 | children = (
173 | DD5187E6186101CC008C10CD /* GRProTableView.h */,
174 | DD5187E7186101CC008C10CD /* GRProTableView.m */,
175 | DD5A2C081825E99400332C2F /* GRProButton.h */,
176 | DD5A2C091825E99400332C2F /* GRProButton.m */,
177 | DD5A2C041825E7B800332C2F /* GRProSplitView.h */,
178 | DD5A2C051825E7B800332C2F /* GRProSplitView.m */,
179 | DDBDA3581826B0DA006D744F /* ThemeStore */,
180 | DD5A2B961825AEC100332C2F /* Resources */,
181 | DD7718231822AC7800482CBE /* Supporting Files */,
182 | DD7718561822B09E00482CBE /* GRProWindow.h */,
183 | DD7718571822B09E00482CBE /* GRProWindow.m */,
184 | DD5A2BF81825DEBF00332C2F /* GRProLabel.h */,
185 | DD5A2BF91825DEBF00332C2F /* GRProLabel.m */,
186 | DD5A2C001825E1B100332C2F /* GRProBox.h */,
187 | DD5A2C011825E1B100332C2F /* GRProBox.m */,
188 | DDBDA3711826C552006D744F /* GRProAlert.h */,
189 | DDBDA3721826C552006D744F /* GRProAlert.m */,
190 | DDBDA3801826EBF5006D744F /* GRProSlider.h */,
191 | DDBDA3811826EBF5006D744F /* GRProSlider.m */,
192 | DDBDA3901826F92D006D744F /* GRProProgressIndicator.h */,
193 | DDBDA3911826F92D006D744F /* GRProProgressIndicator.m */,
194 | DDBDA394182705E0006D744F /* GRProToolbar.h */,
195 | DDBDA395182705E0006D744F /* GRProToolbar.m */,
196 | DDBDA39C1827231E006D744F /* GRProKit.h */,
197 | DDBDA39D1827231E006D744F /* GRProKit.m */,
198 | DD7EC7AC186BBD4900AA527C /* GRProMenu.h */,
199 | DD7EC7AD186BBD4900AA527C /* GRProMenu.m */,
200 | DD7EC7B2186BC09F00AA527C /* GRProFont.h */,
201 | DD7EC7B3186BC09F00AA527C /* GRProFont.m */,
202 | DD88248B186CEDC9002975DE /* GRProColor.h */,
203 | DD88248C186CEDC9002975DE /* GRProColor.m */,
204 | );
205 | path = GRProKit;
206 | sourceTree = "";
207 | };
208 | DD7718231822AC7800482CBE /* Supporting Files */ = {
209 | isa = PBXGroup;
210 | children = (
211 | DD7718241822AC7800482CBE /* GRProKit-Info.plist */,
212 | DD7718251822AC7800482CBE /* InfoPlist.strings */,
213 | DD7718281822AC7800482CBE /* GRProKit-Prefix.pch */,
214 | );
215 | name = "Supporting Files";
216 | sourceTree = "";
217 | };
218 | DDBDA3581826B0DA006D744F /* ThemeStore */ = {
219 | isa = PBXGroup;
220 | children = (
221 | DDBDA3591826B0F1006D744F /* GRThemePiece.h */,
222 | DDBDA35A1826B0F1006D744F /* GRThemePiece.m */,
223 | DDBDA35B1826B0F1006D744F /* GRThemeStore.h */,
224 | DDBDA35C1826B0F1006D744F /* GRThemeStore.m */,
225 | DDBDA35D1826B0F1006D744F /* NSData+ZLib.h */,
226 | DDBDA35E1826B0F1006D744F /* NSData+ZLib.m */,
227 | DDBDA35F1826B0F1006D744F /* ThemeFile.h */,
228 | );
229 | name = ThemeStore;
230 | sourceTree = "";
231 | };
232 | /* End PBXGroup section */
233 |
234 | /* Begin PBXHeadersBuildPhase section */
235 | DD7718161822AC7800482CBE /* Headers */ = {
236 | isa = PBXHeadersBuildPhase;
237 | buildActionMask = 2147483647;
238 | files = (
239 | DD5A2C021825E1B100332C2F /* GRProBox.h in Headers */,
240 | DDBDA3661826B0F1006D744F /* ThemeFile.h in Headers */,
241 | DDBDA3921826F92D006D744F /* GRProProgressIndicator.h in Headers */,
242 | DDBDA3731826C552006D744F /* GRProAlert.h in Headers */,
243 | DDBDA396182705E0006D744F /* GRProToolbar.h in Headers */,
244 | DDBDA3821826EBF5006D744F /* GRProSlider.h in Headers */,
245 | DDBDA39E1827231E006D744F /* GRProKit.h in Headers */,
246 | DD5A2C0A1825E99400332C2F /* GRProButton.h in Headers */,
247 | DDBDA3601826B0F1006D744F /* GRThemePiece.h in Headers */,
248 | DD5187E8186101CC008C10CD /* GRProTableView.h in Headers */,
249 | DD88248D186CEDC9002975DE /* GRProColor.h in Headers */,
250 | DD7EC7AE186BBD4900AA527C /* GRProMenu.h in Headers */,
251 | DDBDA3621826B0F1006D744F /* GRThemeStore.h in Headers */,
252 | DDBDA3641826B0F1006D744F /* NSData+ZLib.h in Headers */,
253 | DD7EC7B4186BC09F00AA527C /* GRProFont.h in Headers */,
254 | DD5A2C061825E7B900332C2F /* GRProSplitView.h in Headers */,
255 | DD5A2BFA1825DEBF00332C2F /* GRProLabel.h in Headers */,
256 | DD7718581822B09E00482CBE /* GRProWindow.h in Headers */,
257 | );
258 | runOnlyForDeploymentPostprocessing = 0;
259 | };
260 | /* End PBXHeadersBuildPhase section */
261 |
262 | /* Begin PBXNativeTarget section */
263 | DD7718181822AC7800482CBE /* GRProKit */ = {
264 | isa = PBXNativeTarget;
265 | buildConfigurationList = DD7718411822AC7800482CBE /* Build configuration list for PBXNativeTarget "GRProKit" */;
266 | buildPhases = (
267 | DD7718141822AC7800482CBE /* Sources */,
268 | DD7718151822AC7800482CBE /* Frameworks */,
269 | DD7718161822AC7800482CBE /* Headers */,
270 | DD7718171822AC7800482CBE /* Resources */,
271 | );
272 | buildRules = (
273 | );
274 | dependencies = (
275 | );
276 | name = GRProKit;
277 | productName = GRProKit;
278 | productReference = DD7718191822AC7800482CBE /* GRProKit.framework */;
279 | productType = "com.apple.product-type.framework";
280 | };
281 | /* End PBXNativeTarget section */
282 |
283 | /* Begin PBXProject section */
284 | DD7718101822AC7800482CBE /* Project object */ = {
285 | isa = PBXProject;
286 | attributes = {
287 | LastUpgradeCheck = 0500;
288 | ORGANIZATIONNAME = "Guilherme Rambo";
289 | };
290 | buildConfigurationList = DD7718131822AC7800482CBE /* Build configuration list for PBXProject "GRProKit" */;
291 | compatibilityVersion = "Xcode 3.2";
292 | developmentRegion = English;
293 | hasScannedForEncodings = 0;
294 | knownRegions = (
295 | en,
296 | );
297 | mainGroup = DD77180F1822AC7800482CBE;
298 | productRefGroup = DD77181A1822AC7800482CBE /* Products */;
299 | projectDirPath = "";
300 | projectRoot = "";
301 | targets = (
302 | DD7718181822AC7800482CBE /* GRProKit */,
303 | );
304 | };
305 | /* End PBXProject section */
306 |
307 | /* Begin PBXResourcesBuildPhase section */
308 | DD7718171822AC7800482CBE /* Resources */ = {
309 | isa = PBXResourcesBuildPhase;
310 | buildActionMask = 2147483647;
311 | files = (
312 | DD754DCE1884636700B7B877 /* GRProTheme.pack in Resources */,
313 | DD7718271822AC7800482CBE /* InfoPlist.strings in Resources */,
314 | DDBDA3771826C7D8006D744F /* GRProAlert.xib in Resources */,
315 | );
316 | runOnlyForDeploymentPostprocessing = 0;
317 | };
318 | /* End PBXResourcesBuildPhase section */
319 |
320 | /* Begin PBXSourcesBuildPhase section */
321 | DD7718141822AC7800482CBE /* Sources */ = {
322 | isa = PBXSourcesBuildPhase;
323 | buildActionMask = 2147483647;
324 | files = (
325 | DD5A2C071825E7B900332C2F /* GRProSplitView.m in Sources */,
326 | DDBDA3741826C552006D744F /* GRProAlert.m in Sources */,
327 | DD7EC7AF186BBD4900AA527C /* GRProMenu.m in Sources */,
328 | DDBDA397182705E0006D744F /* GRProToolbar.m in Sources */,
329 | DDBDA3631826B0F1006D744F /* GRThemeStore.m in Sources */,
330 | DD7718591822B09E00482CBE /* GRProWindow.m in Sources */,
331 | DD5A2BFB1825DEBF00332C2F /* GRProLabel.m in Sources */,
332 | DD7EC7B5186BC09F00AA527C /* GRProFont.m in Sources */,
333 | DDBDA3611826B0F1006D744F /* GRThemePiece.m in Sources */,
334 | DD88248E186CEDC9002975DE /* GRProColor.m in Sources */,
335 | DDBDA3931826F92D006D744F /* GRProProgressIndicator.m in Sources */,
336 | DD5A2C0B1825E99400332C2F /* GRProButton.m in Sources */,
337 | DD5A2C031825E1B100332C2F /* GRProBox.m in Sources */,
338 | DDBDA39F1827231E006D744F /* GRProKit.m in Sources */,
339 | DDBDA3651826B0F1006D744F /* NSData+ZLib.m in Sources */,
340 | DD5187E9186101CC008C10CD /* GRProTableView.m in Sources */,
341 | DDBDA3831826EBF5006D744F /* GRProSlider.m in Sources */,
342 | );
343 | runOnlyForDeploymentPostprocessing = 0;
344 | };
345 | /* End PBXSourcesBuildPhase section */
346 |
347 | /* Begin PBXVariantGroup section */
348 | DD7718251822AC7800482CBE /* InfoPlist.strings */ = {
349 | isa = PBXVariantGroup;
350 | children = (
351 | DD7718261822AC7800482CBE /* en */,
352 | );
353 | name = InfoPlist.strings;
354 | sourceTree = "";
355 | };
356 | /* End PBXVariantGroup section */
357 |
358 | /* Begin XCBuildConfiguration section */
359 | DD77183F1822AC7800482CBE /* Debug */ = {
360 | isa = XCBuildConfiguration;
361 | buildSettings = {
362 | ALWAYS_SEARCH_USER_PATHS = NO;
363 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
364 | CLANG_CXX_LIBRARY = "libc++";
365 | CLANG_ENABLE_OBJC_ARC = YES;
366 | CLANG_WARN_BOOL_CONVERSION = YES;
367 | CLANG_WARN_CONSTANT_CONVERSION = YES;
368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
369 | CLANG_WARN_EMPTY_BODY = YES;
370 | CLANG_WARN_ENUM_CONVERSION = YES;
371 | CLANG_WARN_INT_CONVERSION = YES;
372 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
373 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
374 | COPY_PHASE_STRIP = NO;
375 | GCC_C_LANGUAGE_STANDARD = gnu99;
376 | GCC_DYNAMIC_NO_PIC = NO;
377 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
378 | GCC_OPTIMIZATION_LEVEL = 0;
379 | GCC_PREPROCESSOR_DEFINITIONS = (
380 | "DEBUG=1",
381 | "$(inherited)",
382 | );
383 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
384 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
386 | GCC_WARN_UNDECLARED_SELECTOR = YES;
387 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
388 | GCC_WARN_UNUSED_FUNCTION = YES;
389 | GCC_WARN_UNUSED_VARIABLE = YES;
390 | MACOSX_DEPLOYMENT_TARGET = 10.7;
391 | ONLY_ACTIVE_ARCH = YES;
392 | SDKROOT = macosx;
393 | };
394 | name = Debug;
395 | };
396 | DD7718401822AC7800482CBE /* Release */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ALWAYS_SEARCH_USER_PATHS = NO;
400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
401 | CLANG_CXX_LIBRARY = "libc++";
402 | CLANG_ENABLE_OBJC_ARC = YES;
403 | CLANG_WARN_BOOL_CONVERSION = YES;
404 | CLANG_WARN_CONSTANT_CONVERSION = YES;
405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
406 | CLANG_WARN_EMPTY_BODY = YES;
407 | CLANG_WARN_ENUM_CONVERSION = YES;
408 | CLANG_WARN_INT_CONVERSION = YES;
409 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
410 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
411 | COPY_PHASE_STRIP = YES;
412 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
413 | ENABLE_NS_ASSERTIONS = NO;
414 | GCC_C_LANGUAGE_STANDARD = gnu99;
415 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
418 | GCC_WARN_UNDECLARED_SELECTOR = YES;
419 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
420 | GCC_WARN_UNUSED_FUNCTION = YES;
421 | GCC_WARN_UNUSED_VARIABLE = YES;
422 | MACOSX_DEPLOYMENT_TARGET = 10.7;
423 | SDKROOT = macosx;
424 | };
425 | name = Release;
426 | };
427 | DD7718421822AC7800482CBE /* Debug */ = {
428 | isa = XCBuildConfiguration;
429 | buildSettings = {
430 | COMBINE_HIDPI_IMAGES = YES;
431 | DYLIB_COMPATIBILITY_VERSION = 1;
432 | DYLIB_CURRENT_VERSION = 1;
433 | FRAMEWORK_VERSION = A;
434 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
435 | GCC_PREFIX_HEADER = "GRProKit/GRProKit-Prefix.pch";
436 | INFOPLIST_FILE = "GRProKit/GRProKit-Info.plist";
437 | INSTALL_PATH = "@executable_path/../Frameworks";
438 | PRODUCT_NAME = "$(TARGET_NAME)";
439 | WRAPPER_EXTENSION = framework;
440 | };
441 | name = Debug;
442 | };
443 | DD7718431822AC7800482CBE /* Release */ = {
444 | isa = XCBuildConfiguration;
445 | buildSettings = {
446 | COMBINE_HIDPI_IMAGES = YES;
447 | DYLIB_COMPATIBILITY_VERSION = 1;
448 | DYLIB_CURRENT_VERSION = 1;
449 | FRAMEWORK_VERSION = A;
450 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
451 | GCC_PREFIX_HEADER = "GRProKit/GRProKit-Prefix.pch";
452 | INFOPLIST_FILE = "GRProKit/GRProKit-Info.plist";
453 | INSTALL_PATH = "@executable_path/../Frameworks";
454 | PRODUCT_NAME = "$(TARGET_NAME)";
455 | WRAPPER_EXTENSION = framework;
456 | };
457 | name = Release;
458 | };
459 | /* End XCBuildConfiguration section */
460 |
461 | /* Begin XCConfigurationList section */
462 | DD7718131822AC7800482CBE /* Build configuration list for PBXProject "GRProKit" */ = {
463 | isa = XCConfigurationList;
464 | buildConfigurations = (
465 | DD77183F1822AC7800482CBE /* Debug */,
466 | DD7718401822AC7800482CBE /* Release */,
467 | );
468 | defaultConfigurationIsVisible = 0;
469 | defaultConfigurationName = Release;
470 | };
471 | DD7718411822AC7800482CBE /* Build configuration list for PBXNativeTarget "GRProKit" */ = {
472 | isa = XCConfigurationList;
473 | buildConfigurations = (
474 | DD7718421822AC7800482CBE /* Debug */,
475 | DD7718431822AC7800482CBE /* Release */,
476 | );
477 | defaultConfigurationIsVisible = 0;
478 | defaultConfigurationName = Release;
479 | };
480 | /* End XCConfigurationList section */
481 | };
482 | rootObject = DD7718101822AC7800482CBE /* Project object */;
483 | }
484 |
--------------------------------------------------------------------------------