]> git.sesse.net Git - vlc/blob - activex/viewobject.cpp
compilation fixes for MSVC
[vlc] / activex / viewobject.cpp
1 /*****************************************************************************
2  * viewobject.cpp: ActiveX control for VLC
3  *****************************************************************************
4  * Copyright (C) 2005 VideoLAN
5  *
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
7  *
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.
12  *
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.
17  *
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 #include "plugin.h"
24 #include "viewobject.h"
25
26 #include "utils.h"
27
28 using namespace std;
29
30 STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect,
31         DVTARGETDEVICE *ptd, HDC hicTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
32         LPCRECTL lprcWBounds, BOOL(CALLBACK *pfnContinue)(DWORD), DWORD dwContinue)
33 {
34     if( dwAspect & DVASPECT_CONTENT )
35     {
36         if( _p_instance->getVisible() )
37         {
38             RECT bounds;
39             bounds.left   = lprcBounds->left;
40             bounds.top    = lprcBounds->top;
41             bounds.right  = lprcBounds->right;
42             bounds.bottom = lprcBounds->bottom;
43             _p_instance->onPaint(hdcDraw, bounds, bounds);
44         }
45         return S_OK;
46     }
47     return E_NOTIMPL;
48 };
49
50 STDMETHODIMP VLCViewObject::Freeze(DWORD dwAspect, LONG lindex,
51         PVOID pvAspect, LPDWORD pdwFreeze)
52 {
53     if( NULL != pvAspect )
54         return E_INVALIDARG;
55
56     return E_NOTIMPL;
57 };
58
59 STDMETHODIMP VLCViewObject::GetAdvise(LPDWORD pdwAspect, LPDWORD padvf,
60         LPADVISESINK *ppAdviseSink)
61 {
62     if( NULL != pdwAspect )
63         *pdwAspect = _dwAspect;
64
65     if( NULL != padvf )
66         *padvf = _advf;
67
68     if( NULL != ppAdviseSink )
69     {
70         *ppAdviseSink = _pAdvSink;
71         if( NULL != _pAdvSink )
72             _pAdvSink->AddRef();
73     }
74
75     return S_OK;
76 };
77
78 STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, 
79         PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet)
80 {
81     return S_FALSE;
82 };
83
84 STDMETHODIMP VLCViewObject::SetAdvise(DWORD dwAspect, DWORD advf,
85         LPADVISESINK pAdvSink)
86 {
87     _dwAspect = dwAspect;
88     _advf = advf;
89     if( NULL != _pAdvSink )
90         _pAdvSink->Release();
91
92     _pAdvSink = pAdvSink;
93     if( NULL != pAdvSink )
94     {
95         pAdvSink->AddRef();
96
97         if( dwAspect & DVASPECT_CONTENT )
98         {
99             pAdvSink->OnViewChange(DVASPECT_CONTENT, -1);
100         }
101     }
102     return S_OK;
103 };
104
105 STDMETHODIMP VLCViewObject::Unfreeze(DWORD dwFreeze)
106 {
107     return E_NOTIMPL;
108 };
109
110 STDMETHODIMP VLCViewObject::GetExtent(DWORD dwAspect, LONG lindex,
111         DVTARGETDEVICE *ptd, LPSIZEL lpSizel)
112 {
113     if( dwAspect & DVASPECT_CONTENT )
114     {
115         *lpSizel = _p_instance->getExtent();
116         return S_OK;
117     }
118     lpSizel->cx= 0L;
119     lpSizel->cy= 0L;
120     return E_NOTIMPL;
121 };
122