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: Stéphane Sudre <email@hidden>
- Date: Wed, 13 Aug 2003 08:51:38 +0200
On mercredi, ao{t 13, 2003, at 07:57 AM, Steve Milano wrote:
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.
I think your issue is that you're using the frame sent to
initWithFrame:.
The origin of this frame is set to be the one of the ScreenSaverView
within the System Preferences pane.
To get the frame for your rect, you just have to do set the frame
origin to be NSZeroPoint.
It's not a wise idea to use fixed values for the preview as these
values may change in the next release of the OS.
_______________________________________________
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.