Mac GUI stuff

svn path=/trunk/boinc/; revision=884
This commit is contained in:
Eric Heien 2003-02-10 18:45:27 +00:00
parent 8a0e378e47
commit 80fd59ce85
4 changed files with 34 additions and 13 deletions

View File

@ -1,4 +1,4 @@
// The contents of this file are subject to the Mozilla Public License
// The contents of this file are subject to the Mozilla Public License
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/

View File

@ -19,15 +19,28 @@
#include "mac_join.h"
// Create, show and run modally our dialog window
bool success;
#define kJoinSignature 'join'
#define kProjectURLFieldID 128
#define kAccountKeyFieldID 129
// Create, show and run modally our join window
//
OSStatus CreateJoinDialog()
OSStatus CreateJoinDialog( char *master_url, char *account_key )
{
IBNibRef nibRef;
EventTypeSpec dialogSpec = {kEventClassCommand, kEventCommandProcess };
WindowRef dialogWindow;
EventHandlerUPP dialogUPP;
OSStatus err = noErr;
Size realSize;
ControlID projectURLID = { kJoinSignature, kProjectURLFieldID };
ControlID accountKeyID = { kJoinSignature, kAccountKeyFieldID };
ControlHandle zeControl;
CFStringRef text;
success = false;
// Find the dialog nib
err = CreateNibReference(CFSTR("JoinDialog"), &nibRef);
@ -51,6 +64,14 @@ OSStatus CreateJoinDialog()
// Run modally
RunAppModalLoopForWindow(dialogWindow);
GetControlByID( dialogWindow, &projectURLID, &zeControl );
GetControlData( zeControl, 0, kControlEditTextCFStringTag, sizeof(CFStringRef), &text, &realSize);
CFStringGetCString( text, master_url, 256, CFStringGetSystemEncoding() );
GetControlByID( dialogWindow, &accountKeyID, &zeControl );
GetControlData( zeControl, 0, kControlEditTextCFStringTag, sizeof(CFStringRef), &text, &realSize);
CFStringGetCString( text, account_key, 256, CFStringGetSystemEncoding() );
HideWindow(dialogWindow);
DisposeWindow(dialogWindow);
DisposeEventHandlerUPP(dialogUPP);
@ -59,7 +80,7 @@ CantFindDialogNib:
CantCreateDialogWindow:
CantInstallDialogHandler:
return err;
return success;
}
// Dialog event handler
@ -75,12 +96,8 @@ pascal OSStatus JoinDialogEventHandler (EventHandlerCallRef myHandler, EventRef
// Look for our Yes Join and No Join commands
switch (command.commandID) {
case kHICommandOK: // 'ok '
//HandleResponse(TRUE);
stopModalLoop = TRUE;
result = noErr;
break;
success = true;
case kHICommandCancel: // 'not!'
//HandleResponse(FALSE);
stopModalLoop = TRUE;
result = noErr;
break;
@ -94,4 +111,3 @@ pascal OSStatus JoinDialogEventHandler (EventHandlerCallRef myHandler, EventRef
//Return how we handled the event.
return result;
}

View File

@ -24,7 +24,7 @@ extern "C" {
#endif
pascal OSStatus JoinDialogEventHandler (EventHandlerCallRef myHandler, EventRef event, void *userData);
OSStatus CreateJoinDialog();
OSStatus CreateJoinDialog( char *master_url, char *account_key );
#ifdef __cplusplus
}

View File

@ -24,9 +24,14 @@ extern "C" {
#endif
void InitMainWindow(void);
void GUIRedraw();
void DisplayBOINCStatusWindow (int left, int top, int width, int height);
pascal OSStatus MainAppEventHandler(EventHandlerCallRef appHandler, EventRef theEvent, void* appData);
pascal OSStatus MainWinEventHandler(EventHandlerCallRef appHandler, EventRef theEvent, void* appData);
pascal void BOINCPollLoopProcessor(EventLoopTimerRef inTimer, void* timeData);
pascal void BOINCIdleDetect(EventLoopTimerRef inTimer, void* timeData);
int SaveBOINCPreferences( void );
int ReadBOINCPreferences( void );
int mac_setup (void);
void mac_cleanup (void);