xine-lib  1.2.10
XineOpenGLView.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2007 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  *
20  */
21 
22 #ifndef __HAVE_XINE_OPENGL_VIEW_H__
23 #define __HAVE_XINE_OPENGL_VIEW_H__
24 
25 #import <Cocoa/Cocoa.h>
26 #import <OpenGL/gl.h>
27 
28 #import "XineVideoWindow.h"
29 
30 @protocol XineOpenGLViewDelegate;
31 
32 extern NSString *XineViewDidResizeNotification;
33 
34 @interface XineOpenGLView : NSOpenGLView
35 {
36  @private
37  IBOutlet id <NSObject, XineOpenGLViewDelegate> delegate;
38  IBOutlet id <NSObject, XineOpenGLViewDelegate> controller;
39 
40  NSRecursiveLock * mutex;
41  BOOL initDone;
42 
43  NSSize videoSize;
44  char * textureBuffer;
45  GLuint texture;
46 
49  NSCursor * currentCursor;
50 
51  NSColor * initialColor;
52  unsigned int initialColorYUV;
54 
58  NSOpenGLContext * fullScreenContext;
59 }
60 
61 + (NSOpenGLPixelFormat *)defaultPixelFormat;
62 + (NSOpenGLPixelFormat *)fullScreenPixelFormat;
63 
64 - (id)initWithCoder:(NSCoder *)coder;
65 - (id)initWithFrame:(NSRect)frame;
66 - (id)initWithFrame:(NSRect)frame pixelFormat:(NSOpenGLPixelFormat *)pixelFormat;
67 
68 - (void)dealloc;
69 
70 - (void)encodeWithCoder:(NSCoder *)coder;
71 
72 - (NSOpenGLContext *)openGLContext;
73 - (void)prepareOpenGL;
74 - (void)reshape;
75 - (void)update;
76 
77 - (void)initTextures;
78 - (void)updateTexture;
79 - (void)drawRect:(NSRect)rect;
80 
81 - (NSColor *)initialColor;
82 - (void)setInitialColor:(NSColor *)color;
83 
84 - (void)setNormalSize;
85 - (void)setHalfSize;
86 - (void)setDoubleSize;
87 
88 - (NSSize)videoSize;
89 
90 - (BOOL)keepsVideoAspectRatio;
91 - (void)setKeepsVideoAspectRatio:(BOOL)flag;
92 - (BOOL)resizeViewOnVideoSizeChange;
93 - (void)setResizeViewOnVideoSizeChange:(BOOL)flag;
94 
95 - (void)setViewSize:(NSValue *)sizeWrapper;
96 - (void)setViewSizeInMainThread:(NSSize)size;
97 
98 - (NSCursor *)currentCursor;
99 - (void)setCurrentCursor:(NSCursor *)cursor;
100 
101 - (BOOL)isFullScreen;
102 - (void)goFullScreen:(XineVideoWindowFullScreenMode)mode;
103 - (void)exitFullScreen;
104 
105 - (id)delegate;
106 - (void)setDelegate:(id)aDelegate;
107 - (id)xineController;
108 - (void)setXineController:(id)aController;
109 
110 - (BOOL)acceptsFirstResponder;
111 - (BOOL)mouseDownCanMoveWindow;
112 
113 // Not intended for public use:
114 - (char *)textureBuffer;
115 - (void)setVideoSize:(NSSize)size;
116 - (void)resetCursorRects;
117 - (void)resetCursorRectsInMainThread;
118 - (void)calcFullScreenAspect;
119 - (void)releaseInMainThread;
120 - (void)passEventToDelegate:(NSEvent *)theEvent withSelector:(SEL)selector;
121 
122 - (BOOL)acceptsFirstResponder;
123 - (BOOL)mouseDownCanMoveWindow;
124 
125 @end
126 
127 /* XineOpenGLView delegate methods */
129 
130 - (void)mouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView;
131 - (void)mouseMoved:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView;
132 - (void)otherMouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView;
133 - (void)rightMouseDown:(NSEvent *)theEvent inXineView:(XineOpenGLView *)theView;
134 - (NSSize)xineViewWillResize:(NSSize)oldSize toSize:(NSSize)proposedSize;
135 - (void)xineViewDidResize:(NSNotification *)note;
136 
137 @end
138 
139 #endif /* __HAVE_XINE_OPENGL_VIEW_H__ */
140 
XineViewDidResizeNotification
NSString * XineViewDidResizeNotification
XineOpenGLView::keepsVideoAspectRatio
BOOL keepsVideoAspectRatio
Definition: XineOpenGLView.h:47
XineOpenGLView::mutex
NSRecursiveLock * mutex
Definition: XineOpenGLView.h:40
XineOpenGLView::delegate
IBOutlet id< NSObject, XineOpenGLViewDelegate > delegate
Definition: XineOpenGLView.h:37
XineOpenGLView::fullScreenContext
NSOpenGLContext * fullScreenContext
Definition: XineOpenGLView.h:58
XineOpenGLView
Definition: XineOpenGLView.h:34
XineVideoWindowFullScreenMode
XineVideoWindowFullScreenMode
Definition: XineVideoWindow.h:29
XineOpenGLView::controller
IBOutlet id< NSObject, XineOpenGLViewDelegate > controller
Definition: XineOpenGLView.h:38
XineOpenGLView::isFullScreenPrepared
BOOL isFullScreenPrepared
Definition: XineOpenGLView.h:56
XineOpenGLView::initDone
BOOL initDone
Definition: XineOpenGLView.h:41
XineOpenGLView::isFullScreen
BOOL isFullScreen
Definition: XineOpenGLView.h:55
XineOpenGLView::resizeViewOnVideoSizeChange
BOOL resizeViewOnVideoSizeChange
Definition: XineOpenGLView.h:48
XineVideoWindow.h
XineOpenGLView::currentCursor
NSCursor * currentCursor
Definition: XineOpenGLView.h:49
XineOpenGLView::initialColorYUV
unsigned int initialColorYUV
Definition: XineOpenGLView.h:52
XineOpenGLView::initialColor
NSColor * initialColor
Definition: XineOpenGLView.h:51
XineOpenGLViewDelegate-p
Definition: XineOpenGLView.h:128
XineOpenGLView::videoSize
NSSize videoSize
Definition: XineOpenGLView.h:43
XineOpenGLView::texture
GLuint texture
Definition: XineOpenGLView.h:45
XineOpenGLView::textureBuffer
char * textureBuffer
Definition: XineOpenGLView.h:44
XineOpenGLView::initialColorYUVIsSet
BOOL initialColorYUVIsSet
Definition: XineOpenGLView.h:53
XineOpenGLView::fullScreenMode
XineVideoWindowFullScreenMode fullScreenMode
Definition: XineOpenGLView.h:57