diff options
author | Andre Pang <athp@users.sourceforge.net> | 2004-06-21 15:07:00 +0000 |
---|---|---|
committer | Andre Pang <athp@users.sourceforge.net> | 2004-06-21 15:07:00 +0000 |
commit | d5aaad821db9c1876f2dbfbbbc873cb9ace8c8ab (patch) | |
tree | c36f7c838396d5780013a81c3bccbbb2b224fed1 /src | |
parent | d94ec889227d544683964d3efff23362c6550434 (diff) | |
download | xine-lib-d5aaad821db9c1876f2dbfbbbc873cb9ace8c8ab.tar.gz xine-lib-d5aaad821db9c1876f2dbfbbbc873cb9ace8c8ab.tar.bz2 |
Mac OS X XineVideoWindow:
Added #ifdef guards around video_window.h
Removed setContentSize: method from XineVideoWindow interface, since this
method is already present in NSWindow
Changed setKeepsAspectRatio: & keepAspectRatio's int arguments to BOOL
Added initWithContentSize: method
Added init method
CVS patchset: 6722
CVS date: 2004/06/21 15:07:00
Diffstat (limited to 'src')
-rw-r--r-- | src/video_out/macosx/video_window.h | 15 | ||||
-rw-r--r-- | src/video_out/macosx/video_window.m | 28 |
2 files changed, 37 insertions, 6 deletions
diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h index 2aa29d46a..af84e4c4e 100644 --- a/src/video_out/macosx/video_window.h +++ b/src/video_out/macosx/video_window.h @@ -19,7 +19,10 @@ * */ -#include <Cocoa/Cocoa.h> +#ifndef HAVE_VIDEO_WINDOW_H +#define HAVE_VIDEO_WINDOW_H + +#import <Cocoa/Cocoa.h> typedef enum { XINE_FULLSCREEN_OVERSCAN, @@ -67,13 +70,13 @@ typedef enum { @interface XineVideoWindow : NSWindow { int width, height; BOOL keepAspectRatio; - XineOpenGLView *xineView; + XineOpenGLView * xineView; } -- (void) setContentSize: (NSSize) size; +- (id) initWithContentSize:(NSSize)size; - (XineOpenGLView *) xineView; -- (void) setKeepsAspectRatio: (BOOL) i; -- (int) keepsAspectRatio; +- (void) setKeepsAspectRatio:(BOOL)flag; +- (BOOL) keepsAspectRatio; @end @@ -92,3 +95,5 @@ typedef enum { extern NSString *XineViewDidResizeNotification; +#endif /* HAVE_VIDEO_WINDOW_H */ + diff --git a/src/video_out/macosx/video_window.m b/src/video_out/macosx/video_window.m index 6546428a9..b70d9c0ce 100644 --- a/src/video_out/macosx/video_window.m +++ b/src/video_out/macosx/video_window.m @@ -31,6 +31,8 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; +#define DEFAULT_VIDEO_WINDOW_SIZE (NSMakeSize(320, 200)) + @implementation XineVideoWindow @@ -40,6 +42,30 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; [super setContentSize: size]; } +- (id) init +{ + return [self initWithContentSize:DEFAULT_VIDEO_WINDOW_SIZE]; +} + +- (id) initWithContentSize:(NSSize)size +{ + NSScreen *screen = [NSScreen mainScreen]; + NSSize screen_size = [screen frame].size; + + /* make a centered window */ + NSRect frame; + frame.size = size; + frame.origin.x = (screen_size.width - frame.size.width) / 2; + frame.origin.y = (screen_size.height - frame.size.height) / 2; + + unsigned int style_mask = NSTitledWindowMask | NSMiniaturizableWindowMask | + NSClosableWindowMask | NSResizableWindowMask; + + return ([self initWithContentRect:frame styleMask:style_mask + backing:NSBackingStoreBuffered defer:NO + screen:screen]); +} + - (id) initWithContentRect: (NSRect)rect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType @@ -110,7 +136,7 @@ NSString *XineViewDidResizeNotification = @"XineViewDidResizeNotification"; keepAspectRatio = flag; } -- (int) keepsAspectRatio { +- (BOOL) keepsAspectRatio { return keepAspectRatio; } |