summaryrefslogtreecommitdiffstats
path: root/Liaison/LoadPanelController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Liaison/LoadPanelController.m')
-rw-r--r--Liaison/LoadPanelController.m74
1 files changed, 74 insertions, 0 deletions
diff --git a/Liaison/LoadPanelController.m b/Liaison/LoadPanelController.m
new file mode 100644
index 0000000..efed833
--- /dev/null
+++ b/Liaison/LoadPanelController.m
@@ -0,0 +1,74 @@
+#import "LoadPanelController.h"
+
+@implementation LoadPanelController
+- (id)init
+{
+ self = [super init];
+
+ isShowing = NO;
+
+ return self;
+}
+
+- (void)sheetDidEnd: (NSWindow *)sheet
+ returnCode: (int)returnCode
+ contextInfo: (void *)contextInfo
+{
+ [sheet close];
+}
+
+- (void)show
+{
+ if (isShowing == NO) {
+ [NSApp beginSheet: theLoadPanel
+ modalForWindow: [NSApp mainWindow]
+ modalDelegate: self
+ didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo: nil];
+ modalSession = [NSApp beginModalSessionForWindow: theLoadPanel];
+ isShowing = YES;
+ }
+}
+
+- (void)hide
+{
+ if (isShowing) {
+ [NSApp endModalSession: modalSession];
+ [NSApp endSheet: theLoadPanel];
+ isShowing = NO;
+ }
+}
+
+- (void)setStatus: (NSString *)aStatusMsg
+{
+ [theStatusField setStringValue: aStatusMsg];
+}
+
+- (void)setPath: (NSString *)aPath
+{
+ [thePathField setStringValue: aPath];
+}
+
+- (void)setProgress: (double)aProgress
+{
+ [theProgressBar setDoubleValue: aProgress];
+}
+
+- (void)setIndeterminantProgress: (BOOL)isIndeterminante
+{
+ [theProgressBar setIndeterminate: isIndeterminante];
+}
+
+- (void)update
+{
+ if (isShowing) {
+ if ([theProgressBar isIndeterminate])
+ [theProgressBar animate: self];
+ [NSApp runModalSession: modalSession];
+ }
+}
+@synthesize modalSession;
+@synthesize isShowing;
+@synthesize theProgressBar;
+@synthesize theLoadPanel;
+@end