fix breakqge introduce in [16152]
[vlc.git] / activex / connectioncontainer.h
blob71f1f5b1312e24f79e815a6609cb0d3ea7e741b9
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__
26 #include <ocidl.h>
27 #include <vector>
28 #include <queue>
30 class VLCConnectionPoint : public IConnectionPoint
33 public:
35 VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
36 _iid(iid), _p_cpc(p_cpc) {};
37 virtual ~VLCConnectionPoint() {};
39 // IUnknown methods
40 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
42 if( NULL == ppv )
43 return E_POINTER;
44 if( (IID_IUnknown == riid)
45 || (IID_IConnectionPoint == riid) )
47 AddRef();
48 *ppv = reinterpret_cast<LPVOID>(this);
49 return NOERROR;
51 // must be a standalone object
52 return E_NOINTERFACE;
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);
68 private:
70 REFIID _iid;
71 IConnectionPointContainer *_p_cpc;
72 std::vector<CONNECTDATA> _connections;
75 //////////////////////////////////////////////////////////////////////////
77 class VLCDispatchEvent {
79 public:
80 VLCDispatchEvent(DISPID dispId, DISPPARAMS dispParams) :
81 _dispId(dispId), _dispParams(dispParams) {};
82 VLCDispatchEvent(const VLCDispatchEvent&);
83 ~VLCDispatchEvent();
85 DISPID _dispId;
86 DISPPARAMS _dispParams;
89 class VLCConnectionPointContainer : public IConnectionPointContainer
92 public:
94 VLCConnectionPointContainer(VLCPlugin *p_instance);
95 virtual ~VLCConnectionPointContainer();
97 // IUnknown methods
98 STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
100 if( NULL == ppv)
101 return E_POINTER;
102 if( (IID_IUnknown == riid)
103 || (IID_IConnectionPointContainer == riid) )
105 AddRef();
106 *ppv = reinterpret_cast<LPVOID>(this);
107 return NOERROR;
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);
123 private:
125 VLCPlugin *_p_instance;
126 BOOL _b_freeze;
127 VLCConnectionPoint *_p_events;
128 VLCConnectionPoint *_p_props;
129 std::vector<LPCONNECTIONPOINT> _v_cps;
130 std::queue<class VLCDispatchEvent *> _q_events;
133 #endif