2 Copyright (C) 2004 Nikolas Zimmermann <wildfox@kde.org>
3 2004 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
24 #include "DOMString.h"
25 #include "MediaList.h"
26 #include "DOMException.h"
27 #include "MediaListImpl.h"
28 #include "DOMExceptionImpl.h"
30 #include "kdom/data/CSSConstants.h"
31 #include "MediaList.lut.h"
36 @begin MediaList::s_hashTable 3
37 mediaText MediaListConstants::MediaText DontDelete
38 length MediaListConstants::Length DontDelete|ReadOnly
40 @begin MediaListProto::s_hashTable 5
41 item MediaListConstants::Item DontDelete|Function 1
42 deleteMedium MediaListConstants::DeleteMedium DontDelete|Function 1
43 appendMedium MediaListConstants::AppendMedium DontDelete|Function 1
47 KDOM_IMPLEMENT_PROTOTYPE("MediaList", MediaListProto, MediaListProtoFunc)
49 Value MediaList::getValueProperty(ExecState *, int token) const
53 case MediaListConstants::MediaText:
54 return getDOMString(mediaText());
55 case MediaListConstants::Length:
56 return Number(length());
58 kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl;
64 void MediaList::putValueProperty(ExecState *exec, int token, const Value &value, int)
70 case MediaListConstants::MediaText:
71 setMediaText(toDOMString(exec, value));
74 kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl;
77 KDOM_LEAVE_SAFE(DOMException)
80 Value MediaListProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
82 KDOM_CHECK_THIS(MediaList)
87 case MediaListConstants::Item:
89 unsigned long index = args[0].toUInt32(exec);
90 return getDOMString(obj.item(index));
92 case MediaListConstants::DeleteMedium:
94 DOMString oldMedium = toDOMString(exec, args[0]);
95 obj.deleteMedium(oldMedium);
98 case MediaListConstants::AppendMedium:
100 DOMString newMedium = toDOMString(exec, args[0]);
101 obj.appendMedium(newMedium);
105 kdWarning() << "Unhandled function id in " << k_funcinfo << " : " << id << endl;
109 KDOM_LEAVE_SAFE(DOMException)
113 MediaList MediaList::null;
115 MediaList::MediaList() : d(0)
119 MediaList::MediaList(const MediaList &other) : d(other.d)
125 MediaList::MediaList(MediaListImpl *i) : d(i)
131 KDOM_IMPL_DTOR_ASSIGN_OP(MediaList)
133 void MediaList::setMediaText(const DOMString &mediatext)
136 return d->setMediaText(mediatext);
139 DOMString MediaList::mediaText() const
144 return d->mediaText();
147 unsigned long MediaList::length() const
155 DOMString MediaList::item(unsigned long index) const
160 return d->item(index);
163 void MediaList::deleteMedium(const DOMString &oldMedium)
166 d->deleteMedium(oldMedium);
169 void MediaList::appendMedium(const DOMString &newMedium)
172 d->appendMedium(newMedium);