Exemple #1
0
static	OSErr	InitializeApplication( void )
{
	OSErr						err;
	static const EventTypeSpec	sApplicationEvents[] =	{	{ kEventClassCommand, kEventCommandProcess }	};

	BlockZero( &g, sizeof(g) );
		
	g.mainBundle = CFBundleGetMainBundle();
	if ( g.mainBundle == NULL ) 	{ err = -1;	goto Bail;	}
	
	err	= CreateNibReferenceWithCFBundle( g.mainBundle, CFSTR("WindowFun"), &g.mainNib );
	if ( err != noErr )	goto Bail;
	if ( g.mainNib == NULL ) 		{ err = -1;	goto Bail;	}

	err	= SetMenuBarFromNib( g.mainNib, CFSTR("MenuBar") );
	if ( err != noErr )	goto Bail;

	InstallApplicationEventHandler( NewEventHandlerUPP(AppEventEventHandlerProc), GetEventTypeCount(sApplicationEvents), sApplicationEvents, 0, NULL );

	//	Force the document group to be created first, so we can position our groups between the floating and document groups
	(void) GetWindowGroupOfClass( kDocumentWindowClass );
	
	//	Create our default WindowGroups and set their z-order
	err	= CreateWindowGroup( 0, &g.windowGroups[0] );
	err	= CreateWindowGroup( 0, &g.windowGroups[1] );
	err	= CreateWindowGroup( 0, &g.windowGroups[2] );

	//	Position our groups behind the floating group and in front of the document group
	SendWindowGroupBehind( g.windowGroups[2], GetWindowGroupOfClass( kDocumentWindowClass ) );
	SendWindowGroupBehind( g.windowGroups[1], g.windowGroups[2] );
	SendWindowGroupBehind( g.windowGroups[0], g.windowGroups[1] );

Bail:	
	return( err );
}
Exemple #2
0
bool os_initialize( adobe::application_t* theApp )
{
    //
    // On the Mac we need to install the application menus, respond
    // to AppleEvents and set the resource path. We set the resource
    // path first.
    //
    ProcessSerialNumber psn;
    ADOBE_REQUIRE_STATUS( GetCurrentProcess( &psn ) );

    FSRef location;
    ADOBE_REQUIRE_STATUS( GetProcessBundleLocation( &psn, &location ) );

    theApp->set_resource_directory( fsref_to_path( location ) / "Contents" / "Resources" );

    //
    // Now load our bundle, sign up for AppleEvents and show the menu.
    //
    CFBundleRef bundle = CFBundleGetMainBundle();
    IBNibRef    nibs = 0;

    if( !bundle ) return false;

    ADOBE_REQUIRE_STATUS( CreateNibReferenceWithCFBundle( bundle, kMainNibFileName, &nibs ) );

    if( !nibs )
    {
        ::CFRelease( bundle );

        return false;
    }

    //
    // Sign up to handle the "Open" AppleEvent.
    //
    static adobe::auto_resource<AEEventHandlerUPP> ae_handler( NewAEEventHandlerUPP( handle_open ) );

    AEInstallEventHandler( kCoreEventClass, kAEOpenDocuments, ae_handler.get(), 0, false );

    //
    // Install the menu, and it's event handler.
    //
    ADOBE_REQUIRE_STATUS( SetMenuBarFromNib( nibs, kMenuBarNibName ) );

    static EventTypeSpec                            hi_event = { kEventClassCommand, kHICommandFromMenu };
    static adobe::auto_resource<EventHandlerUPP>    hi_handler( NewEventHandlerUPP( menu_command ) );

    InstallApplicationEventHandler( hi_handler.get(), 1, &hi_event, theApp, 0 );

    //
    // Register this app as an Appearance Client
    //
    // Apple docs: "This function does nothing on Mac OS X. Do not call it."
    //
    // RegisterAppearanceClient();

    return true;
}
//----------------------------------------------------------------------------//
void MacCEGuiRendererSelector::loadDialogWindow()
{
    // get our framework bundle from the app
    CFBundleRef helperFwk =
        CFBundleGetBundleWithIdentifier(
            CFSTR("net.sourceforge.crayzedsgui.CEGUISampleHelper"));

    if (helperFwk)
    {
        IBNibRef nib;
        if (!CreateNibReferenceWithCFBundle(helperFwk,
                                            CFSTR("RendererSelector"), &nib))
        {
            CreateWindowFromNib(nib, CFSTR("RendererSelector"), &d_dialog);
            DisposeNibReference (nib);

            // find popup button in the window
            const HIViewID rendererPopupID = {'PBTN', 0};
            HIViewFindByID(HIViewGetRoot(d_dialog),
                           rendererPopupID,
                           &d_rendererPopup);
        }
    }    
}
Exemple #4
0
static	OSErr	InitializeApplication( void )
{
	OSErr						err;
	static const EventTypeSpec	sApplicationEvents[] =	{	{ kEventClassCommand, kEventCommandProcess }	};

	BlockZero( &g, sizeof(g) );
		
	g.mainBundle = CFBundleGetMainBundle();
	if ( g.mainBundle == NULL ) 		{ err = -1;	goto Bail;	}

	if ( MPLibraryIsLoaded() == false )	{ err = -1;	goto Bail;	}
	
	err	= CreateNibReferenceWithCFBundle( g.mainBundle, CFSTR("main"), &g.mainNib );
	if ( err != noErr )	goto Bail;
	if ( g.mainNib == NULL ) 		{ err = -1;	goto Bail;	}

	err	= SetMenuBarFromNib( g.mainNib, CFSTR("MenuBar") );
	if ( err != noErr )	goto Bail;

	InstallApplicationEventHandler( NewEventHandlerUPP(AppEventEventHandlerProc), GetEventTypeCount(sApplicationEvents), sApplicationEvents, 0, NULL );

Bail:	
	return( err );
}
OSStatus PickMonitor (DisplayIDType *inOutDisplayID, WindowRef parentWindow)
{
	WindowRef theWindow;
	OSStatus status = noErr;
	static const ControlID	kUserPane 		= { 'MONI', 1 };
	
	// Fetch the dialog

	IBNibRef aslNib;
	CFBundleRef theBundle = CFBundleGetMainBundle();
	status = CreateNibReferenceWithCFBundle(theBundle, CFSTR("ASLCore"), &aslNib);
	status = ::CreateWindowFromNib(aslNib, CFSTR( "Pick Monitor" ), &theWindow );
	if (status != noErr)
	{
		assert(false);
		return userCanceledErr;
	}

#if 0
	// Put game name in window title. By default the title includes the token <<<kGameName>>>.

	Str255 windowTitle;
	GetWTitle(theWindow, windowTitle);
	FormatPStringWithGameName(windowTitle);
	SetWTitle(theWindow, windowTitle);
#endif
		
	// Set up the controls

	ControlRef monitorPane;
	GetControlByID( theWindow, &kUserPane, &monitorPane );
	assert(monitorPane);

	SetupPickMonitorPane(monitorPane, *inOutDisplayID);

	// Create our UPP and install the handler.

	EventTypeSpec cmdEvent = { kEventClassCommand, kEventCommandProcess };
	EventHandlerUPP handler = NewEventHandlerUPP( PickMonitorHandler );
	InstallWindowEventHandler( theWindow, handler, 1, &cmdEvent, theWindow, NULL );
	
	// Show the window

	if (parentWindow)
		ShowSheetWindow( theWindow, parentWindow );
	else
		ShowWindow( theWindow );

	// Now we run modally. We will remain here until the PrefHandler
	// calls QuitAppModalLoopForWindow if the user clicks OK or
	// Cancel.

	RunAppModalLoopForWindow( theWindow );

	// OK, we're done. Dispose of our window and our UPP.
	// We do the UPP last because DisposeWindow can send out
	// CarbonEvents, and we haven't explicitly removed our
	// handler. If we disposed the UPP, the Toolbox might try
	// to call it. That would be bad.

	TearDownPickMonitorPane(monitorPane);
	if (parentWindow)
		HideSheetWindow( theWindow );
	DisposeWindow( theWindow );
	DisposeEventHandlerUPP( handler );

	// Return settings to caller

	if (sSelectedDevice != 0)
	{
		// Read back the controls
		DMGetDisplayIDByGDevice (sSelectedDevice, &*inOutDisplayID, true);
		return noErr;
	}
	else
		return userCanceledErr;

}
Exemple #6
0
void
create_login (HWND hwnd,
    LPCSTR username,
    LPCSTR password,
    LPCSTR dsn,
    TLOGIN * log_t)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  WindowRef wlogin;
  ControlRef control;
  ControlID controlID;
  EventRecord event;
  IBNibRef nibRef;
  OSStatus err;
  char msg[1024];

  if (hwnd == NULL)
    return;

  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err =
      CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (CFSTR
	("org.iodbc.drvproxy")), CFSTR ("login"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wlogin);
      DisposeNibReference (nibRef);
      /* Set the title with the DSN */
      if (dsn)
        {
          msg[0] = STRLEN ("Login for ") + STRLEN(dsn);
          sprintf (msg+1, "Login for %s", (char*)dsn);
          SetWTitle (wlogin, msg);
	}
      /* Set the control into the structure */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, LBUSER_CNTL, wlogin,
	  log_t->username);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, LBPASS_CNTL, wlogin,
          log_t->password);
      log_t->user = log_t->pwd = NULL;
      log_t->mainwnd = wlogin;
      /* Install handlers for the finish button, the cancel */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, LBOK_CNTL, wlogin, control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (login_ok_clicked), 1, &controlSpec, log_t,
	  NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, LBCANCEL_CNTL, wlogin,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (login_cancel_clicked), 1, &controlSpec, log_t,
	  NULL);

      SetControlData (log_t->username, 0, kControlEditTextTextTag,
        username ? STRLEN (username) : STRLEN(""),
        (UInt8 *) username ? username : "");
      SetControlData (log_t->password, 0, kControlEditTextPasswordTag,
        password ? STRLEN (password) : STRLEN(""),
        (UInt8 *) password ? password : "");

      /* Show the window and run the loop */
      AdvanceKeyboardFocus (wlogin);
      ShowWindow (wlogin);
      /* The main loop */
      while (log_t->mainwnd)
	{
	  switch (WaitNextEvent (everyEvent, &event, 60L, cursorRgn))
	    {
	    };
	}
    }
  else
    goto error;

  return;

error:
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return;
}
OSStatus _Growl_ShowUpdatePromptForVersion(CFStringRef updateVersion) {
	OSStatus err = noErr;

	if (_checkOSXVersion()) {
		CFBundleRef bundle = CFBundleGetBundleWithIdentifier(GROWL_WITHINSTALLER_FRAMEWORK_IDENTIFIER);
		if (!bundle)
			NSLog(CFSTR("GrowlInstallationPrompt: could not locate framework bundle (forget about installing Growl); had looked for bundle with identifier '%@'"), GROWL_WITHINSTALLER_FRAMEWORK_IDENTIFIER);
		else {
			IBNibRef nib = NULL;
			err = CreateNibReferenceWithCFBundle(bundle, CFSTR("GrowlInstallationPrompt-Carbon"), &nib);
			if (err != noErr) {
				NSLog(CFSTR("GrowlInstallationPrompt: could not obtain nib: CreateNibReferenceWithCFBundle(%@, %@) returned %li"), bundle, CFSTR("GrowlInstallationPrompt-Carbon"), (long)err);
			} else {
				WindowRef window = NULL;

				err = CreateWindowFromNib(nib, CFSTR("Installation prompt"), &window);
				DisposeNibReference(nib);

				if (err != noErr) {
					NSLog(CFSTR("GrowlInstallationPrompt: could not obtain window from nib: CreateWindowFromNib(%p, %@) returned %li"), nib, CFSTR("Installation prompt"), (long)err);
				} else {
					OSStatus fillOutTextErr = _fillOutTextInWindow(window, (updateVersion != nil));
					OSStatus fillOutIconErr = _fillOutIconInWindow(window);

					err = (fillOutTextErr != noErr) ? fillOutTextErr : (fillOutIconErr != noErr) ? fillOutIconErr : noErr;
					if (err == noErr) {
						if (updateVersion) {
							//store the update version on the window.
							updateVersion = CFRetain(updateVersion);
							err = SetWindowProperty(window,
													GROWL_SIGNATURE,
													GIPC_UPDATE_VERSION,
													sizeof(updateVersion),
													&updateVersion);
							if (err != noErr)
								NSLog(CFSTR("GrowlInstallationPrompt: SetWindowProperty returned %li"), (long)err);
						}

						EventHandlerUPP handlerUPP = NewEventHandlerUPP(_handleCommandInWindow);

						struct EventTypeSpec types[] = {
							{ .eventClass = kEventClassCommand, .eventKind = kEventCommandProcess },
						};

						EventHandlerRef handler = NULL;
						err = InstallWindowEventHandler(window,
														handlerUPP,
														GetEventTypeCount(types),
														types,
														/*refcon*/ window,
														&handler);
						if (err != noErr)
							NSLog(CFSTR("GrowlInstallationPrompt: InstallWindowEventHandler returned %li"), (long)err);
						else {
							HIViewID chasingArrowsID = { GROWL_SIGNATURE, chasingArrowsIDNumber };
							HIViewRef chasingArrows = NULL;

							//stop and hide the chasing arrows, until the user clicks Install.
							OSStatus chasingArrowsErr = HIViewFindByID(HIViewGetRoot(window), chasingArrowsID, &chasingArrows);
							if (chasingArrowsErr == noErr) {
								Boolean truth = false;
								SetControlData(chasingArrows,
											   kControlEntireControl,
											   kControlChasingArrowsAnimatingTag,
											   sizeof(truth),
											   &truth);
								HIViewSetVisible(chasingArrows, false);
							}

							SelectWindow(window);
							ShowWindow(window);

							err = RunAppModalLoopForWindow(window);
							if (err != noErr)
								NSLog(CFSTR("GrowlInstallationPrompt: RunAppModalLoopForWindow(%p) returned %li"), window, (long)err);

							RemoveEventHandler(handler);
						}
						DisposeEventHandlerUPP(handlerUPP);
					}

					ReleaseWindow(window);
				}
			}
		}
	}
Exemple #8
0
LPSTR create_gensetup (HWND hwnd, LPCSTR dsn,
    LPCSTR attrs, BOOL add, BOOL *verify_conn)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  TGENSETUP gensetup_t;
  ControlID controlID;
  WindowRef wgensetup;
  ControlRef control;
  EventRecord event;
  IBNibRef nibRef;
  OSStatus err;
  char msg[1024];

  gensetup_t.verify_conn = true;
  /* Search the bundle for a .nib file named 'odbcadmin'. */
  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err = CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (
          CFSTR ("org.iodbc.adm")), CFSTR ("gensetup"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wgensetup);
      DisposeNibReference (nibRef);
      /* Set the title with the DSN */
      if (dsn)
        {
          msg[0] = STRLEN ("Setup of ") + STRLEN(dsn);
          sprintf (msg+1, "Setup of %s", (char*)dsn);
          SetWTitle (wgensetup, msg);
	}
      /* Install handlers for the finish button, the cancel */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSDSN_CNTL, wgensetup,
	  gensetup_t.dsn_entry);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSVERIFYCONN_CNTL, wgensetup,
	  gensetup_t.verify_conn_cb);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSLIST_CNTL, wgensetup,
	  gensetup_t.key_list);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSKEYWORD_CNTL, wgensetup,
	  gensetup_t.key_entry);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSVALUE_CNTL, wgensetup,
	  gensetup_t.value_entry);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSUPDATE_CNTL, wgensetup,
	  gensetup_t.bupdate);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSADD_CNTL, wgensetup,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (gensetup_add_clicked), 1, &controlSpec,
	  &gensetup_t, NULL);
      InstallEventHandler (GetControlEventTarget (gensetup_t.bupdate),
	  NewEventHandlerUPP (gensetup_update_clicked), 1, &controlSpec,
	  &gensetup_t, NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSOK_CNTL, wgensetup,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (gensetup_ok_clicked), 1, &controlSpec,
	  &gensetup_t, NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSCANCEL_CNTL, wgensetup,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (gensetup_cancel_clicked), 1, &controlSpec,
	  &gensetup_t, NULL);
      /* Parse the attributes line */
      gensetup_t.mainwnd = wgensetup;
      parse_attribute_line (&gensetup_t, dsn, attrs, add);
      AdvanceKeyboardFocus (wgensetup);
      /* Show the window and run the loop */
      DeactivateControl (gensetup_t.bupdate);
      DSNSETUP = &gensetup_t;
      ShowWindow (wgensetup);
      /* The main loop */
      while (gensetup_t.mainwnd)
	{
	  switch (WaitNextEvent (everyEvent, &event, 60L, cursorRgn))
	    {
	    };
	}
      *verify_conn = gensetup_t.verify_conn;
    }
  else
    goto error;

  return gensetup_t.connstr;

