Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

connectioncontainer.h

00001 /*****************************************************************************
00002  * connectioncontainer.h: ActiveX control for VLC
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  *
00006  * Authors: Damien Fouilleul <[email protected]>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00021  *****************************************************************************/
00022 
00023 #ifndef __CONNECTIONCONTAINER_H__
00024 #define __CONNECTIONCONTAINER_H__
00025 
00026 #include <ocidl.h>
00027 #include <vector>
00028 #include <queue>
00029 
00030 class VLCConnectionPoint : public IConnectionPoint
00031 {
00032 
00033 public:
00034 
00035     VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
00036         _iid(iid), _p_cpc(p_cpc) {};
00037     virtual ~VLCConnectionPoint() {};
00038 
00039     // IUnknown methods
00040     STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
00041     {
00042         if( NULL == ppv ) return E_POINTER;
00043         if( (IID_IUnknown == riid) 
00044          && (IID_IConnectionPoint == riid) ) {
00045             AddRef();
00046             *ppv = reinterpret_cast<LPVOID>(this);
00047             return NOERROR;
00048         }
00049         // must be a standalone object
00050         return E_NOINTERFACE;
00051     };
00052 
00053     STDMETHODIMP_(ULONG) AddRef(void) { return _p_cpc->AddRef(); };
00054     STDMETHODIMP_(ULONG) Release(void) { return _p_cpc->Release(); };
00055 
00056     // IConnectionPoint methods
00057     STDMETHODIMP GetConnectionInterface(IID *);
00058     STDMETHODIMP GetConnectionPointContainer(LPCONNECTIONPOINTCONTAINER *);
00059     STDMETHODIMP Advise(IUnknown *, DWORD *);
00060     STDMETHODIMP Unadvise(DWORD);
00061     STDMETHODIMP EnumConnections(LPENUMCONNECTIONS *);
00062 
00063     void fireEvent(DISPID dispIdMember, DISPPARAMS* pDispParams);
00064     void firePropChangedEvent(DISPID dispId);
00065 
00066 private:
00067 
00068     REFIID _iid;
00069     IConnectionPointContainer *_p_cpc;
00070     std::vector<CONNECTDATA> _connections;
00071 };
00072 
00074 
00075 class VLCDispatchEvent {
00076 
00077 public:
00078     VLCDispatchEvent(DISPID dispId, DISPPARAMS dispParams) :
00079         _dispId(dispId), _dispParams(dispParams) {};
00080     VLCDispatchEvent(const VLCDispatchEvent&);
00081     ~VLCDispatchEvent();
00082 
00083     DISPID      _dispId;
00084     DISPPARAMS  _dispParams;
00085 };
00086 
00087 class VLCConnectionPointContainer : public IConnectionPointContainer
00088 {
00089 
00090 public:
00091 
00092     VLCConnectionPointContainer(VLCPlugin *p_instance);
00093     virtual ~VLCConnectionPointContainer();
00094 
00095     // IUnknown methods
00096     STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
00097     {
00098         if( (NULL != ppv)
00099          && (IID_IUnknown == riid) 
00100          && (IID_IConnectionPointContainer == riid) ) {
00101             AddRef();
00102             *ppv = reinterpret_cast<LPVOID>(this);
00103             return NOERROR;
00104         }
00105         return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
00106     };
00107 
00108     STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
00109     STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
00110 
00111     // IConnectionPointContainer methods
00112     STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS *);
00113     STDMETHODIMP FindConnectionPoint(REFIID, LPCONNECTIONPOINT *);
00114 
00115     void freezeEvents(BOOL);
00116     void fireEvent(DISPID, DISPPARAMS*);
00117     void firePropChangedEvent(DISPID dispId);
00118 
00119 private:
00120 
00121     VLCPlugin *_p_instance;
00122     BOOL _b_freeze;
00123     VLCConnectionPoint *_p_events;
00124     VLCConnectionPoint *_p_props;
00125     std::vector<LPCONNECTIONPOINT> _v_cps;
00126     std::queue<class VLCDispatchEvent *> _q_events;
00127 };
00128 
00129 #endif
00130 

Generated on Tue Dec 20 10:14:18 2005 for vlc-0.8.4a by  doxygen 1.4.2