Re: ScreenSaver with a subview won't preview
Re: ScreenSaver with a subview won't preview
- Subject: Re: ScreenSaver with a subview won't preview
- From: Steve Milano <email@hidden>
- Date: Tue, 12 Aug 2003 22:57:17 -0700
At 9:28 AM +0200 8/12/03, Stiphane Sudre wrote:
On mardi, ao{t 12, 2003, at 08:08 AM, Steve Milano wrote:
So is there a way to have the preview also show the subview, as
the actual screen saver does?
Sure, you usually just have to add the subview in initWithFrame:isPreview:
For example of screensavers doing this, you can have a look at the
ones available here (since the source code is available):
http://s.sudre.free.fr/Software/WBSoftware.html
Most of them are adding a NSOpenGLView, SaveHollywood is adding a NSMovieView,
I looked at SaveHollywood, and while it wasn't quite the solution I
was looking for, it led me to something that works. Here is the
interesting part, inside initWithFrame:isPreview:
movieView = [[NSMovieView alloc] initWithFrame:NSZeroRect];
if ( isPreview )
{
[movieView setFrame:NSMakeRect(0,0,224,144)]; // ack!
}
else
{
[movieView setFrame:frame]
}
[self addSubview:movieView];
I assumed the value for "frame" passed in would be accurate for both
the full-screen mode and preview mode, but this is apparently not the
case. The NSMakeRect call is unappealing, especially should Apple
change the dimensions of the preview window at some point. But it
does work for now.
You can also have a look at the Alphabet Sample code on the ADC
Sample code home page.
I'll look for this, too. Thanks for the advice, and also for making
so much source code available on your site.
Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.