error:
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return gensetup_t.connstr;
}
Exemple #9
0
BOOL create_confirm_Internal (HWND hwnd,
    SQLPOINTER dsn,
    SQLPOINTER text,
    SQLCHAR waMode)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  ControlID controlID;
  ControlRef control;
  WindowRef wconfirm;
  TCONFIRM confirm_t;
  EventRecord event;
  IBNibRef nibRef;
  CFStringRef msg;
  OSStatus err;

  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err =
      CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (CFSTR
	("org.iodbc.drvproxy")), CFSTR ("confirmation"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wconfirm);
      DisposeNibReference (nibRef);
      /* Set the title with the DSN name */
      if (dsn)
	{
          if (waMode == 'A')
            msg = CFStringCreateWithBytes (NULL, (unsigned char*)dsn, STRLEN(dsn), 
              kCFStringEncodingUTF8, false);
          else
            msg = convert_wchar_to_CFString((wchar_t*)dsn);
          SetWindowTitleWithCFString (wconfirm, msg);
          CFRelease(msg);
	}
      /* Install handlers for the finish button, the cancel */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, CONFYES_CNTL, wconfirm,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (confirmadm_yes_clicked), 1, &controlSpec,
	  &confirm_t, NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, CONFNO_CNTL, wconfirm,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (confirmadm_no_clicked), 1, &controlSpec,
	  &confirm_t, NULL);
      /* Change the static field with the message */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, CONFTEXT_CNTL, wconfirm,
	  control);
      if (waMode == 'A')
        SetControlData (control, 0, kControlEditTextTextTag, STRLEN (text), text);
      else
        {
          msg = convert_wchar_to_CFString((wchar_t*)text);
          SetControlData (control, 0, kControlEditTextCFStringTag, sizeof(CFStringRef), &msg);
          CFRelease(msg);
        }
      DrawOneControl (control);
      confirm_t.yes_no = FALSE;
      confirm_t.mainwnd = wconfirm;
      /* Show the window and run the loop */
      ShowWindow (wconfirm);
      /* The main loop */
      while (confirm_t.mainwnd)
	WaitNextEvent (everyEvent, &event, 60L, cursorRgn);
    }
  else
    goto error;

  return confirm_t.yes_no;

