]> git.sesse.net Git - vlc/blob - activex/connectioncontainer.h
87d97dc624c85dad56cac282af9cbc806c10879a
[vlc] / activex / connectioncontainer.h
1 /*****************************************************************************\r
2  * connectioncontainer.h: ActiveX control for VLC\r
3  *****************************************************************************\r
4  * Copyright (C) 2005 VideoLAN\r
5  *\r
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #ifndef __CONNECTIONCONTAINER_H__\r
24 #define __CONNECTIONCONTAINER_H__\r
25 \r
26 #include <ocidl.h>\r
27 #include <vector>\r
28 \r
29 using namespace std;\r
30 \r
31 class VLCConnectionPoint : public IConnectionPoint\r
32 {\r
33 \r
34 public:\r
35 \r
36     VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :\r
37         _iid(iid), _p_cpc(p_cpc) {};\r
38     virtual ~VLCConnectionPoint() {};\r
39 \r
40     // IUnknown methods\r
41     STDMETHODIMP QueryInterface(REFIID riid, void **ppv)\r
42     {\r
43         if( NULL == ppv ) return E_POINTER;\r
44         if( (IID_IUnknown == riid) \r
45          && (IID_IConnectionPoint == riid) ) {\r
46             AddRef();\r
47             *ppv = reinterpret_cast<LPVOID>(this);\r
48             return NOERROR;\r
49         }\r
50         // must be a standalone object\r
51         return E_NOINTERFACE;\r
52     };\r
53 \r
54     STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };\r
55     STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };\r
56 \r
57     // IConnectionPoint methods\r
58     STDMETHODIMP GetConnectionInterface(IID *);\r
59     STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);\r
60     STDMETHODIMP Advise(IUnknown *, DWORD *);\r
61     STDMETHODIMP Unadvise(DWORD);\r
62     STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);\r
63 \r
64     void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);\r
65     void firePropChangedEvent(DISPID dispId);\r
66 \r
67 private:\r
68 \r
69     REFIID _iid;\r
70     IConnectionPointContainer *_p_cpc;\r
71     vector<CONNECTDATA> _connections;\r
72 };\r
73 \r
74 //////////////////////////////////////////////////////////////////////////\r
75 \r
76 class VLCConnectionPointContainer : public IConnectionPointContainer\r
77 {\r
78 \r
79 public:\r
80 \r
81     VLCConnectionPointContainer(VLCPlugin *p_instance);\r
82     virtual ~VLCConnectionPointContainer();\r
83 \r
84     // IUnknown methods\r
85     STDMETHODIMP QueryInterface(REFIID riid, void **ppv)\r
86     {\r
87         if( (NULL != ppv)\r
88          && (IID_IUnknown == riid) \r
89          && (IID_IConnectionPointContainer == riid) ) {\r
90             AddRef();\r
91             *ppv = reinterpret_cast<LPVOID>(this);\r
92             return NOERROR;\r
93         }\r
94         return _p_instance->QueryInterface(riid, ppv);\r
95     };\r
96 \r
97     STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->AddRef(); };\r
98     STDMETHODIMP_(ULONG) Release(void) { return _p_instance->Release(); };\r
99 \r
100     // IConnectionPointContainer methods\r
101     STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);\r
102     STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);\r
103 \r
104     void fireEvent(DISPID, DISPPARAMS*);\r
105     void firePropChangedEvent(DISPID dispId);\r
106 \r
107 private:\r
108 \r
109     VLCPlugin *_p_instance;\r
110     VLCConnectionPoint *_p_events;\r
111     VLCConnectionPoint *_p_props;\r
112     vector<LPCONNECTIONPOINT> _v_cps;\r
113 };\r
114 \r
115 #endif\r
116 \r