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

khtml

  • khtml
  • 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 

khtml

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

khtml

Skip menu "khtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for khtml by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |