| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# table_layout.h

    00001 /*
    00002  * This file is part of the HTML rendering engine for KDE.
    00003  *
    00004  * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
    00005  *           (C) 2002 Dirk Mueller (mueller@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.
    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: table_layout.h,v 1.4.2.1 2003/05/18 12:34:40 mueller Exp $
    00023  */
    00024 #ifndef TABLE_LAYOUT_H
    00025 #define TABLE_LAYOUT_H
    00026
    00027 #include <qmemarray.h>
    00028 #include <misc/khtmllayout.h>
    00029
    00030 namespace khtml {
    00031
    00032 class RenderTable;
    00033 class RenderTableCell;
    00034
    00035 // -------------------------------------------------------------------------
    00036
    00037 class TableLayout
    00038 {
    00039 public:
    00040     TableLayout( RenderTable *t ) : table( t ) {}
    00041     virtual ~TableLayout() {};
    00042
    00043     virtual void calcMinMaxWidth() = 0;
    00044     virtual void layout() = 0;
    00045
    00046 protected:
    00047     RenderTable *table;
    00048 };
    00049
    00050 // -------------------------------------------------------------------------
    00051
    00052 class FixedTableLayout : public TableLayout
    00053 {
    00054 public:
    00055     FixedTableLayout( RenderTable *table );
    00056     ~FixedTableLayout();
    00057
    00058     void calcMinMaxWidth();
    00059     void layout();
    00060
    00061 protected:
    00062     int calcWidthArray( int tableWidth );
    00063
    00064     QMemArray<Length> width;
    00065 };
    00066
    00067 // -------------------------------------------------------------------------
    00068
    00069 class AutoTableLayout : public TableLayout
    00070 {
    00071 public:
    00072     AutoTableLayout( RenderTable *table );
    00073     ~AutoTableLayout();
    00074
    00075     void calcMinMaxWidth();
    00076     void layout();
    00077
    00078
    00079 protected:
    00080     void fullRecalc();
    00081     void recalcColumn( int effCol );
    00082     int totalPercent() const {
    00083         if ( percentagesDirty )
    00084             calcPercentages();
    00085         return total_percent;
    00086     }
    00087     void calcPercentages() const;
    00088     int calcEffectiveWidth();
    00089     void insertSpanCell( RenderTableCell *cell );
    00090
    00091     struct Layout {
    00092         Layout() : minWidth( 1 ), maxWidth( 1 ),
    00093                    effMinWidth( 0 ), effMaxWidth( 0 ),
    00094                    calcWidth( 0 ) {}
    00095         Length width;
    00096         Length effWidth;
    00097         short minWidth;
    00098         short maxWidth;
    00099         short effMinWidth;
    00100         short effMaxWidth;
    00101         short calcWidth;
    00102     };
    00103
    00104     QMemArray<Layout> layoutStruct;
    00105     QMemArray<RenderTableCell *>spanCells;
    00106     bool hasPercent : 1;
    00107     mutable bool percentagesDirty : 1;
    00108     mutable bool effWidthDirty : 1;
    00109     mutable unsigned short total_percent;
    00110 };
    00111
    00112 }
    00113 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:34:45 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001