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