summaryrefslogtreecommitdiff
path: root/indra/llwindow/llopenglview-objc.h
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2012-12-17 18:00:30 -0500
committerGeenz <geenz@geenzo.com>2012-12-17 18:00:30 -0500
commitc8aa1fb7c8ed44886599ea4e04eed403392e2e34 (patch)
tree440c4a548e55c2a6ade9f75625aabdd2203d31dd /indra/llwindow/llopenglview-objc.h
parentb6abf5c0ee964ced6b8aa25872db597d3f024bfd (diff)
LLWindow: Move to using Cocoa for window and view creation along with setting up callbacks for event handling as such.
Diffstat (limited to 'indra/llwindow/llopenglview-objc.h')
-rw-r--r--indra/llwindow/llopenglview-objc.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/indra/llwindow/llopenglview-objc.h b/indra/llwindow/llopenglview-objc.h
new file mode 100644
index 0000000000..8abe81ce9e
--- /dev/null
+++ b/indra/llwindow/llopenglview-objc.h
@@ -0,0 +1,72 @@
+//
+// LLOpenGLView.h
+// SecondLife
+//
+// Created by Geenz on 10/2/12.
+//
+//
+
+#import <Cocoa/Cocoa.h>
+#include "llwindowmacosx-objc.h"
+
+// Some nasty shovelling of LLOpenGLView from LLNativeBindings to prevent any C++ <-> Obj-C interop oddities.
+// Redraw callback handling removed (for now) due to being unneeded in the patch that preceeds this addition.
+
+@interface LLOpenGLView : NSOpenGLView
+{
+ NSPoint mousePos;
+ ResizeCallback mResizeCallback;
+}
+
+- (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync;
+
+// rebuildContext
+// Destroys and recreates a context with the view's internal format set via setPixelFormat;
+// Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format.
+- (BOOL) rebuildContext;
+
+// rebuildContextWithFormat
+// Destroys and recreates a context with the specified pixel format.
+- (BOOL) rebuildContextWithFormat:(NSOpenGLPixelFormat *)format;
+
+// These are mostly just for C++ <-> Obj-C interop. We can manipulate the CGLContext from C++ without reprecussions.
+- (CGLContextObj) getCGLContextObj;
+- (CGLPixelFormatObj*)getCGLPixelFormatObj;
+
+- (void) registerResizeCallback:(ResizeCallback)callback;
+@end
+
+@interface LLNSWindow : NSWindow {
+ float mMousePos[2];
+ unsigned int mModifiers;
+
+ KeyCallback mKeyDownCallback;
+ KeyCallback mKeyUpCallback;
+ UnicodeCallback mUnicodeCallback;
+ ModifierCallback mModifierCallback;
+ MouseCallback mMouseDownCallback;
+ MouseCallback mMouseUpCallback;
+ MouseCallback mMouseDoubleClickCallback;
+ MouseCallback mRightMouseDownCallback;
+ MouseCallback mRightMouseUpCallback;
+ MouseCallback mMouseMovedCallback;
+ ScrollWheelCallback mScrollWhellCallback;
+ VoidCallback mMouseExitCallback;
+ MouseCallback mDeltaUpdateCallback;
+}
+
+- (void) registerKeyDownCallback:(KeyCallback)callback;
+- (void) registerKeyUpCallback:(KeyCallback)callback;
+- (void) registerUnicodeCallback:(UnicodeCallback)callback;
+- (void) registerModifierCallback:(ModifierCallback)callback;
+- (void) registerMouseDownCallback:(MouseCallback)callback;
+- (void) registerMouseUpCallback:(MouseCallback)callback;
+- (void) registerRightMouseDownCallback:(MouseCallback)callback;
+- (void) registerRightMouseUpCallback:(MouseCallback)callback;
+- (void) registerDoubleClickCallback:(MouseCallback)callback;
+- (void) registerMouseMovedCallback:(MouseCallback)callback;
+- (void) registerScrollCallback:(ScrollWheelCallback)callback;
+- (void) registerMouseExitCallback:(VoidCallback)callback;
+- (void) registerDeltaUpdateCallback:(MouseCallback)callback;
+
+@end \ No newline at end of file