error:
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return confirm_t.yes_no;
}
// ---------------------------------------------------------------------------
//
// -----------
int bExtLibMgr::load(CFArrayRef bundles){
_bTrace_("bExtLibMgr::load(CFArrayRef)",false);
CFBundleRef		bundle;
int				i,n;
UInt32			cr,tp;
bStdExtLib*		ext;
bStdCompLib*	cmp;
bArray			warn(sizeof(bStdExtLib*));
char			c[256];
CFBundleRef		frmkbndl=CFBundleGetBundleWithIdentifier(CFSTR("com.cbconseil.loader.framework"));

    (void)bSplashWd::instance(false,_gapp);
    
OSStatus  status;
IBNibRef  nib=NULL;
    
    status=CreateNibReferenceWithCFBundle(frmkbndl,CFSTR("menubar"),&nib);
    if(status){
_te_("CreateNibReferenceWithCFBundle="+(int)status);
        return(status);
    }
    if((status=SetMenuBarFromNib(nib,CFSTR("MenuBar")))){
_te_("SetMenuBarFromNib"+status);
        return(status);
    }
    DisposeNibReference(nib);

	n=(bundles!=NULL)?CFArrayGetCount(bundles):0;
	for(i=0;i<n;i++){
		bundle=(CFBundleRef)CFArrayGetValueAtIndex(bundles,i);
		CFBundleGetPackageInfo(bundle,&tp,&cr);
// App component
		if(cr=='kCom'){
			cmp=new bStdCompLib(bundle);
			if(cmp->status()!=noErr){
_te_("kernel component");
				exit(0);
			}
char	name[256],vers[256];
			cmp->name(name);
			cmp->vers(vers);
_tm_("app component "+name+" ("+vers+")");
			if(!_acls.add(&cmp)){
				return(-1);
			}
			continue;
		}

		if(cr!='MaMo'){
// Unknown
			continue;
		}
		
// External library
		switch(tp){
			case kXMLSubClassExt:
			case kXMLSubClassExtTool:
			case kXMLSubClassExtXMap:
			case kXMLSubClassExtvDef:
			case kXMLSubClassExtGeog:
			case kXMLSubClassExtCalc:
			case kXMLSubClassExtXBox:
			case kXMLSubClassExtUserCalc:
			case kXMLSubClassExtMacro:
			case kXMLSubClassExtVar:
			case kXMLSubClassExtScript:
				ext=new bStdExtLib(bundle,_gapp);
				break;
			default:
				ext=NULL;
				break;
		}
		if(ext==NULL){
_te_("unknown ext type : "+(UInt32*)&tp);		
			continue;
		}
		if(ext->status()!=noErr){
_te_("bad ext status : "+ext->status());		
			warn.add(&ext);
			continue;
		}
		if(!_elts.add(&ext)){
			return(-1);
		}
	}
	
_tm_("----- BEGIN REMOVING -----");	
	for(i=warn.count();i>0;i--){
		warn.get(i,&ext);
		ext->name(c);
_tm_("cant activate "+c);
		delete ext;
	}
_tm_("----- END REMOVING -----");
    
    (void)bSplashWd::release_instance();

	return(noErr);
}
Exemple #11
0
LPSTR create_keyval (WindowRef wnd, LPCSTR attrs, BOOL *verify_conn)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  TKEYVAL keyval_t;
  ControlID controlID;
  WindowRef wkeyval;
  ControlRef control;
  EventRecord event;
  IBNibRef nibRef;
  OSStatus err;

  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err = CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (
          CFSTR ("org.iodbc.adm")), CFSTR ("keyval"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wkeyval);
      DisposeNibReference (nibRef);

      /* Install handlers for the finish button, the cancel */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSVERIFYCONN_CNTL, wkeyval,
	  keyval_t.verify_conn_cb);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSLIST_CNTL, wkeyval,
	  keyval_t.key_list);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSKEYWORD_CNTL, wkeyval,
	  keyval_t.key_entry);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSVALUE_CNTL, wkeyval,
	  keyval_t.value_entry);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSUPDATE_CNTL, wkeyval,
	  keyval_t.bupdate);

      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSADD_CNTL, wkeyval,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (keyval_add_clicked), 1, &controlSpec,
	  &keyval_t, NULL);
      InstallEventHandler (GetControlEventTarget (keyval_t.bupdate),
	  NewEventHandlerUPP (keyval_update_clicked), 1, &controlSpec,
	  &keyval_t, NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSOK_CNTL, wkeyval,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (keyval_ok_clicked), 1, &controlSpec,
	  &keyval_t, NULL);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, GSCANCEL_CNTL, wkeyval,
	  control);
      InstallEventHandler (GetControlEventTarget (control),
	  NewEventHandlerUPP (keyval_cancel_clicked), 1, &controlSpec,
	  &keyval_t, NULL);

      /* Parse the attributes line */
      keyval_t.mainwnd = wkeyval;
      addkeywords_to_list (keyval_t.key_list, attrs, &keyval_t);

      AdvanceKeyboardFocus (wkeyval);
      /* Show the window and run the loop */
      DeactivateControl (keyval_t.bupdate);
      KEYVAL = &keyval_t;
      ShowSheetWindow(wkeyval, wnd);
      /* The main loop */
      while (keyval_t.mainwnd)
        WaitNextEvent (everyEvent, &event, 60L, cursorRgn);

      if (keyval_t.connstr)
        *verify_conn = keyval_t.verify_conn;
    }
  else
    goto error;

  return keyval_t.connstr;

