KHTML
SVGCursorElement.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #include "config.h" 00024 00025 #if ENABLE(SVG) 00026 #include "SVGCursorElement.h" 00027 00028 #include "Attr.h" 00029 #include "SVGNames.h" 00030 #include "SVGLength.h" 00031 00032 namespace WebCore { 00033 00034 SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document* doc) 00035 : SVGElement(tagName, doc) 00036 , SVGTests() 00037 , SVGExternalResourcesRequired() 00038 , SVGURIReference() 00039 , m_x(0, LengthModeWidth) 00040 , m_y(0, LengthModeHeight) 00041 { 00042 } 00043 00044 SVGCursorElement::~SVGCursorElement() 00045 { 00046 } 00047 00048 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x) 00049 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y) 00050 00051 void SVGCursorElement::parseMappedAttribute(MappedAttribute* attr) 00052 { 00053 if (attr->name() == SVGNames::xAttr) 00054 setXBaseValue(SVGLength(0, LengthModeWidth, attr->value())); 00055 else if (attr->name() == SVGNames::yAttr) 00056 setYBaseValue(SVGLength(0, LengthModeHeight, attr->value())); 00057 else { 00058 if (SVGTests::parseMappedAttribute(attr)) 00059 return; 00060 if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) 00061 return; 00062 if (SVGURIReference::parseMappedAttribute(attr)) 00063 return; 00064 00065 SVGElement::parseMappedAttribute(attr); 00066 } 00067 } 00068 00069 void SVGCursorElement::addClient(SVGElement* element) 00070 { 00071 m_clients.add(element); 00072 } 00073 00074 void SVGCursorElement::removeClient(SVGElement* element) 00075 { 00076 m_clients.remove(element); 00077 } 00078 00079 void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) 00080 { 00081 SVGElement::svgAttributeChanged(attrName); 00082 00083 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || 00084 SVGTests::isKnownAttribute(attrName) || 00085 SVGExternalResourcesRequired::isKnownAttribute(attrName) || 00086 SVGURIReference::isKnownAttribute(attrName)) { 00087 HashSet<SVGElement*>::const_iterator it = m_clients.begin(); 00088 HashSet<SVGElement*>::const_iterator end = m_clients.end(); 00089 00090 for (; it != end; ++it) 00091 (*it)->setChanged(); 00092 } 00093 } 00094 00095 void SVGCursorElement::getSubresourceAttributeStrings(Vector<String>& urls) const 00096 { 00097 urls.append(href()); 00098 } 00099 00100 } 00101 00102 #endif // ENABLE(SVG)
KDE 4.6 API Reference