fix logic
[personal-kdelibs.git] / khtml / dom / html_form.h
blob0e31594bfbd74be3995fe02b733220795517249e
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_FORM_H
30 #define HTML_FORM_H
32 // --------------------------------------------------------------------------
33 #include <dom/html_element.h>
34 #include <dom/html_misc.h>
36 #include <kdemacros.h>
38 namespace DOM {
40 class HTMLButtonElementImpl;
41 class HTMLFormElement;
42 class DOMString;
44 /**
45 * Push button. See the <a
46 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-BUTTON">
47 * BUTTON element definition </a> in HTML 4.0.
50 class KHTML_EXPORT HTMLButtonElement : public HTMLElement
52 public:
53 HTMLButtonElement();
54 HTMLButtonElement(const HTMLButtonElement &other);
55 HTMLButtonElement(const Node &other) : HTMLElement()
56 {(*this)=other;}
57 protected:
58 HTMLButtonElement(HTMLButtonElementImpl *impl);
59 public:
61 HTMLButtonElement & operator = (const HTMLButtonElement &other);
62 HTMLButtonElement & operator = (const Node &other);
64 ~HTMLButtonElement();
66 /**
67 * Returns the \c FORM element containing this
68 * control. Returns null if this control is not within the context
69 * of a form.
72 HTMLFormElement form() const;
74 /**
75 * A single character access key to give access to the form
76 * control. See the <a
77 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
78 * accesskey attribute definition </a> in HTML 4.0.
81 DOMString accessKey() const;
83 /**
84 * see accessKey
86 void setAccessKey( const DOMString & );
88 /**
89 * The control is unavailable in this context. See the <a
90 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
91 * disabled attribute definition </a> in HTML 4.0.
94 bool disabled() const;
96 /**
97 * see disabled
99 void setDisabled( bool );
102 * Form control or object name when submitted with a form. See the
103 * <a
104 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-BUTTON">
105 * name attribute definition </a> in HTML 4.0.
108 DOMString name() const;
111 * see name
113 void setName( const DOMString & );
116 * Index that represents the element's position in the tabbing
117 * order. See the <a
118 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
119 * tabindex attribute definition </a> in HTML 4.0.
122 long tabIndex() const;
125 * see tabIndex
127 void setTabIndex( long );
130 * The type of button. See the <a
131 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-BUTTON">
132 * type attribute definition </a> in HTML 4.0.
135 DOMString type() const;
138 * The current form control value. See the <a
139 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-BUTTON">
140 * value attribute definition </a> in HTML 4.0.
143 DOMString value() const;
146 * see value
148 void setValue( const DOMString & );
151 * Removes keyboard focus from this element.
154 void blur ( );
157 * Gives keyboard focus to this element.
160 void focus ( );
163 // --------------------------------------------------------------------------
165 class HTMLFieldSetElementImpl;
167 * Organizes form controls into logical groups. See the <a
168 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-FIELDSET">
169 * FIELDSET element definition </a> in HTML 4.0.
172 class KHTML_EXPORT HTMLFieldSetElement : public HTMLElement
174 public:
175 HTMLFieldSetElement();
176 HTMLFieldSetElement(const HTMLFieldSetElement &other);
177 HTMLFieldSetElement(const Node &other) : HTMLElement()
178 {(*this)=other;}
179 protected:
180 HTMLFieldSetElement(HTMLFieldSetElementImpl *impl);
181 public:
183 HTMLFieldSetElement & operator = (const HTMLFieldSetElement &other);
184 HTMLFieldSetElement & operator = (const Node &other);
186 ~HTMLFieldSetElement();
189 * ### KDE 4.0: remove.
191 HTMLFormElement form() const;
194 // --------------------------------------------------------------------------
196 class HTMLFormElementImpl;
198 * The \c FORM element encompasses behavior similar to a
199 * collection and an element. It provides direct access to the
200 * contained input elements as well as the attributes of the form
201 * element. See the <a
202 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-FORM">
203 * FORM element definition </a> in HTML 4.0.
206 class KHTML_EXPORT HTMLFormElement : public HTMLElement
208 friend class HTMLButtonElement;
209 friend class HTMLFieldSetElement;
210 friend class HTMLInputElement;
211 friend class HTMLLabelElement;
212 friend class HTMLLegendElement;
213 friend class HTMLSelectElement;
214 friend class HTMLTextAreaElement;
215 friend class HTMLOptionElement;
216 friend class HTMLIsIndexElement;
217 friend class HTMLObjectElement;
219 public:
220 HTMLFormElement();
221 HTMLFormElement(const HTMLFormElement &other);
222 HTMLFormElement(const Node &other) : HTMLElement()
223 {(*this)=other;}
224 protected:
225 HTMLFormElement(HTMLFormElementImpl *impl);
226 public:
228 HTMLFormElement & operator = (const HTMLFormElement &other);
229 HTMLFormElement & operator = (const Node &other);
231 ~HTMLFormElement();
234 * Returns a collection of all control elements in the form.
237 HTMLCollection elements() const;
240 * The number of form controls in the form.
243 long length() const;
246 * Names the form.
249 DOMString name() const;
252 * see name
254 void setName( const DOMString & );
257 * List of character sets supported by the server. See the <a
258 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset">
259 * accept-charset attribute definition </a> in HTML 4.0.
262 DOMString acceptCharset() const;
265 * see acceptCharset
267 void setAcceptCharset( const DOMString & );
270 * Server-side form handler. See the <a
271 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-action">
272 * action attribute definition </a> in HTML 4.0.
275 DOMString action() const;
278 * see action
280 void setAction( const DOMString & );
283 * The content type of the submitted form, generally
284 * "application/x-www-form-urlencoded". See the <a
285 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-enctype">
286 * enctype attribute definition </a> in HTML 4.0.
289 DOMString enctype() const;
292 * see enctype
294 void setEnctype( const DOMString & );
297 * HTTP method used to submit form. See the <a
298 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-method">
299 * method attribute definition </a> in HTML 4.0.
302 DOMString method() const;
305 * see method
307 void setMethod( const DOMString & );
310 * Frame to render the resource in. See the <a
311 * href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">
312 * target attribute definition </a> in HTML 4.0.
315 DOMString target() const;
318 * see target
320 void setTarget( const DOMString & );
323 * Submits the form. It performs the same action as a submit
324 * button.
327 void submit ( );
330 * Restores a form element's default values. It performs the same
331 * action as a reset button.
334 void reset ( );
337 // --------------------------------------------------------------------------
339 class HTMLInputElementImpl;
341 * Form control. Note. Depending upon the environment the page is
342 * being viewed, the value property may be read-only for the file
343 * upload input type. For the "password" input type, the actual value
344 * returned may be masked to prevent unauthorized use. See the <a
345 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-INPUT">
346 * INPUT element definition </a> in HTML 4.0.
349 class KHTML_EXPORT HTMLInputElement : public HTMLElement
351 public:
352 HTMLInputElement();
353 HTMLInputElement(const HTMLInputElement &other);
354 HTMLInputElement(const Node &other) : HTMLElement()
355 {(*this)=other;}
356 protected:
357 HTMLInputElement(HTMLInputElementImpl *impl);
358 public:
360 HTMLInputElement & operator = (const HTMLInputElement &other);
361 HTMLInputElement & operator = (const Node &other);
363 ~HTMLInputElement();
366 * Stores the initial control value (i.e., the initial value of
367 * \c value ).
370 DOMString defaultValue() const;
373 * see defaultValue
375 void setDefaultValue( const DOMString & );
378 * When \c type has the value "Radio" or "Checkbox",
379 * stores the initial value of the \c checked
380 * attribute.
383 bool defaultChecked() const;
386 * see defaultChecked
388 void setDefaultChecked( bool );
391 * ### KDE 4.0: remove.
393 HTMLFormElement form() const;
396 * A comma-separated list of content types that a server
397 * processing this form will handle correctly. See the <a
398 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept">
399 * accept attribute definition </a> in HTML 4.0.
402 DOMString accept() const;
405 * see accept
407 void setAccept( const DOMString & );
410 * A single character access key to give access to the form
411 * control. See the <a
412 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
413 * accesskey attribute definition </a> in HTML 4.0.
416 DOMString accessKey() const;
419 * see accessKey
421 void setAccessKey( const DOMString & );
424 * Aligns this object (vertically or horizontally) with respect to
425 * its surrounding text. See the <a
426 * href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-align-IMG">
427 * align attribute definition </a> in HTML 4.0. This attribute is
428 * deprecated in HTML 4.0.
431 DOMString align() const;
434 * see align
436 void setAlign( const DOMString & );
439 * Alternate text for user agents not rendering the normal content
440 * of this element. See the <a
441 * href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-alt">
442 * alt attribute definition </a> in HTML 4.0.
445 DOMString alt() const;
448 * see alt
450 void setAlt( const DOMString & );
453 * Describes whether a radio or check box is checked, when
454 * \c type has the value "Radio" or "Checkbox". The value is
455 * true if explicitly set. Represents the current state of the
456 * checkbox or radio button. See the <a
457 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-checked">
458 * checked attribute definition </a> in HTML 4.0.
461 bool checked() const;
464 * see checked
466 void setChecked( bool );
469 * Describes whether a radio box is indeterminate
471 bool indeterminate() const;
474 * see indeterminate
476 void setIndeterminate( bool );
479 * The control is unavailable in this context. See the <a
480 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
481 * disabled attribute definition </a> in HTML 4.0.
484 bool disabled() const;
487 * see disabled
489 void setDisabled( bool );
492 * Maximum number of characters for text fields, when \c type
493 * has the value "Text" or "Password". See the <a
494 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-maxlength">
495 * maxlength attribute definition </a> in HTML 4.0.
498 long maxLength() const;
501 * see maxLength
503 void setMaxLength( long );
506 * Form control or object name when submitted with a form. See the
507 * <a
508 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-INPUT">
509 * name attribute definition </a> in HTML 4.0.
512 DOMString name() const;
515 * see name
517 void setName( const DOMString & );
520 * This control is read-only. When \c type has the
521 * value "text" or "password" only. See the <a
522 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-readonly">
523 * readonly attribute definition </a> in HTML 4.0.
526 bool readOnly() const;
528 // ### remove in 4.0
530 * see readOnly
532 void setReadOnly( bool );
535 * @deprecated
537 KDE_DEPRECATED DOMString size() const;
540 * @deprecated
542 KDE_DEPRECATED void setSize( const DOMString & );
545 * Size information. The precise meaning is specific to each type
546 * of field. See the <a
547 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-size-INPUT">
548 * size attribute definition </a> in HTML 4.0.
551 long getSize() const;
554 * see getSize
556 void setSize( long );
559 * When the \c type attribute has the value "Image",
560 * this attribute specifies the location of the image to be used
561 * to decorate the graphical submit button. See the <a
562 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-src">
563 * src attribute definition </a> in HTML 4.0.
566 DOMString src() const;
569 * see src
571 void setSrc( const DOMString & );
574 * Index that represents the element's position in the tabbing
575 * order. See the <a
576 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
577 * tabindex attribute definition </a> in HTML 4.0.
580 long tabIndex() const;
583 * see tabIndex
585 void setTabIndex( long );
588 * The type of control created. See the <a
589 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-INPUT">
590 * type attribute definition </a> in HTML 4.0.
593 DOMString type() const;
596 * see type
598 void setType(const DOMString&);
601 * Use client-side image map. See the <a
602 * href="http://www.w3.org/TR/REC-html40/struct/objects.html#adef-usemap">
603 * usemap attribute definition </a> in HTML 4.0.
606 DOMString useMap() const;
609 * see useMap
611 void setUseMap( const DOMString & );
614 * The current form control value. Used for radio buttons and
615 * check boxes. See the <a
616 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-INPUT">
617 * value attribute definition </a> in HTML 4.0.
620 DOMString value() const;
623 * see value
625 void setValue( const DOMString & );
628 * Removes keyboard focus from this element.
631 void blur ( );
634 * Gives keyboard focus to this element.
637 void focus ( );
640 * Select the contents of the text area. For \c INPUT
641 * elements whose \c type attribute has one of the
642 * following values: "Text", "File", or "Password".
645 void select ( );
648 * Simulate a mouse-click. For \c INPUT elements whose
649 * \c type attribute has one of the following values:
650 * "Button", "Checkbox", "Radio", "Reset", or "Submit".
652 void click ( );
656 * Returns the character offset of beginning of selection, or if none,
657 * the cursor position.
658 * This operation is only supported if the type of this element is text;
659 * otherwise -1 is returned.
660 * NOTE: this method is not part of the DOM, but a Mozilla extension
662 long selectionStart();
665 * Move the beginning of the selection to the given offset in text
666 * This call has no effect if the type of this input element isn't text
667 * NOTE: this method is not part of the DOM, but a Mozilla extension
669 void setSelectionStart(long offset);
672 * Returns the character offset of end of selection, or if none,
673 * the cursor position.
674 * This operation is only supported if the type of this element is text;
675 * otherwise -1 is returned.
676 * NOTE: this method is not part of the DOM, but a Mozilla extension
678 long selectionEnd();
681 * Move the end of the selection (and the cursor) to the given offset in text
682 * This call has no effect if the type of this input element isn't text
683 * NOTE: this method is not part of the DOM, but a Mozilla extension
685 void setSelectionEnd(long offset);
688 * Makes the position span from start to end, and positions the cursor after the selection.
689 * This call has no effect if the type of this input element isn't text or if it is not rendered.
690 * NOTE: this method is not part of the DOM, but a Mozilla extension
692 void setSelectionRange(long start, long end);
696 // --------------------------------------------------------------------------
698 class HTMLLabelElementImpl;
700 * Form field label text. See the <a
701 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL">
702 * LABEL element definition </a> in HTML 4.0.
705 class KHTML_EXPORT HTMLLabelElement : public HTMLElement
707 public:
708 HTMLLabelElement();
709 HTMLLabelElement(const HTMLLabelElement &other);
710 HTMLLabelElement(const Node &other) : HTMLElement()
711 {(*this)=other;}
712 protected:
713 HTMLLabelElement(HTMLLabelElementImpl *impl);
714 public:
716 HTMLLabelElement & operator = (const HTMLLabelElement &other);
717 HTMLLabelElement & operator = (const Node &other);
719 ~HTMLLabelElement();
722 * A single character access key to give access to the form
723 * control. See the <a
724 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
725 * accesskey attribute definition </a> in HTML 4.0.
728 DOMString accessKey() const;
731 * see accessKey
733 void setAccessKey( const DOMString & );
736 * This attribute links this label with another form control by
737 * \c id attribute. See the <a
738 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-for">
739 * for attribute definition </a> in HTML 4.0.
742 DOMString htmlFor() const;
745 * see htmlFor
747 void setHtmlFor( const DOMString & );
750 // --------------------------------------------------------------------------
752 class HTMLLegendElementImpl;
754 * Provides a caption for a \c FIELDSET grouping. See the
755 * <a
756 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LEGEND">
757 * LEGEND element definition </a> in HTML 4.0.
760 class KHTML_EXPORT HTMLLegendElement : public HTMLElement
762 public:
763 HTMLLegendElement();
764 HTMLLegendElement(const HTMLLegendElement &other);
765 HTMLLegendElement(const Node &other) : HTMLElement()
766 {(*this)=other;}
767 protected:
768 HTMLLegendElement(HTMLLegendElementImpl *impl);
769 public:
771 HTMLLegendElement & operator = (const HTMLLegendElement &other);
772 HTMLLegendElement & operator = (const Node &other);
774 ~HTMLLegendElement();
777 * ### KDE 4.0: remove
779 HTMLFormElement form() const;
782 * A single character access key to give access to the form
783 * control. See the <a
784 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
785 * accesskey attribute definition </a> in HTML 4.0.
788 DOMString accessKey() const;
791 * see accessKey
793 void setAccessKey( const DOMString & );
796 * Text alignment relative to \c FIELDSET . See the <a
797 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-align-LEGEND">
798 * align attribute definition </a> in HTML 4.0. This attribute is
799 * deprecated in HTML 4.0.
802 DOMString align() const;
805 * see align
807 void setAlign( const DOMString & );
810 // --------------------------------------------------------------------------
812 class HTMLOptGroupElementImpl;
814 * Group options together in logical subdivisions. See the <a
815 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTGROUP">
816 * OPTGROUP element definition </a> in HTML 4.0.
819 class KHTML_EXPORT HTMLOptGroupElement : public HTMLElement
821 public:
822 HTMLOptGroupElement();
823 HTMLOptGroupElement(const HTMLOptGroupElement &other);
824 HTMLOptGroupElement(const Node &other) : HTMLElement()
825 {(*this)=other;}
826 protected:
827 HTMLOptGroupElement(HTMLOptGroupElementImpl *impl);
828 public:
830 HTMLOptGroupElement & operator = (const HTMLOptGroupElement &other);
831 HTMLOptGroupElement & operator = (const Node &other);
833 ~HTMLOptGroupElement();
836 * The control is unavailable in this context. See the <a
837 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
838 * disabled attribute definition </a> in HTML 4.0.
841 bool disabled() const;
844 * see disabled
846 void setDisabled( bool );
849 * Assigns a label to this option group. See the <a
850 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-label-OPTGROUP">
851 * label attribute definition </a> in HTML 4.0.
854 DOMString label() const;
857 * see label
859 void setLabel( const DOMString & );
862 // --------------------------------------------------------------------------
864 class HTMLSelectElementImpl;
866 * The select element allows the selection of an option. The contained
867 * options can be directly accessed through the select element as a
868 * collection. See the <a
869 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-SELECT">
870 * SELECT element definition </a> in HTML 4.0.
873 class KHTML_EXPORT HTMLSelectElement : public HTMLElement
875 public:
876 HTMLSelectElement();
877 HTMLSelectElement(const HTMLSelectElement &other);
878 HTMLSelectElement(const Node &other) : HTMLElement()
879 {(*this)=other;}
880 protected:
881 HTMLSelectElement(HTMLSelectElementImpl *impl);
882 public:
884 HTMLSelectElement & operator = (const HTMLSelectElement &other);
885 HTMLSelectElement & operator = (const Node &other);
887 ~HTMLSelectElement();
890 * The type of control created.
893 DOMString type() const;
896 * The ordinal index of the selected option. The value -1 is
897 * returned if no element is selected. If multiple options are
898 * selected, the index of the first selected option is returned.
901 long selectedIndex() const;
904 * see selectedIndex
906 void setSelectedIndex( long );
909 * The current form control value.
912 DOMString value() const;
915 * see value
917 void setValue( const DOMString & );
920 * The number of options in this \c SELECT .
923 long length() const;
926 * ### KDE 4.0: remove.
928 HTMLFormElement form() const;
931 * The collection of \c OPTION elements contained by
932 * this element.
935 HTMLCollection options() const;
938 * The control is unavailable in this context. See the <a
939 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
940 * disabled attribute definition </a> in HTML 4.0.
943 bool disabled() const;
946 * see disabled
948 void setDisabled( bool );
951 * If true, multiple \c OPTION elements may be
952 * selected in this \c SELECT . See the <a
953 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-multiple">
954 * multiple attribute definition </a> in HTML 4.0.
957 bool multiple() const;
960 * see multiple
962 void setMultiple( bool );
965 * Form control or object name when submitted with a form. See the
966 * <a
967 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-SELECT">
968 * name attribute definition </a> in HTML 4.0.
971 DOMString name() const;
974 * see name
976 void setName( const DOMString & );
979 * Number of visible rows. See the <a
980 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-size-SELECT">
981 * size attribute definition </a> in HTML 4.0.
984 long size() const;
987 * see size
989 void setSize( long );
992 * Index that represents the element's position in the tabbing
993 * order. See the <a
994 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
995 * tabindex attribute definition </a> in HTML 4.0.
998 long tabIndex() const;
1001 * see tabIndex
1003 void setTabIndex( long );
1006 * Add a new element to the collection of \c OPTION
1007 * elements for this \c SELECT .
1009 * @param element The element to add.
1011 * @param before The element to insert before, or 0 for the
1012 * tail of the list.
1015 void add ( const HTMLElement &element, const HTMLElement &before );
1018 * Remove an element from the collection of \c OPTION
1019 * elements for this \c SELECT . Does nothing if no
1020 * element has the given index.
1022 * @param index The index of the item to remove.
1025 void remove ( long index );
1028 * Removes keyboard focus from this element.
1031 void blur ( );
1034 * Gives keyboard focus to this element.
1037 void focus ( );
1040 // --------------------------------------------------------------------------
1042 class HTMLTextAreaElementImpl;
1044 * Multi-line text field. See the <a
1045 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-TEXTAREA">
1046 * TEXTAREA element definition </a> in HTML 4.0.
1049 class KHTML_EXPORT HTMLTextAreaElement : public HTMLElement
1051 public:
1052 HTMLTextAreaElement();
1053 HTMLTextAreaElement(const HTMLTextAreaElement &other);
1054 HTMLTextAreaElement(const Node &other) : HTMLElement()
1055 {(*this)=other;}
1056 protected:
1057 HTMLTextAreaElement(HTMLTextAreaElementImpl *impl);
1058 public:
1060 HTMLTextAreaElement & operator = (const HTMLTextAreaElement &other);
1061 HTMLTextAreaElement & operator = (const Node &other);
1063 ~HTMLTextAreaElement();
1066 * Stores the initial control value (i.e., the initial value of
1067 * \c value ).
1070 DOMString defaultValue() const;
1073 * see defaultValue
1075 void setDefaultValue( const DOMString & );
1078 * ### KDE 4.0: remove.
1080 HTMLFormElement form() const;
1083 * A single character access key to give access to the form
1084 * control. See the <a
1085 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
1086 * accesskey attribute definition </a> in HTML 4.0.
1089 DOMString accessKey() const;
1092 * see accessKey
1094 void setAccessKey( const DOMString & );
1097 * Width of control (in characters). See the <a
1098 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-cols-TEXTAREA">
1099 * cols attribute definition </a> in HTML 4.0.
1102 long cols() const;
1105 * see cols
1107 void setCols( long );
1110 * The control is unavailable in this context. See the <a
1111 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
1112 * disabled attribute definition </a> in HTML 4.0.
1115 bool disabled() const;
1118 * see disabled
1120 void setDisabled( bool );
1123 * Form control or object name when submitted with a form. See the
1124 * <a
1125 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-TEXTAREA">
1126 * name attribute definition </a> in HTML 4.0.
1129 DOMString name() const;
1132 * see name
1134 void setName( const DOMString & );
1137 * This control is read-only. See the <a
1138 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-readonly">
1139 * readonly attribute definition </a> in HTML 4.0.
1142 bool readOnly() const;
1145 * see readOnly
1147 void setReadOnly( bool );
1150 * Number of text rows. See the <a
1151 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-rows-TEXTAREA">
1152 * rows attribute definition </a> in HTML 4.0.
1155 long rows() const;
1158 * see rows
1160 void setRows( long );
1163 * Index that represents the element's position in the tabbing
1164 * order. See the <a
1165 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
1166 * tabindex attribute definition </a> in HTML 4.0.
1169 long tabIndex() const;
1172 * see tabIndex
1174 void setTabIndex( long );
1177 * The type of this form control.
1180 DOMString type() const;
1183 * The current textual content of the multi-line text field. If
1184 * the entirety of the data can not fit into a single wstring, the
1185 * implementation may truncate the data.
1188 DOMString value() const;
1191 * see value
1193 void setValue( const DOMString & );
1196 * Removes keyboard focus from this element.
1198 void blur ( );
1201 * Gives keyboard focus to this element.
1203 void focus ( );
1206 * Select the contents of the \c TEXTAREA .
1208 void select ( );
1211 * Returns the character offset of beginning of selection, or if none,
1212 * the cursor position.
1213 * NOTE: this method is not part of the DOM, but a Mozilla extension
1215 long selectionStart();
1218 * Move the beginning of the selection to the given offset in text
1219 * NOTE: this method is not part of the DOM, but a Mozilla extension
1221 void setSelectionStart(long offset);
1224 * Returns the character offset of end of selection, or if none,
1225 * the cursor position.
1226 * NOTE: this method is not part of the DOM, but a Mozilla extension
1228 long selectionEnd();
1231 * Move the end of the selection (and the cursor) to the given offset in text
1232 * NOTE: this method is not part of the DOM, but a Mozilla extension
1234 void setSelectionEnd(long offset);
1237 * Selects the text from start to end, and positions the cursor after the selection.
1238 * NOTE: this method is not part of the DOM, but a Mozilla extension
1240 void setSelectionRange(long start, long end);
1243 * Returns the length of the text.
1244 * NOTE: this method is not part of the DOM, but a Mozilla extension
1246 long textLength();
1249 // --------------------------------------------------------------------------
1251 class HTMLOptionElementImpl;
1253 * A selectable choice. See the <a
1254 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTION">
1255 * OPTION element definition </a> in HTML 4.0.
1258 class KHTML_EXPORT HTMLOptionElement : public HTMLElement
1260 public:
1261 HTMLOptionElement();
1262 HTMLOptionElement(const HTMLOptionElement &other);
1263 HTMLOptionElement(const Node &other) : HTMLElement()
1264 {(*this)=other;}
1265 protected:
1266 HTMLOptionElement(HTMLOptionElementImpl *impl);
1267 public:
1269 HTMLOptionElement & operator = (const HTMLOptionElement &other);
1270 HTMLOptionElement & operator = (const Node &other);
1272 ~HTMLOptionElement();
1275 * ### KDE 4.0: remove
1277 HTMLFormElement form() const;
1280 * Stores the initial value of the \c selected
1281 * attribute.
1284 bool defaultSelected() const;
1287 * see defaultSelected
1289 void setDefaultSelected( bool );
1292 * The text contained within the option element.
1295 DOMString text() const;
1298 * The index of this \c OPTION in its parent
1299 * \c SELECT .
1302 long index() const;
1305 * see index
1307 * This function is obsolete - the index property is actually supposed to be read-only
1308 * (http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html)
1310 void setIndex( long );
1313 * The control is unavailable in this context. See the <a
1314 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
1315 * disabled attribute definition </a> in HTML 4.0.
1318 bool disabled() const;
1321 * see disabled
1323 void setDisabled( bool );
1326 * Option label for use in hierarchical menus. See the <a
1327 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-label-OPTION">
1328 * label attribute definition </a> in HTML 4.0.
1331 DOMString label() const;
1334 * see label
1336 void setLabel( const DOMString & );
1339 * Means that this option is initially selected. See the <a
1340 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-selected">
1341 * selected attribute definition </a> in HTML 4.0.
1344 bool selected() const;
1347 * see selected
1349 void setSelected( bool );
1352 * The current form control value. See the <a
1353 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-OPTION">
1354 * value attribute definition </a> in HTML 4.0.
1357 DOMString value() const;
1360 * see value
1362 void setValue( const DOMString & );
1366 // --------------------------------------------------------------------------
1368 class HTMLIsIndexElementImpl;
1369 class HTMLFormElement;
1372 * This element is used for single-line text input. See the <a
1373 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-ISINDEX">
1374 * ISINDEX element definition </a> in HTML 4.0. This element is
1375 * deprecated in HTML 4.0.
1378 class KHTML_EXPORT HTMLIsIndexElement : public HTMLElement
1380 public:
1381 HTMLIsIndexElement();
1382 HTMLIsIndexElement(const HTMLIsIndexElement &other);
1383 HTMLIsIndexElement(const Node &other) : HTMLElement()
1384 {(*this)=other;}
1385 protected:
1386 HTMLIsIndexElement(HTMLIsIndexElementImpl *impl);
1387 public:
1389 HTMLIsIndexElement & operator = (const HTMLIsIndexElement &other);
1390 HTMLIsIndexElement & operator = (const Node &other);
1392 ~HTMLIsIndexElement();
1395 * ### KDE 4.0: remove
1397 HTMLFormElement form() const;
1400 * The prompt message. See the <a
1401 * href="http://www.w3.org/TR/REC-html40/interact/forms.html#adef-prompt">
1402 * prompt attribute definition </a> in HTML 4.0. This attribute is
1403 * deprecated in HTML 4.0.
1406 DOMString prompt() const;
1409 * see prompt
1411 void setPrompt( const DOMString & );
1414 } //namespace
1416 #endif