1e14391e94c850b8bd03680c23b38978db68687a8John Reck/*
2e14391e94c850b8bd03680c23b38978db68687a8John Reck * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3e14391e94c850b8bd03680c23b38978db68687a8John Reck *
4e14391e94c850b8bd03680c23b38978db68687a8John Reck * This library is free software; you can redistribute it and/or
5e14391e94c850b8bd03680c23b38978db68687a8John Reck * modify it under the terms of the GNU Library General Public
6e14391e94c850b8bd03680c23b38978db68687a8John Reck * License as published by the Free Software Foundation; either
7e14391e94c850b8bd03680c23b38978db68687a8John Reck * version 2 of the License, or (at your option) any later version.
8e14391e94c850b8bd03680c23b38978db68687a8John Reck *
9e14391e94c850b8bd03680c23b38978db68687a8John Reck * This library is distributed in the hope that it will be useful,
10e14391e94c850b8bd03680c23b38978db68687a8John Reck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11e14391e94c850b8bd03680c23b38978db68687a8John Reck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12e14391e94c850b8bd03680c23b38978db68687a8John Reck * Library General Public License for more details.
13e14391e94c850b8bd03680c23b38978db68687a8John Reck *
14e14391e94c850b8bd03680c23b38978db68687a8John Reck * You should have received a copy of the GNU Library General Public License
15e14391e94c850b8bd03680c23b38978db68687a8John Reck * along with this library; see the file COPYING.LIB.  If not, write to
16e14391e94c850b8bd03680c23b38978db68687a8John Reck * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17e14391e94c850b8bd03680c23b38978db68687a8John Reck * Boston, MA 02110-1301, USA.
18e14391e94c850b8bd03680c23b38978db68687a8John Reck */
19e14391e94c850b8bd03680c23b38978db68687a8John Reck
20e14391e94c850b8bd03680c23b38978db68687a8John Reck#ifndef SVGAnimatedStaticPropertyTearOff_h
21e14391e94c850b8bd03680c23b38978db68687a8John Reck#define SVGAnimatedStaticPropertyTearOff_h
22e14391e94c850b8bd03680c23b38978db68687a8John Reck
23e14391e94c850b8bd03680c23b38978db68687a8John Reck#if ENABLE(SVG)
24e14391e94c850b8bd03680c23b38978db68687a8John Reck#include "SVGAnimatedProperty.h"
25e14391e94c850b8bd03680c23b38978db68687a8John Reck
26e14391e94c850b8bd03680c23b38978db68687a8John Recknamespace WebCore {
27e14391e94c850b8bd03680c23b38978db68687a8John Reck
28e14391e94c850b8bd03680c23b38978db68687a8John Recktemplate<typename PropertyType>
29e14391e94c850b8bd03680c23b38978db68687a8John Reckclass SVGAnimatedStaticPropertyTearOff : public SVGAnimatedProperty {
30e14391e94c850b8bd03680c23b38978db68687a8John Reckpublic:
31e14391e94c850b8bd03680c23b38978db68687a8John Reck    PropertyType& baseVal()
32e14391e94c850b8bd03680c23b38978db68687a8John Reck    {
33e14391e94c850b8bd03680c23b38978db68687a8John Reck        return m_property;
34e14391e94c850b8bd03680c23b38978db68687a8John Reck    }
35e14391e94c850b8bd03680c23b38978db68687a8John Reck
36e14391e94c850b8bd03680c23b38978db68687a8John Reck    PropertyType& animVal()
37e14391e94c850b8bd03680c23b38978db68687a8John Reck    {
38e14391e94c850b8bd03680c23b38978db68687a8John Reck        // FIXME: No animVal support.
39e14391e94c850b8bd03680c23b38978db68687a8John Reck        return m_property;
40e14391e94c850b8bd03680c23b38978db68687a8John Reck    }
41e14391e94c850b8bd03680c23b38978db68687a8John Reck
42e14391e94c850b8bd03680c23b38978db68687a8John Reck    void setBaseVal(const PropertyType& property)
43e14391e94c850b8bd03680c23b38978db68687a8John Reck    {
44e14391e94c850b8bd03680c23b38978db68687a8John Reck        m_property = property;
45e14391e94c850b8bd03680c23b38978db68687a8John Reck        commitChange();
46e14391e94c850b8bd03680c23b38978db68687a8John Reck    }
47e14391e94c850b8bd03680c23b38978db68687a8John Reck
48e14391e94c850b8bd03680c23b38978db68687a8John Reck    // FIXME: No animVal support.
49e14391e94c850b8bd03680c23b38978db68687a8John Reck    void setAnimVal(const PropertyType&) { }
50e14391e94c850b8bd03680c23b38978db68687a8John Reck
51e14391e94c850b8bd03680c23b38978db68687a8John Reckprivate:
52e14391e94c850b8bd03680c23b38978db68687a8John Reck    friend class SVGAnimatedProperty;
53e14391e94c850b8bd03680c23b38978db68687a8John Reck
54e14391e94c850b8bd03680c23b38978db68687a8John Reck    static PassRefPtr<SVGAnimatedStaticPropertyTearOff<PropertyType> > create(SVGElement* contextElement, const QualifiedName& attributeName, PropertyType& property)
55e14391e94c850b8bd03680c23b38978db68687a8John Reck    {
56e14391e94c850b8bd03680c23b38978db68687a8John Reck        ASSERT(contextElement);
57e14391e94c850b8bd03680c23b38978db68687a8John Reck        return adoptRef(new SVGAnimatedStaticPropertyTearOff<PropertyType>(contextElement, attributeName, property));
58e14391e94c850b8bd03680c23b38978db68687a8John Reck    }
59e14391e94c850b8bd03680c23b38978db68687a8John Reck
60e14391e94c850b8bd03680c23b38978db68687a8John Reck    SVGAnimatedStaticPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, PropertyType& property)
61e14391e94c850b8bd03680c23b38978db68687a8John Reck        : SVGAnimatedProperty(contextElement, attributeName)
62e14391e94c850b8bd03680c23b38978db68687a8John Reck        , m_property(property)
63e14391e94c850b8bd03680c23b38978db68687a8John Reck    {
64e14391e94c850b8bd03680c23b38978db68687a8John Reck    }
65e14391e94c850b8bd03680c23b38978db68687a8John Reck
66e14391e94c850b8bd03680c23b38978db68687a8John Reckprivate:
67e14391e94c850b8bd03680c23b38978db68687a8John Reck    PropertyType& m_property;
68e14391e94c850b8bd03680c23b38978db68687a8John Reck};
69e14391e94c850b8bd03680c23b38978db68687a8John Reck
70e14391e94c850b8bd03680c23b38978db68687a8John Reck}
71e14391e94c850b8bd03680c23b38978db68687a8John Reck
72e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif // ENABLE(SVG)
73e14391e94c850b8bd03680c23b38978db68687a8John Reck#endif // SVGAnimatedStaticPropertyTearOff_h
74