Repository navigation
Expand file tree
/
Copy pathWelcomeWindowController.m
More file actions
61 lines (50 loc) · 2.43 KB
/
Copy pathWelcomeWindowController.m
File metadata and controls
61 lines (50 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// This file is part of Scroll Reverser <https://pilotmoon.com/scrollreverser/>
// Licensed under Apache License v2.0 <http://www.apache.org/licenses/LICENSE-2.0>
#import "WelcomeWindowController.h"
@implementation WelcomeWindowController
- (instancetype)init
{
NSWindow *const window=[[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 213, 192)
styleMask:NSWindowStyleMaskTitled
backing:NSBackingStoreBuffered
defer:YES];
window.releasedWhenClosed=NO;
self=[super initWithWindow:window];
if (self) {
NSView *const contentView=window.contentView;
NSTextField *const welcomeLabel=[NSTextField wrappingLabelWithString:NSLocalizedString(@"Scroll Reverser is now running!", nil)];
welcomeLabel.frame=NSMakeRect(18, 147, 179, 34);
welcomeLabel.alignment=NSTextAlignmentCenter;
welcomeLabel.selectable=NO;
[contentView addSubview:welcomeLabel];
// the menu bar picture, with the help text drawn over its dark area
NSImageView *const imageView=[NSImageView imageViewWithImage:[NSImage imageNamed:@"IntroShot"]];
imageView.frame=NSMakeRect(19, 61, 175, 71);
imageView.imageScaling=NSImageScaleProportionallyUpOrDown;
[contentView addSubview:imageView];
NSTextField *const iconHelpLabel=[NSTextField wrappingLabelWithString:NSLocalizedString(@"For settings, click the icon in the menu bar", nil)];
iconHelpLabel.frame=NSMakeRect(23, 72, 168, 28);
iconHelpLabel.alignment=NSTextAlignmentCenter;
iconHelpLabel.selectable=NO;
iconHelpLabel.font=[NSFont messageFontOfSize:11];
iconHelpLabel.textColor=[NSColor colorWithDeviceRed:0.988 green:1 blue:0.996 alpha:1];
[contentView addSubview:iconHelpLabel];
NSButton *const okButton=[NSButton buttonWithTitle:NSLocalizedString(@"OK", nil) target:self action:@selector(closeWelcomeWindow:)];
okButton.frame=NSMakeRect(63, 13, 86, 32);
okButton.keyEquivalent=@"\r";
[contentView addSubview:okButton];
}
return self;
}
- (void)showWindow:(id)sender
{
[NSApp activateIgnoringOtherApps:YES];
[[self window] setLevel:NSFloatingWindowLevel];
[[self window] center];
[super showWindow:sender];
}
- (IBAction)closeWelcomeWindow:(id)sender
{
[self close];
}
@end