khtml Library API Documentation

render_image.h

00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
00005  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  *
00022  * $Id: render_image.h,v 1.36.2.2 2003/01/13 22:04:49 mueller Exp $
00023  */
00024 #ifndef RENDER_IMAGE_H
00025 #define RENDER_IMAGE_H
00026 
00027 #include "html/dtd.h"
00028 #include "html/html_elementimpl.h"
00029 #include "rendering/render_replaced.h"
00030 #include "dom/dom_string.h"
00031 
00032 #include <qmap.h>
00033 #include <qpixmap.h>
00034 
00035 namespace khtml {
00036 
00037 class DocLoader;
00038 
00039 class RenderImage : public RenderReplaced
00040 {
00041 public:
00042     RenderImage(DOM::HTMLElementImpl *_element);
00043     virtual ~RenderImage();
00044 
00045     virtual const char *renderName() const { return "RenderImage"; }
00046 
00047     virtual bool isRendered() const { return true; }
00048 
00049     virtual void paintObject( QPainter *p, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int tx, int ty);
00050 
00051     virtual void layout();
00052 
00053     virtual void setPixmap( const QPixmap &, const QRect&, CachedImage *);
00054 
00055     QPixmap pixmap() const { return pix; }
00056     // don't even think about making this method virtual!
00057     DOM::HTMLElementImpl* element() const
00058     { return static_cast<DOM::HTMLElementImpl*>(RenderObject::element()); }
00059 
00060     bool complete() const;
00061 
00062     // hook to keep RendeObject::m_inline() up to date
00063     virtual void setStyle(RenderStyle *style);
00064     virtual void updateFromElement();
00065 
00066     virtual void notifyFinished(CachedObject *finishedObj);
00067     virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty);
00068 
00069     virtual short calcReplacedWidth() const;
00070     virtual int   calcReplacedHeight() const;
00071 
00072 private:
00073     /*
00074      * Pointer to the image
00075      * If this pointer is 0L, that means that the picture could not be loaded
00076      * for some strange reason or that the image is waiting to be downloaded
00077      * from the internet for example.
00078      */
00079 
00080     QPixmap pix;
00081 
00082     /*
00083      * Cache for images that need resizing
00084      */
00085     QPixmap resizeCache;
00086 
00087     // text to display as long as the image isn't available
00088     DOM::DOMString alt;
00089 
00090     CachedImage *image;
00091     bool berrorPic : 1;
00092     bool loadEventSent : 1;
00093 };
00094 
00095 
00096 }; //namespace
00097 
00098 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:42 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001