error:
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return keyval_t.connstr;
}
Exemple #12
0
void
create_driverchooser (HWND hwnd, TDRIVERCHOOSER * choose_t)
{
  EventTypeSpec controlSpec = { kEventClassControl, kEventControlHit };
  RgnHandle cursorRgn = NULL;
  WindowRef wdrvchooser;
  ControlID controlID;
  EventRecord event;
  IBNibRef nibRef;
  OSStatus err;

  if (hwnd == NULL)
    return;

  /* Search the bundle for a .nib file named 'odbcadmin'. */
  err =
      CreateNibReferenceWithCFBundle (CFBundleGetBundleWithIdentifier (CFSTR
	("org.iodbc.adm")), CFSTR ("odbcdriver"), &nibRef);
  if (err == noErr)
    {
      /* Nib found ... so create the window */
      CreateWindowFromNib (nibRef, CFSTR ("Dialog"), &wdrvchooser);
      DisposeNibReference (nibRef);
      /* Set the control into the structure */
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCLIST_CNTL, wdrvchooser,
	  choose_t->driverlist);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCFINISH_CNTL, wdrvchooser,
	  choose_t->b_add);
      GETCONTROLBYID (controlID, CNTL_SIGNATURE, DCCANCEL_CNTL, wdrvchooser,
          choose_t->b_remove);
      choose_t->driver = NULL;
      choose_t->mainwnd = wdrvchooser;
      /* Install handlers for the finish button, the cancel */
      InstallEventHandler (GetControlEventTarget (choose_t->b_add),
	  NewEventHandlerUPP (driverchooser_ok_clicked), 1, &controlSpec,
	  choose_t, NULL);
      InstallEventHandler (GetControlEventTarget (choose_t->b_remove),
	  NewEventHandlerUPP (driverchooser_cancel_clicked), 1, &controlSpec,
	  choose_t, NULL);
      Drivers_nrows = 0;
      adddrivers_to_list (choose_t->driverlist, choose_t->mainwnd, TRUE);

      /* Show the window and run the loop */
      choose_t->b_configure = NULL;
      DRIVERCHOOSER = choose_t;
      DeactivateControl (DRIVERCHOOSER->b_add);
      ShowWindow (wdrvchooser);

      /* The main loop */
      while (choose_t->mainwnd)
	WaitNextEvent (everyEvent, &event, 60L, cursorRgn);
    }
  else
    goto error;

  return;

error:
  choose_t->driver = NULL;
  fprintf (stderr, "Can't load Window. Err: %d\n", (int) err);
  return;
}