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__
31 class VLCConnectionPoint
: public IConnectionPoint
36 VLCConnectionPoint(IConnectionPointContainer
*p_cpc
, REFIID iid
) :
37 _iid(iid
), _p_cpc(p_cpc
) {};
38 virtual ~VLCConnectionPoint() {};
41 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
45 if( (IID_IUnknown
== riid
)
46 || (IID_IConnectionPoint
== riid
) )
49 *ppv
= reinterpret_cast<LPVOID
>(this);
52 // must be a standalone object
56 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_cpc
->AddRef(); };
57 STDMETHODIMP_(ULONG
) Release(void) { return _p_cpc
->Release(); };
59 // IConnectionPoint methods
60 STDMETHODIMP
GetConnectionInterface(IID
*);
61 STDMETHODIMP
GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER
*);
62 STDMETHODIMP
Advise(IUnknown
*, DWORD
*);
63 STDMETHODIMP
Unadvise(DWORD
);
64 STDMETHODIMP
EnumConnections(LPENUMCONNECTIONS
*);
66 void fireEvent(DISPID dispIdMember
, DISPPARAMS
* pDispParams
);
67 void firePropChangedEvent(DISPID dispId
);
72 IConnectionPointContainer
*_p_cpc
;
73 std::map
<DWORD
, LPUNKNOWN
> _connections
;
76 //////////////////////////////////////////////////////////////////////////
78 class VLCDispatchEvent
{
81 VLCDispatchEvent(DISPID dispId
, DISPPARAMS dispParams
) :
82 _dispId(dispId
), _dispParams(dispParams
) {};
83 VLCDispatchEvent(const VLCDispatchEvent
&);
87 DISPPARAMS _dispParams
;
90 class VLCConnectionPointContainer
: public IConnectionPointContainer
95 VLCConnectionPointContainer(VLCPlugin
*p_instance
);
96 virtual ~VLCConnectionPointContainer();
99 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
103 if( (IID_IUnknown
== riid
)
104 || (IID_IConnectionPointContainer
== riid
) )
107 *ppv
= reinterpret_cast<LPVOID
>(this);
110 return _p_instance
->pUnkOuter
->QueryInterface(riid
, ppv
);
113 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
114 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
116 // IConnectionPointContainer methods
117 STDMETHODIMP
EnumConnectionPoints(LPENUMCONNECTIONPOINTS
*);
118 STDMETHODIMP
FindConnectionPoint(REFIID
, LPCONNECTIONPOINT
*);
120 void freezeEvents(BOOL
);
121 void fireEvent(DISPID
, DISPPARAMS
*);
122 void firePropChangedEvent(DISPID dispId
);
126 VLCPlugin
*_p_instance
;
128 VLCConnectionPoint
*_p_events
;
129 VLCConnectionPoint
*_p_props
;
130 std::vector
<LPCONNECTIONPOINT
> _v_cps
;
131 std::queue
<class VLCDispatchEvent
*> _q_events
;