viewobject.cpp 3.3 KB
Newer Older
1 2 3
/*****************************************************************************
 * viewobject.cpp: ActiveX control for VLC
 *****************************************************************************
4
 * Copyright (C) 2005 the VideoLAN team
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

#include "plugin.h"
#include "viewobject.h"

Damien Fouilleul's avatar
Damien Fouilleul committed
26
#include "utils.h"
27 28 29 30 31 32 33

using namespace std;

STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect,
        DVTARGETDEVICE *ptd, HDC hicTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
        LPCRECTL lprcWBounds, BOOL(CALLBACK *pfnContinue)(DWORD), DWORD dwContinue)
{
Damien Fouilleul's avatar
Damien Fouilleul committed
34
    if( dwAspect & DVASPECT_CONTENT )
35
    {
36 37 38 39 40 41
        RECT bounds;
        bounds.left   = lprcBounds->left;
        bounds.top    = lprcBounds->top;
        bounds.right  = lprcBounds->right;
        bounds.bottom = lprcBounds->bottom;
        _p_instance->onPaint(hdcDraw, bounds, bounds);
Damien Fouilleul's avatar
Damien Fouilleul committed
42
        return S_OK;
43 44 45 46 47 48 49 50 51 52
    }
    return E_NOTIMPL;
};

STDMETHODIMP VLCViewObject::Freeze(DWORD dwAspect, LONG lindex,
        PVOID pvAspect, LPDWORD pdwFreeze)
{
    if( NULL != pvAspect )
        return E_INVALIDARG;

Damien Fouilleul's avatar
Damien Fouilleul committed
53
    return E_NOTIMPL;
54 55 56 57 58
};

STDMETHODIMP VLCViewObject::GetAdvise(LPDWORD pdwAspect, LPDWORD padvf,
        LPADVISESINK *ppAdviseSink)
{
Damien Fouilleul's avatar
Damien Fouilleul committed
59
    if( NULL != pdwAspect )
60
        *pdwAspect = _dwAspect;
Damien Fouilleul's avatar
Damien Fouilleul committed
61 62

    if( NULL != padvf )
63
        *padvf = _advf;
Damien Fouilleul's avatar
Damien Fouilleul committed
64 65

    if( NULL != ppAdviseSink )
66 67 68 69 70
    {
        *ppAdviseSink = _pAdvSink;
        if( NULL != _pAdvSink )
            _pAdvSink->AddRef();
    }
Damien Fouilleul's avatar
Damien Fouilleul committed
71 72

    return S_OK;
73 74 75 76 77
};

STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, 
        PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet)
{
Damien Fouilleul's avatar
Damien Fouilleul committed
78
    return S_FALSE;
79 80 81 82 83
};

STDMETHODIMP VLCViewObject::SetAdvise(DWORD dwAspect, DWORD advf,
        LPADVISESINK pAdvSink)
{
84 85 86 87

    if( NULL != pAdvSink )
        pAdvSink->AddRef();

88 89 90
    if( NULL != _pAdvSink )
        _pAdvSink->Release();

91 92
    _dwAspect = dwAspect;
    _advf = advf;
93 94
    _pAdvSink = pAdvSink;

95 96 97
    if( (dwAspect & DVASPECT_CONTENT) && (advf & ADVF_PRIMEFIRST) && (NULL != _pAdvSink) )
    {
        _pAdvSink->OnViewChange(DVASPECT_CONTENT, -1);
98
    }
99

100
    return S_OK;
101 102 103 104 105 106 107
};

STDMETHODIMP VLCViewObject::Unfreeze(DWORD dwFreeze)
{
    return E_NOTIMPL;
};

Damien Fouilleul's avatar
Damien Fouilleul committed
108 109 110 111 112 113 114 115 116 117 118 119 120
STDMETHODIMP VLCViewObject::GetExtent(DWORD dwAspect, LONG lindex,
        DVTARGETDEVICE *ptd, LPSIZEL lpSizel)
{
    if( dwAspect & DVASPECT_CONTENT )
    {
        *lpSizel = _p_instance->getExtent();
        return S_OK;
    }
    lpSizel->cx= 0L;
    lpSizel->cy= 0L;
    return E_NOTIMPL;
};