2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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.
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.
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.
20 #ifndef SVGStaticListPropertyTearOff_h
21 #define SVGStaticListPropertyTearOff_h
24 #include "SVGListProperty.h"
28 template<typename PropertyType>
29 class SVGStaticListPropertyTearOff : public SVGListProperty<PropertyType> {
31 typedef SVGListProperty<PropertyType> Base;
33 typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
34 typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
36 static PassRefPtr<SVGStaticListPropertyTearOff<PropertyType> > create(SVGElement* contextElement, PropertyType& values)
38 ASSERT(contextElement);
39 return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(contextElement, values));
43 void clear(ExceptionCode& ec)
45 Base::clearValues(m_values, ec);
48 unsigned numberOfItems() const
50 return Base::numberOfItemsValues(m_values);
53 ListItemType initialize(const ListItemType& newItem, ExceptionCode& ec)
55 return Base::initializeValues(m_values, newItem, ec);
58 ListItemType getItem(unsigned index, ExceptionCode& ec)
60 return Base::getItemValues(m_values, index, ec);
63 ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
65 return Base::insertItemBeforeValues(m_values, newItem, index, ec);
68 ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
70 return Base::replaceItemValues(m_values, newItem, index, ec);
73 ListItemType removeItem(unsigned index, ExceptionCode& ec)
75 return Base::removeItemValues(m_values, index, ec);
78 ListItemType appendItem(const ListItemType& newItem, ExceptionCode& ec)
80 return Base::appendItemValues(m_values, newItem, ec);
84 SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
85 : SVGListProperty<PropertyType>(UndefinedRole)
86 , m_contextElement(contextElement)
91 virtual void commitChange()
93 m_values.commitChange(m_contextElement.get());
96 virtual void processIncomingListItemValue(const ListItemType&, unsigned*)
98 // no-op for static lists
101 virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>&, unsigned*)
103 ASSERT_NOT_REACHED();
107 RefPtr<SVGElement> m_contextElement;
108 PropertyType& m_values;
113 #endif // ENABLE(SVG)
114 #endif // SVGStaticListPropertyTearOff_h