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

KHTML

  • khtml
  • dom
html_image.cpp
Go to the documentation of this file.
1
22// --------------------------------------------------------------------------
23
24#include "html_image.h"
25#include "dom_doc.h"
26#include "html_misc.h"
27
28#include <html/html_imageimpl.h>
29#include <html/html_miscimpl.h>
30#include <xml/dom_docimpl.h>
31
32using namespace DOM;
33
34HTMLAreaElement::HTMLAreaElement() : HTMLElement()
35{
36}
37
38HTMLAreaElement::HTMLAreaElement(const HTMLAreaElement &other) : HTMLElement(other)
39{
40}
41
42HTMLAreaElement::HTMLAreaElement(HTMLAreaElementImpl *impl) : HTMLElement(impl)
43{
44}
45
46HTMLAreaElement &HTMLAreaElement::operator = (const Node &other)
47{
48 assignOther( other, ID_AREA );
49 return *this;
50}
51
52HTMLAreaElement &HTMLAreaElement::operator = (const HTMLAreaElement &other)
53{
54 HTMLElement::operator = (other);
55 return *this;
56}
57
58HTMLAreaElement::~HTMLAreaElement()
59{
60}
61
62DOMString HTMLAreaElement::accessKey() const
63{
64 if(!impl) return DOMString();
65 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
66}
67
68void HTMLAreaElement::setAccessKey( const DOMString &value )
69{
70 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
71}
72
73DOMString HTMLAreaElement::alt() const
74{
75 if(!impl) return DOMString();
76 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
77}
78
79void HTMLAreaElement::setAlt( const DOMString &value )
80{
81 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
82}
83
84DOMString HTMLAreaElement::coords() const
85{
86 if(!impl) return DOMString();
87 return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS);
88}
89
90void HTMLAreaElement::setCoords( const DOMString &value )
91{
92 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value);
93}
94
95DOMString HTMLAreaElement::href() const
96{
97 if(!impl) return DOMString();
98 const DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF).parsedUrl();
99 return !href.isNull() ? impl->document()->completeURL(href.string()) : href;
100}
101
102void HTMLAreaElement::setHref( const DOMString &value )
103{
104 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
105}
106
107bool HTMLAreaElement::noHref() const
108{
109 if(!impl) return 0;
110 return !((ElementImpl *)impl)->getAttribute(ATTR_NOHREF).isNull();
111}
112
113void HTMLAreaElement::setNoHref( bool _noHref )
114{
115 if(impl)
116 {
117 DOMString str;
118 if( _noHref )
119 str = "";
120 ((ElementImpl *)impl)->setAttribute(ATTR_NOHREF, str);
121 }
122}
123
124DOMString HTMLAreaElement::shape() const
125{
126 if(!impl) return DOMString();
127 return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE);
128}
129
130void HTMLAreaElement::setShape( const DOMString &value )
131{
132 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value);
133}
134
135long HTMLAreaElement::tabIndex() const
136{
137 if(!impl) return 0;
138 return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt();
139}
140
141void HTMLAreaElement::setTabIndex( long _tabIndex )
142{
143 if(impl) {
144 DOMString value(QString::number(_tabIndex));
145 ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value);
146 }
147}
148
149DOMString HTMLAreaElement::target() const
150{
151 if(!impl) return DOMString();
152 return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
153}
154
155void HTMLAreaElement::setTarget( const DOMString &value )
156{
157 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
158}
159
160// --------------------------------------------------------------------------
161
162HTMLImageElement::HTMLImageElement() : HTMLElement()
163{
164}
165
166HTMLImageElement::HTMLImageElement(const HTMLImageElement &other) : HTMLElement(other)
167{
168}
169
170HTMLImageElement::HTMLImageElement(HTMLImageElementImpl *impl) : HTMLElement(impl)
171{
172}
173
174HTMLImageElement &HTMLImageElement::operator = (const Node &other)
175{
176 assignOther( other, ID_IMG );
177 return *this;
178}
179
180HTMLImageElement &HTMLImageElement::operator = (const HTMLImageElement &other)
181{
182 HTMLElement::operator = (other);
183 return *this;
184}
185
186HTMLImageElement::~HTMLImageElement()
187{
188}
189
190DOMString HTMLImageElement::name() const
191{
192 if(!impl) return DOMString();
193 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
194}
195
196void HTMLImageElement::setName( const DOMString &value )
197{
198 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
199}
200
201DOMString HTMLImageElement::align() const
202{
203 if(!impl) return DOMString();
204 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
205}
206
207void HTMLImageElement::setAlign( const DOMString &value )
208{
209 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
210}
211
212DOMString HTMLImageElement::alt() const
213{
214 if(!impl) return DOMString();
215 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
216}
217
218void HTMLImageElement::setAlt( const DOMString &value )
219{
220 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
221}
222
223#ifndef KDE_NO_DEPRECATED
224long HTMLImageElement::border() const
225{
226 if(!impl) return 0;
227 // ### return value in pixels
228 return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER).toInt();
229}
230#endif
231
232#ifndef KDE_NO_DEPRECATED
233void HTMLImageElement::setBorder( long value )
234{
235 if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, QString::number(value));
236}
237#endif
238
239DOMString HTMLImageElement::getBorder() const
240{
241 if(!impl) return DOMString();
242 return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER);
243}
244
245void HTMLImageElement::setBorder( const DOMString& value )
246{
247 if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, value);
248}
249
250
251long HTMLImageElement::height() const
252{
253 if(!impl) return 0;
254 return static_cast<HTMLImageElementImpl*>(impl)->height();
255}
256
257void HTMLImageElement::setHeight( long value )
258{
259 if(impl) ((HTMLImageElementImpl *)impl)->setHeight(value);
260}
261
262long HTMLImageElement::hspace() const
263{
264 if(!impl) return 0;
265 // ### return actual value
266 return ((ElementImpl *)impl)->getAttribute(ATTR_HSPACE).toInt();
267}
268
269void HTMLImageElement::setHspace( long value )
270{
271 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HSPACE, QString::number(value));
272}
273
274bool HTMLImageElement::isMap() const
275{
276 if(!impl) return 0;
277 return !((ElementImpl *)impl)->getAttribute(ATTR_ISMAP).isNull();
278}
279
280void HTMLImageElement::setIsMap( bool _isMap )
281{
282 if(impl)
283 {
284 DOMString str;
285 if( _isMap )
286 str = "";
287 ((ElementImpl *)impl)->setAttribute(ATTR_ISMAP, str);
288 }
289}
290
291DOMString HTMLImageElement::longDesc() const
292{
293 if(!impl) return DOMString();
294 return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
295}
296
297void HTMLImageElement::setLongDesc( const DOMString &value )
298{
299 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
300}
301
302DOMString HTMLImageElement::src() const
303{
304 if(!impl) return DOMString();
305 const DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC).parsedUrl();
306 return !s.isNull() ? impl->document()->completeURL(s.string()) : s;
307}
308
309void HTMLImageElement::setSrc( const DOMString &value )
310{
311 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
312}
313
314DOMString HTMLImageElement::useMap() const
315{
316 if(!impl) return DOMString();
317 return ((ElementImpl *)impl)->getAttribute(ATTR_USEMAP);
318}
319
320void HTMLImageElement::setUseMap( const DOMString &value )
321{
322 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_USEMAP, value);
323}
324
325long HTMLImageElement::vspace() const
326{
327 if(!impl) return 0;
328 // ### return actual vspace
329 return ((ElementImpl *)impl)->getAttribute(ATTR_VSPACE).toInt();
330}
331
332void HTMLImageElement::setVspace( long value )
333{
334 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VSPACE, QString::number(value));
335}
336
337long HTMLImageElement::width() const
338{
339 if(!impl) return 0;
340 return static_cast<HTMLImageElementImpl*>(impl)->width();
341}
342
343void HTMLImageElement::setWidth( long value )
344{
345 if(impl) ((HTMLImageElementImpl *)impl)->setWidth(value);
346}
347
348long HTMLImageElement::x() const
349{
350 if (impl) return static_cast<const HTMLImageElementImpl*>(impl)->x();
351 return 0;
352}
353
354long HTMLImageElement::y() const
355{
356 if (impl) return static_cast<const HTMLImageElementImpl*>(impl)->y();
357 return 0;
358}
359
360// --------------------------------------------------------------------------
361
362HTMLMapElement::HTMLMapElement() : HTMLElement()
363{
364}
365
366HTMLMapElement::HTMLMapElement(const HTMLMapElement &other) : HTMLElement(other)
367{
368}
369
370HTMLMapElement::HTMLMapElement(HTMLMapElementImpl *impl) : HTMLElement(impl)
371{
372}
373
374HTMLMapElement &HTMLMapElement::operator = (const Node &other)
375{
376 assignOther( other, ID_MAP );
377 return *this;
378}
379
380HTMLMapElement &HTMLMapElement::operator = (const HTMLMapElement &other)
381{
382 HTMLElement::operator = (other);
383 return *this;
384}
385
386HTMLMapElement::~HTMLMapElement()
387{
388}
389
390HTMLCollection HTMLMapElement::areas() const
391{
392 if(!impl) return HTMLCollection();
393 return HTMLCollection(((HTMLMapElementImpl*)impl)->areas());
394}
395
396DOMString HTMLMapElement::name() const
397{
398 if(!impl) return DOMString();
399 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
400}
401
402void HTMLMapElement::setName( const DOMString &value )
403{
404 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
405}
406
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::DOMString::parsedUrl
DOMString parsedUrl() const
Return a parsed url.
Definition: dom_string.cpp:300
DOM::DOMString::toInt
int toInt() const
Definition: dom_string.cpp:243
DOM::DOMString::isNull
bool isNull() const
Definition: dom_string.h:121
DOM::DOMString::string
QString string() const
Definition: dom_string.cpp:236
DOM::Element::getAttribute
DOMString getAttribute(const DOMString &name)
Retrieves an attribute value by name.
Definition: dom_element.cpp:147
DOM::Element::setAttribute
void setAttribute(const DOMString &name, const DOMString &value)
Adds a new attribute.
Definition: dom_element.cpp:158
DOM::HTMLAreaElement
Client-side image map area definition.
Definition: html_image.h:48
DOM::HTMLAreaElement::setHref
void setHref(const DOMString &)
see href
Definition: html_image.cpp:102
DOM::HTMLAreaElement::tabIndex
long tabIndex() const
Index that represents the element's position in the tabbing order.
Definition: html_image.cpp:135
DOM::HTMLAreaElement::coords
DOMString coords() const
Comma-separated list of lengths, defining an active region geometry.
Definition: html_image.cpp:84
DOM::HTMLAreaElement::~HTMLAreaElement
~HTMLAreaElement()
Definition: html_image.cpp:58
DOM::HTMLAreaElement::alt
DOMString alt() const
Alternate text for user agents not rendering the normal content of this element.
Definition: html_image.cpp:73
DOM::HTMLAreaElement::noHref
bool noHref() const
Specifies that this area is inactive, i.e., has no associated action.
Definition: html_image.cpp:107
DOM::HTMLAreaElement::href
DOMString href() const
The URI of the linked resource.
Definition: html_image.cpp:95
DOM::HTMLAreaElement::setAlt
void setAlt(const DOMString &)
see alt
Definition: html_image.cpp:79
DOM::HTMLAreaElement::shape
DOMString shape() const
The shape of the active area.
Definition: html_image.cpp:124
DOM::HTMLAreaElement::setNoHref
void setNoHref(bool)
see noHref
Definition: html_image.cpp:113
DOM::HTMLAreaElement::target
DOMString target() const
Frame to render the resource in.
Definition: html_image.cpp:149
DOM::HTMLAreaElement::setAccessKey
void setAccessKey(const DOMString &)
see accessKey
Definition: html_image.cpp:68
DOM::HTMLAreaElement::operator=
HTMLAreaElement & operator=(const HTMLAreaElement &other)
Definition: html_image.cpp:52
DOM::HTMLAreaElement::setShape
void setShape(const DOMString &)
see shape
Definition: html_image.cpp:130
DOM::HTMLAreaElement::HTMLAreaElement
HTMLAreaElement()
Definition: html_image.cpp:34
DOM::HTMLAreaElement::setTabIndex
void setTabIndex(long)
see tabIndex
Definition: html_image.cpp:141
DOM::HTMLAreaElement::setTarget
void setTarget(const DOMString &)
see target
Definition: html_image.cpp:155
DOM::HTMLAreaElement::accessKey
DOMString accessKey() const
A single character access key to give access to the form control.
Definition: html_image.cpp:62
DOM::HTMLAreaElement::setCoords
void setCoords(const DOMString &)
see coords
Definition: html_image.cpp:90
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:131
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:70
DOM::HTMLElement::assignOther
void assignOther(const Node &other, int elementId)
Definition: html_element.cpp:176
DOM::HTMLElement::operator=
HTMLElement & operator=(const HTMLElement &other)
Definition: html_element.cpp:41
DOM::HTMLImageElement
Embedded image.
Definition: html_image.h:186
DOM::HTMLImageElement::setName
void setName(const DOMString &)
see name
Definition: html_image.cpp:196
DOM::HTMLImageElement::border
long border() const
Definition: html_image.cpp:224
DOM::HTMLImageElement::~HTMLImageElement
~HTMLImageElement()
Definition: html_image.cpp:186
DOM::HTMLImageElement::vspace
long vspace() const
Vertical space above and below this image.
Definition: html_image.cpp:325
DOM::HTMLImageElement::getBorder
DOMString getBorder() const
Width of border around image.
Definition: html_image.cpp:239
DOM::HTMLImageElement::setWidth
void setWidth(long)
see width
Definition: html_image.cpp:343
DOM::HTMLImageElement::useMap
DOMString useMap() const
Use client-side image map.
Definition: html_image.cpp:314
DOM::HTMLImageElement::setHeight
void setHeight(long)
see height
Definition: html_image.cpp:257
DOM::HTMLImageElement::operator=
HTMLImageElement & operator=(const HTMLImageElement &other)
Definition: html_image.cpp:180
DOM::HTMLImageElement::width
long width() const
Override width.
Definition: html_image.cpp:337
DOM::HTMLImageElement::setAlign
void setAlign(const DOMString &)
see align
Definition: html_image.cpp:207
DOM::HTMLImageElement::align
DOMString align() const
Aligns this object (vertically or horizontally) with respect to its surrounding text.
Definition: html_image.cpp:201
DOM::HTMLImageElement::setLongDesc
void setLongDesc(const DOMString &)
see longDesc
Definition: html_image.cpp:297
DOM::HTMLImageElement::setHspace
void setHspace(long)
see hspace
Definition: html_image.cpp:269
DOM::HTMLImageElement::setSrc
void setSrc(const DOMString &)
see src
Definition: html_image.cpp:309
DOM::HTMLImageElement::y
long y() const
Definition: html_image.cpp:354
DOM::HTMLImageElement::setBorder
void setBorder(const DOMString &)
see border
Definition: html_image.cpp:245
DOM::HTMLImageElement::hspace
long hspace() const
Horizontal space to the left and right of this image.
Definition: html_image.cpp:262
DOM::HTMLImageElement::alt
DOMString alt() const
Alternate text for user agents not rendering the normal content of this element.
Definition: html_image.cpp:212
DOM::HTMLImageElement::longDesc
DOMString longDesc() const
URI designating a long description of this image or frame.
Definition: html_image.cpp:291
DOM::HTMLImageElement::setIsMap
void setIsMap(bool)
see isMap
Definition: html_image.cpp:280
DOM::HTMLImageElement::setVspace
void setVspace(long)
see vspace
Definition: html_image.cpp:332
DOM::HTMLImageElement::setAlt
void setAlt(const DOMString &)
see alt
Definition: html_image.cpp:218
DOM::HTMLImageElement::isMap
bool isMap() const
Use server-side image map.
Definition: html_image.cpp:274
DOM::HTMLImageElement::name
DOMString name() const
The name of the element (for backwards compatibility).
Definition: html_image.cpp:190
DOM::HTMLImageElement::setUseMap
void setUseMap(const DOMString &)
see useMap
Definition: html_image.cpp:320
DOM::HTMLImageElement::src
DOMString src() const
URI designating the source of this image.
Definition: html_image.cpp:302
DOM::HTMLImageElement::height
long height() const
Override height.
Definition: html_image.cpp:251
DOM::HTMLImageElement::HTMLImageElement
HTMLImageElement()
Definition: html_image.cpp:162
DOM::HTMLImageElement::x
long x() const
Nonstandard extension to DOM::ImgElement.
Definition: html_image.cpp:348
DOM::HTMLMapElement
Client-side image map.
Definition: html_image.h:398
DOM::HTMLMapElement::name
DOMString name() const
Names the map (for use with usemap ).
Definition: html_image.cpp:396
DOM::HTMLMapElement::operator=
HTMLMapElement & operator=(const HTMLMapElement &other)
Definition: html_image.cpp:380
DOM::HTMLMapElement::areas
HTMLCollection areas() const
The list of areas defined for the image map.
Definition: html_image.cpp:390
DOM::HTMLMapElement::~HTMLMapElement
~HTMLMapElement()
Definition: html_image.cpp:386
DOM::HTMLMapElement::HTMLMapElement
HTMLMapElement()
Definition: html_image.cpp:362
DOM::HTMLMapElement::setName
void setName(const DOMString &)
see name
Definition: html_image.cpp:402
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:271
DOM::Node::impl
NodeImpl * impl
Definition: dom_node.h:948
dom_doc.h
html_image.h
html_misc.h
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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.14.38 API Reference

Skip menu "kdelibs-4.14.38 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