|
Source Code
|
Cocoa Source Code for Mac OS X Developers
This page contains some of our Cocoa/Objective-C source code for fellow Mac OS X developers.
You're welcome to download and use the source, subject to the License Agreement. It's assumed that you're a developer and you know how to make use of the source; we can't provide support. Happy coding!
Need icons for your Mac OS X applications? See our Developer Icons page!
License Agreement
Our source code is released under a very flexible license, designed to let you use, modify and/or redistribute the code pretty much as you see fit, whilst providing us with basic protection and credit. Before downloading any of our source code, please read our Source Code License page in full.
Source Code
Unless mentioned otherwise, all source code requires Mac OS X 10.2 (Jaguar) or later, and corresponding versions of the Developer Tools to open the projects. Some source may also be suitable for previous versions of Mac OS X.
If a project requires a version of OS X later than 10.2, or has special requirements, this will be mentioned.
|
RoundedFloatingPanel |
|
An NSView subclass and accompanying NSWindow subclass which provide the same rounded floating panel overlay which the Panther application switcher uses.
Here's a screenshot.
Note: this project requires Xcode and Mac OS X 10.3 (Panther) or later. |
|
iTableColumnHeader |
|
An NSTableHeaderCell subclass providing the metallic column headers seen in iApps, including the Calendars list in iCal and the Source list in iTunes.
Here's a screenshot.
Note: this project requires Xcode and Mac OS X 10.3 (Panther) or later. |
|
iTableView (Source List and Colored Checkboxes) |
|
A pair of NSTextFieldCell and NSImageCell subclasses (and a simple NSTableView subclass) which provide the blue-gradient selection highlighting behaviour you see in iCal's "Calendars" list, iTunes' "Source" list, and the sidebar in the Panther Finder. Apple calls this kind of control a Source List.
Also includes code to draw colored checkboxes as in iCal, using any color you want!
Here's a screenshot.
Note: this project requires Xcode and Mac OS X 10.3 (Panther) or later. |
|
Address Book Test |
|
Shows how to make use of the Mac OS X 10.2 Address Book API. Includes a live-filtering field which locates Address Book entries by forename, surname or company, and demonstrates finding the primary email address for a specified person, as well as their name and picture.
Here's a screenshot (email address purposely obscured for the sake of Mike's privacy!) |
|
Better TextFinder |
|
Easily implement Find and Replace in your application. Adapted and improved from TextEdit's implementation. Includes both the class and a Nib file containing an appropriate Find panel. Read more about the improvements here.
Here's a screenshot. |
|
SS_PrefsController |
|
A class which lets you easily create Mail/iTunes/Safari-style Preferences windows, with toolbars and multiple panes loaded from bundles. Loads of configurable options and flexibility, and professional results. Take a look at the class documentation (also included in the download).
Here's a screenshot. |
|
Window Fade-out |
|
Ever felt the need to have a window fade out of existence, instead of just closing? Here's how. |
|
Grab-Scrolling |
|
Shows how to implement grab-scrolling, like in Preview, Photoshop, Acrobat and more. Includes the two requisite hand-cursors.
Here's a screenshot. |
|
Screen Sharing |
|
Source for two apps, a client and a server, letting you send full-screen screenshots of your Mac via Rendezvous. This is a modification of Apple's Picture Sharing code. |
|
Localized Nibs |
|
Not really source code, but just as good! This is a collection of "MainMenu.nib" files, with the menubars pre-localized into various languages. All items are connected to the proper actions, and several additional resources are included (such as flag graphics, ISO language tables, and more).
Currently, these languages are included: English, French, German, Dutch, Italian, Catalan, Danish, Brazilian Portuguese, Swedish, Finnish, Spanish, Serbian, Japanese and Korean.
Here's a screenshot (this is the Italian nib). |
|
Snapping Window |
|
Shows how to create proper snap-to-edge windows or palettes, which snap during the drag (as they should). |
|
PopUpImage |
|
A class which gives you icon-buttons with pop-up menus. Configure all kinds of things like whether the menu appears when you click anywhere on the icon or just on the little pop-up arrow, whether the button shows the icon of the last-selected item (like in Photoshop's fly-out tool palette menus), and more.
Here's a screenshot. |
|
ImagePopUpButton |
|
Eric Wang's reimplementation of my PopUpImage class (see above), using a subclass of NSPopUpButton. In Eric's own words, the improvements include:
- Reuse of NSPopUpButton's menu-related methods.
- The class has been split into an NSControl/NSCell pair, allowing it to be used within NSTableView, NSMatrix, etc. The core functionality is implemented in a subclass of NSPopUpButtonCell.
- There are also some subtle interface-related improvements.
Note: this project requires Xcode and Mac OS X 10.3 (Panther) or later.
|
|
GetNetApps |
|
Ever wanted to find the name (or full path, or icon) of the user's default web brower or email client? Or perhaps their default FTP app, or newsreader? This source shows you how to find the user's chosen default application for any protocol you like.
Here's a screenshot. |
|
URL Test |
|
A simple Cocoa application, showing how to launch URLs, use the standard About box with a scrolling field of credits, display alert panels, remember window positions, and more. Useful for developers who are new to Cocoa. |
|
Icon For File Type |
|
A little app which lets you type a file-extension (like "doc" or "html"), and have it show the icon for that file-type (the big, beautiful 128x128 pixels icon). Useful for display purposes.
Here's a screenshot. |
|
Font Panel Test |
|
Shows you how to choose a font with the standard Font Panel. This little app shows a text field with a font's name and size (like "LucidaGrande 13"). You can click a button to bring up the Font Panel, and when you choose a new font the text field is updated with the new name and size. Useful if your app needs to choose a default font for something. |
|
Mod Key Test |
|
A little window with a button that doesn't do anything... unless you click it whilst holding the command, option and control keys. Shows how to detect that those keys are pressed. Useful in all kinds of situations for adding functionality without cluttering up your app's interface. |
|
Shape Thing |
|
A cool little app that lets you draw multi-coloured circles and ovals. Shows how to let the user draw shapes with the mouse, how to draw shapes with transparency, and how to let the user hold down the shift key to constrain a shape to be proportional. Just for fun!
Here's a screenshot. |
|