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
)
44 if( (IID_IUnknown
== riid
)
45 || (IID_IConnectionPoint
== riid
) )
48 *ppv
= reinterpret_cast<LPVOID
>(this);
51 // must be a standalone object
55 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_cpc
->AddRef(); };
56 STDMETHODIMP_(ULONG
) Release(void) { return _p_cpc
->Release(); };
58 // IConnectionPoint methods
59 STDMETHODIMP
GetConnectionInterface(IID
*);
60 STDMETHODIMP
GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER
*);
61 STDMETHODIMP
Advise(IUnknown
*, DWORD
*);
62 STDMETHODIMP
Unadvise(DWORD
);
63 STDMETHODIMP
EnumConnections(LPENUMCONNECTIONS
*);
65 void fireEvent(DISPID dispIdMember
, DISPPARAMS
* pDispParams
);
66 void firePropChangedEvent(DISPID dispId
);
71 IConnectionPointContainer
*_p_cpc
;
72 std::vector
<CONNECTDATA
> _connections
;
75 //////////////////////////////////////////////////////////////////////////
77 class VLCDispatchEvent
{
80 VLCDispatchEvent(DISPID dispId
, DISPPARAMS dispParams
) :
81 _dispId(dispId
), _dispParams(dispParams
) {};
82 VLCDispatchEvent(const VLCDispatchEvent
&);
86 DISPPARAMS _dispParams
;
89 class VLCConnectionPointContainer
: public IConnectionPointContainer
94 VLCConnectionPointContainer(VLCPlugin
*p_instance
);
95 virtual ~VLCConnectionPointContainer();
98 STDMETHODIMP
QueryInterface(REFIID riid
, void **ppv
)
102 if( (IID_IUnknown
== riid
)
103 || (IID_IConnectionPointContainer
== riid
) )
106 *ppv
= reinterpret_cast<LPVOID
>(this);
109 return _p_instance
->pUnkOuter
->QueryInterface(riid
, ppv
);
112 STDMETHODIMP_(ULONG
) AddRef(void) { return _p_instance
->pUnkOuter
->AddRef(); };
113 STDMETHODIMP_(ULONG
) Release(void) { return _p_instance
->pUnkOuter
->Release(); };
115 // IConnectionPointContainer methods
116 STDMETHODIMP
EnumConnectionPoints(LPENUMCONNECTIONPOINTS
*);
117 STDMETHODIMP
FindConnectionPoint(REFIID
, LPCONNECTIONPOINT
*);
119 void freezeEvents(BOOL
);
120 void fireEvent(DISPID
, DISPPARAMS
*);
121 void firePropChangedEvent(DISPID dispId
);
125 VLCPlugin
*_p_instance
;
127 VLCConnectionPoint
*_p_events
;
128 VLCConnectionPoint
*_p_props
;
129 std::vector
<LPCONNECTIONPOINT
> _v_cps
;
130 std::queue
<class VLCDispatchEvent
*> _q_events
;