1/* StartAppWin.m 2 * 3 * Copyright (C) 2004 Free Software Foundation, Inc. 4 * 5 * Author: Enrico Sersale <enrico@imago.ro> 6 * Date: January 2004 7 * 8 * This file is part of the GNUstep GWorkspace application 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. 23 */ 24 25#include <Foundation/Foundation.h> 26#include <AppKit/AppKit.h> 27#include "StartAppWin.h" 28 29static NSString *nibName = @"StartAppWin"; 30 31@implementation StartAppWin 32 33- (void)dealloc 34{ 35 TEST_RELEASE (win); 36 [super dealloc]; 37} 38 39- (id)init 40{ 41 self = [super init]; 42 43 if (self) { 44 if ([NSBundle loadNibNamed: nibName owner: self] == NO) { 45 NSLog(@"failed to load %@!", nibName); 46 DESTROY (self); 47 return self; 48 } else { 49 NSRect wframe = [win frame]; 50 NSRect scrframe = [[NSScreen mainScreen] frame]; 51 NSRect winrect = NSMakeRect((scrframe.size.width - wframe.size.width) / 2, 52 (scrframe.size.height - wframe.size.height) / 2, 53 wframe.size.width, 54 wframe.size.height); 55 56 [win setFrame: winrect display: NO]; 57 [win setDelegate: self]; 58 59 /* Internationalization */ 60 [startLabel setStringValue: NSLocalizedString(@"starting:", @"")]; 61 } 62 } 63 64 return self; 65} 66 67- (void)showWindowWithTitle:(NSString *)title 68 appName:(NSString *)appname 69 operation:(NSString *)operation 70 maxProgValue:(double)maxvalue 71{ 72 if (win) { 73 [win setTitle: title]; 74 [startLabel setStringValue: operation]; 75 [nameField setStringValue: appname]; 76 77 [progInd setMinValue: 0.0]; 78 [progInd setMaxValue: maxvalue]; 79 [progInd setDoubleValue: 0.0]; 80 81 if ([win isVisible] == NO) { 82 [win orderFrontRegardless]; 83 } 84 } 85} 86 87- (void)updateProgressBy:(double)incr 88{ 89 [progInd incrementBy: incr]; 90} 91 92- (NSWindow *)win 93{ 94 return win; 95} 96 97- (BOOL)windowShouldClose:(id)sender 98{ 99 return YES; 100} 101 102@end 103