Created
December 8, 2009 22:05
-
-
Save jerodsanto/252038 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import <AppKit/CPMenu.j> | |
@implementation JSMenu : CPMenu | |
{ | |
CPMenuItem SessionMenuItem; | |
} | |
- (id)init | |
{ | |
if (self = [super init]) | |
{ | |
for (i = 0; i < 14; i++) | |
[self addItem:[CPMenuItem separatorItem]]; | |
SessionMenuItem = [[CPMenuItem alloc] init]; | |
[SessionMenuItem setFont:[CPFont systemFontOfSize:13]]; | |
[SessionMenuItem setTarget:[[[CPApplication sharedApplication] delegate] userController]]; | |
[self insertItem:SessionMenuItem atIndex:13]; | |
var menuAttributes = [CPDictionary dictionaryWithObjects: | |
[[CPColor colorWithPatternImage:[[CPImage alloc] initByReferencingFile:@"Resources/Menu.png" | |
size:CGSizeMake(5,29)]], | |
[CPColor whiteColor], | |
[CPColor blackColor]] | |
forKeys:[@"CPMenuBarBackgroundColor",@"CPMenuBarTitleColor",@"CPMenuBarTitleShadowColor"] | |
] | |
[CPMenu setMenuBarAttributes:menuAttributes]; | |
} | |
return self; | |
} | |
- (void)setSessionMenuItemFor:(BOOL)isLoggedIn | |
{ | |
if (isLoggedIn) | |
{ | |
[SessionMenuItem setTitle:@"Logout"]; | |
[SessionMenuItem setAction:@selector(logoutUser:)]; | |
} | |
else | |
{ | |
[SessionMenuItem setTitle:@"Login"]; | |
[SessionMenuItem setAction:@selector(showUserWindow:)]; | |
} | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment