khtml Library API Documentation

html_form.cpp

00001 00022 // -------------------------------------------------------------------------- 00023 00024 #include "dom/html_form.h" 00025 #include "dom/dom_exception.h" 00026 #include "dom/dom_doc.h" 00027 00028 #include "html/html_formimpl.h" 00029 #include "html/html_miscimpl.h" 00030 00031 #include "xml/dom_docimpl.h" 00032 #include "misc/htmlhashes.h" 00033 00034 using namespace DOM; 00035 00036 HTMLButtonElement::HTMLButtonElement() : HTMLElement() 00037 { 00038 } 00039 00040 HTMLButtonElement::HTMLButtonElement(const HTMLButtonElement &other) : HTMLElement(other) 00041 { 00042 } 00043 00044 HTMLButtonElement::HTMLButtonElement(HTMLButtonElementImpl *impl) : HTMLElement(impl) 00045 { 00046 } 00047 00048 HTMLButtonElement &HTMLButtonElement::operator = (const Node &other) 00049 { 00050 assignOther( other, ID_BUTTON ); 00051 return *this; 00052 } 00053 00054 HTMLButtonElement &HTMLButtonElement::operator = (const HTMLButtonElement &other) 00055 { 00056 HTMLElement::operator = (other); 00057 return *this; 00058 } 00059 00060 HTMLButtonElement::~HTMLButtonElement() 00061 { 00062 } 00063 00064 HTMLFormElement HTMLButtonElement::form() const 00065 { 00066 return Element::form(); 00067 } 00068 00069 DOMString HTMLButtonElement::accessKey() const 00070 { 00071 if(!impl) return DOMString(); 00072 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00073 } 00074 00075 void HTMLButtonElement::setAccessKey( const DOMString &value ) 00076 { 00077 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00078 } 00079 00080 bool HTMLButtonElement::disabled() const 00081 { 00082 if(!impl) return 0; 00083 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00084 } 00085 00086 void HTMLButtonElement::setDisabled( bool _disabled ) 00087 { 00088 if (impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00089 } 00090 00091 DOMString HTMLButtonElement::name() const 00092 { 00093 if(!impl) return DOMString(); 00094 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME); 00095 } 00096 00097 void HTMLButtonElement::setName( const DOMString &value ) 00098 { 00099 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value); 00100 } 00101 00102 long HTMLButtonElement::tabIndex() const 00103 { 00104 if(!impl) return 0; 00105 return static_cast<ElementImpl*>(impl)->tabIndex(); 00106 } 00107 00108 void HTMLButtonElement::setTabIndex( long _tabIndex ) 00109 { 00110 if (!impl) return; 00111 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00112 } 00113 00114 DOMString HTMLButtonElement::type() const 00115 { 00116 if(!impl) return DOMString(); 00117 return static_cast<HTMLButtonElementImpl*>(impl)->type(); 00118 } 00119 00120 DOMString HTMLButtonElement::value() const 00121 { 00122 if(!impl) return DOMString(); 00123 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE); 00124 if (s.isNull()) return DOMString(""); 00125 return s; 00126 } 00127 00128 void HTMLButtonElement::setValue( const DOMString &value ) 00129 { 00130 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VALUE, value); 00131 } 00132 00133 // -------------------------------------------------------------------------- 00134 00135 HTMLFieldSetElement::HTMLFieldSetElement() : HTMLElement() 00136 { 00137 } 00138 00139 HTMLFieldSetElement::HTMLFieldSetElement(const HTMLFieldSetElement &other) : HTMLElement(other) 00140 { 00141 } 00142 00143 HTMLFieldSetElement::HTMLFieldSetElement(HTMLFieldSetElementImpl *impl) : HTMLElement(impl) 00144 { 00145 } 00146 00147 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const Node &other) 00148 { 00149 assignOther( other, ID_FIELDSET ); 00150 return *this; 00151 } 00152 00153 HTMLFieldSetElement &HTMLFieldSetElement::operator = (const HTMLFieldSetElement &other) 00154 { 00155 HTMLElement::operator = (other); 00156 return *this; 00157 } 00158 00159 HTMLFieldSetElement::~HTMLFieldSetElement() 00160 { 00161 } 00162 00163 HTMLFormElement HTMLFieldSetElement::form() const 00164 { 00165 return Element::form(); 00166 } 00167 00168 // -------------------------------------------------------------------------- 00169 00170 HTMLFormElement::HTMLFormElement() : HTMLElement() 00171 { 00172 } 00173 00174 HTMLFormElement::HTMLFormElement(const HTMLFormElement &other) : HTMLElement(other) 00175 { 00176 } 00177 00178 HTMLFormElement::HTMLFormElement(HTMLFormElementImpl *impl) : HTMLElement(impl) 00179 { 00180 } 00181 00182 HTMLFormElement &HTMLFormElement::operator = (const Node &other) 00183 { 00184 assignOther( other, ID_FORM ); 00185 return *this; 00186 } 00187 00188 HTMLFormElement &HTMLFormElement::operator = (const HTMLFormElement &other) 00189 { 00190 HTMLElement::operator = (other); 00191 return *this; 00192 } 00193 00194 HTMLFormElement::~HTMLFormElement() 00195 { 00196 } 00197 00198 HTMLCollection HTMLFormElement::elements() const 00199 { 00200 if(!impl) return HTMLCollection(); 00201 return HTMLFormCollection(impl); 00202 } 00203 00204 long HTMLFormElement::length() const 00205 { 00206 if(!impl) return 0; 00207 return static_cast<HTMLFormElementImpl*>(impl)->length(); 00208 } 00209 00210 DOMString HTMLFormElement::name() const 00211 { 00212 if(!impl) return DOMString(); 00213 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_NAME); 00214 } 00215 00216 void HTMLFormElement::setName( const DOMString &value ) 00217 { 00218 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_NAME, value); 00219 } 00220 00221 DOMString HTMLFormElement::acceptCharset() const 00222 { 00223 if(!impl) return DOMString(); 00224 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCEPT_CHARSET); 00225 } 00226 00227 void HTMLFormElement::setAcceptCharset( const DOMString &value ) 00228 { 00229 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCEPT_CHARSET, value); 00230 } 00231 00232 DOMString HTMLFormElement::action() const 00233 { 00234 if(!impl) return DOMString(); 00235 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACTION); 00236 } 00237 00238 void HTMLFormElement::setAction( const DOMString &value ) 00239 { 00240 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACTION, value); 00241 } 00242 00243 DOMString HTMLFormElement::enctype() const 00244 { 00245 if(!impl) return DOMString(); 00246 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ENCTYPE); 00247 } 00248 00249 void HTMLFormElement::setEnctype( const DOMString &value ) 00250 { 00251 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ENCTYPE, value); 00252 } 00253 00254 DOMString HTMLFormElement::method() const 00255 { 00256 if(!impl) return DOMString(); 00257 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_METHOD); 00258 } 00259 00260 void HTMLFormElement::setMethod( const DOMString &value ) 00261 { 00262 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_METHOD, value); 00263 } 00264 00265 DOMString HTMLFormElement::target() const 00266 { 00267 if(!impl) return DOMString(); 00268 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_TARGET); 00269 } 00270 00271 void HTMLFormElement::setTarget( const DOMString &value ) 00272 { 00273 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_TARGET, value); 00274 } 00275 00276 void HTMLFormElement::submit( ) 00277 { 00278 if(impl) static_cast<HTMLFormElementImpl*>(impl)->submit( ); 00279 } 00280 00281 void HTMLFormElement::reset( ) 00282 { 00283 if(impl) static_cast<HTMLFormElementImpl*>(impl)->reset( ); 00284 } 00285 00286 // -------------------------------------------------------------------------- 00287 00288 HTMLInputElement::HTMLInputElement() : HTMLElement() 00289 { 00290 } 00291 00292 HTMLInputElement::HTMLInputElement(const HTMLInputElement &other) : HTMLElement(other) 00293 { 00294 } 00295 00296 HTMLInputElement::HTMLInputElement(HTMLInputElementImpl *impl) : HTMLElement(impl) 00297 { 00298 } 00299 00300 HTMLInputElement &HTMLInputElement::operator = (const Node &other) 00301 { 00302 assignOther( other, ID_INPUT ); 00303 return *this; 00304 } 00305 00306 HTMLInputElement &HTMLInputElement::operator = (const HTMLInputElement &other) 00307 { 00308 HTMLElement::operator = (other); 00309 return *this; 00310 } 00311 00312 HTMLInputElement::~HTMLInputElement() 00313 { 00314 } 00315 00316 DOMString HTMLInputElement::defaultValue() const 00317 { 00318 if(!impl) return DOMString(); 00319 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_VALUE); 00320 if (s.isNull()) return DOMString(""); 00321 return s; 00322 00323 } 00324 00325 void HTMLInputElement::setDefaultValue( const DOMString &value ) 00326 { 00327 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VALUE, value); 00328 } 00329 00330 bool HTMLInputElement::defaultChecked() const 00331 { 00332 if(!impl) return 0; 00333 return !((ElementImpl *)impl)->getAttribute(ATTR_CHECKED).isNull(); 00334 } 00335 00336 void HTMLInputElement::setDefaultChecked( bool _defaultChecked ) 00337 { 00338 if(impl) 00339 ((ElementImpl *)impl)->setAttribute(ATTR_CHECKED, _defaultChecked ? "" : 0); 00340 } 00341 00342 HTMLFormElement HTMLInputElement::form() const 00343 { 00344 return Element::form(); 00345 } 00346 00347 DOMString HTMLInputElement::accept() const 00348 { 00349 if(!impl) return DOMString(); 00350 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCEPT); 00351 } 00352 00353 void HTMLInputElement::setAccept( const DOMString &value ) 00354 { 00355 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCEPT, value); 00356 } 00357 00358 DOMString HTMLInputElement::accessKey() const 00359 { 00360 if(!impl) return DOMString(); 00361 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY); 00362 } 00363 00364 void HTMLInputElement::setAccessKey( const DOMString &value ) 00365 { 00366 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value); 00367 } 00368 00369 DOMString HTMLInputElement::align() const 00370 { 00371 if(!impl) return DOMString(); 00372 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN); 00373 } 00374 00375 void HTMLInputElement::setAlign( const DOMString &value ) 00376 { 00377 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value); 00378 } 00379 00380 DOMString HTMLInputElement::alt() const 00381 { 00382 if(!impl) return DOMString(); 00383 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT); 00384 } 00385 00386 void HTMLInputElement::setAlt( const DOMString &value ) 00387 { 00388 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value); 00389 } 00390 00391 bool HTMLInputElement::checked() const 00392 { 00393 if(!impl) return 0; 00394 return ((HTMLInputElementImpl*)impl)->checked(); 00395 } 00396 00397 void HTMLInputElement::setChecked( bool _checked ) 00398 { 00399 if(impl) 00400 ((HTMLInputElementImpl*)impl)->setChecked(_checked); 00401 } 00402 00403 bool HTMLInputElement::disabled() const 00404 { 00405 if(!impl) return 0; 00406 return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull(); 00407 } 00408 00409 void HTMLInputElement::setDisabled( bool _disabled ) 00410 { 00411 if(impl) 00412 { 00413 ((ElementImpl *)impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00414 } 00415 } 00416 00417 long HTMLInputElement::maxLength() const 00418 { 00419 if(!impl) return 0; 00420 return ((HTMLInputElementImpl *)impl)->getAttribute(ATTR_MAXLENGTH).toInt(); 00421 } 00422 00423 void HTMLInputElement::setMaxLength( long _maxLength ) 00424 { 00425 if(impl) { 00426 DOMString value(QString::number(_maxLength)); 00427 ((ElementImpl *)impl)->setAttribute(ATTR_MAXLENGTH,value); 00428 } 00429 } 00430 00431 DOMString HTMLInputElement::name() const 00432 { 00433 if(!impl) return DOMString(); 00434 return static_cast<HTMLInputElementImpl* const>(impl)->name(); 00435 } 00436 00437 void HTMLInputElement::setName( const DOMString &value ) 00438 { 00439 if(impl) static_cast<HTMLInputElementImpl*>(impl)->setName(value); 00440 } 00441 00442 bool HTMLInputElement::readOnly() const 00443 { 00444 if(!impl) return 0; 00445 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull(); 00446 } 00447 00448 void HTMLInputElement::setReadOnly( bool _readOnly ) 00449 { 00450 if(impl) 00451 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0); 00452 } 00453 00454 /* The next two are provided for backwards compatibility. */ 00455 DOMString HTMLInputElement::size() const 00456 { 00457 if(!impl) return DOMString(); 00458 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE); 00459 } 00460 00461 void HTMLInputElement::setSize( const DOMString &value ) 00462 { 00463 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, value); 00464 } 00465 00466 long HTMLInputElement::getSize() const 00467 { 00468 if(!impl) return 0; 00469 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SIZE).toInt(); 00470 } 00471 00472 void HTMLInputElement::setSize( long value ) 00473 { 00474 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE, QString::number(value)); 00475 } 00476 00477 DOMString HTMLInputElement::src() const 00478 { 00479 if(!impl) return DOMString(); 00480 DOMString s = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SRC); 00481 return !s.isNull() ? impl->getDocument()->completeURL( s.string() ) : s; 00482 } 00483 00484 void HTMLInputElement::setSrc( const DOMString &value ) 00485 { 00486 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SRC, value); 00487 } 00488 00489 long HTMLInputElement::tabIndex() const 00490 { 00491 if(!impl) return 0; 00492 return static_cast<ElementImpl*>(impl)->tabIndex(); 00493 } 00494 00495 void HTMLInputElement::setTabIndex( long _tabIndex ) 00496 { 00497 if (!impl) return; 00498 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00499 } 00500 00501 DOMString HTMLInputElement::type() const 00502 { 00503 if(!impl) return DOMString(); 00504 return ((HTMLInputElementImpl *)impl)->type(); 00505 } 00506 00507 void HTMLInputElement::setType(const DOMString& _type) 00508 { 00509 if (!impl) return; 00510 static_cast<HTMLInputElementImpl*>(impl)->setType(_type); 00511 } 00512 00513 DOMString HTMLInputElement::useMap() const 00514 { 00515 if(!impl) return DOMString(); 00516 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_USEMAP); 00517 } 00518 00519 void HTMLInputElement::setUseMap( const DOMString &value ) 00520 { 00521 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_USEMAP, value); 00522 } 00523 00524 DOMString HTMLInputElement::value() const 00525 { 00526 if(!impl) return DOMString(); 00527 return ((HTMLInputElementImpl*)impl)->value(); 00528 } 00529 00530 void HTMLInputElement::setValue( const DOMString &value ) 00531 { 00532 if (impl) 00533 ((HTMLInputElementImpl*)impl)->setValue(value); 00534 00535 } 00536 00537 void HTMLInputElement::blur( ) 00538 { 00539 if(impl) 00540 ((HTMLInputElementImpl*)impl)->blur(); 00541 } 00542 00543 void HTMLInputElement::focus( ) 00544 { 00545 if(impl) 00546 ((HTMLInputElementImpl*)impl)->focus(); 00547 } 00548 00549 void HTMLInputElement::select( ) 00550 { 00551 if(impl) 00552 ((HTMLInputElementImpl *)impl)->select( ); 00553 } 00554 00555 void HTMLInputElement::click( ) 00556 { 00557 if(impl) 00558 ((HTMLInputElementImpl *)impl)->click( ); 00559 } 00560 00561 // -------------------------------------------------------------------------- 00562 00563 HTMLLabelElement::HTMLLabelElement() : HTMLElement() 00564 { 00565 } 00566 00567 HTMLLabelElement::HTMLLabelElement(const HTMLLabelElement &other) : HTMLElement(other) 00568 { 00569 } 00570 00571 HTMLLabelElement::HTMLLabelElement(HTMLLabelElementImpl *impl) : HTMLElement(impl) 00572 { 00573 } 00574 00575 HTMLLabelElement &HTMLLabelElement::operator = (const Node &other) 00576 { 00577 assignOther( other, ID_LABEL ); 00578 return *this; 00579 } 00580 00581 HTMLLabelElement &HTMLLabelElement::operator = (const HTMLLabelElement &other) 00582 { 00583 HTMLElement::operator = (other); 00584 return *this; 00585 } 00586 00587 HTMLLabelElement::~HTMLLabelElement() 00588 { 00589 } 00590 00591 DOMString HTMLLabelElement::accessKey() const 00592 { 00593 if(!impl) return DOMString(); 00594 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00595 } 00596 00597 void HTMLLabelElement::setAccessKey( const DOMString &value ) 00598 { 00599 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00600 } 00601 00602 DOMString HTMLLabelElement::htmlFor() const 00603 { 00604 if(!impl) return DOMString(); 00605 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_FOR); 00606 } 00607 00608 void HTMLLabelElement::setHtmlFor( const DOMString &value ) 00609 { 00610 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_FOR, value); 00611 } 00612 00613 // -------------------------------------------------------------------------- 00614 00615 HTMLLegendElement::HTMLLegendElement() : HTMLElement() 00616 { 00617 } 00618 00619 HTMLLegendElement::HTMLLegendElement(const HTMLLegendElement &other) : HTMLElement(other) 00620 { 00621 } 00622 00623 HTMLLegendElement::HTMLLegendElement(HTMLLegendElementImpl *impl) : HTMLElement(impl) 00624 { 00625 } 00626 00627 HTMLLegendElement &HTMLLegendElement::operator = (const Node &other) 00628 { 00629 assignOther( other, ID_LEGEND ); 00630 return *this; 00631 } 00632 00633 HTMLLegendElement &HTMLLegendElement::operator = (const HTMLLegendElement &other) 00634 { 00635 HTMLElement::operator = (other); 00636 return *this; 00637 } 00638 00639 HTMLLegendElement::~HTMLLegendElement() 00640 { 00641 } 00642 00643 HTMLFormElement HTMLLegendElement::form() const 00644 { 00645 return Element::form(); 00646 } 00647 00648 DOMString HTMLLegendElement::accessKey() const 00649 { 00650 if(!impl) return DOMString(); 00651 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00652 } 00653 00654 void HTMLLegendElement::setAccessKey( const DOMString &value ) 00655 { 00656 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00657 } 00658 00659 DOMString HTMLLegendElement::align() const 00660 { 00661 if(!impl) return DOMString(); 00662 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ALIGN); 00663 } 00664 00665 void HTMLLegendElement::setAlign( const DOMString &value ) 00666 { 00667 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ALIGN, value); 00668 } 00669 00670 // -------------------------------------------------------------------------- 00671 00672 HTMLOptGroupElement::HTMLOptGroupElement() : HTMLElement() 00673 { 00674 } 00675 00676 HTMLOptGroupElement::HTMLOptGroupElement(const HTMLOptGroupElement &other) : HTMLElement(other) 00677 { 00678 } 00679 00680 HTMLOptGroupElement::HTMLOptGroupElement(HTMLOptGroupElementImpl *impl) : HTMLElement(impl) 00681 { 00682 } 00683 00684 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const Node &other) 00685 { 00686 assignOther( other, ID_OPTGROUP ); 00687 return *this; 00688 } 00689 00690 HTMLOptGroupElement &HTMLOptGroupElement::operator = (const HTMLOptGroupElement &other) 00691 { 00692 HTMLElement::operator = (other); 00693 return *this; 00694 } 00695 00696 HTMLOptGroupElement::~HTMLOptGroupElement() 00697 { 00698 } 00699 00700 bool HTMLOptGroupElement::disabled() const 00701 { 00702 if(!impl) return 0; 00703 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00704 } 00705 00706 void HTMLOptGroupElement::setDisabled( bool _disabled ) 00707 { 00708 if(impl) 00709 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00710 } 00711 00712 DOMString HTMLOptGroupElement::label() const 00713 { 00714 if(!impl) return DOMString(); 00715 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL); 00716 } 00717 00718 void HTMLOptGroupElement::setLabel( const DOMString &value ) 00719 { 00720 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value); 00721 } 00722 00723 // -------------------------------------------------------------------------- 00724 00725 HTMLSelectElement::HTMLSelectElement() : HTMLElement() 00726 { 00727 } 00728 00729 HTMLSelectElement::HTMLSelectElement(const HTMLSelectElement &other) : HTMLElement(other) 00730 { 00731 } 00732 00733 HTMLSelectElement::HTMLSelectElement(HTMLSelectElementImpl *impl) : HTMLElement(impl) 00734 { 00735 } 00736 00737 HTMLSelectElement &HTMLSelectElement::operator = (const Node &other) 00738 { 00739 assignOther( other, ID_SELECT ); 00740 return *this; 00741 } 00742 00743 HTMLSelectElement &HTMLSelectElement::operator = (const HTMLSelectElement &other) 00744 { 00745 HTMLElement::operator = (other); 00746 return *this; 00747 } 00748 00749 HTMLSelectElement::~HTMLSelectElement() 00750 { 00751 } 00752 00753 DOMString HTMLSelectElement::type() const 00754 { 00755 if(!impl) return DOMString(); 00756 return ((HTMLSelectElementImpl *)impl)->type(); 00757 } 00758 00759 long HTMLSelectElement::selectedIndex() const 00760 { 00761 if(!impl) return 0; 00762 return ((HTMLSelectElementImpl *)impl)->selectedIndex(); 00763 } 00764 00765 void HTMLSelectElement::setSelectedIndex( long _selectedIndex ) 00766 { 00767 if(impl) 00768 ((HTMLSelectElementImpl *)impl)->setSelectedIndex(_selectedIndex); 00769 } 00770 00771 DOMString HTMLSelectElement::value() const 00772 { 00773 if(!impl) return DOMString(); 00774 return static_cast<HTMLSelectElementImpl*>(impl)->value(); 00775 } 00776 00777 void HTMLSelectElement::setValue( const DOMString &value ) 00778 { 00779 if(!impl || value.isNull()) return; 00780 static_cast<HTMLSelectElementImpl*>(impl)->setValue(value.implementation()); 00781 } 00782 00783 long HTMLSelectElement::length() const 00784 { 00785 if(!impl) return 0; 00786 return ((HTMLSelectElementImpl *)impl)->length(); 00787 } 00788 00789 HTMLFormElement HTMLSelectElement::form() const 00790 { 00791 return Element::form(); 00792 } 00793 00794 HTMLCollection HTMLSelectElement::options() const 00795 { 00796 if(!impl) return HTMLCollection(); 00797 return HTMLCollection(impl, HTMLCollectionImpl::SELECT_OPTIONS); 00798 } 00799 00800 bool HTMLSelectElement::disabled() const 00801 { 00802 if(!impl) return 0; 00803 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00804 } 00805 00806 void HTMLSelectElement::setDisabled( bool _disabled ) 00807 { 00808 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00809 } 00810 00811 00812 bool HTMLSelectElement::multiple() const 00813 { 00814 if(!impl) return 0; 00815 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_MULTIPLE).isNull(); 00816 } 00817 00818 void HTMLSelectElement::setMultiple( bool _multiple ) 00819 { 00820 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_MULTIPLE, _multiple ? "" : 0); 00821 } 00822 00823 DOMString HTMLSelectElement::name() const 00824 { 00825 if(!impl) return DOMString(); 00826 return static_cast<HTMLSelectElementImpl* const>(impl)->name(); 00827 } 00828 00829 void HTMLSelectElement::setName( const DOMString &value ) 00830 { 00831 if(impl) static_cast<HTMLSelectElementImpl*>(impl)->setName(value); 00832 } 00833 00834 long HTMLSelectElement::size() const 00835 { 00836 if(!impl) return 0; 00837 return ((HTMLSelectElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt(); 00838 } 00839 00840 void HTMLSelectElement::setSize( long _size ) 00841 { 00842 00843 if(impl) { 00844 DOMString value(QString::number(_size)); 00845 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SIZE,value); 00846 } 00847 } 00848 00849 long HTMLSelectElement::tabIndex() const 00850 { 00851 if(!impl) return 0; 00852 return static_cast<ElementImpl*>(impl)->tabIndex(); 00853 } 00854 00855 void HTMLSelectElement::setTabIndex( long _tabIndex ) 00856 { 00857 if (!impl) return; 00858 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 00859 } 00860 00861 void HTMLSelectElement::add( const HTMLElement &element, const HTMLElement &before ) 00862 { 00863 if (!impl) 00864 throw DOMException(DOMException::NOT_FOUND_ERR); 00865 00866 int exceptioncode = 0; 00867 static_cast<HTMLSelectElementImpl*>(impl)->add( element, before, exceptioncode ); 00868 if ( exceptioncode ) 00869 throw DOMException( exceptioncode ); 00870 } 00871 00872 void HTMLSelectElement::remove( long index ) 00873 { 00874 if(impl) static_cast<HTMLSelectElementImpl*>(impl)->remove( index ); 00875 } 00876 00877 void HTMLSelectElement::blur( ) 00878 { 00879 if(impl) 00880 ((HTMLSelectElementImpl*)impl)->blur(); 00881 } 00882 00883 void HTMLSelectElement::focus( ) 00884 { 00885 if(impl) 00886 ((HTMLSelectElementImpl*)impl)->focus(); 00887 } 00888 00889 // -------------------------------------------------------------------------- 00890 00891 HTMLTextAreaElement::HTMLTextAreaElement() : HTMLElement() 00892 { 00893 } 00894 00895 HTMLTextAreaElement::HTMLTextAreaElement(const HTMLTextAreaElement &other) : HTMLElement(other) 00896 { 00897 } 00898 00899 HTMLTextAreaElement::HTMLTextAreaElement(HTMLTextAreaElementImpl *impl) : HTMLElement(impl) 00900 { 00901 } 00902 00903 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const Node &other) 00904 { 00905 assignOther( other, ID_TEXTAREA ); 00906 return *this; 00907 } 00908 00909 HTMLTextAreaElement &HTMLTextAreaElement::operator = (const HTMLTextAreaElement &other) 00910 { 00911 HTMLElement::operator = (other); 00912 return *this; 00913 } 00914 00915 HTMLTextAreaElement::~HTMLTextAreaElement() 00916 { 00917 } 00918 00919 DOMString HTMLTextAreaElement::defaultValue() const 00920 { 00921 if(!impl) return DOMString(); 00922 return ((HTMLTextAreaElementImpl *)impl)->defaultValue(); 00923 } 00924 00925 void HTMLTextAreaElement::setDefaultValue( const DOMString &value ) 00926 { 00927 if (impl) ((HTMLTextAreaElementImpl *)impl)->setDefaultValue(value); 00928 } 00929 00930 HTMLFormElement HTMLTextAreaElement::form() const 00931 { 00932 return Element::form(); 00933 } 00934 00935 DOMString HTMLTextAreaElement::accessKey() const 00936 { 00937 if(!impl) return DOMString(); 00938 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_ACCESSKEY); 00939 } 00940 00941 void HTMLTextAreaElement::setAccessKey( const DOMString &value ) 00942 { 00943 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ACCESSKEY, value); 00944 } 00945 00946 long HTMLTextAreaElement::cols() const 00947 { 00948 if(!impl) return 0; 00949 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_COLS).toInt(); 00950 } 00951 00952 void HTMLTextAreaElement::setCols( long _cols ) 00953 { 00954 00955 if(impl) { 00956 DOMString value(QString::number(_cols)); 00957 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_COLS,value); 00958 } 00959 } 00960 00961 bool HTMLTextAreaElement::disabled() const 00962 { 00963 if(!impl) return 0; 00964 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 00965 } 00966 00967 void HTMLTextAreaElement::setDisabled( bool _disabled ) 00968 { 00969 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 00970 } 00971 00972 DOMString HTMLTextAreaElement::name() const 00973 { 00974 if(!impl) return DOMString(); 00975 return static_cast<HTMLTextAreaElementImpl* const>(impl)->name(); 00976 } 00977 00978 void HTMLTextAreaElement::setName( const DOMString &value ) 00979 { 00980 if(impl) static_cast<HTMLTextAreaElementImpl*>(impl)->setName(value); 00981 } 00982 00983 bool HTMLTextAreaElement::readOnly() const 00984 { 00985 if(!impl) return 0; 00986 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_READONLY).isNull(); 00987 } 00988 00989 void HTMLTextAreaElement::setReadOnly( bool _readOnly ) 00990 { 00991 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_READONLY, _readOnly ? "" : 0); 00992 } 00993 00994 long HTMLTextAreaElement::rows() const 00995 { 00996 if(!impl) return 0; 00997 return ((HTMLTextAreaElementImpl *)impl)->getAttribute(ATTR_ROWS).toInt(); 00998 } 00999 01000 void HTMLTextAreaElement::setRows( long _rows ) 01001 { 01002 01003 if(impl) { 01004 DOMString value(QString::number(_rows)); 01005 static_cast<ElementImpl*>(impl)->setAttribute(ATTR_ROWS,value); 01006 } 01007 } 01008 01009 long HTMLTextAreaElement::tabIndex() const 01010 { 01011 if(!impl) return 0; 01012 return static_cast<ElementImpl*>(impl)->tabIndex(); 01013 } 01014 01015 void HTMLTextAreaElement::setTabIndex( long _tabIndex ) 01016 { 01017 if (!impl) return; 01018 static_cast<ElementImpl*>(impl)->setTabIndex(_tabIndex); 01019 } 01020 01021 DOMString HTMLTextAreaElement::type() const 01022 { 01023 if(!impl) return DOMString(); 01024 return ((HTMLTextAreaElementImpl *)impl)->type(); 01025 } 01026 01027 DOMString HTMLTextAreaElement::value() const 01028 { 01029 if(!impl) return DOMString(); 01030 return ((HTMLTextAreaElementImpl *)impl)->value(); 01031 } 01032 01033 void HTMLTextAreaElement::setValue( const DOMString &value ) 01034 { 01035 if(impl) ((HTMLTextAreaElementImpl *)impl)->setValue(value); 01036 } 01037 01038 void HTMLTextAreaElement::blur( ) 01039 { 01040 if(impl) 01041 ((HTMLTextAreaElementImpl*)impl)->blur(); 01042 } 01043 01044 void HTMLTextAreaElement::focus( ) 01045 { 01046 if(impl) 01047 ((HTMLTextAreaElementImpl*)impl)->focus(); 01048 } 01049 01050 void HTMLTextAreaElement::select( ) 01051 { 01052 if(impl) 01053 ((HTMLTextAreaElementImpl *)impl)->select( ); 01054 } 01055 01056 // -------------------------------------------------------------------------- 01057 01058 HTMLOptionElement::HTMLOptionElement() : HTMLElement() 01059 { 01060 } 01061 01062 HTMLOptionElement::HTMLOptionElement(const HTMLOptionElement &other) : HTMLElement(other) 01063 { 01064 } 01065 01066 HTMLOptionElement::HTMLOptionElement(HTMLOptionElementImpl *impl) : HTMLElement(impl) 01067 { 01068 } 01069 01070 HTMLOptionElement &HTMLOptionElement::operator = (const Node &other) 01071 { 01072 assignOther( other, ID_OPTION ); 01073 return *this; 01074 } 01075 01076 HTMLOptionElement &HTMLOptionElement::operator = (const HTMLOptionElement &other) 01077 { 01078 HTMLElement::operator = (other); 01079 return *this; 01080 } 01081 01082 HTMLOptionElement::~HTMLOptionElement() 01083 { 01084 } 01085 01086 HTMLFormElement HTMLOptionElement::form() const 01087 { 01088 return Element::form(); 01089 } 01090 01091 bool HTMLOptionElement::defaultSelected() const 01092 { 01093 if(!impl) return 0; 01094 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_SELECTED).isNull(); 01095 } 01096 01097 void HTMLOptionElement::setDefaultSelected( bool _defaultSelected ) 01098 { 01099 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_SELECTED, _defaultSelected ? "" : 0); 01100 } 01101 01102 DOMString HTMLOptionElement::text() const 01103 { 01104 if(!impl) return DOMString(); 01105 return ((HTMLOptionElementImpl *)impl)->text(); 01106 } 01107 01108 long HTMLOptionElement::index() const 01109 { 01110 if(!impl) return 0; 01111 return ((HTMLOptionElementImpl *)impl)->index(); 01112 } 01113 01114 void HTMLOptionElement::setIndex( long /*_index*/ ) 01115 { 01116 throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); 01117 } 01118 01119 bool HTMLOptionElement::disabled() const 01120 { 01121 if(!impl) return 0; 01122 return !static_cast<ElementImpl*>(impl)->getAttribute(ATTR_DISABLED).isNull(); 01123 } 01124 01125 void HTMLOptionElement::setDisabled( bool _disabled ) 01126 { 01127 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_DISABLED, _disabled ? "" : 0); 01128 } 01129 01130 DOMString HTMLOptionElement::label() const 01131 { 01132 if(!impl) return DOMString(); 01133 return static_cast<ElementImpl*>(impl)->getAttribute(ATTR_LABEL); 01134 } 01135 01136 void HTMLOptionElement::setLabel( const DOMString &value ) 01137 { 01138 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_LABEL, value); 01139 } 01140 01141 bool HTMLOptionElement::selected() const 01142 { 01143 if(!impl) return 0; 01144 return ((HTMLOptionElementImpl *)impl)->selected(); 01145 } 01146 01147 void HTMLOptionElement::setSelected(bool _selected) { 01148 if(!impl) return; 01149 ((HTMLOptionElementImpl *)impl)->setSelected(_selected); 01150 } 01151 01152 DOMString HTMLOptionElement::value() const 01153 { 01154 if(!impl) return DOMString(); 01155 return static_cast<HTMLOptionElementImpl*>(impl)->value(); 01156 } 01157 01158 void HTMLOptionElement::setValue( const DOMString &value ) 01159 { 01160 if(impl) static_cast<HTMLOptionElementImpl*>(impl)->setValue(value.implementation()); 01161 } 01162 01163 // ----------------------------------------------------------------------------- 01164 01165 HTMLIsIndexElement::HTMLIsIndexElement() : HTMLElement() 01166 { 01167 } 01168 01169 HTMLIsIndexElement::HTMLIsIndexElement(const HTMLIsIndexElement &other) : HTMLElement(other) 01170 { 01171 } 01172 01173 HTMLIsIndexElement::HTMLIsIndexElement(HTMLIsIndexElementImpl *impl) : HTMLElement(impl) 01174 { 01175 } 01176 01177 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const Node &other) 01178 { 01179 assignOther( other, ID_ISINDEX ); 01180 return *this; 01181 } 01182 01183 HTMLIsIndexElement &HTMLIsIndexElement::operator = (const HTMLIsIndexElement &other) 01184 { 01185 HTMLElement::operator = (other); 01186 return *this; 01187 } 01188 01189 HTMLIsIndexElement::~HTMLIsIndexElement() 01190 { 01191 } 01192 01193 HTMLFormElement HTMLIsIndexElement::form() const 01194 { 01195 return Element::form(); 01196 } 01197 01198 DOMString HTMLIsIndexElement::prompt() const 01199 { 01200 if(!impl) return DOMString(); 01201 return static_cast<HTMLIsIndexElementImpl*>(impl)->prompt(); 01202 } 01203 01204 void HTMLIsIndexElement::setPrompt( const DOMString &value ) 01205 { 01206 if(impl) static_cast<HTMLIsIndexElementImpl*>(impl)->setPrompt(value); 01207 }
KDE Logo
This file is part of the documentation for khtml Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:44:53 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003