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.

129 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. #if JUCE_WINDOWS || DOXYGEN
  22. //==============================================================================
  23. /**
  24. A Windows-specific class that can create and embed an ActiveX control inside
  25. itself.
  26. To use it, create one of these, put it in place and make sure it's visible in a
  27. window, then use createControl() to instantiate an ActiveX control. The control
  28. will then be moved and resized to follow the movements of this component.
  29. Of course, since the control is a heavyweight window, it'll obliterate any
  30. juce components that may overlap this component, but that's life.
  31. */
  32. class JUCE_API ActiveXControlComponent : public Component
  33. {
  34. public:
  35. //==============================================================================
  36. /** Create an initially-empty container. */
  37. ActiveXControlComponent();
  38. /** Destructor. */
  39. ~ActiveXControlComponent();
  40. /** Tries to create an ActiveX control and embed it in this peer.
  41. The peer controlIID is a pointer to an IID structure - it's treated
  42. as a void* because when including the Juce headers, you might not always
  43. have included windows.h first, in which case IID wouldn't be defined.
  44. e.g. @code
  45. const IID myIID = __uuidof (QTControl);
  46. myControlComp->createControl (&myIID);
  47. @endcode
  48. */
  49. bool createControl (const void* controlIID);
  50. /** Deletes the ActiveX control, if one has been created.
  51. */
  52. void deleteControl();
  53. /** Returns true if a control is currently in use. */
  54. bool isControlOpen() const noexcept { return control != nullptr; }
  55. /** Does a QueryInterface call on the embedded control object.
  56. This allows you to cast the control to whatever type of COM object you need.
  57. The iid parameter is a pointer to an IID structure - it's treated
  58. as a void* because when including the Juce headers, you might not always
  59. have included windows.h first, in which case IID wouldn't be defined, but
  60. you should just pass a pointer to an IID.
  61. e.g. @code
  62. const IID iid = __uuidof (IOleWindow);
  63. IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
  64. if (oleWindow != nullptr)
  65. {
  66. HWND hwnd;
  67. oleWindow->GetWindow (&hwnd);
  68. ...
  69. oleWindow->Release();
  70. }
  71. @endcode
  72. */
  73. void* queryInterface (const void* iid) const;
  74. /** Set this to false to stop mouse events being allowed through to the control.
  75. */
  76. void setMouseEventsAllowed (bool eventsCanReachControl);
  77. /** Returns true if mouse events are allowed to get through to the control.
  78. */
  79. bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; }
  80. //==============================================================================
  81. /** @internal */
  82. void paint (Graphics&) override;
  83. /** @internal */
  84. intptr_t offerEventToActiveXControl (void*);
  85. static intptr_t offerEventToActiveXControlStatic (void*);
  86. private:
  87. class Pimpl;
  88. friend struct ContainerDeletePolicy<Pimpl>;
  89. ScopedPointer<Pimpl> control;
  90. bool mouseEventsAllowed = true;
  91. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
  92. };
  93. #endif
  94. } // namespace juce