• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

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

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.1
This website is maintained by Timothy Pearson.