1 /*****************************************************************************
2 * connectioncontainer.h: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef __CONNECTIONCONTAINER_H__
24 #define __CONNECTIONCONTAINER_H__
30 class VLCConnectionPoint : public IConnectionPoint
35 VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
36 _iid(iid), _p_cpc(p_cpc) {};
37 virtual ~VLCConnectionPoint() {};
40 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
42 if( NULL == ppv ) return E_POINTER;
43 if( (IID_IUnknown == riid)
44 && (IID_IConnectionPoint == riid) ) {
46 *ppv = reinterpret_cast<LPVOID>(this);
49 // must be a standalone object
53 STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };
54 STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };
56 // IConnectionPoint methods
57 STDMETHODIMP GetConnectionInterface(IID *);
58 STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);
59 STDMETHODIMP Advise(IUnknown *, DWORD *);
60 STDMETHODIMP Unadvise(DWORD);
61 STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
63 void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);
64 void firePropChangedEvent(DISPID dispId);
69 IConnectionPointContainer *_p_cpc;
70 std::vector<CONNECTDATA> _connections;
73 //////////////////////////////////////////////////////////////////////////
75 class VLCDispatchEvent {
78 VLCDispatchEvent(DISPID dispId, DISPPARAMS dispParams) :
79 _dispId(dispId), _dispParams(dispParams) {};
80 VLCDispatchEvent(const VLCDispatchEvent&);
84 DISPPARAMS _dispParams;
87 class VLCConnectionPointContainer : public IConnectionPointContainer
92 VLCConnectionPointContainer(VLCPlugin *p_instance);
93 virtual ~VLCConnectionPointContainer();
96 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
99 && (IID_IUnknown == riid)
100 && (IID_IConnectionPointContainer == riid) ) {
102 *ppv = reinterpret_cast<LPVOID>(this);
105 return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
108 STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
109 STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
111 // IConnectionPointContainer methods
112 STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
113 STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
115 void freezeEvents(BOOL);
116 void fireEvent(DISPID, DISPPARAMS*);
117 void firePropChangedEvent(DISPID dispId);
121 VLCPlugin *_p_instance;
123 VLCConnectionPoint *_p_events;
124 VLCConnectionPoint *_p_props;
125 std::vector<LPCONNECTIONPOINT> _v_cps;
126 std::queue<class VLCDispatchEvent *> _q_events;