1 #import "ITSplashView.h"
3 @implementation ITSplashView
12 - (void)drawRect:(NSRect)rect {
13 [_image compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
20 - (void)stopAnimation {
21 [_progress stopAnimation:nil];
24 - (NSProgressIndicator *)progressIndicator {
32 - (NSString *)string {
33 return [_text stringValue];
36 - (void)setImage:(NSImage *)image {
38 _image = [image retain];
41 - (void)setString:(NSString *)text {
42 [_text setStringValue:text];
45 - (void)loadControlsFromPath:(NSString *)path {
46 [_progress removeFromSuperview];
48 [_text removeFromSuperview];
51 NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:path];
52 int height = [[settings objectForKey:@"ProgressIndicator.thickness"] intValue];
55 /*case NSProgressIndicatorPreferredSmallThickness:
56 size = NSMiniControlSize;
58 case NSProgressIndicatorPreferredAquaThickness:
59 size = NSSmallControlSize;
61 case NSProgressIndicatorPreferredThickness:
63 size = NSRegularControlSize;
66 if ([[settings objectForKey:@"ProgressIndicator.style"] intValue] == 0) {
67 //We have a normal bar
68 _progress = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect([[settings objectForKey:@"ProgressIndicator.x"] intValue], [[settings objectForKey:@"ProgressIndicator.y"] intValue], [[settings objectForKey:@"ProgressIndicator.size"] intValue], height)];
69 [_progress setStyle:NSProgressIndicatorBarStyle];
70 [_progress setControlSize:size];
71 [_progress setIndeterminate:NO];
72 [_progress setMaxValue:100.0];
73 [_progress setMinValue:0.0];
75 //We have a spinner thinger
76 _progress = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect([[settings objectForKey:@"ProgressIndicator.x"] intValue], [[settings objectForKey:@"ProgressIndicator.y"] intValue], [[settings objectForKey:@"ProgressIndicator.size"] intValue], [[settings objectForKey:@"ProgressIndicator.size"] intValue])];
77 [_progress setStyle:NSProgressIndicatorSpinningStyle];
78 [_progress setControlSize:size];
80 [self addSubview:_progress];
81 [_progress startAnimation:nil];
83 _text = [[NSTextField alloc] initWithFrame:NSMakeRect([[settings objectForKey:@"StatusText.x"] intValue], [[settings objectForKey:@"StatusText.y"] intValue], [[settings objectForKey:@"StatusText.width"] intValue], 22)];
84 [_text setEditable:NO];
85 [_text setSelectable:NO];
86 [_text setBezeled:NO];
87 [_text setDrawsBackground:NO];
88 [self addSubview:_text];