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

KHTML

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

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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