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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_ACTIVEXCONTROLCOMPONENT_H_INCLUDED
  18. #define JUCE_ACTIVEXCONTROLCOMPONENT_H_INCLUDED
  19. #if JUCE_WINDOWS || DOXYGEN
  20. //==============================================================================
  21. /**
  22. A Windows-specific class that can create and embed an ActiveX control inside
  23. itself.
  24. To use it, create one of these, put it in place and make sure it's visible in a
  25. window, then use createControl() to instantiate an ActiveX control. The control
  26. will then be moved and resized to follow the movements of this component.
  27. Of course, since the control is a heavyweight window, it'll obliterate any
  28. juce components that may overlap this component, but that's life.
  29. */
  30. class JUCE_API ActiveXControlComponent : public Component
  31. {
  32. public:
  33. //==============================================================================
  34. /** Create an initially-empty container. */
  35. ActiveXControlComponent();
  36. /** Destructor. */
  37. ~ActiveXControlComponent();
  38. /** Tries to create an ActiveX control and embed it in this peer.
  39. The peer controlIID is a pointer to an IID structure - it's treated
  40. as a void* because when including the Juce headers, you might not always
  41. have included windows.h first, in which case IID wouldn't be defined.
  42. e.g. @code
  43. const IID myIID = __uuidof (QTControl);
  44. myControlComp->createControl (&myIID);
  45. @endcode
  46. */
  47. bool createControl (const void* controlIID);
  48. /** Deletes the ActiveX control, if one has been created.
  49. */
  50. void deleteControl();
  51. /** Returns true if a control is currently in use. */
  52. bool isControlOpen() const noexcept { return control != nullptr; }
  53. /** Does a QueryInterface call on the embedded control object.
  54. This allows you to cast the control to whatever type of COM object you need.
  55. The iid parameter is a pointer to an IID structure - it's treated
  56. as a void* because when including the Juce headers, you might not always
  57. have included windows.h first, in which case IID wouldn't be defined, but
  58. you should just pass a pointer to an IID.
  59. e.g. @code
  60. const IID iid = __uuidof (IOleWindow);
  61. IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
  62. if (oleWindow != nullptr)
  63. {
  64. HWND hwnd;
  65. oleWindow->GetWindow (&hwnd);
  66. ...
  67. oleWindow->Release();
  68. }
  69. @endcode
  70. */
  71. void* queryInterface (const void* iid) const;
  72. /** Set this to false to stop mouse events being allowed through to the control.
  73. */
  74. void setMouseEventsAllowed (bool eventsCanReachControl);
  75. /** Returns true if mouse events are allowed to get through to the control.
  76. */
  77. bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; }
  78. //==============================================================================
  79. /** @internal */
  80. void paint (Graphics&) override;
  81. private:
  82. class Pimpl;
  83. friend struct ContainerDeletePolicy<Pimpl>;
  84. ScopedPointer<Pimpl> control;
  85. bool mouseEventsAllowed;
  86. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
  87. };
  88. #endif
  89. #endif // JUCE_ACTIVEXCONTROLCOMPONENT_H_INCLUDED