KHTML
html_form.h
Go to the documentation of this file.00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * (C) 1999 Lars Knoll (knoll@kde.org) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * This file includes excerpts from the Document Object Model (DOM) 00022 * Level 1 Specification (Recommendation) 00023 * http://www.w3.org/TR/REC-DOM-Level-1/ 00024 * Copyright © World Wide Web Consortium , (Massachusetts Institute of 00025 * Technology , Institut National de Recherche en Informatique et en 00026 * Automatique , Keio University ). All Rights Reserved. 00027 * 00028 */ 00029 #ifndef HTML_FORM_H 00030 #define HTML_FORM_H 00031 00032 // -------------------------------------------------------------------------- 00033 #include <dom/html_element.h> 00034 #include <dom/html_misc.h> 00035 00036 #include <kdemacros.h> 00037 00038 namespace DOM { 00039 00040 class HTMLButtonElementImpl; 00041 class HTMLFormElement; 00042 class DOMString; 00043 00050 class KHTML_EXPORT HTMLButtonElement : public HTMLElement 00051 { 00052 public: 00053 HTMLButtonElement(); 00054 HTMLButtonElement(const HTMLButtonElement &other); 00055 HTMLButtonElement(const Node &other) : HTMLElement() 00056 {(*this)=other;} 00057 protected: 00058 HTMLButtonElement(HTMLButtonElementImpl *impl); 00059 public: 00060 00061 HTMLButtonElement & operator = (const HTMLButtonElement &other); 00062 HTMLButtonElement & operator = (const Node &other); 00063 00064 ~HTMLButtonElement(); 00065 00072 HTMLFormElement form() const; 00073 00081 DOMString accessKey() const; 00082 00086 void setAccessKey( const DOMString & ); 00087 00094 bool disabled() const; 00095 00099 void setDisabled( bool ); 00100 00108 DOMString name() const; 00109 00113 void setName( const DOMString & ); 00114 00122 long tabIndex() const; 00123 00127 void setTabIndex( long ); 00128 00135 DOMString type() const; 00136 00143 DOMString value() const; 00144 00148 void setValue( const DOMString & ); 00149 00154 void blur ( ); 00155 00160 void focus ( ); 00161 }; 00162 00163 // -------------------------------------------------------------------------- 00164 00165 class HTMLFieldSetElementImpl; 00172 class KHTML_EXPORT HTMLFieldSetElement : public HTMLElement 00173 { 00174 public: 00175 HTMLFieldSetElement(); 00176 HTMLFieldSetElement(const HTMLFieldSetElement &other); 00177 HTMLFieldSetElement(const Node &other) : HTMLElement() 00178 {(*this)=other;} 00179 protected: 00180 HTMLFieldSetElement(HTMLFieldSetElementImpl *impl); 00181 public: 00182 00183 HTMLFieldSetElement & operator = (const HTMLFieldSetElement &other); 00184 HTMLFieldSetElement & operator = (const Node &other); 00185 00186 ~HTMLFieldSetElement(); 00187 00191 HTMLFormElement form() const; 00192 }; 00193 00194 // -------------------------------------------------------------------------- 00195 00196 class HTMLFormElementImpl; 00206 class KHTML_EXPORT HTMLFormElement : public HTMLElement 00207 { 00208 friend class HTMLButtonElement; 00209 friend class HTMLFieldSetElement; 00210 friend class HTMLInputElement; 00211 friend class HTMLLabelElement; 00212 friend class HTMLLegendElement; 00213 friend class HTMLSelectElement; 00214 friend class HTMLTextAreaElement; 00215 friend class HTMLOptionElement; 00216 friend class HTMLIsIndexElement; 00217 friend class HTMLObjectElement; 00218 00219 public: 00220 HTMLFormElement(); 00221 HTMLFormElement(const HTMLFormElement &other); 00222 HTMLFormElement(const Node &other) : HTMLElement() 00223 {(*this)=other;} 00224 protected: 00225 HTMLFormElement(HTMLFormElementImpl *impl); 00226 public: 00227 00228 HTMLFormElement & operator = (const HTMLFormElement &other); 00229 HTMLFormElement & operator = (const Node &other); 00230 00231 ~HTMLFormElement(); 00232 00237 HTMLCollection elements() const; 00238 00243 long length() const; 00244 00249 DOMString name() const; 00250 00254 void setName( const DOMString & ); 00255 00262 DOMString acceptCharset() const; 00263 00267 void setAcceptCharset( const DOMString & ); 00268 00275 DOMString action() const; 00276 00280 void setAction( const DOMString & ); 00281 00289 DOMString enctype() const; 00290 00294 void setEnctype( const DOMString & ); 00295 00302 DOMString method() const; 00303 00307 void setMethod( const DOMString & ); 00308 00315 DOMString target() const; 00316 00320 void setTarget( const DOMString & ); 00321 00327 void submit ( ); 00328 00334 void reset ( ); 00335 }; 00336 00337 // -------------------------------------------------------------------------- 00338 00339 class HTMLInputElementImpl; 00349 class KHTML_EXPORT HTMLInputElement : public HTMLElement 00350 { 00351 public: 00352 HTMLInputElement(); 00353 HTMLInputElement(const HTMLInputElement &other); 00354 HTMLInputElement(const Node &other) : HTMLElement() 00355 {(*this)=other;} 00356 protected: 00357 HTMLInputElement(HTMLInputElementImpl *impl); 00358 public: 00359 00360 HTMLInputElement & operator = (const HTMLInputElement &other); 00361 HTMLInputElement & operator = (const Node &other); 00362 00363 ~HTMLInputElement(); 00364 00370 DOMString defaultValue() const; 00371 00375 void setDefaultValue( const DOMString & ); 00376 00383 bool defaultChecked() const; 00384 00388 void setDefaultChecked( bool ); 00389 00393 HTMLFormElement form() const; 00394 00402 DOMString accept() const; 00403 00407 void setAccept( const DOMString & ); 00408 00416 DOMString accessKey() const; 00417 00421 void setAccessKey( const DOMString & ); 00422 00431 DOMString align() const; 00432 00436 void setAlign( const DOMString & ); 00437 00445 DOMString alt() const; 00446 00450 void setAlt( const DOMString & ); 00451 00461 bool checked() const; 00462 00466 void setChecked( bool ); 00467 00471 bool indeterminate() const; 00472 00476 void setIndeterminate( bool ); 00477 00484 bool disabled() const; 00485 00489 void setDisabled( bool ); 00490 00498 long maxLength() const; 00499 00503 void setMaxLength( long ); 00504 00512 DOMString name() const; 00513 00517 void setName( const DOMString & ); 00518 00526 bool readOnly() const; 00527 00528 // ### remove in 4.0 00532 void setReadOnly( bool ); 00533 00537 DOMString size() const KDE_DEPRECATED; 00538 00542 void setSize( const DOMString & ) KDE_DEPRECATED; 00543 00551 long getSize() const; 00552 00556 void setSize( long ); 00557 00566 DOMString src() const; 00567 00571 void setSrc( const DOMString & ); 00572 00580 long tabIndex() const; 00581 00585 void setTabIndex( long ); 00586 00593 DOMString type() const; 00594 00598 void setType(const DOMString&); 00599 00606 DOMString useMap() const; 00607 00611 void setUseMap( const DOMString & ); 00612 00620 DOMString value() const; 00621 00625 void setValue( const DOMString & ); 00626 00631 void blur ( ); 00632 00637 void focus ( ); 00638 00645 void select ( ); 00646 00652 void click ( ); 00653 00654 00663 long selectionStart(); 00664 00671 void setSelectionStart(long offset); 00672 00681 long selectionEnd(); 00682 00689 void setSelectionEnd(long offset); 00690 00697 void setSelectionRange(long start, long end); 00698 00699 }; 00700 00701 // -------------------------------------------------------------------------- 00702 00703 class HTMLLabelElementImpl; 00710 class KHTML_EXPORT HTMLLabelElement : public HTMLElement 00711 { 00712 public: 00713 HTMLLabelElement(); 00714 HTMLLabelElement(const HTMLLabelElement &other); 00715 HTMLLabelElement(const Node &other) : HTMLElement() 00716 {(*this)=other;} 00717 protected: 00718 HTMLLabelElement(HTMLLabelElementImpl *impl); 00719 public: 00720 00721 HTMLLabelElement & operator = (const HTMLLabelElement &other); 00722 HTMLLabelElement & operator = (const Node &other); 00723 00724 ~HTMLLabelElement(); 00725 00733 DOMString accessKey() const; 00734 00738 void setAccessKey( const DOMString & ); 00739 00747 DOMString htmlFor() const; 00748 00752 void setHtmlFor( const DOMString & ); 00753 }; 00754 00755 // -------------------------------------------------------------------------- 00756 00757 class HTMLLegendElementImpl; 00765 class KHTML_EXPORT HTMLLegendElement : public HTMLElement 00766 { 00767 public: 00768 HTMLLegendElement(); 00769 HTMLLegendElement(const HTMLLegendElement &other); 00770 HTMLLegendElement(const Node &other) : HTMLElement() 00771 {(*this)=other;} 00772 protected: 00773 HTMLLegendElement(HTMLLegendElementImpl *impl); 00774 public: 00775 00776 HTMLLegendElement & operator = (const HTMLLegendElement &other); 00777 HTMLLegendElement & operator = (const Node &other); 00778 00779 ~HTMLLegendElement(); 00780 00784 HTMLFormElement form() const; 00785 00793 DOMString accessKey() const; 00794 00798 void setAccessKey( const DOMString & ); 00799 00807 DOMString align() const; 00808 00812 void setAlign( const DOMString & ); 00813 }; 00814 00815 // -------------------------------------------------------------------------- 00816 00817 class HTMLOptGroupElementImpl; 00824 class KHTML_EXPORT HTMLOptGroupElement : public HTMLElement 00825 { 00826 public: 00827 HTMLOptGroupElement(); 00828 HTMLOptGroupElement(const HTMLOptGroupElement &other); 00829 HTMLOptGroupElement(const Node &other) : HTMLElement() 00830 {(*this)=other;} 00831 protected: 00832 HTMLOptGroupElement(HTMLOptGroupElementImpl *impl); 00833 public: 00834 00835 HTMLOptGroupElement & operator = (const HTMLOptGroupElement &other); 00836 HTMLOptGroupElement & operator = (const Node &other); 00837 00838 ~HTMLOptGroupElement(); 00839 00846 bool disabled() const; 00847 00851 void setDisabled( bool ); 00852 00859 DOMString label() const; 00860 00864 void setLabel( const DOMString & ); 00865 }; 00866 00867 // -------------------------------------------------------------------------- 00868 00869 class HTMLSelectElementImpl; 00878 class KHTML_EXPORT HTMLSelectElement : public HTMLElement 00879 { 00880 public: 00881 HTMLSelectElement(); 00882 HTMLSelectElement(const HTMLSelectElement &other); 00883 HTMLSelectElement(const Node &other) : HTMLElement() 00884 {(*this)=other;} 00885 protected: 00886 HTMLSelectElement(HTMLSelectElementImpl *impl); 00887 public: 00888 00889 HTMLSelectElement & operator = (const HTMLSelectElement &other); 00890 HTMLSelectElement & operator = (const Node &other); 00891 00892 ~HTMLSelectElement(); 00893 00898 DOMString type() const; 00899 00906 long selectedIndex() const; 00907 00911 void setSelectedIndex( long ); 00912 00917 DOMString value() const; 00918 00922 void setValue( const DOMString & ); 00923 00928 long length() const; 00929 00933 HTMLFormElement form() const; 00934 00940 HTMLCollection options() const; 00941 00948 bool disabled() const; 00949 00953 void setDisabled( bool ); 00954 00962 bool multiple() const; 00963 00967 void setMultiple( bool ); 00968 00976 DOMString name() const; 00977 00981 void setName( const DOMString & ); 00982 00989 long size() const; 00990 00994 void setSize( long ); 00995 01003 long tabIndex() const; 01004 01008 void setTabIndex( long ); 01009 01020 void add ( const HTMLElement &element, const HTMLElement &before ); 01021 01030 void remove ( long index ); 01031 01036 void blur ( ); 01037 01042 void focus ( ); 01043 }; 01044 01045 // -------------------------------------------------------------------------- 01046 01047 class HTMLTextAreaElementImpl; 01054 class KHTML_EXPORT HTMLTextAreaElement : public HTMLElement 01055 { 01056 public: 01057 HTMLTextAreaElement(); 01058 HTMLTextAreaElement(const HTMLTextAreaElement &other); 01059 HTMLTextAreaElement(const Node &other) : HTMLElement() 01060 {(*this)=other;} 01061 protected: 01062 HTMLTextAreaElement(HTMLTextAreaElementImpl *impl); 01063 public: 01064 01065 HTMLTextAreaElement & operator = (const HTMLTextAreaElement &other); 01066 HTMLTextAreaElement & operator = (const Node &other); 01067 01068 ~HTMLTextAreaElement(); 01069 01075 DOMString defaultValue() const; 01076 01080 void setDefaultValue( const DOMString & ); 01081 01085 HTMLFormElement form() const; 01086 01094 DOMString accessKey() const; 01095 01099 void setAccessKey( const DOMString & ); 01100 01107 long cols() const; 01108 01112 void setCols( long ); 01113 01120 bool disabled() const; 01121 01125 void setDisabled( bool ); 01126 01134 DOMString name() const; 01135 01139 void setName( const DOMString & ); 01140 01147 bool readOnly() const; 01148 01152 void setReadOnly( bool ); 01153 01160 long rows() const; 01161 01165 void setRows( long ); 01166 01174 long tabIndex() const; 01175 01179 void setTabIndex( long ); 01180 01185 DOMString type() const; 01186 01193 DOMString value() const; 01194 01198 void setValue( const DOMString & ); 01199 01203 void blur ( ); 01204 01208 void focus ( ); 01209 01213 void select ( ); 01214 01221 long selectionStart(); 01222 01228 void setSelectionStart(long offset); 01229 01236 long selectionEnd(); 01237 01243 void setSelectionEnd(long offset); 01244 01250 void setSelectionRange(long start, long end); 01251 01257 long textLength(); 01258 }; 01259 01260 // -------------------------------------------------------------------------- 01261 01262 class HTMLOptionElementImpl; 01269 class KHTML_EXPORT HTMLOptionElement : public HTMLElement 01270 { 01271 public: 01272 HTMLOptionElement(); 01273 HTMLOptionElement(const HTMLOptionElement &other); 01274 HTMLOptionElement(const Node &other) : HTMLElement() 01275 {(*this)=other;} 01276 protected: 01277 HTMLOptionElement(HTMLOptionElementImpl *impl); 01278 public: 01279 01280 HTMLOptionElement & operator = (const HTMLOptionElement &other); 01281 HTMLOptionElement & operator = (const Node &other); 01282 01283 ~HTMLOptionElement(); 01284 01288 HTMLFormElement form() const; 01289 01295 bool defaultSelected() const; 01296 01300 void setDefaultSelected( bool ); 01301 01306 DOMString text() const; 01307 01313 long index() const; 01314 01321 void setIndex( long ); 01322 01329 bool disabled() const; 01330 01334 void setDisabled( bool ); 01335 01342 DOMString label() const; 01343 01347 void setLabel( const DOMString & ); 01348 01355 bool selected() const; 01356 01360 void setSelected( bool ); 01361 01368 DOMString value() const; 01369 01373 void setValue( const DOMString & ); 01374 }; 01375 01376 01377 // -------------------------------------------------------------------------- 01378 01379 class HTMLIsIndexElementImpl; 01380 class HTMLFormElement; 01381 01389 class KHTML_EXPORT HTMLIsIndexElement : public HTMLElement 01390 { 01391 public: 01392 HTMLIsIndexElement(); 01393 HTMLIsIndexElement(const HTMLIsIndexElement &other); 01394 HTMLIsIndexElement(const Node &other) : HTMLElement() 01395 {(*this)=other;} 01396 protected: 01397 HTMLIsIndexElement(HTMLIsIndexElementImpl *impl); 01398 public: 01399 01400 HTMLIsIndexElement & operator = (const HTMLIsIndexElement &other); 01401 HTMLIsIndexElement & operator = (const Node &other); 01402 01403 ~HTMLIsIndexElement(); 01404 01408 HTMLFormElement form() const; 01409 01417 DOMString prompt() const; 01418 01422 void setPrompt( const DOMString & ); 01423 }; 01424 01425 } //namespace 01426 01427 #endif