1 /*****************************************************************************
2 * connectioncontainer.h: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
5 * Copyright (C) 2010 M2X BV
7 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
8 * Jean-Paul Saman <jpsaman@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef __CONNECTIONCONTAINER_H__
26 #define __CONNECTIONCONTAINER_H__
34 class VLCConnectionPoint
: public IConnectionPoint
39 VLCConnectionPoint(IConnectionPointContainer
*p_cpc
, REFIID iid
);
40 virtual ~VLCConnectionPoint();
43 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
47 if( (IID_IUnknown
== riid
)
48 || (IID_IConnectionPoint
== riid
) )
51 *ppv
= reinterpret_cast<LPVOID
>(this);
54 // must be a standalone object
58 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_cpc
->AddRef(); };
59 STDMETHODIMP_(ULONG
) Release(void) { return _p_cpc
->Release(); };
61 // IConnectionPoint methods
62 STDMETHODIMP
GetConnectionInterface(IID
*);
63 STDMETHODIMP
GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER
*);
64 STDMETHODIMP
Advise(IUnknown
*, DWORD
*);
65 STDMETHODIMP
Unadvise(DWORD
);
66 STDMETHODIMP
EnumConnections(LPENUMCONNECTIONS
*);
68 void fireEvent(DISPID dispIdMember
, DISPPARAMS
* pDispParams
);
69 void firePropChangedEvent(DISPID dispId
);
74 IGlobalInterfaceTable
*m_pGIT
;
75 IConnectionPointContainer
*_p_cpc
;
76 std::map
<DWORD
, LPUNKNOWN
> _connections
;
79 //////////////////////////////////////////////////////////////////////////
81 class VLCDispatchEvent
{
84 VLCDispatchEvent(DISPID dispId
, DISPPARAMS dispParams
) :
85 _dispId(dispId
), _dispParams(dispParams
) {};
86 VLCDispatchEvent(const VLCDispatchEvent
&);
90 DISPPARAMS _dispParams
;
93 class VLCConnectionPointContainer
: public IConnectionPointContainer
98 VLCConnectionPointContainer(VLCPlugin
*p_instance
);
99 virtual ~VLCConnectionPointContainer();
102 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
106 if( (IID_IUnknown
== riid
)
107 || (IID_IConnectionPointContainer
== riid
) )
110 *ppv
= reinterpret_cast<LPVOID
>(this);
113 return _p_instance
->pUnkOuter
->QueryInterface(riid
, ppv
);
116 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
117 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
119 // IConnectionPointContainer methods
120 STDMETHODIMP
EnumConnectionPoints(LPENUMCONNECTIONPOINTS
*);
121 STDMETHODIMP
FindConnectionPoint(REFIID
, LPCONNECTIONPOINT
*);
123 void freezeEvents(BOOL
);
124 void fireEvent(DISPID
, DISPPARAMS
*);
125 void firePropChangedEvent(DISPID dispId
);
128 CRITICAL_SECTION csEvents
;
131 VLCPlugin
*_p_instance
;
134 VLCConnectionPoint
*_p_events
;
135 VLCConnectionPoint
*_p_props
;
136 std::vector
<LPCONNECTIONPOINT
> _v_cps
;
137 std::queue
<class VLCDispatchEvent
*> _q_events
;