2 * This file is part of the HTML rendering engine for KDE.
4 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
27 #include "rendering/render_block.h"
29 // ### list-style-position, list-style-image is still missing
35 class RenderListMarker
;
38 // -----------------------------------------------------------------------------
40 class RenderListItem
: public RenderBlock
42 friend class RenderListMarker
;
43 // friend class CounterListItem;
46 RenderListItem(DOM::NodeImpl
*);
48 virtual const char *renderName() const { return "RenderListItem"; }
50 virtual void setStyle(RenderStyle
*style
);
52 virtual bool isListItem() const { return true; }
54 void setValue( long v
) { predefVal
= v
; }
56 virtual void layout( );
57 virtual void detach( );
58 virtual void calcMinMaxWidth();
59 //virtual short marginLeft() const;
60 //virtual short marginRight() const;
62 void setInsideList(bool b
) { m_insideList
= b
; }
66 void updateMarkerLocation();
67 void resetListMarker() { m_marker
= 0; }
69 RenderListMarker
*m_marker
;
70 CounterNode
*m_counter
;
71 signed long predefVal
: 30;
72 bool m_insideList
: 1;
73 bool m_deleteMarker
: 1;
76 // -----------------------------------------------------------------------------
78 class RenderListMarker
: public RenderBox
81 RenderListMarker(DOM::NodeImpl
* node
);
84 virtual void setStyle(RenderStyle
*style
);
86 virtual const char *renderName() const { return "RenderListMarker"; }
87 // so the marker gets to layout itself. Only needed for
88 // list-style-position: inside
90 virtual void paint(PaintInfo
& i
, int xoff
, int yoff
);
91 virtual void layout( );
92 virtual void calcMinMaxWidth();
94 virtual short lineHeight( bool firstLine
) const;
95 virtual short baselinePosition( bool firstLine
) const;
97 virtual void updatePixmap( const QRect
&, CachedImage
*);
99 virtual void calcWidth();
101 virtual bool isListMarker() const { return true; }
103 virtual short markerWidth() const { return m_markerWidth
; }
105 RenderListItem
* listItem() const { return m_listItem
; }
106 void setListItem(RenderListItem
* listItem
) { m_listItem
= listItem
; }
108 bool listPositionInside() const
109 { return !m_listItem
->m_insideList
|| style()->listStylePosition() == INSIDE
; }
112 friend class RenderListItem
;
115 CachedImage
*m_listImage
;
117 RenderListItem
* m_listItem
;
120 // Implementation of list-item counter
121 // ### should replace most list-item specific code in renderObject::getCounter
123 class CounterListItem : public CounterNode
128 virtual void recount( bool first = false );
129 virtual void setSelfDirty();