khtml Library API Documentation

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