A Windows-specific class that can create and embed an ActiveX control inside itself. More...
Inherits Component.
Public Member Functions | |
| ActiveXControlComponent () | |
| Create an initially-empty container. | |
| ~ActiveXControlComponent () | |
| Destructor. | |
| bool | createControl (const void *controlIID) |
| Tries to create an ActiveX control and embed it in this peer. | |
| void | deleteControl () |
| Deletes the ActiveX control, if one has been created. | |
| bool | isControlOpen () const noexcept |
| Returns true if a control is currently in use. | |
| void * | queryInterface (const void *iid) const |
| Does a QueryInterface call on the embedded control object. | |
| void | setMouseEventsAllowed (bool eventsCanReachControl) |
| Set this to false to stop mouse events being allowed through to the control. | |
| bool | areMouseEventsAllowed () const noexcept |
| Returns true if mouse events are allowed to get through to the control. | |
| void | paint (Graphics &g) |
| Components can override this method to draw their content. | |
Public Attributes | |
| void * | originalWndProc |
A Windows-specific class that can create and embed an ActiveX control inside itself.
To use it, create one of these, put it in place and make sure it's visible in a window, then use createControl() to instantiate an ActiveX control. The control will then be moved and resized to follow the movements of this component.
Of course, since the control is a heavyweight window, it'll obliterate any juce components that may overlap this component, but that's life.
| ActiveXControlComponent::ActiveXControlComponent | ( | ) |
Create an initially-empty container.
| ActiveXControlComponent::~ActiveXControlComponent | ( | ) |
Destructor.
| bool ActiveXControlComponent::createControl | ( | const void * | controlIID ) |
Tries to create an ActiveX control and embed it in this peer.
The peer controlIID is a pointer to an IID structure - it's treated as a void* because when including the Juce headers, you might not always have included windows.h first, in which case IID wouldn't be defined.
e.g.
const IID myIID = __uuidof (QTControl);
myControlComp->createControl (&myIID);
| void ActiveXControlComponent::deleteControl | ( | ) |
Deletes the ActiveX control, if one has been created.
| bool ActiveXControlComponent::isControlOpen | ( | ) | const |
Returns true if a control is currently in use.
| void* ActiveXControlComponent::queryInterface | ( | const void * | iid ) | const |
Does a QueryInterface call on the embedded control object.
This allows you to cast the control to whatever type of COM object you need.
The iid parameter is a pointer to an IID structure - it's treated as a void* because when including the Juce headers, you might not always have included windows.h first, in which case IID wouldn't be defined, but you should just pass a pointer to an IID.
e.g.
const IID iid = __uuidof (IOleWindow); IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid); if (oleWindow != nullptr) { HWND hwnd; oleWindow->GetWindow (&hwnd); ... oleWindow->Release(); }
| void ActiveXControlComponent::setMouseEventsAllowed | ( | bool | eventsCanReachControl ) |
Set this to false to stop mouse events being allowed through to the control.
| bool ActiveXControlComponent::areMouseEventsAllowed | ( | ) | const |
Returns true if mouse events are allowed to get through to the control.
| void ActiveXControlComponent::paint | ( | Graphics & | g ) | [virtual] |
Components can override this method to draw their content.
The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.
Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.
If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.
You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().
| g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.