-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pkrll/master
Added feature in 2.3.0 (01A9) + bug fix in 2.3.1 (01AA)
- Loading branch information
Showing
8 changed files
with
203 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*! | ||
* @class RFMenu | ||
* @brief A Custom Menu. | ||
* @version 1.0.0 | ||
* @author Ardalan Samimi | ||
* @copyright Saturn Five | ||
*/ | ||
@interface RFMenu : NSMenu | ||
|
||
@property (nonatomic, strong) NSMenuItem *autoStartMenu; | ||
@property (nonatomic, strong) NSMenuItem *aboutAppMenu; | ||
@property (nonatomic, strong) NSMenuItem *durationMenu; | ||
@property (nonatomic, strong) NSMenuItem *shutdownMenu; | ||
|
||
- (instancetype)initMainMenuWithTitle:(NSString *)title; | ||
- (instancetype)initSubMenuWithTitle:(NSString *)title; | ||
- (void)addItemWithTitle:(NSString *)title | ||
tag:(int)tag | ||
selector:(SEL)selector | ||
target:(id)sender; | ||
- (void)resetStateForMenuItems; | ||
|
||
@end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*! | ||
* RFMenu.h | ||
* RocketFuel | ||
* | ||
* Created by Ardalan Samimi on 26/10/15. | ||
* Copyright © 2015 Saturn Five. All rights reserved. | ||
*/ | ||
|
||
#import "RFMenu.h" | ||
|
||
@implementation RFMenu | ||
|
||
- (instancetype)initMainMenuWithTitle:(NSString *)title { | ||
self = [super initWithTitle:title]; | ||
|
||
if (self) { | ||
[self addItemsToMainMenu]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (instancetype)initSubMenuWithTitle:(NSString *)title { | ||
self = [super initWithTitle:title]; | ||
|
||
if (self) { | ||
|
||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)addItemsToMainMenu { | ||
self.autoStartMenu = [[NSMenuItem alloc] initWithTitle:@"Launch at login" | ||
action:nil | ||
keyEquivalent:@""]; | ||
self.durationMenu = [[NSMenuItem alloc] initWithTitle:@"Deactivate after" | ||
action:nil | ||
keyEquivalent:@""]; | ||
self.aboutAppMenu = [[NSMenuItem alloc] initWithTitle:@"About" | ||
action:nil | ||
keyEquivalent:@""]; | ||
self.shutdownMenu = [[NSMenuItem alloc] initWithTitle:@"Quit" | ||
action:@selector(terminate:) | ||
keyEquivalent:@""]; | ||
[self addItem:self.autoStartMenu]; | ||
[self addItem:self.durationMenu]; | ||
[self addItem:[NSMenuItem separatorItem]]; | ||
[self addItem:self.aboutAppMenu]; | ||
[self addItem:[NSMenuItem separatorItem]]; | ||
[self addItem:self.shutdownMenu]; | ||
} | ||
|
||
- (void)addItemWithTitle:(NSString *)title | ||
tag:(int)tag | ||
selector:(SEL)selector | ||
target:(id)sender { | ||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:title | ||
action:selector | ||
keyEquivalent:@""]; | ||
item.tag = tag; | ||
item.target = sender; | ||
[self addItem:item]; | ||
} | ||
|
||
- (void)resetStateForMenuItems { | ||
for (NSMenuItem *item in self.itemArray) { | ||
item.state = NSOffState; | ||
} | ||
} | ||
|
||
@end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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