Skip to content

Commit

Permalink
macosx: use @synthesize to generate getters
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaikov committed Nov 9, 2014
1 parent 83feebc commit d756c17
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 44 deletions.
19 changes: 12 additions & 7 deletions wrapper/macos/SunPinyinApplicationDelegate.h
Expand Up @@ -71,23 +71,28 @@ typedef enum {

+(instancetype)fromApp;

-(NSMenu*)menu;
-(CandidateWindow*)candiWin;

-(IBAction)showPrefPanel:(id)sender;
-(IBAction)showFontPanel:(id)sender;

-(IBAction)toggleChinesePuncts:(id)sender;
-(bool)inputChinesePuncts;
-(IBAction)toggleFullSymbols:(id)sender;
-(bool)inputFullSymbols;

-(SwitchingPolicies)switchingPolicy;
-(CommitPolicies)commitPolicy;
-(bool)usingUSKbLayout;

-(NSDictionary *)registrationDictionaryForGrowl;
-(void)messageNotify:(NSString*)msg;

// so our controllers can access the shared NSMenu.
@property (readonly, nonatomic) NSMenu *menu;
@property (readonly, nonatomic) CandidateWindow *candiWin;

@property (readonly, nonatomic) bool inputChinesePuncts;
@property (readonly, nonatomic) bool inputFullSymbols;
@property (readonly, nonatomic) SwitchingPolicies switchingPolicy;
@property (readonly, nonatomic) CommitPolicies commitPolicy;
@property (readonly, nonatomic) bool usingUSKbLayout;


@end

// -*- indent-tabs-mode: nil -*- vim:et:ts=4
46 changes: 9 additions & 37 deletions wrapper/macos/SunPinyinApplicationDelegate.mm
Expand Up @@ -53,22 +53,19 @@

@implementation SunPinyinApplicationDelegate

@synthesize menu = _menu;
@synthesize candiWin = _candiWin;
@synthesize inputChinesePuncts = _inputChinesePuncts;
@synthesize inputFullSymbols = _inputFullSymbols;
@synthesize switchingPolicy = _switchingPolicy;
@synthesize commitPolicy = _commitPolicy;
@synthesize usingUSKbLayout = _usingUSKbLayout;

+(instancetype)fromApp
{
return (SunPinyinApplicationDelegate *)[NSApp delegate];
}

//this method is added so that our controllers can access the shared NSMenu.
-(NSMenu*)menu
{
return _menu;
}

-(CandidateWindow*)candiWin
{
return _candiWin;
}

-(void)updateUISettings
{
NSUserDefaults* pref = [NSUserDefaults standardUserDefaults];
Expand Down Expand Up @@ -223,11 +220,6 @@ -(IBAction)toggleChinesePuncts:(id)sender
forKey:@"inputChinesePuncts"];
}

-(bool)inputChinesePuncts
{
return _inputChinesePuncts;
}

-(IBAction)toggleFullSymbols:(id)sender
{
NSMenuItem *item = [_menu itemWithTag:1];
Expand All @@ -236,27 +228,7 @@ -(IBAction)toggleFullSymbols:(id)sender
forKey:@"inputFullSymbols"];
}

-(bool)inputFullSymbols
{
return _inputFullSymbols;
}

-(SwitchingPolicies)switchingPolicy
{
return _switchingPolicy;
}

-(CommitPolicies)commitPolicy
{
return _commitPolicy;
}

-(bool)usingUSKbLayout
{
return _usingUSKbLayout;
}

-(void)dealloc
-(void)dealloc
{
delete _data;
delete _history;
Expand Down

0 comments on commit d756c17

Please sign in to comment.