# khtml Library API Documentation

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

# html_image.cpp

    00001
    00022 // --------------------------------------------------------------------------
    00023
    00024 #include "dom/dom_doc.h"
    00025 #include "dom/html_image.h"
    00026 #include "dom/html_misc.h"
    00027
    00028 #include "html/html_imageimpl.h"
    00029 #include "html/html_miscimpl.h"
    00030 #include "misc/htmlhashes.h"
    00031 #include "xml/dom_docimpl.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     DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF);
    00100     return !href.isNull() ? impl->getDocument()->completeURL(href.string()) : href;
    00101 }
    00102
    00103 void HTMLAreaElement::setHref( const DOMString &value )
    00104 {
    00105     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
    00106 }
    00107
    00108 bool HTMLAreaElement::noHref() const
    00109 {
    00110     if(!impl) return 0;
    00111     return !((ElementImpl *)impl)->getAttribute(ATTR_NOHREF).isNull();
    00112 }
    00113
    00114 void HTMLAreaElement::setNoHref( bool _noHref )
    00115 {
    00116     if(impl)
    00117     {
    00118     DOMString str;
    00119     if( _noHref )
    00120         str = "";
    00121     ((ElementImpl *)impl)->setAttribute(ATTR_NOHREF, str);
    00122     }
    00123 }
    00124
    00125 DOMString HTMLAreaElement::shape() const
    00126 {
    00127     if(!impl) return DOMString();
    00128     return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE);
    00129 }
    00130
    00131 void HTMLAreaElement::setShape( const DOMString &value )
    00132 {
    00133     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value);
    00134 }
    00135
    00136 long HTMLAreaElement::tabIndex() const
    00137 {
    00138     if(!impl) return 0;
    00139     return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt();
    00140 }
    00141
    00142 void HTMLAreaElement::setTabIndex( long _tabIndex )
    00143 {
    00144     if(impl) {
    00145     DOMString value(QString::number(_tabIndex));
    00146         ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value);
    00147     }
    00148 }
    00149
    00150 DOMString HTMLAreaElement::target() const
    00151 {
    00152     if(!impl) return DOMString();
    00153     return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
    00154 }
    00155
    00156 void HTMLAreaElement::setTarget( const DOMString &value )
    00157 {
    00158     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
    00159 }
    00160
    00161 // --------------------------------------------------------------------------
    00162
    00163 HTMLImageElement::HTMLImageElement() : HTMLElement()
    00164 {
    00165 }
    00166
    00167 HTMLImageElement::HTMLImageElement(const HTMLImageElement &other) : HTMLElement(other)
    00168 {
    00169 }
    00170
    00171 HTMLImageElement::HTMLImageElement(HTMLImageElementImpl *impl) : HTMLElement(impl)
    00172 {
    00173 }
    00174
    00175 HTMLImageElement &HTMLImageElement::operator = (const Node &other)
    00176 {
    00177     assignOther( other, ID_IMG );
    00178     return *this;
    00179 }
    00180
    00181 HTMLImageElement &HTMLImageElement::operator = (const HTMLImageElement &other)
    00182 {
    00183     HTMLElement::operator = (other);
    00184     return *this;
    00185 }
    00186
    00187 HTMLImageElement::~HTMLImageElement()
    00188 {
    00189 }
    00190
    00191 DOMString HTMLImageElement::name() const
    00192 {
    00193     if(!impl) return DOMString();
    00194     return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
    00195 }
    00196
    00197 void HTMLImageElement::setName( const DOMString &value )
    00198 {
    00199     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
    00200 }
    00201
    00202 DOMString HTMLImageElement::align() const
    00203 {
    00204     if(!impl) return DOMString();
    00205     return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
    00206 }
    00207
    00208 void HTMLImageElement::setAlign( const DOMString &value )
    00209 {
    00210     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
    00211 }
    00212
    00213 DOMString HTMLImageElement::alt() const
    00214 {
    00215     if(!impl) return DOMString();
    00216     return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
    00217 }
    00218
    00219 void HTMLImageElement::setAlt( const DOMString &value )
    00220 {
    00221     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
    00222 }
    00223
    00224 long HTMLImageElement::border() const
    00225 {
    00226     if(!impl) return 0;
    00227     // ### return value in pixels
    00228     return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER).toInt();
    00229 }
    00230
    00231 void HTMLImageElement::setBorder( long value )
    00232 {
    00233     if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, QString::number(value));
    00234 }
    00235
    00236 DOMString HTMLImageElement::getBorder() const
    00237 {
    00238     if(!impl) return DOMString();
    00239     return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER);
    00240 }
    00241
    00242 void HTMLImageElement::setBorder( const DOMString& value )
    00243 {
    00244     if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, value);
    00245 }
    00246
    00247
    00248 long HTMLImageElement::height() const
    00249 {
    00250     if(!impl) return 0;
    00251     return static_cast<HTMLImageElementImpl*>(impl)->height();
    00252 }
    00253
    00254 void HTMLImageElement::setHeight( long value )
    00255 {
    00256     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, QString::number(value));
    00257 }
    00258
    00259 long HTMLImageElement::hspace() const
    00260 {
    00261     if(!impl) return 0;
    00262     // ### return actual value
    00263     return ((ElementImpl *)impl)->getAttribute(ATTR_HSPACE).toInt();
    00264 }
    00265
    00266 void HTMLImageElement::setHspace( long value )
    00267 {
    00268     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HSPACE, QString::number(value));
    00269 }
    00270
    00271 bool HTMLImageElement::isMap() const
    00272 {
    00273     if(!impl) return 0;
    00274     return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
    00275 }
    00276
    00277 void HTMLImageElement::setIsMap( bool _isMap )
    00278 {
    00279     if(impl)
    00280     {
    00281     DOMString str;
    00282     if( _isMap )
    00283         str = "";
    00284     ((ElementImpl *)impl)->setAttribute(ATTR_ISMAP, str);
    00285     }
    00286 }
    00287
    00288 DOMString HTMLImageElement::longDesc() const
    00289 {
    00290     if(!impl) return DOMString();
    00291     return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
    00292 }
    00293
    00294 void HTMLImageElement::setLongDesc( const DOMString &value )
    00295 {
    00296     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
    00297 }
    00298
    00299 DOMString HTMLImageElement::src() const
    00300 {
    00301     if(!impl) return DOMString();
    00302     DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC);
    00303     return !s.isNull() ? impl->getDocument()->completeURL( s.string() ) : s;
    00304 }
    00305
    00306 void HTMLImageElement::setSrc( const DOMString &value )
    00307 {
    00308     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
    00309 }
    00310
    00311 DOMString HTMLImageElement::useMap() const
    00312 {
    00313     if(!impl) return DOMString();
    00314     return ((ElementImpl *)impl)->getAttribute(ATTR_USEMAP);
    00315 }
    00316
    00317 void HTMLImageElement::setUseMap( const DOMString &value )
    00318 {
    00319     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_USEMAP, value);
    00320 }
    00321
    00322 long HTMLImageElement::vspace() const
    00323 {
    00324     if(!impl) return 0;
    00325     // ### return actual vspace
    00326     return ((ElementImpl *)impl)->getAttribute(ATTR_VSPACE).toInt();
    00327 }
    00328
    00329 void HTMLImageElement::setVspace( long value )
    00330 {
    00331     if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VSPACE, QString::number(value));
    00332 }
    00333
    00334 long HTMLImageElement::width() const
    00335 {
    00336     if(!impl) return 0;
    00337     return static_cast<HTMLImageElementImpl*>(impl)->width();
    00338 }
    00339
    00340 void HTMLImageElement::setWidth( long value )
    00341 {
    00342     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, QString::number(value));
    00343 }
    00344
    00345 long HTMLImageElement::x() const
    00346 {
    00347     if (impl && impl->renderer()) {
    00348         int x = 0;
    00349         int y = 0;
    00350         impl->renderer()->absolutePosition(x,y);
    00351         return x;
    00352     }
    00353     return 0;
    00354 }
    00355
    00356 long HTMLImageElement::y() const
    00357 {
    00358     if (impl && impl->renderer()) {
    00359         int x = 0;
    00360         int y = 0;
    00361         impl->renderer()->absolutePosition(x,y);
    00362         return y;
    00363     }
    00364     return 0;
    00365 }
    00366
    00367 // --------------------------------------------------------------------------
    00368
    00369 HTMLMapElement::HTMLMapElement() : HTMLElement()
    00370 {
    00371 }
    00372
    00373 HTMLMapElement::HTMLMapElement(const HTMLMapElement &other) : HTMLElement(other)
    00374 {
    00375 }
    00376
    00377 HTMLMapElement::HTMLMapElement(HTMLMapElementImpl *impl) : HTMLElement(impl)
    00378 {
    00379 }
    00380
    00381 HTMLMapElement &HTMLMapElement::operator = (const Node &other)
    00382 {
    00383     assignOther( other, ID_MAP );
    00384     return *this;
    00385 }
    00386
    00387 HTMLMapElement &HTMLMapElement::operator = (const HTMLMapElement &other)
    00388 {
    00389     HTMLElement::operator = (other);
    00390     return *this;
    00391 }
    00392
    00393 HTMLMapElement::~HTMLMapElement()
    00394 {
    00395 }
    00396
    00397 HTMLCollection HTMLMapElement::areas() const
    00398 {
    00399     if(!impl) return HTMLCollection();
    00400     return HTMLCollection(impl, HTMLCollectionImpl::MAP_AREAS);
    00401 }
    00402
    00403 DOMString HTMLMapElement::name() const
    00404 {
    00405     if(!impl) return DOMString();
    00406     return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
    00407 }
    00408
    00409 void HTMLMapElement::setName( const DOMString &value )
    00410 {
    00411     if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
    00412 }
    00413

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:11 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003