File indexing completed on 2024-04-28 15:23:01

0001 /*
0002  * This file is part of the DOM implementation for KDE.
0003  *
0004  * Copyright 1999 Lars Knoll (knoll@kde.org)
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, write to
0018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020  *
0021  * This file includes excerpts from the Document Object Model (DOM)
0022  * Level 1 Specification (Recommendation)
0023  * https://www.w3.org/TR/REC-DOM-Level-1/
0024  * Copyright © World Wide Web Consortium , (Massachusetts Institute of
0025  * Technology , Institut National de Recherche en Informatique et en
0026  * Automatique , Keio University ). All Rights Reserved.
0027  *
0028  */
0029 #ifndef HTML_FORM_H
0030 #define HTML_FORM_H
0031 
0032 // --------------------------------------------------------------------------
0033 #include <dom/html_element.h>
0034 #include <dom/html_misc.h>
0035 
0036 namespace DOM
0037 {
0038 
0039 class HTMLButtonElementImpl;
0040 class HTMLFormElement;
0041 class DOMString;
0042 
0043 /**
0044  * Push button. See the <a
0045  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-BUTTON">
0046  * BUTTON element definition </a> in HTML 4.0.
0047  *
0048  */
0049 class KHTML_EXPORT HTMLButtonElement : public HTMLElement
0050 {
0051 public:
0052     HTMLButtonElement();
0053     HTMLButtonElement(const HTMLButtonElement &other);
0054     HTMLButtonElement(const Node &other) : HTMLElement()
0055     {
0056         (*this) = other;
0057     }
0058 protected:
0059     HTMLButtonElement(HTMLButtonElementImpl *impl);
0060 public:
0061 
0062     HTMLButtonElement &operator = (const HTMLButtonElement &other);
0063     HTMLButtonElement &operator = (const Node &other);
0064 
0065     ~HTMLButtonElement();
0066 
0067     /**
0068      * Returns the \c FORM element containing this
0069      * control. Returns null if this control is not within the context
0070      * of a form.
0071      *
0072      */
0073     HTMLFormElement form() const;
0074 
0075     /**
0076      * A single character access key to give access to the form
0077      * control. See the <a
0078      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
0079      * accesskey attribute definition </a> in HTML 4.0.
0080      *
0081      */
0082     DOMString accessKey() const;
0083 
0084     /**
0085      * see accessKey
0086      */
0087     void setAccessKey(const DOMString &);
0088 
0089     /**
0090      * The control is unavailable in this context. See the <a
0091      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
0092      * disabled attribute definition </a> in HTML 4.0.
0093      *
0094      */
0095     bool disabled() const;
0096 
0097     /**
0098      * see disabled
0099      */
0100     void setDisabled(bool);
0101 
0102     /**
0103      * Form control or object name when submitted with a form. See the
0104      * <a
0105      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-BUTTON">
0106      * name attribute definition </a> in HTML 4.0.
0107      *
0108      */
0109     DOMString name() const;
0110 
0111     /**
0112      * see name
0113      */
0114     void setName(const DOMString &);
0115 
0116     /**
0117      * Index that represents the element's position in the tabbing
0118      * order. See the <a
0119      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
0120      * tabindex attribute definition </a> in HTML 4.0.
0121      *
0122      */
0123     long tabIndex() const;
0124 
0125     /**
0126      * see tabIndex
0127      */
0128     void setTabIndex(long);
0129 
0130     /**
0131      * The type of button. See the <a
0132      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-BUTTON">
0133      * type attribute definition </a> in HTML 4.0.
0134      *
0135      */
0136     DOMString type() const;
0137 
0138     /**
0139      * The current form control value. See the <a
0140      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-BUTTON">
0141      * value attribute definition </a> in HTML 4.0.
0142      *
0143      */
0144     DOMString value() const;
0145 
0146     /**
0147      * see value
0148      */
0149     void setValue(const DOMString &);
0150 
0151     /**
0152      * Removes keyboard focus from this element.
0153      *
0154      */
0155     void blur();
0156 
0157     /**
0158      * Gives keyboard focus to this element.
0159      *
0160      */
0161     void focus();
0162 };
0163 
0164 // --------------------------------------------------------------------------
0165 
0166 class HTMLFieldSetElementImpl;
0167 /**
0168  * Organizes form controls into logical groups. See the <a
0169  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-FIELDSET">
0170  * FIELDSET element definition </a> in HTML 4.0.
0171  *
0172  */
0173 class KHTML_EXPORT HTMLFieldSetElement : public HTMLElement
0174 {
0175 public:
0176     HTMLFieldSetElement();
0177     HTMLFieldSetElement(const HTMLFieldSetElement &other);
0178     HTMLFieldSetElement(const Node &other) : HTMLElement()
0179     {
0180         (*this) = other;
0181     }
0182 protected:
0183     HTMLFieldSetElement(HTMLFieldSetElementImpl *impl);
0184 public:
0185 
0186     HTMLFieldSetElement &operator = (const HTMLFieldSetElement &other);
0187     HTMLFieldSetElement &operator = (const Node &other);
0188 
0189     ~HTMLFieldSetElement();
0190 
0191     // TODO: deprecate/remove?
0192     HTMLFormElement form() const;
0193 };
0194 
0195 // --------------------------------------------------------------------------
0196 
0197 class HTMLFormElementImpl;
0198 /**
0199  * The \c FORM element encompasses behavior similar to a
0200  * collection and an element. It provides direct access to the
0201  * contained input elements as well as the attributes of the form
0202  * element. See the <a
0203  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-FORM">
0204  * FORM element definition </a> in HTML 4.0.
0205  *
0206  */
0207 class KHTML_EXPORT HTMLFormElement : public HTMLElement
0208 {
0209     friend class HTMLButtonElement;
0210     friend class HTMLFieldSetElement;
0211     friend class HTMLInputElement;
0212     friend class HTMLLabelElement;
0213     friend class HTMLLegendElement;
0214     friend class HTMLSelectElement;
0215     friend class HTMLTextAreaElement;
0216     friend class HTMLOptionElement;
0217     friend class HTMLIsIndexElement;
0218     friend class HTMLObjectElement;
0219 
0220 public:
0221     HTMLFormElement();
0222     HTMLFormElement(const HTMLFormElement &other);
0223     HTMLFormElement(const Node &other) : HTMLElement()
0224     {
0225         (*this) = other;
0226     }
0227 protected:
0228     HTMLFormElement(HTMLFormElementImpl *impl);
0229 public:
0230 
0231     HTMLFormElement &operator = (const HTMLFormElement &other);
0232     HTMLFormElement &operator = (const Node &other);
0233 
0234     ~HTMLFormElement();
0235 
0236     /**
0237      * Returns a collection of all control elements in the form.
0238      *
0239      */
0240     HTMLCollection elements() const;
0241 
0242     /**
0243      * The number of form controls in the form.
0244      *
0245      */
0246     long length() const;
0247 
0248     /**
0249      * Names the form.
0250      *
0251      */
0252     DOMString name() const;
0253 
0254     /**
0255      * see name
0256      */
0257     void setName(const DOMString &);
0258 
0259     /**
0260      * List of character sets supported by the server. See the <a
0261      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset">
0262      * accept-charset attribute definition </a> in HTML 4.0.
0263      *
0264      */
0265     DOMString acceptCharset() const;
0266 
0267     /**
0268      * see acceptCharset
0269      */
0270     void setAcceptCharset(const DOMString &);
0271 
0272     /**
0273      * Server-side form handler. See the <a
0274      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-action">
0275      * action attribute definition </a> in HTML 4.0.
0276      *
0277      */
0278     DOMString action() const;
0279 
0280     /**
0281      * see action
0282      */
0283     void setAction(const DOMString &);
0284 
0285     /**
0286      * The content type of the submitted form, generally
0287      * "application/x-www-form-urlencoded". See the <a
0288      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-enctype">
0289      * enctype attribute definition </a> in HTML 4.0.
0290      *
0291      */
0292     DOMString enctype() const;
0293 
0294     /**
0295      * see enctype
0296      */
0297     void setEnctype(const DOMString &);
0298 
0299     /**
0300      * HTTP method used to submit form. See the <a
0301      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-method">
0302      * method attribute definition </a> in HTML 4.0.
0303      *
0304      */
0305     DOMString method() const;
0306 
0307     /**
0308      * see method
0309      */
0310     void setMethod(const DOMString &);
0311 
0312     /**
0313      * Frame to render the resource in. See the <a
0314      * href="https://www.w3.org/TR/REC-html40/present/frames.html#adef-target">
0315      * target attribute definition </a> in HTML 4.0.
0316      *
0317      */
0318     DOMString target() const;
0319 
0320     /**
0321      * see target
0322      */
0323     void setTarget(const DOMString &);
0324 
0325     /**
0326      * Submits the form. It performs the same action as a submit
0327      * button.
0328      *
0329      */
0330     void submit();
0331 
0332     /**
0333      * Restores a form element's default values. It performs the same
0334      * action as a reset button.
0335      *
0336      */
0337     void reset();
0338 };
0339 
0340 // --------------------------------------------------------------------------
0341 
0342 class HTMLInputElementImpl;
0343 /**
0344  * Form control. Note. Depending upon the environment the page is
0345  * being viewed, the value property may be read-only for the file
0346  * upload input type. For the "password" input type, the actual value
0347  * returned may be masked to prevent unauthorized use. See the <a
0348  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-INPUT">
0349  * INPUT element definition </a> in HTML 4.0.
0350  *
0351  */
0352 class KHTML_EXPORT HTMLInputElement : public HTMLElement
0353 {
0354 public:
0355     HTMLInputElement();
0356     HTMLInputElement(const HTMLInputElement &other);
0357     HTMLInputElement(const Node &other) : HTMLElement()
0358     {
0359         (*this) = other;
0360     }
0361 protected:
0362     HTMLInputElement(HTMLInputElementImpl *impl);
0363 public:
0364 
0365     HTMLInputElement &operator = (const HTMLInputElement &other);
0366     HTMLInputElement &operator = (const Node &other);
0367 
0368     ~HTMLInputElement();
0369 
0370     /**
0371      * Stores the initial control value (i.e., the initial value of
0372      * \c value ).
0373      *
0374      */
0375     DOMString defaultValue() const;
0376 
0377     /**
0378      * see defaultValue
0379      */
0380     void setDefaultValue(const DOMString &);
0381 
0382     /**
0383      * When \c type has the value "Radio" or "Checkbox",
0384      * stores the initial value of the \c checked
0385      * attribute.
0386      *
0387      */
0388     bool defaultChecked() const;
0389 
0390     /**
0391      * see defaultChecked
0392      */
0393     void setDefaultChecked(bool);
0394 
0395     // TODO: deprecate/remove?
0396     HTMLFormElement form() const;
0397 
0398     /**
0399      * A comma-separated list of content types that a server
0400      * processing this form will handle correctly. See the <a
0401      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept">
0402      * accept attribute definition </a> in HTML 4.0.
0403      *
0404      */
0405     DOMString accept() const;
0406 
0407     /**
0408      * see accept
0409      */
0410     void setAccept(const DOMString &);
0411 
0412     /**
0413      * A single character access key to give access to the form
0414      * control. See the <a
0415      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
0416      * accesskey attribute definition </a> in HTML 4.0.
0417      *
0418      */
0419     DOMString accessKey() const;
0420 
0421     /**
0422      * see accessKey
0423      */
0424     void setAccessKey(const DOMString &);
0425 
0426     /**
0427      * Aligns this object (vertically or horizontally) with respect to
0428      * its surrounding text. See the <a
0429      * href="https://www.w3.org/TR/REC-html40/struct/objects.html#adef-align-IMG">
0430      * align attribute definition </a> in HTML 4.0. This attribute is
0431      * deprecated in HTML 4.0.
0432      *
0433      */
0434     DOMString align() const;
0435 
0436     /**
0437      * see align
0438      */
0439     void setAlign(const DOMString &);
0440 
0441     /**
0442      * Alternate text for user agents not rendering the normal content
0443      * of this element. See the <a
0444      * href="https://www.w3.org/TR/REC-html40/struct/objects.html#adef-alt">
0445      * alt attribute definition </a> in HTML 4.0.
0446      *
0447      */
0448     DOMString alt() const;
0449 
0450     /**
0451      * see alt
0452      */
0453     void setAlt(const DOMString &);
0454 
0455     /**
0456      * Describes whether a radio or check box is checked, when
0457      * \c type has the value "Radio" or "Checkbox". The value is
0458      * true if explicitly set. Represents the current state of the
0459      * checkbox or radio button. See the <a
0460      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-checked">
0461      * checked attribute definition </a> in HTML 4.0.
0462      *
0463      */
0464     bool checked() const;
0465 
0466     /**
0467      * see checked
0468      */
0469     void setChecked(bool);
0470 
0471     /**
0472      * Describes whether a radio box is indeterminate
0473      */
0474     bool indeterminate() const;
0475 
0476     /**
0477      * see indeterminate
0478      */
0479     void setIndeterminate(bool);
0480 
0481     /**
0482      * The control is unavailable in this context. See the <a
0483      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
0484      * disabled attribute definition </a> in HTML 4.0.
0485      *
0486      */
0487     bool disabled() const;
0488 
0489     /**
0490      * see disabled
0491      */
0492     void setDisabled(bool);
0493 
0494     /**
0495      * Maximum number of characters for text fields, when \c type
0496      * has the value "Text" or "Password". See the <a
0497      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-maxlength">
0498      * maxlength attribute definition </a> in HTML 4.0.
0499      *
0500      */
0501     long maxLength() const;
0502 
0503     /**
0504      * see maxLength
0505      */
0506     void setMaxLength(long);
0507 
0508     /**
0509      * Form control or object name when submitted with a form. See the
0510      * <a
0511      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-INPUT">
0512      * name attribute definition </a> in HTML 4.0.
0513      *
0514      */
0515     DOMString name() const;
0516 
0517     /**
0518      * see name
0519      */
0520     void setName(const DOMString &);
0521 
0522     /**
0523      * This control is read-only. When \c type has the
0524      * value "text" or "password" only. See the <a
0525      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-readonly">
0526      * readonly attribute definition </a> in HTML 4.0.
0527      *
0528      */
0529     bool readOnly() const;
0530 
0531     // ### remove in 4.0
0532     /**
0533      * see readOnly
0534      */
0535     void setReadOnly(bool);
0536 
0537     /**
0538      * @deprecated
0539      */
0540 #ifndef KHTML_NO_DEPRECATED
0541     KHTML_DEPRECATED DOMString size() const;
0542 #endif
0543 
0544     /**
0545      * @deprecated
0546      */
0547 #ifndef KHTML_NO_DEPRECATED
0548     KHTML_DEPRECATED void setSize(const DOMString &);
0549 #endif
0550 
0551     /**
0552      * Size information. The precise meaning is specific to each type
0553      * of field. See the <a
0554      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-size-INPUT">
0555      * size attribute definition </a> in HTML 4.0.
0556      *
0557      */
0558     long getSize() const;
0559 
0560     /**
0561      * see getSize
0562      */
0563     void setSize(long);
0564 
0565     /**
0566      * When the \c type attribute has the value "Image",
0567      * this attribute specifies the location of the image to be used
0568      * to decorate the graphical submit button. See the <a
0569      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-src">
0570      * src attribute definition </a> in HTML 4.0.
0571      *
0572      */
0573     DOMString src() const;
0574 
0575     /**
0576      * see src
0577      */
0578     void setSrc(const DOMString &);
0579 
0580     /**
0581      * Index that represents the element's position in the tabbing
0582      * order. See the <a
0583      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
0584      * tabindex attribute definition </a> in HTML 4.0.
0585      *
0586      */
0587     long tabIndex() const;
0588 
0589     /**
0590      * see tabIndex
0591      */
0592     void setTabIndex(long);
0593 
0594     /**
0595      * The type of control created. See the <a
0596      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-INPUT">
0597      * type attribute definition </a> in HTML 4.0.
0598      *
0599      */
0600     DOMString type() const;
0601 
0602     /**
0603      * see type
0604      */
0605     void setType(const DOMString &);
0606 
0607     /**
0608      * Use client-side image map. See the <a
0609      * href="https://www.w3.org/TR/REC-html40/struct/objects.html#adef-usemap">
0610      * usemap attribute definition </a> in HTML 4.0.
0611      *
0612      */
0613     DOMString useMap() const;
0614 
0615     /**
0616      * see useMap
0617      */
0618     void setUseMap(const DOMString &);
0619 
0620     /**
0621      * The current form control value. Used for radio buttons and
0622      * check boxes. See the <a
0623      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-INPUT">
0624      * value attribute definition </a> in HTML 4.0.
0625      *
0626      */
0627     DOMString value() const;
0628 
0629     /**
0630      * see value
0631      */
0632     void setValue(const DOMString &);
0633 
0634     /**
0635      * Removes keyboard focus from this element.
0636      *
0637      */
0638     void blur();
0639 
0640     /**
0641      * Gives keyboard focus to this element.
0642      *
0643      */
0644     void focus();
0645 
0646     /**
0647      * Select the contents of the text area. For \c INPUT
0648      * elements whose \c type attribute has one of the
0649      * following values: "Text", "File", or "Password".
0650      *
0651      */
0652     void select();
0653 
0654     /**
0655      * Simulate a mouse-click. For \c INPUT elements whose
0656      * \c type attribute has one of the following values:
0657      * "Button", "Checkbox", "Radio", "Reset", or "Submit".
0658      */
0659     void click();
0660 
0661     /**
0662      * Returns the character offset of beginning of selection, or if none,
0663      * the cursor position.
0664      * This operation is only supported if the type of this element is text;
0665      * otherwise -1 is returned.
0666      * NOTE: this method is not part of the DOM, but a Mozilla extension
0667      */
0668     long selectionStart();
0669 
0670     /**
0671      * Move the beginning of the selection to the given offset in text
0672      * This call has no effect if the type of this input element isn't text
0673      * NOTE: this method is not part of the DOM, but a Mozilla extension
0674      */
0675     void setSelectionStart(long offset);
0676 
0677     /**
0678      * Returns the character offset of end of selection, or if none,
0679      * the cursor position.
0680      * This operation is only supported if the type of this element is text;
0681      * otherwise -1 is returned.
0682      * NOTE: this method is not part of the DOM, but a Mozilla extension
0683      */
0684     long selectionEnd();
0685 
0686     /**
0687      * Move the end of the selection (and the cursor) to the given offset in text
0688      * This call has no effect if the type of this input element isn't text
0689      * NOTE: this method is not part of the DOM, but a Mozilla extension
0690      */
0691     void setSelectionEnd(long offset);
0692 
0693     /**
0694      * Makes the position span from start to end, and positions the cursor after the selection.
0695      * This call has no effect if the type of this input element isn't text or if it is not rendered.
0696      * NOTE: this method is not part of the DOM, but a Mozilla extension
0697      */
0698     void setSelectionRange(long start, long end);
0699 
0700 };
0701 
0702 // --------------------------------------------------------------------------
0703 
0704 class HTMLLabelElementImpl;
0705 /**
0706  * Form field label text. See the <a
0707  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL">
0708  * LABEL element definition </a> in HTML 4.0.
0709  *
0710  */
0711 class KHTML_EXPORT HTMLLabelElement : public HTMLElement
0712 {
0713 public:
0714     HTMLLabelElement();
0715     HTMLLabelElement(const HTMLLabelElement &other);
0716     HTMLLabelElement(const Node &other) : HTMLElement()
0717     {
0718         (*this) = other;
0719     }
0720 protected:
0721     HTMLLabelElement(HTMLLabelElementImpl *impl);
0722 public:
0723 
0724     HTMLLabelElement &operator = (const HTMLLabelElement &other);
0725     HTMLLabelElement &operator = (const Node &other);
0726 
0727     ~HTMLLabelElement();
0728 
0729     /**
0730      * A single character access key to give access to the form
0731      * control. See the <a
0732      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
0733      * accesskey attribute definition </a> in HTML 4.0.
0734      *
0735      */
0736     DOMString accessKey() const;
0737 
0738     /**
0739      * see accessKey
0740      */
0741     void setAccessKey(const DOMString &);
0742 
0743     /**
0744      * This attribute links this label with another form control by
0745      * \c id attribute. See the <a
0746      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-for">
0747      * for attribute definition </a> in HTML 4.0.
0748      *
0749      */
0750     DOMString htmlFor() const;
0751 
0752     /**
0753      * see htmlFor
0754      */
0755     void setHtmlFor(const DOMString &);
0756 };
0757 
0758 // --------------------------------------------------------------------------
0759 
0760 class HTMLLegendElementImpl;
0761 /**
0762  * Provides a caption for a \c FIELDSET grouping. See the
0763  * <a
0764  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-LEGEND">
0765  * LEGEND element definition </a> in HTML 4.0.
0766  *
0767  */
0768 class KHTML_EXPORT HTMLLegendElement : public HTMLElement
0769 {
0770 public:
0771     HTMLLegendElement();
0772     HTMLLegendElement(const HTMLLegendElement &other);
0773     HTMLLegendElement(const Node &other) : HTMLElement()
0774     {
0775         (*this) = other;
0776     }
0777 protected:
0778     HTMLLegendElement(HTMLLegendElementImpl *impl);
0779 public:
0780 
0781     HTMLLegendElement &operator = (const HTMLLegendElement &other);
0782     HTMLLegendElement &operator = (const Node &other);
0783 
0784     ~HTMLLegendElement();
0785 
0786     // TODO: deprecate/remove?
0787     HTMLFormElement form() const;
0788 
0789     /**
0790      * A single character access key to give access to the form
0791      * control. See the <a
0792      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
0793      * accesskey attribute definition </a> in HTML 4.0.
0794      *
0795      */
0796     DOMString accessKey() const;
0797 
0798     /**
0799      * see accessKey
0800      */
0801     void setAccessKey(const DOMString &);
0802 
0803     /**
0804      * Text alignment relative to \c FIELDSET . See the <a
0805      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-align-LEGEND">
0806      * align attribute definition </a> in HTML 4.0. This attribute is
0807      * deprecated in HTML 4.0.
0808      *
0809      */
0810     DOMString align() const;
0811 
0812     /**
0813      * see align
0814      */
0815     void setAlign(const DOMString &);
0816 };
0817 
0818 // --------------------------------------------------------------------------
0819 
0820 class HTMLOptGroupElementImpl;
0821 /**
0822  * Group options together in logical subdivisions. See the <a
0823  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTGROUP">
0824  * OPTGROUP element definition </a> in HTML 4.0.
0825  *
0826  */
0827 class KHTML_EXPORT HTMLOptGroupElement : public HTMLElement
0828 {
0829 public:
0830     HTMLOptGroupElement();
0831     HTMLOptGroupElement(const HTMLOptGroupElement &other);
0832     HTMLOptGroupElement(const Node &other) : HTMLElement()
0833     {
0834         (*this) = other;
0835     }
0836 protected:
0837     HTMLOptGroupElement(HTMLOptGroupElementImpl *impl);
0838 public:
0839 
0840     HTMLOptGroupElement &operator = (const HTMLOptGroupElement &other);
0841     HTMLOptGroupElement &operator = (const Node &other);
0842 
0843     ~HTMLOptGroupElement();
0844 
0845     /**
0846      * The control is unavailable in this context. See the <a
0847      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
0848      * disabled attribute definition </a> in HTML 4.0.
0849      *
0850      */
0851     bool disabled() const;
0852 
0853     /**
0854      * see disabled
0855      */
0856     void setDisabled(bool);
0857 
0858     /**
0859      * Assigns a label to this option group. See the <a
0860      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-label-OPTGROUP">
0861      * label attribute definition </a> in HTML 4.0.
0862      *
0863      */
0864     DOMString label() const;
0865 
0866     /**
0867      * see label
0868      */
0869     void setLabel(const DOMString &);
0870 };
0871 
0872 // --------------------------------------------------------------------------
0873 
0874 class HTMLSelectElementImpl;
0875 /**
0876  * The select element allows the selection of an option. The contained
0877  * options can be directly accessed through the select element as a
0878  * collection. See the <a
0879  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-SELECT">
0880  * SELECT element definition </a> in HTML 4.0.
0881  *
0882  */
0883 class KHTML_EXPORT HTMLSelectElement : public HTMLElement
0884 {
0885 public:
0886     HTMLSelectElement();
0887     HTMLSelectElement(const HTMLSelectElement &other);
0888     HTMLSelectElement(const Node &other) : HTMLElement()
0889     {
0890         (*this) = other;
0891     }
0892 protected:
0893     HTMLSelectElement(HTMLSelectElementImpl *impl);
0894 public:
0895 
0896     HTMLSelectElement &operator = (const HTMLSelectElement &other);
0897     HTMLSelectElement &operator = (const Node &other);
0898 
0899     ~HTMLSelectElement();
0900 
0901     /**
0902      * The type of control created.
0903      *
0904      */
0905     DOMString type() const;
0906 
0907     /**
0908      * The ordinal index of the selected option. The value -1 is
0909      * returned if no element is selected. If multiple options are
0910      * selected, the index of the first selected option is returned.
0911      *
0912      */
0913     long selectedIndex() const;
0914 
0915     /**
0916      * see selectedIndex
0917      */
0918     void setSelectedIndex(long);
0919 
0920     /**
0921      * The current form control value.
0922      *
0923      */
0924     DOMString value() const;
0925 
0926     /**
0927      * see value
0928      */
0929     void setValue(const DOMString &);
0930 
0931     /**
0932      * The number of options in this \c SELECT .
0933      *
0934      */
0935     long length() const;
0936 
0937     // TODO: deprecate/remove?
0938     HTMLFormElement form() const;
0939 
0940     /**
0941      * The collection of \c OPTION elements contained by
0942      * this element.
0943      *
0944      */
0945     HTMLCollection options() const;
0946 
0947     /**
0948      * The control is unavailable in this context. See the <a
0949      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
0950      * disabled attribute definition </a> in HTML 4.0.
0951      *
0952      */
0953     bool disabled() const;
0954 
0955     /**
0956      * see disabled
0957      */
0958     void setDisabled(bool);
0959 
0960     /**
0961      * If true, multiple \c OPTION elements may be
0962      * selected in this \c SELECT . See the <a
0963      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-multiple">
0964      * multiple attribute definition </a> in HTML 4.0.
0965      *
0966      */
0967     bool multiple() const;
0968 
0969     /**
0970      * see multiple
0971      */
0972     void setMultiple(bool);
0973 
0974     /**
0975      * Form control or object name when submitted with a form. See the
0976      * <a
0977      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-SELECT">
0978      * name attribute definition </a> in HTML 4.0.
0979      *
0980      */
0981     DOMString name() const;
0982 
0983     /**
0984      * see name
0985      */
0986     void setName(const DOMString &);
0987 
0988     /**
0989      * Number of visible rows. See the <a
0990      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-size-SELECT">
0991      * size attribute definition </a> in HTML 4.0.
0992      *
0993      */
0994     long size() const;
0995 
0996     /**
0997      * see size
0998      */
0999     void setSize(long);
1000 
1001     /**
1002      * Index that represents the element's position in the tabbing
1003      * order. See the <a
1004      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
1005      * tabindex attribute definition </a> in HTML 4.0.
1006      *
1007      */
1008     long tabIndex() const;
1009 
1010     /**
1011      * see tabIndex
1012      */
1013     void setTabIndex(long);
1014 
1015     /**
1016      * Add a new element to the collection of \c OPTION
1017      * elements for this \c SELECT .
1018      *
1019      * @param element The element to add.
1020      *
1021      * @param before The element to insert before, or 0 for the
1022      * tail of the list.
1023      *
1024      */
1025     void add(const HTMLElement &element, const HTMLElement &before);
1026 
1027     /**
1028      * Remove an element from the collection of \c OPTION
1029      * elements for this \c SELECT . Does nothing if no
1030      * element has the given index.
1031      *
1032      * @param index The index of the item to remove.
1033      *
1034      */
1035     void remove(long index);
1036 
1037     /**
1038      * Removes keyboard focus from this element.
1039      *
1040      */
1041     void blur();
1042 
1043     /**
1044      * Gives keyboard focus to this element.
1045      *
1046      */
1047     void focus();
1048 };
1049 
1050 // --------------------------------------------------------------------------
1051 
1052 class HTMLTextAreaElementImpl;
1053 /**
1054  * Multi-line text field. See the <a
1055  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-TEXTAREA">
1056  * TEXTAREA element definition </a> in HTML 4.0.
1057  *
1058  */
1059 class KHTML_EXPORT HTMLTextAreaElement : public HTMLElement
1060 {
1061 public:
1062     HTMLTextAreaElement();
1063     HTMLTextAreaElement(const HTMLTextAreaElement &other);
1064     HTMLTextAreaElement(const Node &other) : HTMLElement()
1065     {
1066         (*this) = other;
1067     }
1068 protected:
1069     HTMLTextAreaElement(HTMLTextAreaElementImpl *impl);
1070 public:
1071 
1072     HTMLTextAreaElement &operator = (const HTMLTextAreaElement &other);
1073     HTMLTextAreaElement &operator = (const Node &other);
1074 
1075     ~HTMLTextAreaElement();
1076 
1077     /**
1078      * Stores the initial control value (i.e., the initial value of
1079      * \c value ).
1080      *
1081      */
1082     DOMString defaultValue() const;
1083 
1084     /**
1085      * see defaultValue
1086      */
1087     void setDefaultValue(const DOMString &);
1088 
1089     // TODO: deprecate/remove?
1090     HTMLFormElement form() const;
1091 
1092     /**
1093      * A single character access key to give access to the form
1094      * control. See the <a
1095      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-accesskey">
1096      * accesskey attribute definition </a> in HTML 4.0.
1097      *
1098      */
1099     DOMString accessKey() const;
1100 
1101     /**
1102      * see accessKey
1103      */
1104     void setAccessKey(const DOMString &);
1105 
1106     /**
1107      * Width of control (in characters). See the <a
1108      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-cols-TEXTAREA">
1109      * cols attribute definition </a> in HTML 4.0.
1110      *
1111      */
1112     long cols() const;
1113 
1114     /**
1115      * see cols
1116      */
1117     void setCols(long);
1118 
1119     /**
1120      * The control is unavailable in this context. See the <a
1121      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
1122      * disabled attribute definition </a> in HTML 4.0.
1123      *
1124      */
1125     bool disabled() const;
1126 
1127     /**
1128      * see disabled
1129      */
1130     void setDisabled(bool);
1131 
1132     /**
1133      * Form control or object name when submitted with a form. See the
1134      * <a
1135      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-name-TEXTAREA">
1136      * name attribute definition </a> in HTML 4.0.
1137      *
1138      */
1139     DOMString name() const;
1140 
1141     /**
1142      * see name
1143      */
1144     void setName(const DOMString &);
1145 
1146     /**
1147      * This control is read-only. See the <a
1148      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-readonly">
1149      * readonly attribute definition </a> in HTML 4.0.
1150      *
1151      */
1152     bool readOnly() const;
1153 
1154     /**
1155      * see readOnly
1156      */
1157     void setReadOnly(bool);
1158 
1159     /**
1160      * Number of text rows. See the <a
1161      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-rows-TEXTAREA">
1162      * rows attribute definition </a> in HTML 4.0.
1163      *
1164      */
1165     long rows() const;
1166 
1167     /**
1168      * see rows
1169      */
1170     void setRows(long);
1171 
1172     /**
1173      * Index that represents the element's position in the tabbing
1174      * order. See the <a
1175      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-tabindex">
1176      * tabindex attribute definition </a> in HTML 4.0.
1177      *
1178      */
1179     long tabIndex() const;
1180 
1181     /**
1182      * see tabIndex
1183      */
1184     void setTabIndex(long);
1185 
1186     /**
1187      * The type of this form control.
1188      *
1189      */
1190     DOMString type() const;
1191 
1192     /**
1193      * The current textual content of the multi-line text field. If
1194      * the entirety of the data can not fit into a single wstring, the
1195      * implementation may truncate the data.
1196      *
1197      */
1198     DOMString value() const;
1199 
1200     /**
1201      * see value
1202      */
1203     void setValue(const DOMString &);
1204 
1205     /**
1206      * Removes keyboard focus from this element.
1207      */
1208     void blur();
1209 
1210     /**
1211      * Gives keyboard focus to this element.
1212      */
1213     void focus();
1214 
1215     /**
1216      * Select the contents of the \c TEXTAREA .
1217      */
1218     void select();
1219 
1220     /**
1221      * Returns the character offset of beginning of selection, or if none,
1222      * the cursor position.
1223      * NOTE: this method is not part of the DOM, but a Mozilla extension
1224      */
1225     long selectionStart();
1226 
1227     /**
1228      * Move the beginning of the selection to the given offset in text
1229      * NOTE: this method is not part of the DOM, but a Mozilla extension
1230      */
1231     void setSelectionStart(long offset);
1232 
1233     /**
1234      * Returns the character offset of end of selection, or if none,
1235      * the cursor position.
1236      * NOTE: this method is not part of the DOM, but a Mozilla extension
1237      */
1238     long selectionEnd();
1239 
1240     /**
1241      * Move the end of the selection (and the cursor) to the given offset in text
1242      * NOTE: this method is not part of the DOM, but a Mozilla extension
1243      */
1244     void setSelectionEnd(long offset);
1245 
1246     /**
1247      * Selects the text from start to end, and positions the cursor after the selection.
1248      * NOTE: this method is not part of the DOM, but a Mozilla extension
1249      */
1250     void setSelectionRange(long start, long end);
1251 
1252     /**
1253      * Returns the length of the text.
1254      * NOTE: this method is not part of the DOM, but a Mozilla extension
1255      */
1256     long textLength();
1257 };
1258 
1259 // --------------------------------------------------------------------------
1260 
1261 class HTMLOptionElementImpl;
1262 /**
1263  * A selectable choice. See the <a
1264  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTION">
1265  * OPTION element definition </a> in HTML 4.0.
1266  *
1267  */
1268 class KHTML_EXPORT HTMLOptionElement : public HTMLElement
1269 {
1270 public:
1271     HTMLOptionElement();
1272     HTMLOptionElement(const HTMLOptionElement &other);
1273     HTMLOptionElement(const Node &other) : HTMLElement()
1274     {
1275         (*this) = other;
1276     }
1277 protected:
1278     HTMLOptionElement(HTMLOptionElementImpl *impl);
1279 public:
1280 
1281     HTMLOptionElement &operator = (const HTMLOptionElement &other);
1282     HTMLOptionElement &operator = (const Node &other);
1283 
1284     ~HTMLOptionElement();
1285 
1286     // TODO: deprecate/remove?
1287     HTMLFormElement form() const;
1288 
1289     /**
1290      * Stores the initial value of the \c selected
1291      * attribute.
1292      *
1293      */
1294     bool defaultSelected() const;
1295 
1296     /**
1297      * see defaultSelected
1298      */
1299     void setDefaultSelected(bool);
1300 
1301     /**
1302      * The text contained within the option element.
1303      *
1304      */
1305     DOMString text() const;
1306 
1307     /**
1308      * The index of this \c OPTION in its parent
1309      * \c SELECT .
1310      *
1311      */
1312     long index() const;
1313 
1314     /**
1315      * see index
1316      *
1317      * This function is obsolete - the index property is actually supposed to be read-only
1318      * (https://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html)
1319      */
1320     void setIndex(long);
1321 
1322     /**
1323      * The control is unavailable in this context. See the <a
1324      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-disabled">
1325      * disabled attribute definition </a> in HTML 4.0.
1326      *
1327      */
1328     bool disabled() const;
1329 
1330     /**
1331      * see disabled
1332      */
1333     void setDisabled(bool);
1334 
1335     /**
1336      * Option label for use in hierarchical menus. See the <a
1337      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-label-OPTION">
1338      * label attribute definition </a> in HTML 4.0.
1339      *
1340      */
1341     DOMString label() const;
1342 
1343     /**
1344      * see label
1345      */
1346     void setLabel(const DOMString &);
1347 
1348     /**
1349      * Means that this option is initially selected. See the <a
1350      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-selected">
1351      * selected attribute definition </a> in HTML 4.0.
1352      *
1353      */
1354     bool selected() const;
1355 
1356     /**
1357      * see selected
1358      */
1359     void setSelected(bool);
1360 
1361     /**
1362      * The current form control value. See the <a
1363      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-value-OPTION">
1364      * value attribute definition </a> in HTML 4.0.
1365      *
1366      */
1367     DOMString value() const;
1368 
1369     /**
1370      * see value
1371      */
1372     void setValue(const DOMString &);
1373 };
1374 
1375 // --------------------------------------------------------------------------
1376 
1377 class HTMLIsIndexElementImpl;
1378 class HTMLFormElement;
1379 
1380 /**
1381  * This element is used for single-line text input. See the <a
1382  * href="https://www.w3.org/TR/REC-html40/interact/forms.html#edef-ISINDEX">
1383  * ISINDEX element definition </a> in HTML 4.0. This element is
1384  * deprecated in HTML 4.0.
1385  *
1386  */
1387 class KHTML_EXPORT HTMLIsIndexElement : public HTMLElement
1388 {
1389 public:
1390     HTMLIsIndexElement();
1391     HTMLIsIndexElement(const HTMLIsIndexElement &other);
1392     HTMLIsIndexElement(const Node &other) : HTMLElement()
1393     {
1394         (*this) = other;
1395     }
1396 protected:
1397     HTMLIsIndexElement(HTMLIsIndexElementImpl *impl);
1398 public:
1399 
1400     HTMLIsIndexElement &operator = (const HTMLIsIndexElement &other);
1401     HTMLIsIndexElement &operator = (const Node &other);
1402 
1403     ~HTMLIsIndexElement();
1404 
1405     // TODO: deprecate/remove?
1406     HTMLFormElement form() const;
1407 
1408     /**
1409      * The prompt message. See the <a
1410      * href="https://www.w3.org/TR/REC-html40/interact/forms.html#adef-prompt">
1411      * prompt attribute definition </a> in HTML 4.0. This attribute is
1412      * deprecated in HTML 4.0.
1413      *
1414      */
1415     DOMString prompt() const;
1416 
1417     /**
1418      * see prompt
1419      */
1420     void setPrompt(const DOMString &);
1421 };
1422 
1423 } //namespace
1424 
1425 #endif