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.

139 lines
4.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-7 by Raw Material Software ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the
  7. GNU General Public License, as published by the Free Software Foundation;
  8. either version 2 of the License, or (at your option) any later version.
  9. JUCE is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with JUCE; if not, visit www.gnu.org/licenses or write to the
  15. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  16. Boston, MA 02111-1307 USA
  17. ------------------------------------------------------------------------------
  18. If you'd like to release a closed-source product which uses JUCE, commercial
  19. licenses are also available: visit www.rawmaterialsoftware.com/juce for
  20. more information.
  21. ==============================================================================
  22. */
  23. #ifndef __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  24. #define __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__
  25. #include "../juce_Component.h"
  26. #if JUCE_WIN32 || DOXYGEN
  27. //==============================================================================
  28. /**
  29. A Windows-specific class that can create and embed an ActiveX control inside
  30. itself.
  31. To use it, create one of these, put it in place and make sure it's visible in a
  32. window, then use createControl() to instantiate an ActiveX control. The control
  33. will then be moved and resized to follow the movements of this component.
  34. Of course, since the control is a heavyweight window, it'll obliterate any
  35. juce components that may overlap this component, but that's life.
  36. */
  37. class JUCE_API ActiveXControlComponent : public Component
  38. {
  39. public:
  40. //==============================================================================
  41. /** Create an initially-empty container. */
  42. ActiveXControlComponent();
  43. /** Destructor. */
  44. ~ActiveXControlComponent();
  45. /** Tries to create an ActiveX control and embed it in this peer.
  46. The peer controlIID is a pointer to an IID structure - it's treated
  47. as a void* because when including the Juce headers, you might not always
  48. have included windows.h first, in which case IID wouldn't be defined.
  49. e.g. @code
  50. const IID myIID = __uuidof (QTControl);
  51. myControlComp->createControl (&myIID);
  52. @endcode
  53. */
  54. bool createControl (const void* controlIID);
  55. /** Deletes the ActiveX control, if one has been created.
  56. */
  57. void deleteControl();
  58. /** Returns true if a control is currently in use. */
  59. bool isControlOpen() const throw() { return control != 0; }
  60. /** Does a QueryInterface call on the embedded control object.
  61. This allows you to cast the control to whatever type of COM object you need.
  62. The iid parameter is a pointer to an IID structure - it's treated
  63. as a void* because when including the Juce headers, you might not always
  64. have included windows.h first, in which case IID wouldn't be defined, but
  65. you should just pass a pointer to an IID.
  66. e.g. @code
  67. const IID iid = __uuidof (IOleWindow);
  68. IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
  69. if (oleWindow != 0)
  70. {
  71. HWND hwnd;
  72. oleWindow->GetWindow (&hwnd);
  73. ...
  74. oleWindow->Release();
  75. }
  76. @endcode
  77. */
  78. void* queryInterface (const void* iid) const;
  79. /** Set this to false to stop mouse events being allowed through to the control.
  80. */
  81. void setMouseEventsAllowed (const bool eventsCanReachControl);
  82. /** Returns true if mouse events are allowed to get through to the control.
  83. */
  84. bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
  85. //==============================================================================
  86. /** @internal */
  87. void paint (Graphics& g);
  88. /** @internal */
  89. void* originalWndProc;
  90. juce_UseDebuggingNewOperator
  91. private:
  92. friend class ActiveXControlData;
  93. void* control;
  94. bool mouseEventsAllowed;
  95. ActiveXControlComponent (const ActiveXControlComponent&);
  96. const ActiveXControlComponent& operator= (const ActiveXControlComponent&);
  97. void setControlBounds (const Rectangle& bounds) const;
  98. void setControlVisible (const bool b) const;
  99. };
  100. #endif
  101. #endif // __JUCE_ACTIVEXCONTROLCOMPONENT_JUCEHEADER__