2 //#import "ITTransientStatusWindow.h"
3 #import "ITIconAndTextStatusWindow.h"
4 #import "ITTSWBackgroundView.h"
5 #import "ITTextField.h"
6 #import "ITBevelView.h"
7 #import "ITCutWindowEffect.h"
8 #import "ITDissolveWindowEffect.h"
9 #import "ITSlideHorizontallyWindowEffect.h"
10 #import "ITSlideVerticallyWindowEffect.h"
11 #import "ITPivotWindowEffect.h"
17 #define SW_BORDER 32.0
18 #define SW_IMAGE @"Library"
21 @interface Controller (ITStatusItemSupport)
22 - (void)createStatusItem;
23 - (void)removeStatusItem;
27 @implementation Controller
31 [self createStatusItem];
32 [button setBezelStyle:1001];
33 [button setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:14]];
34 [button setTitle:@"Launch Manually"];
36 [button setFrameSize:NSMakeSize([button frame].size.width + 8, 24)];
37 [testTextField setCastsShadow:YES];
38 [tabView setAllowsDragging:YES];
39 [bevelView setBevelDepth:10];
40 statusWindow = [ITIconAndTextStatusWindow sharedWindow];
41 [statusWindow setEntryEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
42 [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]];
43 [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
44 [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]];
45 // [tabView setAllowsDragging:YES];
46 [[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
49 /*************************************************************************/
51 #pragma mark ITStatusItem SUPPORT
52 /*************************************************************************/
54 - (void)createStatusItem
56 statusItem = [[ITStatusItem alloc] initWithStatusBar:[NSStatusBar systemStatusBar]
57 withLength:NSVariableStatusItemLength];
59 if ( [showImageCheckBox state] == NSOnState ) {
60 [statusItem setImage:[NSImage imageNamed:@"ITStatusItem"]];
63 if ( [useInvertedCheckBox state] == NSOnState ) {
64 [statusItem setAlternateImage:[NSImage imageNamed:@"ITStatusItemInv"]];
67 if ( [showTitleCheckBox state] == NSOnState ) {
68 [statusItem setTitle:@"ITStatusItem"];
71 [statusItem setMenu:statusItemMenu];
73 [statusItemMenu addItemWithTitle:[NSString stringWithUTF8String:"★★★★★"]
78 - (void)removeStatusItem
80 [[statusItem statusBar] removeStatusItem:statusItem];
81 [statusItem autorelease];
85 - (IBAction)toggleStatusItem:(id)sender
87 if ( [sender state] == NSOnState ) {
88 [self createStatusItem];
89 [showImageCheckBox setEnabled:YES];
90 [showTitleCheckBox setEnabled:YES];
91 [useInvertedCheckBox setEnabled:YES];
93 [self removeStatusItem];
94 [showImageCheckBox setEnabled:NO];
95 [useInvertedCheckBox setEnabled:NO];
96 [showTitleCheckBox setEnabled:NO];
100 - (IBAction)toggleImage:(id)sender
102 if ( [sender state] == NSOnState ) {
103 [statusItem setImage:[NSImage imageNamed:@"ITStatusItem"]];
104 [statusItem setAlternateImage:[NSImage imageNamed:@"ITStatusItemInv"]];
105 [useInvertedCheckBox setEnabled:YES];
106 [useInvertedCheckBox setState:NSOnState];
108 [statusItem setImage:nil];
109 [statusItem setAlternateImage:nil];
110 [useInvertedCheckBox setEnabled:NO];
111 [useInvertedCheckBox setState:NSOffState];
115 - (IBAction)toggleInvertedImage:(id)sender
117 if ( [sender state] == NSOnState ) {
118 [statusItem setAlternateImage:[NSImage imageNamed:@"ITStatusItemInv"]];
120 [statusItem setAlternateImage:nil];
124 - (IBAction)toggleTitle:(id)sender
126 if ( [sender state] == NSOnState ) {
127 [statusItem setTitle:@"ITStatusItem"];
129 [statusItem setTitle:nil];
134 /*************************************************************************/
136 #pragma mark ITTextView SUPPORT
137 /*************************************************************************/
139 - (IBAction)toggleCastsShadow:(id)sender
141 [testTextField setCastsShadow:([sender state] == NSOnState)];
145 /*************************************************************************/
147 #pragma mark ITTransientStatusWindow SUPPORT
148 /*************************************************************************/
150 - (IBAction)buildStatusWindow:(id)sender
152 NSImage *image = [NSImage imageNamed:SW_IMAGE];
153 NSString *text = [swSampleTextView string];
154 [statusWindow setImage:image];
155 [statusWindow buildTextWindowWithString:text];
158 - (IBAction)toggleStatusWindow:(id)sender
160 if ( ([statusWindow visibilityState] == ITWindowHiddenState) ||
161 ([statusWindow visibilityState] == ITWindowVanishingState) ) {
162 [[statusWindow contentView] setNeedsDisplay:YES];
163 [statusWindow appear:self];
165 [statusWindow vanish:self];
169 - (IBAction)changeWindowSetting:(id)sender
171 if ( [sender tag] == 3010 ) {
173 if ( [sender indexOfSelectedItem] == 0) {
174 [statusWindow setExitMode:ITTransientStatusWindowExitAfterDelay];
175 } else if ( [sender indexOfSelectedItem] == 1) {
176 [statusWindow setExitMode:ITTransientStatusWindowExitOnCommand];
179 } else if ( [sender tag] == 3020 ) {
181 } else if ( [sender tag] == 3030 ) {
182 [statusWindow setExitDelay:[sender floatValue]];
183 } else if ( [sender tag] == 3040 ) {
184 [statusWindow setVerticalPosition:[sender indexOfSelectedItem]];
185 } else if ( [sender tag] == 3050 ) {
186 [statusWindow setHorizontalPosition:[sender indexOfSelectedItem]];
187 } else if ( [sender tag] == 3060 ) {
188 [[statusWindow entryEffect] setEffectTime:[sender floatValue]];
189 } else if ( [sender tag] == 3061 ) {
190 [[statusWindow exitEffect] setEffectTime:[sender floatValue]];
191 } else if ( [sender tag] == 3070 ) {
193 if ( [sender indexOfSelectedItem] == 0 ) {
194 [statusWindow setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
195 } else if ( [sender indexOfSelectedItem] == 1 ) {
196 [statusWindow setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
197 } else if ( [sender indexOfSelectedItem] == 2 ) {
198 [statusWindow setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
199 } else if ( [sender indexOfSelectedItem] == 3 ) {
200 [statusWindow setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
201 } else if ( [sender indexOfSelectedItem] == 4 ) {
202 [statusWindow setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
205 [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
207 } else if ( [sender tag] == 3080 ) {
209 if ( [sender indexOfSelectedItem] == 0 ) {
210 [statusWindow setExitEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
211 } else if ( [sender indexOfSelectedItem] == 1 ) {
212 [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]];
213 } else if ( [sender indexOfSelectedItem] == 2 ) {
214 [statusWindow setExitEffect:[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow]];
215 } else if ( [sender indexOfSelectedItem] == 3 ) {
216 [statusWindow setExitEffect:[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow]];
217 } else if ( [sender indexOfSelectedItem] == 4 ) {
218 [statusWindow setExitEffect:[[ITPivotWindowEffect alloc] initWithWindow:statusWindow]];
221 [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]];
223 } else if ( [sender tag] == 3090 ) {
225 if ( [sender indexOfSelectedItem] == 0 ) {
226 [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundApple];
227 } else if ( [sender indexOfSelectedItem] == 1 ) {
228 [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundReadable];
229 } else if ( [sender indexOfSelectedItem] == 2 ) {
230 [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundColored];
233 } else if ( [sender tag] == 3100 ) {
234 [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundColor:[sender color]];
239 /*************************************************************************/
241 #pragma mark ITTabView SUPPORT
242 /*************************************************************************/
244 - (IBAction)toggleTabDragging:(id)sender
246 if ([sender state] == NSOnState) {
247 [tabView setAllowsDragging:YES];
249 [tabView setAllowsDragging:NO];
253 - (IBAction)toggleCommandDragging:(id)sender
255 if ([sender state] == NSOnState) {
256 [tabView setRequiredModifiers:NSCommandKeyMask];
258 [tabView setRequiredModifiers:0];
262 - (IBAction)toggleControlDragging:(id)sender
266 - (IBAction)toggleOptionDragging:(id)sender
270 - (IBAction)toggleShiftDragging:(id)sender
275 /*************************************************************************/
277 #pragma mark ITBevelView SUPPORT
278 /*************************************************************************/
280 - (IBAction)changeBevelViewSetting:(id)sender
282 [bevelView setBevelDepth:[sender intValue]];
286 /*************************************************************************/
288 #pragma mark ITButton SUPPORT
289 /*************************************************************************/
292 /*************************************************************************/
294 #pragma mark NSWindow DELEGATE METHODS
295 /*************************************************************************/
297 - (void)windowWillMiniaturize:(NSNotification *)note
299 [[note object] setMiniwindowImage:[NSImage imageNamed:@"ITStatusItem"]];