fix logic
[personal-kdelibs.git] / khtml / dom / html_misc.h
blobaef79d6a40a48027578de96046565036531d9e6c
1 /*
2 * This file is part of the DOM implementation for KDE.
4 * Copyright 1999 Lars Knoll (knoll@kde.org)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
21 * This file includes excerpts from the Document Object Model (DOM)
22 * Level 1 Specification (Recommendation)
23 * http://www.w3.org/TR/REC-DOM-Level-1/
24 * Copyright © World Wide Web Consortium , (Massachusetts Institute of
25 * Technology , Institut National de Recherche en Informatique et en
26 * Automatique , Keio University ). All Rights Reserved.
29 #ifndef HTML_MISC_H
30 #define HTML_MISC_H
32 #include <khtml_export.h>
33 #include <dom/html_element.h>
35 namespace DOM {
37 class HTMLBaseFontElementImpl;
38 class DOMString;
39 class HTMLCollectionImpl;
41 /**
42 * Base font. See the <a
43 * href="http://www.w3.org/TR/REC-html40/present/graphics.html#edef-BASEFONT">
44 * BASEFONT element definition </a> in HTML 4.0. This element is
45 * deprecated in HTML 4.0.
48 class KHTML_EXPORT HTMLBaseFontElement : public HTMLElement
50 public:
51 HTMLBaseFontElement();
52 HTMLBaseFontElement(const HTMLBaseFontElement &other);
53 HTMLBaseFontElement(const Node &other) : HTMLElement()
54 {(*this)=other;}
55 protected:
56 HTMLBaseFontElement(HTMLBaseFontElementImpl *impl);
57 public:
59 HTMLBaseFontElement & operator = (const HTMLBaseFontElement &other);
60 HTMLBaseFontElement & operator = (const Node &other);
62 ~HTMLBaseFontElement();
64 /**
65 * Font color. See the <a href="http://www.w3.org/TR/REC-html40/">
66 * color attribute definition </a> in HTML 4.0. This attribute is
67 * deprecated in HTML 4.0.
70 DOMString color() const;
72 /**
73 * see color
75 void setColor( const DOMString & );
77 /**
78 * Font face identifier. See the <a
79 * href="http://www.w3.org/TR/REC-html40/"> face attribute
80 * definition </a> in HTML 4.0. This attribute is deprecated in
81 * HTML 4.0.
84 DOMString face() const;
86 /**
87 * see face
89 void setFace( const DOMString & );
91 /**
92 * Computed Font size. See the <a
93 * href="http://www.w3.org/TR/REC-html40/present/graphics.html#adef-size-BASEFONT">
94 * size attribute definition </a> in HTML 4.0. This attribute is
95 * deprecated in HTML 4.0.
98 long getSize() const;
101 * see size
103 void setSize( long );
106 * @deprecated
108 KDE_DEPRECATED DOMString size() const;
111 * @deprecated
113 KDE_DEPRECATED void setSize( const DOMString & );
116 // --------------------------------------------------------------------------
119 * An \c HTMLCollection is a list of nodes. An individual
120 * node may be accessed by either ordinal index or the node's
121 * \c name or \c id attributes. Note: Collections in
122 * the HTML DOM are assumed to be live meaning that they are
123 * automatically updated when the underlying document is changed.
126 class KHTML_EXPORT HTMLCollection
128 friend class HTMLDocument;
129 friend class HTMLSelectElement;
130 friend class HTMLImageElement;
131 friend class HTMLMapElement;
132 friend class HTMLTableElement;
133 friend class HTMLTableRowElement;
134 friend class HTMLTableSectionElement;
135 friend class HTMLLayerElement;
136 friend class HTMLElement;
138 public:
139 HTMLCollection();
140 HTMLCollection(const HTMLCollection &other);
141 protected:
142 HTMLCollection(HTMLCollectionImpl* impl);
143 HTMLCollection(NodeImpl *base, int type);
144 public:
146 HTMLCollection & operator = (const HTMLCollection &other);
148 ~HTMLCollection();
151 * This attribute specifies the length or size of the list.
154 unsigned long length() const;
157 * This method retrieves a node specified by ordinal index. Nodes
158 * are numbered in tree order (depth-first traversal order).
160 * @param index The index of the node to be fetched. The index
161 * origin is 0.
163 * @return The \c Node at the corresponding position
164 * upon success. A value of \c null is returned if the
165 * index is out of range.
168 Node item ( unsigned long index ) const;
171 * This method retrieves a \c Node using a name. It
172 * first searches for a \c Node with a matching
173 * \c id attribute. If it doesn't find one, it then searches
174 * for a \c Node with a matching \c name
175 * attribute, but only on those elements that are allowed a name
176 * attribute.
178 * @param name The name of the \c Node to be fetched.
180 * @return The \c Node with a \c name or
181 * \c id attribute whose value corresponds to the
182 * specified string. Upon failure (e.g., no node with this name
183 * exists), returns \c null .
186 Node namedItem ( const DOMString &name ) const;
189 * @internal
190 * not part of the DOM
192 Node base() const;
193 HTMLCollectionImpl *handle() const;
194 bool isNull() const;
195 // Fast iteration
196 Node firstItem() const;
197 Node nextItem() const;
198 // In case of multiple items named the same way
199 Node nextNamedItem( const DOMString &name ) const;
201 protected:
202 HTMLCollectionImpl *impl;
205 class KHTML_EXPORT HTMLFormCollection : public HTMLCollection
207 friend class HTMLFormElement;
208 protected:
209 HTMLFormCollection(NodeImpl *base);
212 } //namespace
214 #endif