1 #import "MTShizzleWindow.h"
3 @interface MTShizzleWindow (Private)
4 - (void)setBling:(id)bling;
9 @implementation MTShizzleWindow
11 static MTShizzleWindow *_privateSharedWindow = nil;
13 + (id)sharedWindowForSender:(id)sender
15 if( _privateSharedWindow ) {
16 [_privateSharedWindow setBling:sender];
17 return _privateSharedWindow;
19 _privateSharedWindow = [[MTShizzleWindow alloc]
20 initWithContentRect:NSMakeRect(0, 0, 385, 353)
21 styleMask:NSTitledWindowMask
22 backing:NSBackingStoreBuffered
24 [_privateSharedWindow setBling:sender];
25 return _privateSharedWindow;
29 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
31 if ( (self = [super initWithContentRect:contentRect
43 [regBenefits release];
49 [registerButton release];
52 [contentView release];
57 - (void)setBling:(id)bling
65 unichar returnChar = '\r';
67 [self setReleasedWhenClosed:NO];
68 [self setTitle:[NSString stringWithFormat:@"Register %@", @"MenuTunes"]];
69 contentView = [self contentView];
71 regMessage = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 282, 345, 51)];
72 [regMessage setStringValue:[NSString stringWithFormat:@"%@ is shareware. If you find it to be a valuable tool, please click the button below to buy your copy. Your support is greatly appreciated.", @"MenuTunes"]];
73 [regMessage setBordered:NO];
74 [regMessage setBezeled:NO];
75 [regMessage setEditable:NO];
76 [regMessage setSelectable:NO];
77 [regMessage setDrawsBackground:NO];
78 [contentView addSubview:regMessage];
81 box = [[NSBox alloc] initWithFrame:NSMakeRect(20, 181, 345, 81)];
82 [box setTitlePosition:NSNoTitle];
83 [box setBorderType:NSBezelBorder];
84 [contentView addSubview:box];
86 //This isn't tall enough
87 registerButton = [[NSButton alloc] initWithFrame:NSMakeRect(24, 13, 115, 49)];
88 [registerButton setImage:[NSImage imageNamed:@"esellerate"]];
89 [registerButton setButtonType:NSMomentaryPushButton];
90 [registerButton setBezelStyle:NSRegularSquareBezelStyle];
91 [registerButton setTarget:_sender];
92 [registerButton setAction:@selector(goToTheStore:)];
93 [[box contentView] addSubview:registerButton];
95 regBenefits = [[NSTextField alloc] initWithFrame:NSMakeRect(152, 16, 175, 42)];
96 [regBenefits setStringValue:[NSString stringWithUTF8String:"• Register instantly and easily.\n• Fast, secure transaction.\n• Major credit cards accepted."]];
97 [regBenefits setBordered:NO];
98 [regBenefits setBezeled:NO];
99 [regBenefits setEditable:NO];
100 [regBenefits setSelectable:NO];
101 [regBenefits setDrawsBackground:NO];
102 [regBenefits setFont:[NSFont fontWithName:@"Lucida Grande" size:11]];
103 [[box contentView] addSubview:regBenefits];
105 enterInfo = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 148, 345, 17)];
106 [enterInfo setStringValue:@"Please enter your registration information below."];
107 [enterInfo setBordered:NO];
108 [enterInfo setBezeled:NO];
109 [enterInfo setEditable:NO];
110 [enterInfo setSelectable:NO];
111 [enterInfo setDrawsBackground:NO];
112 [enterInfo setFont:[NSFont fontWithName:@"Lucida Grande" size:13]];
113 [contentView addSubview:enterInfo];
115 owner = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 126, 345, 14)];
116 [owner setStringValue:@"License Owner:"];
117 [owner setBordered:NO];
118 [owner setBezeled:NO];
119 [owner setEditable:NO];
120 [owner setSelectable:NO];
121 [owner setDrawsBackground:NO];
122 [owner setFont:[NSFont fontWithName:@"Lucida Grande" size:11]];
123 [contentView addSubview:owner];
125 key = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 82, 345, 14)];
126 [key setStringValue:@"License Key:"];
127 [key setBordered:NO];
129 [key setEditable:NO];
130 [key setSelectable:NO];
131 [key setDrawsBackground:NO];
132 [key setFont:[NSFont fontWithName:@"Lucida Grande" size:11]];
133 [contentView addSubview:key];
135 ownerEntry = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 104, 345, 22)];
136 [ownerEntry setTarget:_sender];
137 [ownerEntry setAction:@selector(verifyKey:)];
138 [contentView addSubview:ownerEntry];
140 keyEntry = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 60, 345, 22)];
141 [keyEntry setTarget:_sender];
142 [keyEntry setAction:@selector(verifyKey:)];
143 [contentView addSubview:keyEntry];
145 regLater = [[NSButton alloc] initWithFrame:NSMakeRect(138, 16, 116, 25)];
146 [regLater setTitle:@"Register Later"];
147 [regLater setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
148 [regLater setTarget:_sender];
149 [regLater setAction:@selector(registerLater:)];
150 [regLater setBezelStyle:NSRoundedBezelStyle];
151 [contentView addSubview:regLater];
153 verifyKey = [[NSButton alloc] initWithFrame:NSMakeRect(255, 16, 116, 25)];
154 [verifyKey setTitle:@"Verify Key"];
155 [verifyKey setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
156 [verifyKey setTarget:_sender];
157 [verifyKey setAction:@selector(verifyKey:)];
158 [verifyKey setBezelStyle:NSRoundedBezelStyle];
159 [verifyKey setKeyEquivalent:[NSString stringWithCharacters:&returnChar length:1]];
160 [contentView addSubview:verifyKey];
165 [registerButton setTarget:_sender];
166 [ownerEntry setTarget:_sender];
167 [keyEntry setTarget:_sender];
168 [regLater setTarget:_sender];
169 [verifyKey setTarget:_sender];
174 return [ownerEntry stringValue];
179 return [keyEntry stringValue];