• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

JSSVGPathSegListCustom.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "config.h"
00021 #include "wtf/Platform.h"
00022 
00023 #if ENABLE(SVG)
00024 #include "JSSVGPathSegList.h"
00025 
00026 #include "Document.h"
00027 #include "Frame.h"
00028 #include "JSSVGPathSeg.h"
00029 #include "SVGDocumentExtensions.h"
00030 #include "SVGElement.h"
00031 #include "SVGPathSegList.h"
00032 
00033 #include <wtf/Assertions.h>
00034 
00035 using namespace KJS;
00036 using namespace DOM;
00037 
00038 namespace khtml {
00039 
00040 KJS::JSValue* JSSVGPathSegList::clear(ExecState* exec, const List& args)
00041 {
00042     ExceptionCode ec = 0;
00043 
00044     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00045     imp->clear(ec);
00046 
00047     setDOMException(exec, ec);
00048 
00049     m_context->svgAttributeChanged(imp->associatedAttributeName());
00050     return jsUndefined();
00051 }
00052 
00053 KJS::JSValue* JSSVGPathSegList::initialize(ExecState* exec, const List& args)
00054 {
00055     ExceptionCode ec = 0;
00056     SVGPathSeg* newItem = toSVGPathSeg(args[0]);
00057 
00058     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00059 
00060     SVGPathSeg* obj = WTF::getPtr(imp->initialize(newItem, ec));
00061 
00062     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00063     setDOMException(exec, ec);
00064 
00065     m_context->svgAttributeChanged(imp->associatedAttributeName());    
00066     return result;
00067 }
00068 
00069 KJS::JSValue* JSSVGPathSegList::getItem(ExecState* exec, const List& args)
00070 {
00071     ExceptionCode ec = 0;
00072 
00073     bool indexOk;
00074     unsigned index = args[0]->toInt32(exec, indexOk);
00075     if (!indexOk) {
00076         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00077         return jsUndefined();
00078     }
00079 
00080     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00081     SVGPathSeg* obj = WTF::getPtr(imp->getItem(index, ec));
00082 
00083     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00084     setDOMException(exec, ec);
00085     return result;
00086 }
00087 
00088 KJS::JSValue* JSSVGPathSegList::insertItemBefore(ExecState* exec, const List& args)
00089 {
00090     ExceptionCode ec = 0;
00091     SVGPathSeg* newItem = toSVGPathSeg(args[0]);
00092 
00093     bool indexOk;
00094     unsigned index = args[1]->toInt32(exec, indexOk);
00095     if (!indexOk) {
00096         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00097         return jsUndefined();
00098     }
00099 
00100     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00101 
00102     KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->insertItemBefore(newItem, index, ec)), m_context.get());
00103     setDOMException(exec, ec);
00104 
00105     m_context->svgAttributeChanged(imp->associatedAttributeName());    
00106     return result;
00107 }
00108 
00109 KJS::JSValue* JSSVGPathSegList::replaceItem(ExecState* exec, const List& args)
00110 {
00111     ExceptionCode ec = 0;
00112     SVGPathSeg* newItem = toSVGPathSeg(args[0]);
00113     
00114     bool indexOk;
00115     unsigned index = args[1]->toInt32(exec, indexOk);
00116     if (!indexOk) {
00117         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00118         return jsUndefined();
00119     }
00120 
00121     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00122 
00123     KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->replaceItem(newItem, index, ec)), m_context.get());
00124     setDOMException(exec, ec);
00125 
00126     m_context->svgAttributeChanged(imp->associatedAttributeName());    
00127     return result;
00128 }
00129 
00130 KJS::JSValue* JSSVGPathSegList::removeItem(ExecState* exec, const List& args)
00131 {
00132     ExceptionCode ec = 0;
00133     
00134     bool indexOk;
00135     unsigned index = args[0]->toInt32(exec, indexOk);
00136     if (!indexOk) {
00137         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00138         return jsUndefined();
00139     }
00140 
00141     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00142 
00143     RefPtr<SVGPathSeg> obj(imp->removeItem(index, ec));
00144 
00145     KJS::JSValue* result = toJS(exec, obj.get(), m_context.get());
00146     setDOMException(exec, ec);
00147 
00148     m_context->svgAttributeChanged(imp->associatedAttributeName());    
00149     return result;
00150 }
00151 
00152 KJS::JSValue* JSSVGPathSegList::appendItem(ExecState* exec, const List& args)
00153 {
00154     ExceptionCode ec = 0;
00155     SVGPathSeg* newItem = toSVGPathSeg(args[0]);
00156 
00157     SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
00158 
00159     KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->appendItem(newItem, ec)), m_context.get());
00160     setDOMException(exec, ec);
00161 
00162     m_context->svgAttributeChanged(imp->associatedAttributeName());    
00163     return result;
00164 }
00165 
00166 }
00167 
00168 #endif // ENABLE(SVG)

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal