OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
include/OSX/OgreOSXCocoaWindow.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __OSXCocoaWindow_H__
30 #define __OSXCocoaWindow_H__
31 
32 #include "OgreOSXCocoaContext.h"
33 
34 #include <AppKit/NSWindow.h>
35 #include <QuartzCore/CVDisplayLink.h>
36 #include "OgreOSXCocoaView.h"
38 
40 
41 @interface OgreWindow : NSWindow
42 
43 @end
44 
45 namespace Ogre {
46 
47  class _OgreGLExport OSXCocoaWindow : public RenderWindow
48  {
49  private:
50  NSWindow *mWindow;
51  NSView *mView;
52  NSOpenGLContext *mGLContext;
53  NSOpenGLPixelFormat *mGLPixelFormat;
54  NSPoint mWindowOrigin;
55  OSXCocoaWindowDelegate *mWindowDelegate;
56  OSXCocoaContext* mContext;
57 
58  bool mActive;
59  bool mClosed;
60  bool mHidden;
61  bool mVSync;
62  bool mHasResized;
63  bool mIsExternal;
64  String mWindowTitle;
65  bool mUseNSView;
66  float mContentScalingFactor;
67  bool mContentScalingSupported;
68 
69  void _setWindowParameters(void);
70  public:
71  OSXCocoaWindow();
72  ~OSXCocoaWindow();
73 
74  NSView* ogreView() const { return mView; };
75  NSWindow* ogreWindow() const { return mWindow; };
76  NSOpenGLContext* nsopenGLContext() const { return mGLContext; };
77  NSOpenGLPixelFormat* nsopenGLPixelFormat() const { return mGLPixelFormat; };
78  void createWithView(OgreView *view);
79 
80  void create(const String& name, unsigned int width, unsigned int height,
81  bool fullScreen, const NameValuePairList *miscParams);
83  void destroy(void);
85  bool isActive(void) const;
87  bool isClosed(void) const;
89  bool isHidden(void) const { return mHidden; }
91  void setHidden(bool hidden);
93  void setVSyncEnabled(bool vsync);
95  bool isVSyncEnabled() const;
97  void reposition(int left, int top);
99  void resize(unsigned int width, unsigned int height);
101  void swapBuffers();
103  virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
105  virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
107  virtual unsigned int getWidth(void) const;
109  virtual unsigned int getHeight(void) const;
111  void windowMovedOrResized(void);
112  void windowResized(void);
113  void windowHasResized(void);
114  void createNewWindow(unsigned int width, unsigned int height, String title);
115  void createWindowFromExternal(NSView *viewRef);
116 
117  bool requiresTextureFlipping() const { return false; }
118  void getCustomAttribute( const String& name, void* pData );
119  };
120 }
121 
122 #endif
123 
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
#define _OgreGLExport
_StringBase String