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.

95 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 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. #include "../juce_Component.h"
  21. #if ! DOXYGEN
  22. class NSViewComponentInternal;
  23. #endif
  24. #if JUCE_MAC || DOXYGEN
  25. //==============================================================================
  26. /**
  27. A Mac-specific class that can create and embed an NSView inside itself.
  28. To use it, create one of these, put it in place and make sure it's visible in a
  29. window, then use setView() to assign an NSView to it. The view will then be
  30. moved and resized to follow the movements of this component.
  31. Of course, since the view is a native object, it'll obliterate any
  32. juce components that may overlap this component, but that's life.
  33. */
  34. class JUCE_API NSViewComponent : public Component
  35. {
  36. public:
  37. //==============================================================================
  38. /** Create an initially-empty container. */
  39. NSViewComponent();
  40. /** Destructor. */
  41. ~NSViewComponent();
  42. /** Assigns an NSView to this peer.
  43. The view will be retained and released by this component for as long as
  44. it is needed. To remove the current view, just call setView (0).
  45. Note: a void* is used here to avoid including the cocoa headers as
  46. part of the juce.h, but the method expects an NSView*.
  47. */
  48. void setView (void* nsView);
  49. /** Returns the current NSView.
  50. Note: a void* is returned here to avoid including the cocoa headers as
  51. a requirement of juce.h, so you should just cast the object to an NSView*.
  52. */
  53. void* getView() const;
  54. /** Resizes this component to fit the view that it contains. */
  55. void resizeToFitView();
  56. //==============================================================================
  57. /** @internal */
  58. void paint (Graphics& g);
  59. juce_UseDebuggingNewOperator
  60. private:
  61. friend class NSViewComponentInternal;
  62. ScopedPointer <NSViewComponentInternal> info;
  63. NSViewComponent (const NSViewComponent&);
  64. NSViewComponent& operator= (const NSViewComponent&);
  65. };
  66. #endif
  67. #endif // __JUCE_NSVIEWCOMPONENT_JUCEHEADER__