VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_gui_extra / embedding / juce_NSViewComponent.h
blob98760295e78096e4b8ca4e3c2823c4692ba1ee5a
1 /*
2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
23 ==============================================================================
26 namespace juce
29 #if JUCE_MAC || DOXYGEN
31 //==============================================================================
32 /**
33 A Mac-specific class that can create and embed an NSView inside itself.
35 To use it, create one of these, put it in place and make sure it's visible in a
36 window, then use setView() to assign an NSView to it. The view will then be
37 moved and resized to follow the movements of this component.
39 Of course, since the view is a native object, it'll obliterate any
40 JUCE components that may overlap this component, but that's life.
42 @tags{GUI}
44 class JUCE_API NSViewComponent : public Component
46 public:
47 //==============================================================================
48 /** Create an initially-empty container. */
49 NSViewComponent();
51 /** Destructor. */
52 ~NSViewComponent() override;
54 /** Assigns an NSView to this peer.
56 The view will be retained and released by this component for as long as
57 it is needed. To remove the current view, just call setView (nullptr).
59 Note: A void* is used here to avoid including the cocoa headers as
60 part of JuceHeader.h, but the method expects an NSView*.
62 void setView (void* nsView);
64 /** Returns the current NSView.
66 Note: A void* is returned here to avoid the needing to include the cocoa
67 headers, so you should just cast the return value to an NSView*.
69 void* getView() const;
71 /** Resizes this component to fit the view that it contains. */
72 void resizeToFitView();
74 //==============================================================================
75 /** @internal */
76 void paint (Graphics&) override;
77 /** @internal */
78 void alphaChanged() override;
79 /** @internal */
80 static ReferenceCountedObject* attachViewToComponent (Component&, void*);
82 private:
83 ReferenceCountedObjectPtr<ReferenceCountedObject> attachment;
85 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NSViewComponent)
88 #endif
90 } // namespace juce