KHtml

html_form.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
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.
10  *
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.
15  *
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.
20  *
21  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 1 Specification (Recommendation)
23  * https://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.
27  *
28  */
29 #ifndef HTML_FORM_H
30 #define HTML_FORM_H
31 
32 // --------------------------------------------------------------------------
33 #include <dom/html_element.h>
34 #include <dom/html_misc.h>
35 
36 namespace DOM
37 {
38 
39 class HTMLButtonElementImpl;
40 class HTMLFormElement;
41 class DOMString;
42 
49 class KHTML_EXPORT HTMLButtonElement : public HTMLElement
50 {
51 public:
54  HTMLButtonElement(const Node &other) : HTMLElement()
55  {
56  (*this) = other;
57  }
58 protected:
59  HTMLButtonElement(HTMLButtonElementImpl *impl);
60 public:
61 
62  HTMLButtonElement &operator = (const HTMLButtonElement &other);
63  HTMLButtonElement &operator = (const Node &other);
64 
66 
73  HTMLFormElement form() const;
74 
82  DOMString accessKey() const;
83 
87  void setAccessKey(const DOMString &);
88 
95  bool disabled() const;
96 
100  void setDisabled(bool);
101 
109  DOMString name() const;
110 
114  void setName(const DOMString &);
115 
123  long tabIndex() const;
124 
128  void setTabIndex(long);
129 
136  DOMString type() const;
137 
144  DOMString value() const;
145 
149  void setValue(const DOMString &);
150 
155  void blur();
156 
161  void focus();
162 };
163 
164 // --------------------------------------------------------------------------
165 
166 class HTMLFieldSetElementImpl;
173 class KHTML_EXPORT HTMLFieldSetElement : public HTMLElement
174 {
175 public:
178  HTMLFieldSetElement(const Node &other) : HTMLElement()
179  {
180  (*this) = other;
181  }
182 protected:
183  HTMLFieldSetElement(HTMLFieldSetElementImpl *impl);
184 public:
185 
186  HTMLFieldSetElement &operator = (const HTMLFieldSetElement &other);
187  HTMLFieldSetElement &operator = (const Node &other);
188 
190 
191  // TODO: deprecate/remove?
192  HTMLFormElement form() const;
193 };
194 
195 // --------------------------------------------------------------------------
196 
197 class HTMLFormElementImpl;
207 class KHTML_EXPORT HTMLFormElement : public HTMLElement
208 {
209  friend class HTMLButtonElement;
210  friend class HTMLFieldSetElement;
211  friend class HTMLInputElement;
212  friend class HTMLLabelElement;
213  friend class HTMLLegendElement;
214  friend class HTMLSelectElement;
215  friend class HTMLTextAreaElement;
216  friend class HTMLOptionElement;
217  friend class HTMLIsIndexElement;
218  friend class HTMLObjectElement;
219 
220 public:
221  HTMLFormElement();
222  HTMLFormElement(const HTMLFormElement &other);
223  HTMLFormElement(const Node &other) : HTMLElement()
224  {
225  (*this) = other;
226  }
227 protected:
228  HTMLFormElement(HTMLFormElementImpl *impl);
229 public:
230 
231  HTMLFormElement &operator = (const HTMLFormElement &other);
232  HTMLFormElement &operator = (const Node &other);
233 
234  ~HTMLFormElement();
235 
240  HTMLCollection elements() const;
241 
246  long length() const;
247 
252  DOMString name() const;
253 
257  void setName(const DOMString &);
258 
265  DOMString acceptCharset() const;
266 
270  void setAcceptCharset(const DOMString &);
271 
278  DOMString action() const;
279 
283  void setAction(const DOMString &);
284 
292  DOMString enctype() const;
293 
297  void setEnctype(const DOMString &);
298 
305  DOMString method() const;
306 
310  void setMethod(const DOMString &);
311 
318  DOMString target() const;
319 
323  void setTarget(const DOMString &);
324 
330  void submit();
331 
337  void reset();
338 };
339 
340 // --------------------------------------------------------------------------
341 
342 class HTMLInputElementImpl;
352 class KHTML_EXPORT HTMLInputElement : public HTMLElement
353 {
354 public:
356  HTMLInputElement(const HTMLInputElement &other);
357  HTMLInputElement(const Node &other) : HTMLElement()
358  {
359  (*this) = other;
360  }
361 protected:
362  HTMLInputElement(HTMLInputElementImpl *impl);
363 public:
364 
365  HTMLInputElement &operator = (const HTMLInputElement &other);
366  HTMLInputElement &operator = (const Node &other);
367 
368  ~HTMLInputElement();
369 
375  DOMString defaultValue() const;
376 
380  void setDefaultValue(const DOMString &);
381 
388  bool defaultChecked() const;
389 
393  void setDefaultChecked(bool);
394 
395  // TODO: deprecate/remove?
396  HTMLFormElement form() const;
397 
405  DOMString accept() const;
406 
410  void setAccept(const DOMString &);
411 
419  DOMString accessKey() const;
420 
424  void setAccessKey(const DOMString &);
425 
434  DOMString align() const;
435 
439  void setAlign(const DOMString &);
440 
448  DOMString alt() const;
449 
453  void setAlt(const DOMString &);
454 
464  bool checked() const;
465 
469  void setChecked(bool);
470 
474  bool indeterminate() const;
475 
479  void setIndeterminate(bool);
480 
487  bool disabled() const;
488 
492  void setDisabled(bool);
493 
501  long maxLength() const;
502 
506  void setMaxLength(long);
507 
515  DOMString name() const;
516 
520  void setName(const DOMString &);
521 
529  bool readOnly() const;
530 
531  // ### remove in 4.0
535  void setReadOnly(bool);
536 
540 #ifndef KHTML_NO_DEPRECATED
541  KHTML_DEPRECATED DOMString size() const;
542 #endif
543 
547 #ifndef KHTML_NO_DEPRECATED
548  KHTML_DEPRECATED void setSize(const DOMString &);
549 #endif
550 
558  long getSize() const;
559 
563  void setSize(long);
564 
573  DOMString src() const;
574 
578  void setSrc(const DOMString &);
579 
587  long tabIndex() const;
588 
592  void setTabIndex(long);
593 
600  DOMString type() const;
601 
605  void setType(const DOMString &);
606 
613  DOMString useMap() const;
614 
618  void setUseMap(const DOMString &);
619 
627  DOMString value() const;
628 
632  void setValue(const DOMString &);
633 
638  void blur();
639 
644  void focus();
645 
652  void select();
653 
659  void click();
660 
668  long selectionStart();
669 
675  void setSelectionStart(long offset);
676 
684  long selectionEnd();
685 
691  void setSelectionEnd(long offset);
692 
698  void setSelectionRange(long start, long end);
699 
700 };
701 
702 // --------------------------------------------------------------------------
703 
704 class HTMLLabelElementImpl;
711 class KHTML_EXPORT HTMLLabelElement : public HTMLElement
712 {
713 public:
715  HTMLLabelElement(const HTMLLabelElement &other);
716  HTMLLabelElement(const Node &other) : HTMLElement()
717  {
718  (*this) = other;
719  }
720 protected:
721  HTMLLabelElement(HTMLLabelElementImpl *impl);
722 public:
723 
724  HTMLLabelElement &operator = (const HTMLLabelElement &other);
725  HTMLLabelElement &operator = (const Node &other);
726 
727  ~HTMLLabelElement();
728 
736  DOMString accessKey() const;
737 
741  void setAccessKey(const DOMString &);
742 
750  DOMString htmlFor() const;
751 
755  void setHtmlFor(const DOMString &);
756 };
757 
758 // --------------------------------------------------------------------------
759 
760 class HTMLLegendElementImpl;
768 class KHTML_EXPORT HTMLLegendElement : public HTMLElement
769 {
770 public:
772  HTMLLegendElement(const HTMLLegendElement &other);
773  HTMLLegendElement(const Node &other) : HTMLElement()
774  {
775  (*this) = other;
776  }
777 protected:
778  HTMLLegendElement(HTMLLegendElementImpl *impl);
779 public:
780 
781  HTMLLegendElement &operator = (const HTMLLegendElement &other);
782  HTMLLegendElement &operator = (const Node &other);
783 
785 
786  // TODO: deprecate/remove?
787  HTMLFormElement form() const;
788 
796  DOMString accessKey() const;
797 
801  void setAccessKey(const DOMString &);
802 
810  DOMString align() const;
811 
815  void setAlign(const DOMString &);
816 };
817 
818 // --------------------------------------------------------------------------
819 
820 class HTMLOptGroupElementImpl;
827 class KHTML_EXPORT HTMLOptGroupElement : public HTMLElement
828 {
829 public:
832  HTMLOptGroupElement(const Node &other) : HTMLElement()
833  {
834  (*this) = other;
835  }
836 protected:
837  HTMLOptGroupElement(HTMLOptGroupElementImpl *impl);
838 public:
839 
840  HTMLOptGroupElement &operator = (const HTMLOptGroupElement &other);
841  HTMLOptGroupElement &operator = (const Node &other);
842 
844 
851  bool disabled() const;
852 
856  void setDisabled(bool);
857 
864  DOMString label() const;
865 
869  void setLabel(const DOMString &);
870 };
871 
872 // --------------------------------------------------------------------------
873 
874 class HTMLSelectElementImpl;
883 class KHTML_EXPORT HTMLSelectElement : public HTMLElement
884 {
885 public:
887  HTMLSelectElement(const HTMLSelectElement &other);
888  HTMLSelectElement(const Node &other) : HTMLElement()
889  {
890  (*this) = other;
891  }
892 protected:
893  HTMLSelectElement(HTMLSelectElementImpl *impl);
894 public:
895 
896  HTMLSelectElement &operator = (const HTMLSelectElement &other);
897  HTMLSelectElement &operator = (const Node &other);
898 
900 
905  DOMString type() const;
906 
913  long selectedIndex() const;
914 
918  void setSelectedIndex(long);
919 
924  DOMString value() const;
925 
929  void setValue(const DOMString &);
930 
935  long length() const;
936 
937  // TODO: deprecate/remove?
938  HTMLFormElement form() const;
939 
945  HTMLCollection options() const;
946 
953  bool disabled() const;
954 
958  void setDisabled(bool);
959 
967  bool multiple() const;
968 
972  void setMultiple(bool);
973 
981  DOMString name() const;
982 
986  void setName(const DOMString &);
987 
994  long size() const;
995 
999  void setSize(long);
1000 
1008  long tabIndex() const;
1009 
1013  void setTabIndex(long);
1014 
1025  void add(const HTMLElement &element, const HTMLElement &before);
1026 
1035  void remove(long index);
1036 
1041  void blur();
1042 
1047  void focus();
1048 };
1049 
1050 // --------------------------------------------------------------------------
1051 
1052 class HTMLTextAreaElementImpl;
1059 class KHTML_EXPORT HTMLTextAreaElement : public HTMLElement
1060 {
1061 public:
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 
1076 
1082  DOMString defaultValue() const;
1083 
1087  void setDefaultValue(const DOMString &);
1088 
1089  // TODO: deprecate/remove?
1090  HTMLFormElement form() const;
1091 
1099  DOMString accessKey() const;
1100 
1104  void setAccessKey(const DOMString &);
1105 
1112  long cols() const;
1113 
1117  void setCols(long);
1118 
1125  bool disabled() const;
1126 
1130  void setDisabled(bool);
1131 
1139  DOMString name() const;
1140 
1144  void setName(const DOMString &);
1145 
1152  bool readOnly() const;
1153 
1157  void setReadOnly(bool);
1158 
1165  long rows() const;
1166 
1170  void setRows(long);
1171 
1179  long tabIndex() const;
1180 
1184  void setTabIndex(long);
1185 
1190  DOMString type() const;
1191 
1198  DOMString value() const;
1199 
1203  void setValue(const DOMString &);
1204 
1208  void blur();
1209 
1213  void focus();
1214 
1218  void select();
1219 
1225  long selectionStart();
1226 
1231  void setSelectionStart(long offset);
1232 
1238  long selectionEnd();
1239 
1244  void setSelectionEnd(long offset);
1245 
1250  void setSelectionRange(long start, long end);
1251 
1256  long textLength();
1257 };
1258 
1259 // --------------------------------------------------------------------------
1260 
1261 class HTMLOptionElementImpl;
1268 class KHTML_EXPORT HTMLOptionElement : public HTMLElement
1269 {
1270 public:
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 
1294  bool defaultSelected() const;
1295 
1299  void setDefaultSelected(bool);
1300 
1305  DOMString text() const;
1306 
1312  long index() const;
1313 
1320  void setIndex(long);
1321 
1328  bool disabled() const;
1329 
1333  void setDisabled(bool);
1334 
1341  DOMString label() const;
1342 
1346  void setLabel(const DOMString &);
1347 
1354  bool selected() const;
1355 
1359  void setSelected(bool);
1360 
1367  DOMString value() const;
1368 
1372  void setValue(const DOMString &);
1373 };
1374 
1375 // --------------------------------------------------------------------------
1376 
1377 class HTMLIsIndexElementImpl;
1378 class HTMLFormElement;
1379 
1387 class KHTML_EXPORT HTMLIsIndexElement : public HTMLElement
1388 {
1389 public:
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 
1415  DOMString prompt() const;
1416 
1420  void setPrompt(const DOMString &);
1421 };
1422 
1423 } //namespace
1424 
1425 #endif
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
The select element allows the selection of an option.
Definition: html_form.h:883
This element is used for single-line text input.
Definition: html_form.h:1387
The FORM element encompasses behavior similar to a collection and an element.
Definition: html_form.h:207
Form control.
Definition: html_form.h:352
An HTMLCollection is a list of nodes.
Definition: html_misc.h:133
Group options together in logical subdivisions.
Definition: html_form.h:827
Provides a caption for a FIELDSET grouping.
Definition: html_form.h:768
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
Generic embedded object.
Definition: html_object.h:268
This library provides a full-featured HTML parser and widget.
Multi-line text field.
Definition: html_form.h:1059
Push button.
Definition: html_form.h:49
Organizes form controls into logical groups.
Definition: html_form.h:173
A selectable choice.
Definition: html_form.h:1268
Form field label text.
Definition: html_form.h:711
All HTML element interfaces derive from this class.
Definition: html_element.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:46:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.