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 * Copyright 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 KDE_DEPRECATED DOMString size() const; 00538 00542 KDE_DEPRECATED void setSize( const DOMString & ); 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 00662 long selectionStart(); 00663 00669 void setSelectionStart(long offset); 00670 00678 long selectionEnd(); 00679 00685 void setSelectionEnd(long offset); 00686 00692 void setSelectionRange(long start, long end); 00693 00694 }; 00695 00696 // -------------------------------------------------------------------------- 00697 00698 class HTMLLabelElementImpl; 00705 class KHTML_EXPORT HTMLLabelElement : public HTMLElement 00706 { 00707 public: 00708 HTMLLabelElement(); 00709 HTMLLabelElement(const HTMLLabelElement &other); 00710 HTMLLabelElement(const Node &other) : HTMLElement() 00711 {(*this)=other;} 00712 protected: 00713 HTMLLabelElement(HTMLLabelElementImpl *impl); 00714 public: 00715 00716 HTMLLabelElement & operator = (const HTMLLabelElement &other); 00717 HTMLLabelElement & operator = (const Node &other); 00718 00719 ~HTMLLabelElement(); 00720 00728 DOMString accessKey() const; 00729 00733 void setAccessKey( const DOMString & ); 00734 00742 DOMString htmlFor() const; 00743 00747 void setHtmlFor( const DOMString & ); 00748 }; 00749 00750 // -------------------------------------------------------------------------- 00751 00752 class HTMLLegendElementImpl; 00760 class KHTML_EXPORT HTMLLegendElement : public HTMLElement 00761 { 00762 public: 00763 HTMLLegendElement(); 00764 HTMLLegendElement(const HTMLLegendElement &other); 00765 HTMLLegendElement(const Node &other) : HTMLElement() 00766 {(*this)=other;} 00767 protected: 00768 HTMLLegendElement(HTMLLegendElementImpl *impl); 00769 public: 00770 00771 HTMLLegendElement & operator = (const HTMLLegendElement &other); 00772 HTMLLegendElement & operator = (const Node &other); 00773 00774 ~HTMLLegendElement(); 00775 00779 HTMLFormElement form() const; 00780 00788 DOMString accessKey() const; 00789 00793 void setAccessKey( const DOMString & ); 00794 00802 DOMString align() const; 00803 00807 void setAlign( const DOMString & ); 00808 }; 00809 00810 // -------------------------------------------------------------------------- 00811 00812 class HTMLOptGroupElementImpl; 00819 class KHTML_EXPORT HTMLOptGroupElement : public HTMLElement 00820 { 00821 public: 00822 HTMLOptGroupElement(); 00823 HTMLOptGroupElement(const HTMLOptGroupElement &other); 00824 HTMLOptGroupElement(const Node &other) : HTMLElement() 00825 {(*this)=other;} 00826 protected: 00827 HTMLOptGroupElement(HTMLOptGroupElementImpl *impl); 00828 public: 00829 00830 HTMLOptGroupElement & operator = (const HTMLOptGroupElement &other); 00831 HTMLOptGroupElement & operator = (const Node &other); 00832 00833 ~HTMLOptGroupElement(); 00834 00841 bool disabled() const; 00842 00846 void setDisabled( bool ); 00847 00854 DOMString label() const; 00855 00859 void setLabel( const DOMString & ); 00860 }; 00861 00862 // -------------------------------------------------------------------------- 00863 00864 class HTMLSelectElementImpl; 00873 class KHTML_EXPORT HTMLSelectElement : public HTMLElement 00874 { 00875 public: 00876 HTMLSelectElement(); 00877 HTMLSelectElement(const HTMLSelectElement &other); 00878 HTMLSelectElement(const Node &other) : HTMLElement() 00879 {(*this)=other;} 00880 protected: 00881 HTMLSelectElement(HTMLSelectElementImpl *impl); 00882 public: 00883 00884 HTMLSelectElement & operator = (const HTMLSelectElement &other); 00885 HTMLSelectElement & operator = (const Node &other); 00886 00887 ~HTMLSelectElement(); 00888 00893 DOMString type() const; 00894 00901 long selectedIndex() const; 00902 00906 void setSelectedIndex( long ); 00907 00912 DOMString value() const; 00913 00917 void setValue( const DOMString & ); 00918 00923 long length() const; 00924 00928 HTMLFormElement form() const; 00929 00935 HTMLCollection options() const; 00936 00943 bool disabled() const; 00944 00948 void setDisabled( bool ); 00949 00957 bool multiple() const; 00958 00962 void setMultiple( bool ); 00963 00971 DOMString name() const; 00972 00976 void setName( const DOMString & ); 00977 00984 long size() const; 00985 00989 void setSize( long ); 00990 00998 long tabIndex() const; 00999 01003 void setTabIndex( long ); 01004 01015 void add ( const HTMLElement &element, const HTMLElement &before ); 01016 01025 void remove ( long index ); 01026 01031 void blur ( ); 01032 01037 void focus ( ); 01038 }; 01039 01040 // -------------------------------------------------------------------------- 01041 01042 class HTMLTextAreaElementImpl; 01049 class KHTML_EXPORT HTMLTextAreaElement : public HTMLElement 01050 { 01051 public: 01052 HTMLTextAreaElement(); 01053 HTMLTextAreaElement(const HTMLTextAreaElement &other); 01054 HTMLTextAreaElement(const Node &other) : HTMLElement() 01055 {(*this)=other;} 01056 protected: 01057 HTMLTextAreaElement(HTMLTextAreaElementImpl *impl); 01058 public: 01059 01060 HTMLTextAreaElement & operator = (const HTMLTextAreaElement &other); 01061 HTMLTextAreaElement & operator = (const Node &other); 01062 01063 ~HTMLTextAreaElement(); 01064 01070 DOMString defaultValue() const; 01071 01075 void setDefaultValue( const DOMString & ); 01076 01080 HTMLFormElement form() const; 01081 01089 DOMString accessKey() const; 01090 01094 void setAccessKey( const DOMString & ); 01095 01102 long cols() const; 01103 01107 void setCols( long ); 01108 01115 bool disabled() const; 01116 01120 void setDisabled( bool ); 01121 01129 DOMString name() const; 01130 01134 void setName( const DOMString & ); 01135 01142 bool readOnly() const; 01143 01147 void setReadOnly( bool ); 01148 01155 long rows() const; 01156 01160 void setRows( long ); 01161 01169 long tabIndex() const; 01170 01174 void setTabIndex( long ); 01175 01180 DOMString type() const; 01181 01188 DOMString value() const; 01189 01193 void setValue( const DOMString & ); 01194 01198 void blur ( ); 01199 01203 void focus ( ); 01204 01208 void select ( ); 01209 01215 long selectionStart(); 01216 01221 void setSelectionStart(long offset); 01222 01228 long selectionEnd(); 01229 01234 void setSelectionEnd(long offset); 01235 01240 void setSelectionRange(long start, long end); 01241 01246 long textLength(); 01247 }; 01248 01249 // -------------------------------------------------------------------------- 01250 01251 class HTMLOptionElementImpl; 01258 class KHTML_EXPORT HTMLOptionElement : public HTMLElement 01259 { 01260 public: 01261 HTMLOptionElement(); 01262 HTMLOptionElement(const HTMLOptionElement &other); 01263 HTMLOptionElement(const Node &other) : HTMLElement() 01264 {(*this)=other;} 01265 protected: 01266 HTMLOptionElement(HTMLOptionElementImpl *impl); 01267 public: 01268 01269 HTMLOptionElement & operator = (const HTMLOptionElement &other); 01270 HTMLOptionElement & operator = (const Node &other); 01271 01272 ~HTMLOptionElement(); 01273 01277 HTMLFormElement form() const; 01278 01284 bool defaultSelected() const; 01285 01289 void setDefaultSelected( bool ); 01290 01295 DOMString text() const; 01296 01302 long index() const; 01303 01310 void setIndex( long ); 01311 01318 bool disabled() const; 01319 01323 void setDisabled( bool ); 01324 01331 DOMString label() const; 01332 01336 void setLabel( const DOMString & ); 01337 01344 bool selected() const; 01345 01349 void setSelected( bool ); 01350 01357 DOMString value() const; 01358 01362 void setValue( const DOMString & ); 01363 }; 01364 01365 01366 // -------------------------------------------------------------------------- 01367 01368 class HTMLIsIndexElementImpl; 01369 class HTMLFormElement; 01370 01378 class KHTML_EXPORT HTMLIsIndexElement : public HTMLElement 01379 { 01380 public: 01381 HTMLIsIndexElement(); 01382 HTMLIsIndexElement(const HTMLIsIndexElement &other); 01383 HTMLIsIndexElement(const Node &other) : HTMLElement() 01384 {(*this)=other;} 01385 protected: 01386 HTMLIsIndexElement(HTMLIsIndexElementImpl *impl); 01387 public: 01388 01389 HTMLIsIndexElement & operator = (const HTMLIsIndexElement &other); 01390 HTMLIsIndexElement & operator = (const Node &other); 01391 01392 ~HTMLIsIndexElement(); 01393 01397 HTMLFormElement form() const; 01398 01406 DOMString prompt() const; 01407 01411 void setPrompt( const DOMString & ); 01412 }; 01413 01414 } //namespace 01415 01416 #endif