Re: Loading a .nib?
Re: Loading a .nib?
- Subject: Re: Loading a .nib?
- From: Graham Cox <email@hidden>
- Date: Sat, 3 May 2008 11:19:57 +1000
On 3 May 2008, at 10:45 am, J. Todd Slack wrote:
I have a question.
1. Can you point me to where it puts the UI inside the iTunes
Visualizer window?
Not sure what you mean by "putting the UI in the iTunes visualizer
window"? It doesn't - it creates a separate dialog window which seems
to be what all iTunes plug-ins do and are expected to do. You can
*draw* into the iTunes visualizer window of course, which is mostly
the point of them, but I don't put any UI there as such. You possibly
could, but never tried it.
In my mini-framework, the method to draw to the visualizer is
ITPlugIn::Render() - you override that to put your visual content into
the visualizer.
2. Also, how does one load a .nib from carbon?
One thing to clarify about Carbon vs. Cocoa - while Cocoa itself is
unavailable, you can of course use Core Foundation. However everything
in Carbon is lower level and generally more work than Cocoa, so be
prepared ;-)
Here's what I did - some vars referenced are data members:
void ITSpectrumAnalyserPlugIn::NewConfigDialog()
{
// default is to load dialog from NIB in bundle
IBNibRef nibRef;
//we have to find our bundle to load the nib inside of it
CFBundleRef iTunesXPlugin;
iTunesXPlugin =
CFBundleGetBundleWithIdentifier( CFSTR( "LEDSpectrumAnalyser" ));
if ( iTunesXPlugin )
{
CreateNibReferenceWithCFBundle( iTunesXPlugin,
CFSTR( "SettingsDialog" ), &nibRef );
if ( nibRef )
{
UseResFile( resFile );
CreateWindowFromNib( nibRef, CFSTR( "PluginSettings" ),
&configDialog );
DisposeNibReference( nibRef );
// if window was created, set up callback to handle its events. At
this stage we are only interested
// in control hit events
if ( configDialog )
{
static EventTypeSpec eventSpec[] = { kEventClassControl,
kEventControlHit,
kEventClassWindow, kEventWindowClose,
kEventClassTextInput, kEventTextInputUnicodeForKeyEvent };
InstallWindowEventHandler( configDialog,
NewEventHandlerUPP( DialogEventHandler ), 3, eventSpec, this, NULL );
}
}
}
else
SysBeep( 1 );
}
If you are in the Bay Area, CA, I will take you to lunch...
Thanks ;-) I'm in Australia....
G.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden