The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

124 lines
4.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  19. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  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. */
  31. class JUCE_API ActiveXControlComponent : public Component
  32. {
  33. public:
  34. //==============================================================================
  35. /** Create an initially-empty container. */
  36. ActiveXControlComponent();
  37. /** Destructor. */
  38. ~ActiveXControlComponent();
  39. /** Tries to create an ActiveX control and embed it in this peer.
  40. The peer controlIID is a pointer to an IID structure - it's treated
  41. as a void* because when including the Juce headers, you might not always
  42. have included windows.h first, in which case IID wouldn't be defined.
  43. e.g. @code
  44. const IID myIID = __uuidof (QTControl);
  45. myControlComp->createControl (&myIID);
  46. @endcode
  47. */
  48. bool createControl (const void* controlIID);
  49. /** Deletes the ActiveX control, if one has been created.
  50. */
  51. void deleteControl();
  52. /** Returns true if a control is currently in use. */
  53. bool isControlOpen() const noexcept { return control != nullptr; }
  54. /** Does a QueryInterface call on the embedded control object.
  55. This allows you to cast the control to whatever type of COM object you need.
  56. The iid parameter is a pointer to an IID structure - it's treated
  57. as a void* because when including the Juce headers, you might not always
  58. have included windows.h first, in which case IID wouldn't be defined, but
  59. you should just pass a pointer to an IID.
  60. e.g. @code
  61. const IID iid = __uuidof (IOleWindow);
  62. IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
  63. if (oleWindow != nullptr)
  64. {
  65. HWND hwnd;
  66. oleWindow->GetWindow (&hwnd);
  67. ...
  68. oleWindow->Release();
  69. }
  70. @endcode
  71. */
  72. void* queryInterface (const void* iid) const;
  73. /** Set this to false to stop mouse events being allowed through to the control.
  74. */
  75. void setMouseEventsAllowed (bool eventsCanReachControl);
  76. /** Returns true if mouse events are allowed to get through to the control.
  77. */
  78. bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; }
  79. //==============================================================================
  80. /** @internal */
  81. void paint (Graphics& g);
  82. private:
  83. class Pimpl;
  84. friend class ScopedPointer <Pimpl>;
  85. ScopedPointer <Pimpl> control;
  86. bool mouseEventsAllowed;
  87. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
  88. };
  89. #endif
  90. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__