Skip to content

Commit

Permalink
init with project files
Browse files Browse the repository at this point in the history
  • Loading branch information
smokyonion committed Jan 7, 2011
1 parent 695785e commit e9cafdd
Show file tree
Hide file tree
Showing 12 changed files with 5,249 additions and 0 deletions.
2 changes: 2 additions & 0 deletions English.lproj/InfoPlist.strings
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

4,425 changes: 4,425 additions & 0 deletions English.lproj/MainMenu.xib

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions SCSwitchButton-Info.plist
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions SCSwitchButton.h
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// SCSwitchButton.h
// SCSwitchButton
//
// Created by Vincent on 1/7/11.
// Copyright 2011 Vincent S. Wang. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface SCSwitchButton : NSButton {

}

@end
84 changes: 84 additions & 0 deletions SCSwitchButton.m
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,84 @@
//
// SCSwitchButton.m
// SCSwitchButton
//
// Created by Vincent on 1/7/11.
// Copyright 2011 Vincent S. Wang. All rights reserved.
//

#import "SCSwitchButton.h"
#import "SCSwitchButtonCell.h"

@implementation SCSwitchButton

+ (void)initialize
{
[self setCellClass:[SCSwitchButtonCell class]];
}

- (void)awakeFromNib
{
[[self class] setCellClass:[SCSwitchButtonCell class]];
}

- (void)keyDown:(NSEvent *)event
{
unichar character = [[event characters] characterAtIndex:0UL];
switch (character)
{
case NSLeftArrowFunctionKey:
case NSRightArrowFunctionKey:
//Do nothing (yet). We'll handle this in keyUp:.
break;
default:
[super keyDown:event];
break;
}
}

- (void)keyUp:(NSEvent *)event
{
unichar character = [[event characters] characterAtIndex:0UL];
switch (character)
{
case NSLeftArrowFunctionKey:
switch ([self state])
{
case NSOffState:
NSBeep();
break;
case NSMixedState:
[self setState:NSOffState];
break;
case NSOnState:
if ([self allowsMixedState])
[self setState:NSMixedState];
else
[self setState:NSOffState];
break;
}
break;
case NSRightArrowFunctionKey:
switch ([self state])
{
case NSOffState:
if ([self allowsMixedState])
[self setState:NSMixedState];
else
[self setState:NSOnState];
break;
case NSMixedState:
[self setState:NSOnState];
break;
case NSOnState:
NSBeep();
break;
}
break;
default:
[super keyUp:event];
break;
}
}

@end
Loading

0 comments on commit e9cafdd

Please sign in to comment.