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.

juce_ActiveXControlComponent.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  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 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. #if JUCE_WINDOWS || DOXYGEN
  21. //==============================================================================
  22. /**
  23. A Windows-specific class that can create and embed an ActiveX control inside
  24. itself.
  25. To use it, create one of these, put it in place and make sure it's visible in a
  26. window, then use createControl() to instantiate an ActiveX control. The control
  27. will then be moved and resized to follow the movements of this component.
  28. Of course, since the control is a heavyweight window, it'll obliterate any
  29. JUCE components that may overlap this component, but that's life.
  30. @tags{GUI}
  31. */
  32. class JUCE_API ActiveXControlComponent : public Component
  33. {
  34. public:
  35. //==============================================================================
  36. /** Create an initially-empty container. */
  37. ActiveXControlComponent();
  38. /** Destructor. */
  39. ~ActiveXControlComponent() override;
  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. std::unique_ptr<Pimpl> control;
  89. bool mouseEventsAllowed = true;
  90. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
  91. };
  92. #endif
  93. } // namespace juce