Audio plugin host https://kx.studio/carla
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.

77 lines
2.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. #if JUCE_WINDOWS || DOXYGEN
  16. //==============================================================================
  17. /**
  18. A Windows-specific class that can create and embed a HWND inside itself.
  19. To use it, create one of these, put it in place and make sure it's visible in a
  20. window, then use setHWND() to assign a HWND to it. The window will then be
  21. moved and resized to follow the movements of this component.
  22. Of course, since the window is a native object, it'll obliterate any
  23. JUCE components that may overlap this component, but that's life.
  24. @tags{GUI}
  25. */
  26. class JUCE_API HWNDComponent : public Component
  27. {
  28. public:
  29. //==============================================================================
  30. /** Create an initially-empty container. */
  31. HWNDComponent();
  32. /** Destructor. */
  33. ~HWNDComponent() override;
  34. /** Assigns a HWND to this peer.
  35. The window will be retained and released by this component for as long as
  36. it is needed. To remove the current HWND, just call setHWND (nullptr).
  37. Note: A void* is used here to avoid including the Windows headers as
  38. part of JuceHeader.h, but the method expects a HWND.
  39. */
  40. void setHWND (void* hwnd);
  41. /** Returns the current HWND.
  42. Note: A void* is returned here to avoid the needing to include the Windows
  43. headers, so you should just cast the return value to a HWND.
  44. */
  45. void* getHWND() const;
  46. /** Resizes this component to fit the HWND that it contains. */
  47. void resizeToFit();
  48. private:
  49. class Pimpl;
  50. std::unique_ptr<Pimpl> pimpl;
  51. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponent)
  52. };
  53. #endif
  54. } // namespace juce