khtml Library API Documentation

render_box.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_box.h,v 1.57.2.3 2003/05/18 12:34:40 mueller Exp $
00023  */
00024 #ifndef RENDER_BOX_H
00025 #define RENDER_BOX_H
00026 
00027 #include "render_container.h"
00028 #include "misc/loader.h"
00029 
00030 namespace khtml {
00031     class CachedObject;
00032 
00033 class RenderBox : public RenderContainer
00034 {
00035 
00036 
00037 // combines ElemImpl & PosElImpl (all rendering objects are positioned)
00038 // should contain all border and padding handling
00039 
00040 public:
00041     RenderBox(DOM::NodeImpl* node);
00042     virtual ~RenderBox();
00043 
00044     virtual const char *renderName() const { return "RenderBox"; }
00045 
00046     virtual void setStyle(RenderStyle *style);
00047     virtual void paint(QPainter *p, int _x, int _y, int _w, int _h,
00048                        int _tx, int _ty);
00049 
00050     virtual void close();
00051 
00052     virtual short minWidth() const { return m_minWidth; }
00053     virtual short maxWidth() const { return m_maxWidth; }
00054 
00055     virtual short contentWidth() const;
00056     virtual int contentHeight() const;
00057 
00058     virtual bool absolutePosition(int &xPos, int &yPos, bool f = false);
00059 
00060     virtual void setPos( int xPos, int yPos );
00061 
00062     virtual int xPos() const { return m_x; }
00063     virtual int yPos() const { return m_y; }
00064     virtual short width() const;
00065     virtual int height() const;
00066 
00067     virtual short marginTop() const { return m_marginTop; }
00068     virtual short marginBottom() const { return m_marginBottom; }
00069     virtual short marginLeft() const { return m_marginLeft; }
00070     virtual short marginRight() const { return m_marginRight; }
00071 
00072     virtual void setWidth( int width ) { m_width = width; }
00073     virtual void setHeight( int height ) { m_height = height; }
00074 
00075     virtual void position(int x, int y, int from, int len, int width, bool reverse, bool firstLine, int);
00076 
00077     virtual int lowestPosition() const;
00078     virtual int rightmostPosition() const;
00079 
00080     virtual void repaint();
00081 
00082     virtual void repaintRectangle(int x, int y, int w, int h, bool f=false);
00083 
00084     virtual void setPixmap(const QPixmap &, const QRect&, CachedImage *);
00085 
00086     virtual short containingBlockWidth() const;
00087 
00088     virtual void calcWidth();
00089     virtual void calcHeight();
00090 
00091     virtual short calcReplacedWidth() const;
00092     virtual int   calcReplacedHeight() const;
00093 
00094     virtual int availableHeight() const;
00095 
00096     void calcVerticalMargins();
00097 
00098     void relativePositionOffset(int &tx, int &ty);
00099 
00100 protected:
00101     virtual void paintBoxDecorations(QPainter *p,int _x, int _y,
00102                                        int _w, int _h, int _tx, int _ty);
00103     void paintBackground(QPainter *p, const QColor &c, CachedImage *bg, int clipy, int cliph, int _tx, int _ty, int w, int h);
00104     void outlineBox(QPainter *p, int _tx, int _ty, const char *color = "red");
00105 
00106     virtual int borderTopExtra() { return 0; }
00107     virtual int borderBottomExtra() { return 0; }
00108 
00109     void calcAbsoluteHorizontal();
00110     void calcAbsoluteVertical();
00111 
00112     void calcHorizontalMargins(const Length& ml, const Length& mr, int cw);
00113 
00114     void calcClip(QPainter* p, int tx, int ty);
00115 
00116     // the actual height of the contents + borders + padding
00117     int m_height;
00118 
00119     int m_y;
00120 
00121     short m_x;
00122     short m_width;
00123 
00124     short m_marginTop;
00125     short m_marginBottom;
00126 
00127     short m_marginLeft;
00128     short m_marginRight;
00129 
00130     /*
00131      * the minimum width the element needs, to be able to render
00132      * its content without clipping
00133      */
00134     short m_minWidth;
00135     /* The maximum width the element can fill horizontally
00136      * ( = the width of the element with line breaking disabled)
00137      */
00138     short m_maxWidth;
00139 };
00140 
00141 
00142 } //namespace
00143 
00144 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:39 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001