Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/Classes/LoadingPanelController.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Sat Sep 3 06:22:57 2011 UTC (12 years, 8 months ago) by toshinagata1964
File size: 1728 byte(s)
initial import
1 //
2 // LoadingPanelController.m
3 //
4 // Created by Toshi Nagata.
5 /*
6 Copyright (c) 2000-2011 Toshi Nagata. All rights reserved.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation version 2 of the License.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 */
17
18 #import "LoadingPanelController.h"
19
20 @implementation LoadingPanelController
21
22 - (id)initWithTitle: (NSString *)title andCaption: (NSString *)caption
23 {
24 self = [super initWithWindowNibName:@"LoadingPanel"];
25 [[self window] setTitle: title];
26 [textField setStringValue: caption];
27 return self;
28 }
29
30 - (id)beginSession
31 {
32 session = [[NSApplication sharedApplication] beginModalSessionForWindow: [self window]];
33 return self;
34 }
35
36 - (BOOL)runSession
37 {
38 return ([[NSApplication sharedApplication] runModalSession: session] == NSRunContinuesResponse);
39 }
40
41 - (id)endSession
42 {
43 [[NSApplication sharedApplication] endModalSession: session];
44 return self;
45 }
46
47 - (void)windowDidLoad
48 {
49 canceled = NO;
50 [indicator setDoubleValue: 0.0];
51 }
52
53 - (void)setProgressAmount: (double)amount
54 {
55 if (amount >= 0.0 && amount <= 100.0) {
56 [indicator setIndeterminate: NO];
57 [indicator setDoubleValue: amount];
58 } else {
59 [indicator setIndeterminate: YES];
60 [indicator startAnimation: self];
61 }
62 }
63
64 - (void)setCaption: (NSString *)caption
65 {
66 [textField setStringValue: caption];
67 }
68
69 - (BOOL)canceled
70 {
71 return canceled;
72 }
73
74 - (IBAction)cancelAction:(id)sender
75 {
76 canceled = YES;
77 }
78
79 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26