# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# html_image.cpp

    00001
    00023 // --------------------------------------------------------------------------
    00024
    00025 #include "dom/dom_doc.h"
    00026 #include "dom/html_image.h"
    00027 #include "dom/html_misc.h"
    00028
    00029 #include "html/html_imageimpl.h"
    00030 #include "html/html_miscimpl.h"
    00031 #include "misc/htmlhashes.h"
    00032 #include "xml/dom_docimpl.h"
    00033
    00034 using namespace DOM;
    00035
    00036 HTMLAreaElement::HTMLAreaElement() : HTMLElement()
    00037 {
    00038 }
    00039
    00040 HTMLAreaElement::HTMLAreaElement(const HTMLAreaElement &other) : HTMLElement(other)
    00041 {
    00042 }
    00043
    00044 HTMLAreaElement::HTMLAreaElement(HTMLAreaElementImpl *impl) : HTMLElement(impl)
    00045 {
    00046 }
    00047
    00048 HTMLAreaElement &HTMLAreaElement::operator = (const Node &other)
    00049 {
    00050     assignOther( other, ID_AREA );
    00051     return *this;
    00052 }
    00053
    00054 HTMLAreaElement &HTMLAreaElement::operator = (const HTMLAreaElement &other)
    00055 {
    00056     HTMLElement::operator = (other);
    00057     return *this;
    00058 }
    00059
    00060 HTMLAreaElement::~HTMLAreaElement()
    00061 {
    00062 }
    00063
    00064 DOMString HTMLAreaElement::accessKey() const
    00065 {
    00066     if(!impl) return DOMString();
    00067     return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
    00068 }
    00069
    00070 void HTMLAreaElement::setAccessKey( const DOMString &value )
    00071 {
    00072     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
    00073 }
    00074
    00075 DOMString HTMLAreaElement::alt() const
    00076 {
    00077     if(!impl) return DOMString();
    00078     return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
    00079 }
    00080
    00081 void HTMLAreaElement::setAlt( const DOMString &value )
    00082 {
    00083     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
    00084 }
    00085
    00086 DOMString HTMLAreaElement::coords() const
    00087 {
    00088     if(!impl) return DOMString();
    00089     return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS);
    00090 }
    00091
    00092 void HTMLAreaElement::setCoords( const DOMString &value )
    00093 {
    00094     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value);
    00095 }
    00096
    00097 DOMString HTMLAreaElement::href() const
    00098 {
    00099     if(!impl) return DOMString();
    00100     DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF);
    00101     return href.length() ? impl->getDocument()->completeURL(href.string()) : href;
    00102 }
    00103
    00104 void HTMLAreaElement::setHref( const DOMString &value )
    00105 {
    00106     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
    00107 }
    00108
    00109 bool HTMLAreaElement::noHref() const
    00110 {
    00111     if(!impl) return 0;
    00112     return !((ElementImpl *)impl)->getAttribute(ATTR_NOHREF).isNull();
    00113 }
    00114
    00115 void HTMLAreaElement::setNoHref( bool _noHref )
    00116 {
    00117     if(impl)
    00118     {
    00119         DOMString str;
    00120         if( _noHref )
    00121             str = "";
    00122         ((ElementImpl *)impl)->setAttribute(ATTR_NOHREF, str);
    00123     }
    00124 }
    00125
    00126 DOMString HTMLAreaElement::shape() const
    00127 {
    00128     if(!impl) return DOMString();
    00129     return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE);
    00130 }
    00131
    00132 void HTMLAreaElement::setShape( const DOMString &value )
    00133 {
    00134     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value);
    00135 }
    00136
    00137 long HTMLAreaElement::tabIndex() const
    00138 {
    00139     if(!impl) return 0;
    00140     return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt();
    00141 }
    00142
    00143 void HTMLAreaElement::setTabIndex( long _tabIndex )
    00144 {
    00145     if(impl) {
    00146         DOMString value(QString::number(_tabIndex));
    00147         ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value);
    00148     }
    00149 }
    00150
    00151 DOMString HTMLAreaElement::target() const
    00152 {
    00153     if(!impl) return DOMString();
    00154     return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
    00155 }
    00156
    00157 void HTMLAreaElement::setTarget( const DOMString &value )
    00158 {
    00159     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
    00160 }
    00161
    00162 // --------------------------------------------------------------------------
    00163
    00164 HTMLImageElement::HTMLImageElement() : HTMLElement()
    00165 {
    00166 }
    00167
    00168 HTMLImageElement::HTMLImageElement(const HTMLImageElement &other) : HTMLElement(other)
    00169 {
    00170 }
    00171
    00172 HTMLImageElement::HTMLImageElement(HTMLImageElementImpl *impl) : HTMLElement(impl)
    00173 {
    00174 }
    00175
    00176 HTMLImageElement &HTMLImageElement::operator = (const Node &other)
    00177 {
    00178     assignOther( other, ID_IMG );
    00179     return *this;
    00180 }
    00181
    00182 HTMLImageElement &HTMLImageElement::operator = (const HTMLImageElement &other)
    00183 {
    00184     HTMLElement::operator = (other);
    00185     return *this;
    00186 }
    00187
    00188 HTMLImageElement::~HTMLImageElement()
    00189 {
    00190 }
    00191
    00192 DOMString HTMLImageElement::name() const
    00193 {
    00194     if(!impl) return DOMString();
    00195     return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
    00196 }
    00197
    00198 void HTMLImageElement::setName( const DOMString &value )
    00199 {
    00200     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
    00201 }
    00202
    00203 DOMString HTMLImageElement::align() const
    00204 {
    00205     if(!impl) return DOMString();
    00206     return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
    00207 }
    00208
    00209 void HTMLImageElement::setAlign( const DOMString &value )
    00210 {
    00211     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
    00212 }
    00213
    00214 DOMString HTMLImageElement::alt() const
    00215 {
    00216     if(!impl) return DOMString();
    00217     return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
    00218 }
    00219
    00220 void HTMLImageElement::setAlt( const DOMString &value )
    00221 {
    00222     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
    00223 }
    00224
    00225 long HTMLImageElement::border() const
    00226 {
    00227     if(!impl) return 0;
    00228     // ### return value in pixels
    00229     return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER).toInt();
    00230 }
    00231
    00232 void HTMLImageElement::setBorder( long value )
    00233 {
    00234     if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, QString::number(value));
    00235 }
    00236
    00237 DOMString HTMLImageElement::getBorder() const
    00238 {
    00239     if(!impl) return DOMString();
    00240     return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER);
    00241 }
    00242
    00243 void HTMLImageElement::setBorder( const DOMString& value )
    00244 {
    00245     if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, value);
    00246 }
    00247
    00248
    00249 long HTMLImageElement::height() const
    00250 {
    00251     if(!impl) return 0;
    00252     return static_cast<HTMLImageElementImpl*>(impl)->height();
    00253 }
    00254
    00255 void HTMLImageElement::setHeight( long value )
    00256 {
    00257     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, QString::number(value));
    00258 }
    00259
    00260 long HTMLImageElement::hspace() const
    00261 {
    00262     if(!impl) return 0;
    00263     // ### return actual value
    00264     return ((ElementImpl *)impl)->getAttribute(ATTR_HSPACE).toInt();
    00265 }
    00266
    00267 void HTMLImageElement::setHspace( long value )
    00268 {
    00269     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HSPACE, QString::number(value));
    00270 }
    00271
    00272 bool HTMLImageElement::isMap() const
    00273 {
    00274     if(!impl) return 0;
    00275     return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
    00276 }
    00277
    00278 void HTMLImageElement::setIsMap( bool _isMap )
    00279 {
    00280     if(impl)
    00281     {
    00282         DOMString str;
    00283         if( _isMap )
    00284             str = "";
    00285         ((ElementImpl *)impl)->setAttribute(ATTR_ISMAP, str);
    00286     }
    00287 }
    00288
    00289 DOMString HTMLImageElement::longDesc() const
    00290 {
    00291     if(!impl) return DOMString();
    00292     return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
    00293 }
    00294
    00295 void HTMLImageElement::setLongDesc( const DOMString &value )
    00296 {
    00297     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
    00298 }
    00299
    00300 DOMString HTMLImageElement::src() const
    00301 {
    00302     if(!impl) return DOMString();
    00303     DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC);
    00304     // ### not sure if we're supposed to do the completion
    00305     if ( !s.isEmpty() )
    00306         s = ownerDocument().completeURL( s );
    00307     return s;
    00308 }
    00309
    00310 void HTMLImageElement::setSrc( const DOMString &value )
    00311 {
    00312     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
    00313 }
    00314
    00315 DOMString HTMLImageElement::useMap() const
    00316 {
    00317     if(!impl) return DOMString();
    00318     return ((ElementImpl *)impl)->getAttribute(ATTR_USEMAP);
    00319 }
    00320
    00321 void HTMLImageElement::setUseMap( const DOMString &value )
    00322 {
    00323     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_USEMAP, value);
    00324 }
    00325
    00326 long HTMLImageElement::vspace() const
    00327 {
    00328     if(!impl) return 0;
    00329     // ### return actual vspace
    00330     return ((ElementImpl *)impl)->getAttribute(ATTR_VSPACE).toInt();
    00331 }
    00332
    00333 void HTMLImageElement::setVspace( long value )
    00334 {
    00335     if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VSPACE, QString::number(value));
    00336 }
    00337
    00338 long HTMLImageElement::width() const
    00339 {
    00340     if(!impl) return 0;
    00341     return static_cast<HTMLImageElementImpl*>(impl)->width();
    00342 }
    00343
    00344 void HTMLImageElement::setWidth( long value )
    00345 {
    00346     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, QString::number(value));
    00347 }
    00348
    00349 // --------------------------------------------------------------------------
    00350
    00351 HTMLMapElement::HTMLMapElement() : HTMLElement()
    00352 {
    00353 }
    00354
    00355 HTMLMapElement::HTMLMapElement(const HTMLMapElement &other) : HTMLElement(other)
    00356 {
    00357 }
    00358
    00359 HTMLMapElement::HTMLMapElement(HTMLMapElementImpl *impl) : HTMLElement(impl)
    00360 {
    00361 }
    00362
    00363 HTMLMapElement &HTMLMapElement::operator = (const Node &other)
    00364 {
    00365     assignOther( other, ID_MAP );
    00366     return *this;
    00367 }
    00368
    00369 HTMLMapElement &HTMLMapElement::operator = (const HTMLMapElement &other)
    00370 {
    00371     HTMLElement::operator = (other);
    00372     return *this;
    00373 }
    00374
    00375 HTMLMapElement::~HTMLMapElement()
    00376 {
    00377 }
    00378
    00379 HTMLCollection HTMLMapElement::areas() const
    00380 {
    00381     if(!impl) return HTMLCollection();
    00382     return HTMLCollection(impl, HTMLCollectionImpl::MAP_AREAS);
    00383 }
    00384
    00385 DOMString HTMLMapElement::name() const
    00386 {
    00387     if(!impl) return DOMString();
    00388     return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
    00389 }
    00390
    00391 void HTMLMapElement::setName( const DOMString &value )
    00392 {
    00393     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
    00394 }
    00395

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:54 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001