-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use custom anotation window to show translations for macOS Sierra v10.12
- Loading branch information
Showing
10 changed files
with
166 additions
and
61 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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,15 @@ | ||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface AnnotationWinController : NSWindowController{ | ||
|
||
} | ||
|
||
- (void)showWindow:(NSPoint)origin; | ||
|
||
- (void)hideWindow; | ||
|
||
- (void)setAnnotation:(NSString *)annotation; | ||
|
||
+ (id)sharedController; | ||
|
||
@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,53 @@ | ||
#import "AnnotationWinController.h" | ||
|
||
static AnnotationWinController *sharedController; | ||
|
||
@interface AnnotationWinController () | ||
@property (retain, nonatomic) IBOutlet NSPanel *panel; | ||
@property (retain, nonatomic) IBOutlet NSTextView *view; | ||
@end | ||
|
||
@implementation AnnotationWinController | ||
@synthesize view; | ||
@synthesize panel; | ||
|
||
+ (id)sharedController | ||
{ | ||
return sharedController; | ||
} | ||
|
||
-(void)awakeFromNib{ | ||
sharedController = self; | ||
[[self panel] setStyleMask:NSBorderlessWindowMask]; | ||
[[self panel] setOpaque:NO]; | ||
[[self panel] setBackgroundColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.0]]; | ||
[self hideWindow]; | ||
} | ||
|
||
- (void)showWindow:(NSPoint)origin { | ||
NSSize size; | ||
size.width = 170; | ||
size.height = 258; | ||
[[self panel] setMinSize:size]; | ||
[[self panel] setContentSize: size]; | ||
[[self panel] setAlphaValue: 0.9]; | ||
|
||
[[self panel] setFrameTopLeftPoint: origin]; | ||
[[self panel] orderFront:nil]; | ||
[[self panel] setLevel: CGShieldingWindowLevel() + 1]; | ||
[[self panel] setAutodisplay:YES]; | ||
} | ||
|
||
- (void)hideWindow{ | ||
// [[self panel] orderOut:nil]; | ||
NSRect rect; | ||
rect.size.width = 0; | ||
rect.size.height = 0; | ||
[[self panel] setFrame:rect display:NO]; | ||
} | ||
|
||
- (void)setAnnotation:(NSString *)annotation{ | ||
[[self view] setString:annotation]; | ||
} | ||
|
||
@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