• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.2 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • dom
html_form.cpp
Go to the documentation of this file.
1 
22 // --------------------------------------------------------------------------
23 
24 #include "dom/html_form.h"
25 #include "dom/dom_exception.h"
26 #include "dom/dom_doc.h"
27 
28 #include "html/html_formimpl.h"
29 #include "html/html_miscimpl.h"
30 
31 #include "xml/dom_docimpl.h"
32 
33 using namespace DOM;
34 
35 HTMLButtonElement::HTMLButtonElement() : HTMLElement()
36 {
37 }
38 
39 HTMLButtonElement::HTMLButtonElement(const HTMLButtonElement &other) : HTMLElement(other)
40 {
41 }
42 
43 HTMLButtonElement::HTMLButtonElement(HTMLButtonElementImpl *impl) : HTMLElement(impl)
44 {
45 }
46 
47 HTMLButtonElement &HTMLButtonElement::operator = (const Node &other)
48 {
49  assignOther( other, ID_BUTTON );
50  return *this;
51 }
52 
53 HTMLButtonElement &HTMLButtonElement::operator = (const HTMLButtonElement &other)
54 {
55  HTMLElement::operator = (other);
56  return *this;
57 }
58 
59 HTMLButtonElement::~HTMLButtonElement()
60 {
61 }
62 
63 HTMLFormElement HTMLButtonElement::form() const
64 {
65  return Element::form();
66 }
67 
68 DOMString HTMLButtonElement::accessKey() const
69 {
70  if(!impl) return DOMString();
71  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY);
72 }
73 
74 void HTMLButtonElement::setAccessKey( const DOMString &value )
75 {
76  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value);
77 }
78 
79 bool HTMLButtonElement::disabled() const
80 {
81  if(!impl) return 0;
82  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull();
83 }
84 
85 void HTMLButtonElement::setDisabled( bool _disabled )
86 {
87  if (impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
88 }
89 
90 DOMString HTMLButtonElement::name() const
91 {
92  if(!impl) return DOMString();
93  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME);
94 }
95 
96 void HTMLButtonElement::setName( const DOMString &value )
97 {
98  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value);
99 }
100 
101 void HTMLButtonElement::focus( )
102 {
103  if(impl)
104  static_cast<HTMLButtonElementImpl*>(impl)->focus();
105 }
106 
107 void HTMLButtonElement::blur( )
108 {
109  if(impl)
110  static_cast<HTMLButtonElementImpl*>(impl)->blur();
111 }
112 
113 long HTMLButtonElement::tabIndex() const
114 {
115  if(!impl) return 0;
116  return static_cast<ElementImpl*>(impl)->tabIndex();
117 }
118 
119 void HTMLButtonElement::setTabIndex( long _tabIndex )
120 {
121  if (!impl) return;
122  static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex);
123 }
124 
125 DOMString HTMLButtonElement::type() const
126 {
127  if(!impl) return DOMString();
128  return static_cast<HTMLButtonElementImpl*>(impl)->type();
129 }
130 
131 DOMString HTMLButtonElement::value() const
132 {
133  if(!impl) return DOMString();
134  DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE);
135  if (s.isNull()) return DOMString("");
136  return s;
137 }
138 
139 void HTMLButtonElement::setValue( const DOMString &value )
140 {
141  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VALUE, value);
142 }
143 
144 // --------------------------------------------------------------------------
145 
146 HTMLFieldSetElement::HTMLFieldSetElement() : HTMLElement()
147 {
148 }
149 
150 HTMLFieldSetElement::HTMLFieldSetElement(const HTMLFieldSetElement &other) : HTMLElement(other)
151 {
152 }
153 
154 HTMLFieldSetElement::HTMLFieldSetElement(HTMLFieldSetElementImpl *impl) : HTMLElement(impl)
155 {
156 }
157 
158 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const Node &other)
159 {
160  assignOther( other, ID_FIELDSET );
161  return *this;
162 }
163 
164 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const HTMLFieldSetElement &other)
165 {
166  HTMLElement::operator = (other);
167  return *this;
168 }
169 
170 HTMLFieldSetElement::~HTMLFieldSetElement()
171 {
172 }
173 
174 HTMLFormElement HTMLFieldSetElement::form() const
175 {
176  return Element::form();
177 }
178 
179 // --------------------------------------------------------------------------
180 
181 HTMLFormElement::HTMLFormElement() : HTMLElement()
182 {
183 }
184 
185 HTMLFormElement::HTMLFormElement(const HTMLFormElement &other) : HTMLElement(other)
186 {
187 }
188 
189 HTMLFormElement::HTMLFormElement(HTMLFormElementImpl *impl) : HTMLElement(impl)
190 {
191 }
192 
193 HTMLFormElement &HTMLFormElement::operator = (const Node &other)
194 {
195  assignOther( other, ID_FORM );
196  return *this;
197 }
198 
199 HTMLFormElement &HTMLFormElement::operator = (const HTMLFormElement &other)
200 {
201  HTMLElement::operator = (other);
202  return *this;
203 }
204 
205 HTMLFormElement::~HTMLFormElement()
206 {
207 }
208 
209 HTMLCollection HTMLFormElement::elements() const
210 {
211  if(!impl) return HTMLCollection();
212  return HTMLFormCollection(impl);
213 }
214 
215 long HTMLFormElement::length() const
216 {
217  if(!impl) return 0;
218  return static_cast<HTMLFormElementImpl*>(impl)->length();
219 }
220 
221 DOMString HTMLFormElement::name() const
222 {
223  if(!impl) return DOMString();
224  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME);
225 }
226 
227 void HTMLFormElement::setName( const DOMString &value )
228 {
229  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value);
230 }
231 
232 DOMString HTMLFormElement::acceptCharset() const
233 {
234  if(!impl) return DOMString();
235  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCEPT_CHARSET);
236 }
237 
238 void HTMLFormElement::setAcceptCharset( const DOMString &value )
239 {
240  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCEPT_CHARSET, value);
241 }
242 
243 DOMString HTMLFormElement::action() const
244 {
245  if(!impl) return DOMString();
246  return static_cast<HTMLFormElementImpl*>(impl)->action();
247 }
248 
249 void HTMLFormElement::setAction( const DOMString &value )
250 {
251  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACTION, value);
252 }
253 
254 DOMString HTMLFormElement::enctype() const
255 {
256  if(!impl) return DOMString();
257  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ENCTYPE);
258 }
259 
260 void HTMLFormElement::setEnctype( const DOMString &value )
261 {
262  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ENCTYPE, value);
263 }
264 
265 DOMString HTMLFormElement::method() const
266 {
267  if(!impl) return DOMString();
268  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_METHOD);
269 }
270 
271 void HTMLFormElement::setMethod( const DOMString &value )
272 {
273  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_METHOD, value);
274 }
275 
276 DOMString HTMLFormElement::target() const
277 {
278  if(!impl) return DOMString();
279  return static_cast<HTMLFormElementImpl*>(impl)->target();
280 }
281 
282 void HTMLFormElement::setTarget( const DOMString &value )
283 {
284  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_TARGET, value);
285 }
286 
287 void HTMLFormElement::submit( )
288 {
289  if(impl) static_cast<HTMLFormElementImpl*>(impl)->submit( );
290 }
291 
292 void HTMLFormElement::reset( )
293 {
294  if(impl) static_cast<HTMLFormElementImpl*>(impl)->reset( );
295 }
296 
297 // --------------------------------------------------------------------------
298 
299 HTMLInputElement::HTMLInputElement() : HTMLElement()
300 {
301 }
302 
303 HTMLInputElement::HTMLInputElement(const HTMLInputElement &other) : HTMLElement(other)
304 {
305 }
306 
307 HTMLInputElement::HTMLInputElement(HTMLInputElementImpl *impl) : HTMLElement(impl)
308 {
309 }
310 
311 HTMLInputElement &HTMLInputElement::operator = (const Node &other)
312 {
313  assignOther( other, ID_INPUT );
314  return *this;
315 }
316 
317 HTMLInputElement &HTMLInputElement::operator = (const HTMLInputElement &other)
318 {
319  HTMLElement::operator = (other);
320  return *this;
321 }
322 
323 HTMLInputElement::~HTMLInputElement()
324 {
325 }
326 
327 DOMString HTMLInputElement::defaultValue() const
328 {
329  if(!impl) return DOMString();
330  DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE);
331  if (s.isNull()) return DOMString("");
332  return s;
333 
334 }
335 
336 void HTMLInputElement::setDefaultValue( const DOMString &value )
337 {
338  if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALUE, value);
339 }
340 
341 bool HTMLInputElement::defaultChecked() const
342 {
343  if(!impl) return 0;
344  return !((ElementImpl *)impl)->getAttribute(ATTR_CHECKED).isNull();
345 }
346 
347 void HTMLInputElement::setDefaultChecked( bool _defaultChecked )
348 {
349  if(impl)
350  ((ElementImpl *)impl)->setAttribute(ATTR_CHECKED, _defaultChecked ? "" : 0);
351 }
352 
353 HTMLFormElement HTMLInputElement::form() const
354 {
355  return Element::form();
356 }
357 
358 DOMString HTMLInputElement::accept() const
359 {
360  if(!impl) return DOMString();
361  return ((ElementImpl *)impl)->getAttribute(ATTR_ACCEPT);
362 }
363 
364 void HTMLInputElement::setAccept( const DOMString &value )
365 {
366  if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCEPT, value);
367 }
368 
369 DOMString HTMLInputElement::accessKey() const
370 {
371  if(!impl) return DOMString();
372  return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
373 }
374 
375 void HTMLInputElement::setAccessKey( const DOMString &value )
376 {
377  if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
378 }
379 
380 DOMString HTMLInputElement::align() const
381 {
382  if(!impl) return DOMString();
383  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
384 }
385 
386 void HTMLInputElement::setAlign( const DOMString &value )
387 {
388  if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
389 }
390 
391 DOMString HTMLInputElement::alt() const
392 {
393  if(!impl) return DOMString();
394  return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
395 }
396 
397 void HTMLInputElement::setAlt( const DOMString &value )
398 {
399  if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
400 }
401 
402 bool HTMLInputElement::checked() const
403 {
404  if(!impl) return 0;
405  return ((HTMLInputElementImpl*)impl)->checked();
406 }
407 
408 void HTMLInputElement::setChecked( bool _checked )
409 {
410  if(impl)
411  ((HTMLInputElementImpl*)impl)->setChecked(_checked);
412 }
413 
414 bool HTMLInputElement::indeterminate() const
415 {
416  if(!impl) return 0;
417  return ((HTMLInputElementImpl*)impl)->indeterminate();
418 }
419 
420 void HTMLInputElement::setIndeterminate( bool _indeterminate )
421 {
422  if(impl)
423  ((HTMLInputElementImpl*)impl)->setIndeterminate(_indeterminate);
424 }
425 
426 bool HTMLInputElement::disabled() const
427 {
428  if(!impl) return 0;
429  return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
430 }
431 
432 void HTMLInputElement::setDisabled( bool _disabled )
433 {
434  if(impl)
435  {
436  ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
437  }
438 }
439 
440 long HTMLInputElement::maxLength() const
441 {
442  if(!impl) return 0;
443  return ((HTMLInputElementImpl *)impl)->getAttribute(ATTR_MAXLENGTH).toInt();
444 }
445 
446 void HTMLInputElement::setMaxLength( long _maxLength )
447 {
448  if(impl) {
449  DOMString value(QString::number(_maxLength));
450  ((ElementImpl *)impl)->setAttribute(ATTR_MAXLENGTH,value);
451  }
452 }
453 
454 DOMString HTMLInputElement::name() const
455 {
456  if(!impl) return DOMString();
457  return static_cast<HTMLInputElementImpl* const>(impl)->name();
458 }
459 
460 void HTMLInputElement::setName( const DOMString &value )
461 {
462  if(impl) static_cast<HTMLInputElementImpl*>(impl)->setName(value);
463 }
464 
465 bool HTMLInputElement::readOnly() const
466 {
467  if(!impl) return 0;
468  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull();
469 }
470 
471 void HTMLInputElement::setReadOnly( bool _readOnly )
472 {
473  if(impl)
474  static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0);
475 }
476 
477 /* The next two are provided for backwards compatibility. */
478 #ifndef KDE_NO_DEPRECATED
479 DOMString HTMLInputElement::size() const
480 {
481  if(!impl) return DOMString();
482  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE);
483 }
484 #endif
485 
486 #ifndef KDE_NO_DEPRECATED
487 void HTMLInputElement::setSize( const DOMString &value )
488 {
489  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, value);
490 }
491 #endif
492 
493 long HTMLInputElement::getSize() const
494 {
495  if(!impl) return 0;
496  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE).toInt();
497 }
498 
499 void HTMLInputElement::setSize( long value )
500 {
501  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, QString::number(value));
502 }
503 
504 DOMString HTMLInputElement::src() const
505 {
506  if(!impl) return DOMString();
507  DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SRC);
508  return !s.isNull() ? impl->document()->completeURL( s.string() ) : s;
509 }
510 
511 void HTMLInputElement::setSrc( const DOMString &value )
512 {
513  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SRC, value);
514 }
515 
516 long HTMLInputElement::tabIndex() const
517 {
518  if(!impl) return 0;
519  return static_cast<ElementImpl*>(impl)->tabIndex();
520 }
521 
522 void HTMLInputElement::setTabIndex( long _tabIndex )
523 {
524  if (!impl) return;
525  static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex);
526 }
527 
528 DOMString HTMLInputElement::type() const
529 {
530  if(!impl) return DOMString();
531  return ((HTMLInputElementImpl *)impl)->type();
532 }
533 
534 void HTMLInputElement::setType(const DOMString& _type)
535 {
536  if (!impl) return;
537  static_cast<HTMLInputElementImpl*>(impl)->setType(_type);
538 }
539 
540 DOMString HTMLInputElement::useMap() const
541 {
542  if(!impl) return DOMString();
543  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_USEMAP);
544 }
545 
546 void HTMLInputElement::setUseMap( const DOMString &value )
547 {
548  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_USEMAP, value);
549 }
550 
551 DOMString HTMLInputElement::value() const
552 {
553  if(!impl) return DOMString();
554  return ((HTMLInputElementImpl*)impl)->value();
555 }
556 
557 void HTMLInputElement::setValue( const DOMString &value )
558 {
559  if (impl)
560  ((HTMLInputElementImpl*)impl)->setValue(value);
561 
562 }
563 
564 void HTMLInputElement::blur( )
565 {
566  if(impl)
567  ((HTMLInputElementImpl*)impl)->blur();
568 }
569 
570 void HTMLInputElement::focus( )
571 {
572  if(impl)
573  ((HTMLInputElementImpl*)impl)->focus();
574 }
575 
576 void HTMLInputElement::select( )
577 {
578  if(impl)
579  ((HTMLInputElementImpl *)impl)->select( );
580 }
581 
582 void HTMLInputElement::click( )
583 {
584  if(impl)
585  ((HTMLInputElementImpl *)impl)->click( );
586 }
587 
588 long HTMLInputElement::selectionStart()
589 {
590  if (impl)
591  return ((HTMLInputElementImpl *)impl)->selectionStart( );
592  return -1;
593 }
594 
595 long HTMLInputElement::selectionEnd()
596 {
597  if (impl)
598  return ((HTMLInputElementImpl *)impl)->selectionEnd( );
599  return -1;
600 }
601 
602 void HTMLInputElement::setSelectionStart(long pos)
603 {
604  if (impl)
605  ((HTMLInputElementImpl *)impl)->setSelectionStart( pos );
606 }
607 
608 void HTMLInputElement::setSelectionEnd(long pos)
609 {
610  if (impl)
611  ((HTMLInputElementImpl *)impl)->setSelectionEnd( pos );
612 }
613 
614 void HTMLInputElement::setSelectionRange(long start, long end)
615 {
616  if (impl)
617  ((HTMLInputElementImpl *)impl)->setSelectionRange( start, end );
618 }
619 
620 // --------------------------------------------------------------------------
621 
622 HTMLLabelElement::HTMLLabelElement() : HTMLElement()
623 {
624 }
625 
626 HTMLLabelElement::HTMLLabelElement(const HTMLLabelElement &other) : HTMLElement(other)
627 {
628 }
629 
630 HTMLLabelElement::HTMLLabelElement(HTMLLabelElementImpl *impl) : HTMLElement(impl)
631 {
632 }
633 
634 HTMLLabelElement &HTMLLabelElement::operator = (const Node &other)
635 {
636  assignOther( other, ID_LABEL );
637  return *this;
638 }
639 
640 HTMLLabelElement &HTMLLabelElement::operator = (const HTMLLabelElement &other)
641 {
642  HTMLElement::operator = (other);
643  return *this;
644 }
645 
646 HTMLLabelElement::~HTMLLabelElement()
647 {
648 }
649 
650 DOMString HTMLLabelElement::accessKey() const
651 {
652  if(!impl) return DOMString();
653  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY);
654 }
655 
656 void HTMLLabelElement::setAccessKey( const DOMString &value )
657 {
658  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value);
659 }
660 
661 DOMString HTMLLabelElement::htmlFor() const
662 {
663  if(!impl) return DOMString();
664  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_FOR);
665 }
666 
667 void HTMLLabelElement::setHtmlFor( const DOMString &value )
668 {
669  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_FOR, value);
670 }
671 
672 // --------------------------------------------------------------------------
673 
674 HTMLLegendElement::HTMLLegendElement() : HTMLElement()
675 {
676 }
677 
678 HTMLLegendElement::HTMLLegendElement(const HTMLLegendElement &other) : HTMLElement(other)
679 {
680 }
681 
682 HTMLLegendElement::HTMLLegendElement(HTMLLegendElementImpl *impl) : HTMLElement(impl)
683 {
684 }
685 
686 HTMLLegendElement &HTMLLegendElement::operator = (const Node &other)
687 {
688  assignOther( other, ID_LEGEND );
689  return *this;
690 }
691 
692 HTMLLegendElement &HTMLLegendElement::operator = (const HTMLLegendElement &other)
693 {
694  HTMLElement::operator = (other);
695  return *this;
696 }
697 
698 HTMLLegendElement::~HTMLLegendElement()
699 {
700 }
701 
702 HTMLFormElement HTMLLegendElement::form() const
703 {
704  return Element::form();
705 }
706 
707 DOMString HTMLLegendElement::accessKey() const
708 {
709  if(!impl) return DOMString();
710  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY);
711 }
712 
713 void HTMLLegendElement::setAccessKey( const DOMString &value )
714 {
715  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value);
716 }
717 
718 DOMString HTMLLegendElement::align() const
719 {
720  if(!impl) return DOMString();
721  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ALIGN);
722 }
723 
724 void HTMLLegendElement::setAlign( const DOMString &value )
725 {
726  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ALIGN, value);
727 }
728 
729 // --------------------------------------------------------------------------
730 
731 HTMLOptGroupElement::HTMLOptGroupElement() : HTMLElement()
732 {
733 }
734 
735 HTMLOptGroupElement::HTMLOptGroupElement(const HTMLOptGroupElement &other) : HTMLElement(other)
736 {
737 }
738 
739 HTMLOptGroupElement::HTMLOptGroupElement(HTMLOptGroupElementImpl *impl) : HTMLElement(impl)
740 {
741 }
742 
743 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const Node &other)
744 {
745  assignOther( other, ID_OPTGROUP );
746  return *this;
747 }
748 
749 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const HTMLOptGroupElement &other)
750 {
751  HTMLElement::operator = (other);
752  return *this;
753 }
754 
755 HTMLOptGroupElement::~HTMLOptGroupElement()
756 {
757 }
758 
759 bool HTMLOptGroupElement::disabled() const
760 {
761  if(!impl) return 0;
762  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull();
763 }
764 
765 void HTMLOptGroupElement::setDisabled( bool _disabled )
766 {
767  if(impl)
768  static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
769 }
770 
771 DOMString HTMLOptGroupElement::label() const
772 {
773  if(!impl) return DOMString();
774  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL);
775 }
776 
777 void HTMLOptGroupElement::setLabel( const DOMString &value )
778 {
779  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value);
780 }
781 
782 // --------------------------------------------------------------------------
783 
784 HTMLSelectElement::HTMLSelectElement() : HTMLElement()
785 {
786 }
787 
788 HTMLSelectElement::HTMLSelectElement(const HTMLSelectElement &other) : HTMLElement(other)
789 {
790 }
791 
792 HTMLSelectElement::HTMLSelectElement(HTMLSelectElementImpl *impl) : HTMLElement(impl)
793 {
794 }
795 
796 HTMLSelectElement &HTMLSelectElement::operator = (const Node &other)
797 {
798  assignOther( other, ID_SELECT );
799  return *this;
800 }
801 
802 HTMLSelectElement &HTMLSelectElement::operator = (const HTMLSelectElement &other)
803 {
804  HTMLElement::operator = (other);
805  return *this;
806 }
807 
808 HTMLSelectElement::~HTMLSelectElement()
809 {
810 }
811 
812 DOMString HTMLSelectElement::type() const
813 {
814  if(!impl) return DOMString();
815  return ((HTMLSelectElementImpl *)impl)->type();
816 }
817 
818 long HTMLSelectElement::selectedIndex() const
819 {
820  if(!impl) return 0;
821  return ((HTMLSelectElementImpl *)impl)->selectedIndex();
822 }
823 
824 void HTMLSelectElement::setSelectedIndex( long _selectedIndex )
825 {
826  if(impl)
827  ((HTMLSelectElementImpl *)impl)->setSelectedIndex(_selectedIndex);
828 }
829 
830 DOMString HTMLSelectElement::value() const
831 {
832  if(!impl) return DOMString();
833  return static_cast<HTMLSelectElementImpl*>(impl)->value();
834 }
835 
836 void HTMLSelectElement::setValue( const DOMString &value )
837 {
838  if(!impl || value.isNull()) return;
839  static_cast<HTMLSelectElementImpl*>(impl)->setValue(value.implementation());
840 }
841 
842 long HTMLSelectElement::length() const
843 {
844  if(!impl) return 0;
845  return ((HTMLSelectElementImpl *)impl)->length();
846 }
847 
848 HTMLFormElement HTMLSelectElement::form() const
849 {
850  return Element::form();
851 }
852 
853 HTMLCollection HTMLSelectElement::options() const
854 {
855  if(!impl) return HTMLCollection();
856  return HTMLCollection(((HTMLSelectElementImpl*)impl)->options());
857 }
858 
859 bool HTMLSelectElement::disabled() const
860 {
861  if(!impl) return 0;
862  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull();
863 }
864 
865 void HTMLSelectElement::setDisabled( bool _disabled )
866 {
867  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
868 }
869 
870 
871 bool HTMLSelectElement::multiple() const
872 {
873  if(!impl) return 0;
874  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_MULTIPLE).isNull();
875 }
876 
877 void HTMLSelectElement::setMultiple( bool _multiple )
878 {
879  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_MULTIPLE, _multiple ? "" : 0);
880 }
881 
882 DOMString HTMLSelectElement::name() const
883 {
884  if(!impl) return DOMString();
885  return static_cast<HTMLSelectElementImpl* const>(impl)->name();
886 }
887 
888 void HTMLSelectElement::setName( const DOMString &value )
889 {
890  if(impl) static_cast<HTMLSelectElementImpl*>(impl)->setName(value);
891 }
892 
893 long HTMLSelectElement::size() const
894 {
895  if(!impl) return 0;
896  return ((HTMLSelectElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt();
897 }
898 
899 void HTMLSelectElement::setSize( long _size )
900 {
901 
902  if(impl) {
903  DOMString value(QString::number(_size));
904  static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE,value);
905  }
906 }
907 
908 long HTMLSelectElement::tabIndex() const
909 {
910  if(!impl) return 0;
911  return static_cast<ElementImpl*>(impl)->tabIndex();
912 }
913 
914 void HTMLSelectElement::setTabIndex( long _tabIndex )
915 {
916  if (!impl) return;
917  static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex);
918 }
919 
920 void HTMLSelectElement::add( const HTMLElement &element, const HTMLElement &before )
921 {
922  if (!impl)
923  throw DOMException(DOMException::NOT_FOUND_ERR);
924 
925  int exceptioncode = 0;
926  static_cast<HTMLSelectElementImpl*>(impl)->add(
927  static_cast<HTMLElementImpl*>(element.handle()),
928  static_cast<HTMLElementImpl*>(before.handle()), exceptioncode );
929  if ( exceptioncode )
930  throw DOMException( exceptioncode );
931 }
932 
933 void HTMLSelectElement::remove( long index )
934 {
935  if(impl) static_cast<HTMLSelectElementImpl*>(impl)->remove( index );
936 }
937 
938 void HTMLSelectElement::blur( )
939 {
940  if(impl)
941  ((HTMLSelectElementImpl*)impl)->blur();
942 }
943 
944 void HTMLSelectElement::focus( )
945 {
946  if(impl)
947  ((HTMLSelectElementImpl*)impl)->focus();
948 }
949 
950 // --------------------------------------------------------------------------
951 
952 HTMLTextAreaElement::HTMLTextAreaElement() : HTMLElement()
953 {
954 }
955 
956 HTMLTextAreaElement::HTMLTextAreaElement(const HTMLTextAreaElement &other) : HTMLElement(other)
957 {
958 }
959 
960 HTMLTextAreaElement::HTMLTextAreaElement(HTMLTextAreaElementImpl *impl) : HTMLElement(impl)
961 {
962 }
963 
964 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const Node &other)
965 {
966  assignOther( other, ID_TEXTAREA );
967  return *this;
968 }
969 
970 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const HTMLTextAreaElement &other)
971 {
972  HTMLElement::operator = (other);
973  return *this;
974 }
975 
976 HTMLTextAreaElement::~HTMLTextAreaElement()
977 {
978 }
979 
980 DOMString HTMLTextAreaElement::defaultValue() const
981 {
982  if(!impl) return DOMString();
983  return ((HTMLTextAreaElementImpl *)impl)->defaultValue();
984 }
985 
986 void HTMLTextAreaElement::setDefaultValue( const DOMString &value )
987 {
988  if (impl) ((HTMLTextAreaElementImpl *)impl)->setDefaultValue(value);
989 }
990 
991 HTMLFormElement HTMLTextAreaElement::form() const
992 {
993  return Element::form();
994 }
995 
996 DOMString HTMLTextAreaElement::accessKey() const
997 {
998  if(!impl) return DOMString();
999  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY);
1000 }
1001 
1002 void HTMLTextAreaElement::setAccessKey( const DOMString &value )
1003 {
1004  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value);
1005 }
1006 
1007 long HTMLTextAreaElement::cols() const
1008 {
1009  if(!impl) return 0;
1010  return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_COLS).toInt();
1011 }
1012 
1013 void HTMLTextAreaElement::setCols( long _cols )
1014 {
1015 
1016  if(impl) {
1017  DOMString value(QString::number(_cols));
1018  static_cast<ElementImpl*>(impl)->setAttribute(ATTR_COLS,value);
1019  }
1020 }
1021 
1022 bool HTMLTextAreaElement::disabled() const
1023 {
1024  if(!impl) return 0;
1025  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull();
1026 }
1027 
1028 void HTMLTextAreaElement::setDisabled( bool _disabled )
1029 {
1030  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
1031 }
1032 
1033 DOMString HTMLTextAreaElement::name() const
1034 {
1035  if(!impl) return DOMString();
1036  return static_cast<HTMLTextAreaElementImpl* const>(impl)->name();
1037 }
1038 
1039 void HTMLTextAreaElement::setName( const DOMString &value )
1040 {
1041  if(impl) static_cast<HTMLTextAreaElementImpl*>(impl)->setName(value);
1042 }
1043 
1044 bool HTMLTextAreaElement::readOnly() const
1045 {
1046  if(!impl) return 0;
1047  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull();
1048 }
1049 
1050 void HTMLTextAreaElement::setReadOnly( bool _readOnly )
1051 {
1052  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0);
1053 }
1054 
1055 long HTMLTextAreaElement::rows() const
1056 {
1057  if(!impl) return 0;
1058  return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_ROWS).toInt();
1059 }
1060 
1061 void HTMLTextAreaElement::setRows( long _rows )
1062 {
1063 
1064  if(impl) {
1065  DOMString value(QString::number(_rows));
1066  static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ROWS,value);
1067  }
1068 }
1069 
1070 long HTMLTextAreaElement::tabIndex() const
1071 {
1072  if(!impl) return 0;
1073  return static_cast<ElementImpl*>(impl)->tabIndex();
1074 }
1075 
1076 void HTMLTextAreaElement::setTabIndex( long _tabIndex )
1077 {
1078  if (!impl) return;
1079  static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex);
1080 }
1081 
1082 DOMString HTMLTextAreaElement::type() const
1083 {
1084  if(!impl) return DOMString();
1085  return ((HTMLTextAreaElementImpl *)impl)->type();
1086 }
1087 
1088 DOMString HTMLTextAreaElement::value() const
1089 {
1090  if(!impl) return DOMString();
1091  return ((HTMLTextAreaElementImpl *)impl)->value();
1092 }
1093 
1094 void HTMLTextAreaElement::setValue( const DOMString &value )
1095 {
1096  if(impl) ((HTMLTextAreaElementImpl *)impl)->setValue(value);
1097 }
1098 
1099 void HTMLTextAreaElement::blur( )
1100 {
1101  if(impl)
1102  ((HTMLTextAreaElementImpl*)impl)->blur();
1103 }
1104 
1105 void HTMLTextAreaElement::focus( )
1106 {
1107  if(impl)
1108  ((HTMLTextAreaElementImpl*)impl)->focus();
1109 }
1110 
1111 void HTMLTextAreaElement::select( )
1112 {
1113  if(impl)
1114  ((HTMLTextAreaElementImpl *)impl)->select( );
1115 }
1116 
1117 long HTMLTextAreaElement::selectionStart()
1118 {
1119  if (impl)
1120  return ((HTMLTextAreaElementImpl *)impl)->selectionStart( );
1121  return 0;
1122 }
1123 
1124 long HTMLTextAreaElement::selectionEnd()
1125 {
1126  if (impl)
1127  return ((HTMLTextAreaElementImpl *)impl)->selectionEnd( );
1128  return 0;
1129 }
1130 
1131 long HTMLTextAreaElement::textLength()
1132 {
1133  if (impl)
1134  return ((HTMLTextAreaElementImpl *)impl)->textLength( );
1135  return 0;
1136 }
1137 
1138 void HTMLTextAreaElement::setSelectionStart(long pos)
1139 {
1140  if (impl)
1141  ((HTMLTextAreaElementImpl *)impl)->setSelectionStart( pos );
1142 }
1143 
1144 void HTMLTextAreaElement::setSelectionEnd(long pos)
1145 {
1146  if (impl)
1147  ((HTMLTextAreaElementImpl *)impl)->setSelectionEnd( pos );
1148 }
1149 
1150 void HTMLTextAreaElement::setSelectionRange(long start, long end)
1151 {
1152  if (impl)
1153  ((HTMLTextAreaElementImpl *)impl)->setSelectionRange( start, end );
1154 }
1155 
1156 // --------------------------------------------------------------------------
1157 
1158 HTMLOptionElement::HTMLOptionElement() : HTMLElement()
1159 {
1160 }
1161 
1162 HTMLOptionElement::HTMLOptionElement(const HTMLOptionElement &other) : HTMLElement(other)
1163 {
1164 }
1165 
1166 HTMLOptionElement::HTMLOptionElement(HTMLOptionElementImpl *impl) : HTMLElement(impl)
1167 {
1168 }
1169 
1170 HTMLOptionElement &HTMLOptionElement::operator = (const Node &other)
1171 {
1172  assignOther( other, ID_OPTION );
1173  return *this;
1174 }
1175 
1176 HTMLOptionElement &HTMLOptionElement::operator = (const HTMLOptionElement &other)
1177 {
1178  HTMLElement::operator = (other);
1179  return *this;
1180 }
1181 
1182 HTMLOptionElement::~HTMLOptionElement()
1183 {
1184 }
1185 
1186 HTMLFormElement HTMLOptionElement::form() const
1187 {
1188  return Element::form();
1189 }
1190 
1191 bool HTMLOptionElement::defaultSelected() const
1192 {
1193  if(!impl) return 0;
1194  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SELECTED).isNull();
1195 }
1196 
1197 void HTMLOptionElement::setDefaultSelected( bool _defaultSelected )
1198 {
1199  if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setDefaultSelected(_defaultSelected);
1200 }
1201 
1202 DOMString HTMLOptionElement::text() const
1203 {
1204  if(!impl) return DOMString();
1205  return ((HTMLOptionElementImpl *)impl)->text();
1206 }
1207 
1208 long HTMLOptionElement::index() const
1209 {
1210  if(!impl) return 0;
1211  return ((HTMLOptionElementImpl *)impl)->index();
1212 }
1213 
1214 void HTMLOptionElement::setIndex( long /*_index*/ )
1215 {
1216  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR);
1217 }
1218 
1219 bool HTMLOptionElement::disabled() const
1220 {
1221  if(!impl) return 0;
1222  return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull();
1223 }
1224 
1225 void HTMLOptionElement::setDisabled( bool _disabled )
1226 {
1227  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0);
1228 }
1229 
1230 DOMString HTMLOptionElement::label() const
1231 {
1232  if(!impl) return DOMString();
1233  return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL);
1234 }
1235 
1236 void HTMLOptionElement::setLabel( const DOMString &value )
1237 {
1238  if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value);
1239 }
1240 
1241 bool HTMLOptionElement::selected() const
1242 {
1243  if(!impl) return 0;
1244  return ((HTMLOptionElementImpl *)impl)->selected();
1245 }
1246 
1247 void HTMLOptionElement::setSelected(bool _selected) {
1248  if(!impl) return;
1249  ((HTMLOptionElementImpl *)impl)->setSelected(_selected);
1250 }
1251 
1252 DOMString HTMLOptionElement::value() const
1253 {
1254  if(!impl) return DOMString();
1255  return static_cast<HTMLOptionElementImpl*>(impl)->value();
1256 }
1257 
1258 void HTMLOptionElement::setValue( const DOMString &value )
1259 {
1260  if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setValue(value.implementation());
1261 }
1262 
1263 // -----------------------------------------------------------------------------
1264 
1265 HTMLIsIndexElement::HTMLIsIndexElement() : HTMLElement()
1266 {
1267 }
1268 
1269 HTMLIsIndexElement::HTMLIsIndexElement(const HTMLIsIndexElement &other) : HTMLElement(other)
1270 {
1271 }
1272 
1273 HTMLIsIndexElement::HTMLIsIndexElement(HTMLIsIndexElementImpl *impl) : HTMLElement(impl)
1274 {
1275 }
1276 
1277 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const Node &other)
1278 {
1279  assignOther( other, ID_ISINDEX );
1280  return *this;
1281 }
1282 
1283 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const HTMLIsIndexElement &other)
1284 {
1285  HTMLElement::operator = (other);
1286  return *this;
1287 }
1288 
1289 HTMLIsIndexElement::~HTMLIsIndexElement()
1290 {
1291 }
1292 
1293 HTMLFormElement HTMLIsIndexElement::form() const
1294 {
1295  return Element::form();
1296 }
1297 
1298 DOMString HTMLIsIndexElement::prompt() const
1299 {
1300  if(!impl) return DOMString();
1301  return static_cast<HTMLIsIndexElementImpl*>(impl)->prompt();
1302 }
1303 
1304 void HTMLIsIndexElement::setPrompt( const DOMString &value )
1305 {
1306  if(impl) static_cast<HTMLIsIndexElementImpl*>(impl)->setPrompt(value);
1307 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Apr 16 2013 21:10:36 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.10.2 API Reference

Skip menu "kdelibs-4.10.2 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal