File indexing completed on 2024-04-21 14:57:57
0001 /* 0002 * This file is part of the KDE project. 0003 * 0004 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 0005 * (C) 2000 Simon Hausmann <hausmann@kde.org> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 * 0022 */ 0023 #ifndef __render_frames_h__ 0024 #define __render_frames_h__ 0025 0026 #include "rendering/render_replaced.h" 0027 #include "xml/dom_nodeimpl.h" 0028 #include "html/html_baseimpl.h" 0029 0030 namespace DOM 0031 { 0032 class HTMLFrameElementImpl; 0033 class HTMLElementImpl; 0034 class MouseEventImpl; 0035 } 0036 0037 namespace khtml 0038 { 0039 class ChildFrame; 0040 0041 class RenderFrameSet : public RenderBox 0042 { 0043 friend class DOM::HTMLFrameSetElementImpl; 0044 public: 0045 RenderFrameSet(DOM::HTMLFrameSetElementImpl *frameSet); 0046 0047 virtual ~RenderFrameSet(); 0048 0049 const char *renderName() const override 0050 { 0051 return "RenderFrameSet"; 0052 } 0053 bool isFrameSet() const override 0054 { 0055 return true; 0056 } 0057 0058 void layout() override; 0059 0060 void positionFrames(); 0061 void paintFrameSetRules(QPainter *paint, const QRect &damageRect); 0062 0063 bool resizing() const 0064 { 0065 return m_resizing; 0066 } 0067 bool noResize() const 0068 { 0069 return element()->noResize(); 0070 } 0071 0072 bool userResize(DOM::MouseEventImpl *evt); 0073 bool canResize(int _x, int _y); 0074 void setResizing(bool e); 0075 0076 Qt::CursorShape cursorShape() const 0077 { 0078 return m_cursor; 0079 } 0080 0081 bool nodeAtPoint(NodeInfo &info, int x, int y, int tx, int ty, HitTestAction hitTestAction, bool inside) override; 0082 0083 DOM::HTMLFrameSetElementImpl *element() const 0084 { 0085 return static_cast<DOM::HTMLFrameSetElementImpl *>(RenderObject::element()); 0086 } 0087 0088 #ifdef ENABLE_DUMP 0089 void dump(QTextStream &stream, const QString &ind) const override; 0090 #endif 0091 0092 private: 0093 Qt::CursorShape m_cursor; 0094 int m_oldpos; 0095 int m_gridLen[2]; 0096 int *m_gridDelta[2]; 0097 int *m_gridLayout[2]; 0098 0099 bool *m_hSplitVar; // is this split variable? 0100 bool *m_vSplitVar; 0101 0102 int m_hSplit; // the split currently resized 0103 int m_vSplit; 0104 int m_hSplitPos; 0105 int m_vSplitPos; 0106 0107 bool m_resizing; 0108 bool m_paint; 0109 bool m_clientresizing; 0110 }; 0111 0112 class RenderPart : public khtml::RenderWidget 0113 { 0114 Q_OBJECT 0115 public: 0116 RenderPart(DOM::HTMLElementImpl *node); 0117 0118 const char *renderName() const override 0119 { 0120 return "RenderPart"; 0121 } 0122 0123 virtual void setWidget(QWidget *widget); 0124 0125 short intrinsicWidth() const override; 0126 int intrinsicHeight() const override; 0127 0128 public Q_SLOTS: 0129 virtual void slotViewCleared(); 0130 }; 0131 0132 class RenderFrame : public khtml::RenderPart 0133 { 0134 Q_OBJECT 0135 public: 0136 RenderFrame(DOM::HTMLFrameElementImpl *frame); 0137 0138 const char *renderName() const override 0139 { 0140 return "RenderFrame"; 0141 } 0142 bool isFrame() const override 0143 { 0144 return true; 0145 } 0146 0147 // frames never have padding 0148 int paddingTop() const override 0149 { 0150 return 0; 0151 } 0152 int paddingBottom() const override 0153 { 0154 return 0; 0155 } 0156 int paddingLeft() const override 0157 { 0158 return 0; 0159 } 0160 int paddingRight() const override 0161 { 0162 return 0; 0163 } 0164 0165 DOM::HTMLFrameElementImpl *element() const 0166 { 0167 return static_cast<DOM::HTMLFrameElementImpl *>(RenderObject::element()); 0168 } 0169 0170 public Q_SLOTS: 0171 void slotViewCleared() override; 0172 }; 0173 0174 // I can hardly call the class RenderObject ;-) 0175 class RenderPartObject : public khtml::RenderPart 0176 { 0177 Q_OBJECT 0178 public: 0179 RenderPartObject(DOM::HTMLElementImpl *); 0180 0181 const char *renderName() const override 0182 { 0183 return "RenderPartObject"; 0184 } 0185 0186 void layout() override; 0187 0188 bool canHaveBorder() const override 0189 { 0190 return true; 0191 } 0192 0193 public Q_SLOTS: 0194 void slotViewCleared() override; 0195 }; 0196 0197 } 0198 0199 #endif