llopenglview-objc.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * @file llopenglview-objc.h
  3. * @brief Class interfaces for most of the Mac facing window functionality.
  4. *
  5. * $LicenseInfo:firstyear=2000&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LLOpenGLView_H
  27. #define LLOpenGLView_H
  28. #import <Cocoa/Cocoa.h>
  29. #import <IOKit/IOKitLib.h>
  30. #import <CoreFoundation/CFBase.h>
  31. #import <CoreFoundation/CFNumber.h>
  32. #include <string>
  33. @interface LLOpenGLView : NSOpenGLView <NSTextInputClient>
  34. {
  35. std::string mLastDraggedUrl;
  36. unsigned int mModifiers;
  37. float mMousePos[2];
  38. bool mHasMarkedText;
  39. unsigned int mMarkedTextLength;
  40. bool mMarkedTextAllowed;
  41. bool mSimulatedRightClick;
  42. }
  43. - (id) initWithFrame:(NSRect)frame withSamples:(NSUInteger)samples andVsync:(BOOL)vsync andCoreGL:(BOOL)core_gl;
  44. - (void)commitCurrentPreedit;
  45. // rebuildContext
  46. // Destroys and recreates a context with the view's internal format set via setPixelFormat;
  47. // Use this in event of needing to rebuild a context for whatever reason, without needing to assign a new pixel format.
  48. - (BOOL) rebuildContext;
  49. // rebuildContextWithFormat
  50. // Destroys and recreates a context with the specified pixel format.
  51. - (BOOL) rebuildContextWithFormat:(NSOpenGLPixelFormat *)format;
  52. // These are mostly just for C++ <-> Obj-C interop. We can manipulate the CGLContext from C++ without reprecussions.
  53. - (CGLContextObj) getCGLContextObj;
  54. - (CGLPixelFormatObj*)getCGLPixelFormatObj;
  55. - (unsigned long) getVramSize;
  56. - (void) allowMarkedTextInput:(bool)allowed;
  57. @end
  58. @interface LLUserInputWindow : NSPanel
  59. @end
  60. @interface LLNonInlineTextView : NSTextView
  61. {
  62. LLOpenGLView *glview;
  63. unichar mKeyPressed;
  64. }
  65. - (void) setGLView:(LLOpenGLView*)view;
  66. @end
  67. @interface LLNSWindow : NSWindow
  68. - (NSPoint)convertToScreenFromLocalPoint:(NSPoint)point relativeToView:(NSView *)view;
  69. - (NSPoint)flipPoint:(NSPoint)aPoint;
  70. @end
  71. @interface NSScreen (PointConversion)
  72. /*
  73. Returns the screen where the mouse resides
  74. */
  75. + (NSScreen *)currentScreenForMouseLocation;
  76. /*
  77. Allows you to convert a point from global coordinates to the current screen coordinates.
  78. */
  79. - (NSPoint)convertPointToScreenCoordinates:(NSPoint)aPoint;
  80. /*
  81. Allows to flip the point coordinates, so y is 0 at the top instead of the bottom. x remains the same
  82. */
  83. - (NSPoint)flipPoint:(NSPoint)aPoint;
  84. @end
  85. #endif