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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 an ActiveX control inside
  19. itself.
  20. To use it, create one of these, put it in place and make sure it's visible in a
  21. window, then use createControl() to instantiate an ActiveX control. The control
  22. will then be moved and resized to follow the movements of this component.
  23. Of course, since the control is a heavyweight window, it'll obliterate any
  24. JUCE components that may overlap this component, but that's life.
  25. @tags{GUI}
  26. */
  27. class JUCE_API ActiveXControlComponent : public Component
  28. {
  29. public:
  30. //==============================================================================
  31. /** Create an initially-empty container. */
  32. ActiveXControlComponent();
  33. /** Destructor. */
  34. ~ActiveXControlComponent();
  35. /** Tries to create an ActiveX control and embed it in this peer.
  36. The peer controlIID is a pointer to an IID structure - it's treated
  37. as a void* because when including the JUCE headers, you might not always
  38. have included windows.h first, in which case IID wouldn't be defined.
  39. e.g. @code
  40. const IID myIID = __uuidof (QTControl);
  41. myControlComp->createControl (&myIID);
  42. @endcode
  43. */
  44. bool createControl (const void* controlIID);
  45. /** Deletes the ActiveX control, if one has been created.
  46. */
  47. void deleteControl();
  48. /** Returns true if a control is currently in use. */
  49. bool isControlOpen() const noexcept { return control != nullptr; }
  50. /** Does a QueryInterface call on the embedded control object.
  51. This allows you to cast the control to whatever type of COM object you need.
  52. The iid parameter is a pointer to an IID structure - it's treated
  53. as a void* because when including the JUCE headers, you might not always
  54. have included windows.h first, in which case IID wouldn't be defined, but
  55. you should just pass a pointer to an IID.
  56. e.g. @code
  57. const IID iid = __uuidof (IOleWindow);
  58. IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
  59. if (oleWindow != nullptr)
  60. {
  61. HWND hwnd;
  62. oleWindow->GetWindow (&hwnd);
  63. ...
  64. oleWindow->Release();
  65. }
  66. @endcode
  67. */
  68. void* queryInterface (const void* iid) const;
  69. /** Set this to false to stop mouse events being allowed through to the control.
  70. */
  71. void setMouseEventsAllowed (bool eventsCanReachControl);
  72. /** Returns true if mouse events are allowed to get through to the control.
  73. */
  74. bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; }
  75. //==============================================================================
  76. /** @internal */
  77. void paint (Graphics&) override;
  78. /** @internal */
  79. intptr_t offerEventToActiveXControl (void*);
  80. static intptr_t offerEventToActiveXControlStatic (void*);
  81. private:
  82. class Pimpl;
  83. std::unique_ptr<Pimpl> control;
  84. bool mouseEventsAllowed = true;
  85. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
  86. };
  87. #endif
  88. } // namespace juce