The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  19. #define __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
  20. #if JUCE_MAC || DOXYGEN
  21. //==============================================================================
  22. /**
  23. A Mac-specific class that can create and embed an NSView inside itself.
  24. To use it, create one of these, put it in place and make sure it's visible in a
  25. window, then use setView() to assign an NSView to it. The view will then be
  26. moved and resized to follow the movements of this component.
  27. Of course, since the view is a native object, it'll obliterate any
  28. juce components that may overlap this component, but that's life.
  29. */
  30. class JUCE_API NSViewComponent : public Component
  31. {
  32. public:
  33. //==============================================================================
  34. /** Create an initially-empty container. */
  35. NSViewComponent();
  36. /** Destructor. */
  37. ~NSViewComponent();
  38. /** Assigns an NSView to this peer.
  39. The view will be retained and released by this component for as long as
  40. it is needed. To remove the current view, just call setView (nullptr).
  41. Note: a void* is used here to avoid including the cocoa headers as
  42. part of the juce.h, but the method expects an NSView*.
  43. */
  44. void setView (void* nsView);
  45. /** Returns the current NSView.
  46. Note: a void* is returned here to avoid the needing to include the cocoa
  47. headers, so you should just cast the return value to an NSView*.
  48. */
  49. void* getView() const;
  50. /** Resizes this component to fit the view that it contains. */
  51. void resizeToFitView();
  52. //==============================================================================
  53. /** @internal */
  54. void paint (Graphics& g);
  55. private:
  56. class Pimpl;
  57. friend class Pimpl;
  58. ScopedPointer<Pimpl> pimpl;
  59. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NSViewComponent);
  60. };
  61. #endif
  62. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__