[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:47:44 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit ed6510e3b63d0879484057396e09bb98a792e089
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 28 02:32:17 2001 +0000

    Files needed for rendering.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@217 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQApplication.mm b/WebCore/kwq/KWQApplication.mm
index 9070707..122fa85 100644
--- a/WebCore/kwq/KWQApplication.mm
+++ b/WebCore/kwq/KWQApplication.mm
@@ -24,3 +24,115 @@
  */
 
 #include <qapplication.h>
+
+#import "_KWQOwner.h"
+
+QPalette QApplication::palette(const QWidget *p)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QPalette QApplication::palette(const QWidget *p)\n");
+}
+
+
+QWidget *QApplication::desktop()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QWidget *QApplication::desktop()\n");
+}
+
+
+int QApplication::startDragDistance()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) int QApplication::startDragDistance()\n");
+}
+
+
+QSize QApplication::globalStrut()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QSize QApplication::globalStrut()\n");
+}
+
+
+void QApplication::setOverrideCursor(const QCursor &c)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QApplication::setOverrideCursor(const QCursor &c)\n");
+}
+
+
+void QApplication::restoreOverrideCursor()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QApplication::restoreOverrideCursor()\n");
+}
+
+
+bool QApplication::sendEvent(QObject *o, QEvent *e)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QApplication::sendEvent(QObject *o, QEvent *e)\n");
+}
+
+
+QApplication::QApplication( int &argc, char **argv)
+{
+    _initialize();
+}
+
+
+void QApplication::_initialize(){
+    NSDictionary *info;
+    NSString *principalClassName;
+    NSString *mainNibFile;
+
+    globalPool = [[NSAutoreleasePool allocWithZone:NULL] init];
+    info = [[NSBundle mainBundle] infoDictionary];
+    principalClassName = [info objectForKey:@"NSPrincipalClass"];
+    mainNibFile = [info objectForKey:@"NSMainNibFile"];
+
+    if (principalClassName) {
+        Class principalClass = NSClassFromString(principalClassName);
+	if (principalClass) {
+            application = [principalClass sharedApplication];
+	    if (![NSBundle loadNibNamed: mainNibFile owner: application]) {
+                NSLog (@"ERROR:  QApplication::_initialize() unable to load %@\n", mainNibFile, nil);
+            }
+        }
+    }	
+    
+    //  Force linkage
+    [_KWQOwner class];
+}
+
+
+QApplication::~QApplication()
+{
+    [globalPool release];
+}
+
+
+void QApplication::setMainWidget(QWidget *w)
+{
+    if (application == nil){
+        NSLog (@"ERROR: QApplication::setMainWidget() application not set.\n");
+        return;
+    }
+    if (w == 0){
+        NSLog (@"ERROR: QApplication::setMainWidget() widget not valid.\n");
+        return;
+    }
+    
+    NSScrollView *sv = [[NSScrollView alloc] initWithFrame: NSMakeRect (0,0,0,0)];
+    [sv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+    [sv setHasVerticalScroller: YES];
+    [sv setHasHorizontalScroller: YES];
+    [sv setDocumentView: w->getView()];
+    [((_KWQOwner *)application)->window setContentView: sv];
+}
+
+
+int QApplication::exec()
+{
+    if (application == nil){
+        NSLog (@"ERROR: QApplication::exec() application not set.\n");
+        return 0;
+    }
+    [application run];
+    return 1;
+}
+
diff --git a/WebCore/kwq/KWQBrush.mm b/WebCore/kwq/KWQBrush.mm
index c9e7c2b..f5bd45f 100644
--- a/WebCore/kwq/KWQBrush.mm
+++ b/WebCore/kwq/KWQBrush.mm
@@ -24,3 +24,49 @@
  */
 
 #include <qbrush.h>
+
+QBrush::QBrush()
+{
+    qcolor = Qt::black;
+    qbrushstyle = NoBrush;
+}
+
+
+QBrush::QBrush(const QColor &c)
+{
+    qcolor = c;
+    qbrushstyle = SolidPattern;
+}
+
+
+QBrush::QBrush(const QBrush &copyFrom)
+{
+    qcolor = copyFrom.qcolor;
+    qbrushstyle = copyFrom.qbrushstyle;
+}
+
+
+QBrush &QBrush::operator=(const QBrush &assignFrom)
+{
+    qcolor = assignFrom.qcolor;
+    qbrushstyle = assignFrom.qbrushstyle;
+    return *this;
+}
+
+
+QBrush::~QBrush()
+{
+}
+
+
+bool QBrush::operator==(const QBrush &compareTo) const
+{
+    return qcolor == compareTo.qcolor;
+}
+
+
+bool QBrush::operator!=(const QBrush &compareTo) const
+{
+    return !(operator==( compareTo ));
+}
+
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
new file mode 100644
index 0000000..6089c85
--- /dev/null
+++ b/WebCore/kwq/KWQColor.mm
@@ -0,0 +1,279 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QColor class
+**
+** Created : 940112
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qcolor.h>
+
+QRgb qRgb(int r, int g, int b)
+{
+    return r << 16 | g << 8 | b;
+}
+
+
+QRgb qRgba(int r, int g, int b, int a)
+{
+    return a << 24 | r << 16 | g << 8 | b;
+}
+
+
+
+QColor::QColor()
+{
+    color = nil;
+}
+
+
+QColor::QColor(int r, int g, int b)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    else
+        _initialize (r, g, b);
+}
+
+
+QColor::QColor(const char *)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor::QColor(const char *)\n");
+}
+
+
+void QColor::_initialize(int r, int g, int b)
+{
+    color = [[NSColor colorWithCalibratedRed: ((float)(r)) / (float)255.0
+                    green: ((float)(g)) / (float)255.0
+                    blue: ((float)(b)) / (float)255.0
+                    alpha: 1.0] retain];
+}
+
+
+QColor::~QColor(){
+    if (color != nil)
+        [color release];
+}
+
+
+QColor::QColor(const QColor &copyFrom)
+{
+    if (color == copyFrom.color)
+        return;
+    if (color != nil)
+        [color release];
+    if (copyFrom.color != nil)
+        color = [copyFrom.color retain];
+    else
+        color = nil;
+}
+
+
+QString QColor::name() const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QString QColor::name() const\n");
+}
+
+
+void QColor::setNamedColor(const QString&)
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QColor::setNamedColor(const QString&)\n");
+}
+
+
+bool QColor::isValid() const
+{
+    return TRUE;
+}
+
+
+int QColor::red() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color redComponent] * 255);
+}
+
+
+int QColor::QColor::green() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color greenComponent] * 255);
+}
+
+int QColor::blue() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color blueComponent] * 255);
+}
+
+
+QRgb QColor::rgb() const
+{
+    if (color == nil)
+        return 0;
+    return qRgb (red(),green(),blue());
+}
+
+
+void QColor::setRgb(int r, int g, int b)
+{
+    if (color != nil)
+        [color release];
+    color = [[NSColor colorWithCalibratedRed: ((float)(r)) / (float)255.0
+                    green: ((float)(g)) / (float)255.0
+                    blue: ((float)(b)) / (float)255.0
+                    alpha: 1.0] retain];
+}
+
+
+void QColor::setRgb(int rgb)
+{
+    if (color != nil)
+        [color release];
+    color = [[NSColor colorWithCalibratedRed: ((float)(rgb >> 16)) / 255.0
+                    green: ((float)(rgb >> 8)) / 255.0
+                    blue: ((float)(rgb & 0xff)) / 255.0
+                    alpha: 1.0] retain];
+}
+
+
+void QColor::hsv(int *, int *, int *) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QColor::hsv(int *, int *, int *) const\n");
+}
+
+QColor QColor::light(int f = 150) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor QColor::light(int f = 150) const\n");
+}
+
+
+QColor QColor::dark(int f = 200) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor QColor::dark(int f = 200) const\n");
+}
+
+
+QColor &QColor::operator=(const QColor &assignFrom)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    if (color != assignFrom.color){ 
+        if (color != nil)
+            [color release];
+        if (assignFrom.color != nil)
+            color = [assignFrom.color retain];
+        else
+            color = nil;
+    }
+    return *this;
+}
+
+
+bool QColor::operator==(const QColor &compareTo) const
+{
+    return [color isEqual: compareTo.color];
+}
+
+
+bool QColor::operator!=(const QColor &compareTo) const
+{
+    return !(operator==(compareTo));
+}
+
+
+
+
+/*****************************************************************************
+  Global colors
+ *****************************************************************************/
+
+bool QColor::globals_init = FALSE;		// global color not initialized
+
+
+static QColor stdcol[19];
+
+QT_STATIC_CONST_IMPL QColor & Qt::color0 = stdcol[0];
+QT_STATIC_CONST_IMPL QColor & Qt::color1  = stdcol[1];
+QT_STATIC_CONST_IMPL QColor & Qt::black  = stdcol[2];
+QT_STATIC_CONST_IMPL QColor & Qt::white = stdcol[3];
+QT_STATIC_CONST_IMPL QColor & Qt::darkGray = stdcol[4];
+QT_STATIC_CONST_IMPL QColor & Qt::gray = stdcol[5];
+QT_STATIC_CONST_IMPL QColor & Qt::lightGray = stdcol[6];
+QT_STATIC_CONST_IMPL QColor & Qt::red = stdcol[7];
+QT_STATIC_CONST_IMPL QColor & Qt::green = stdcol[8];
+QT_STATIC_CONST_IMPL QColor & Qt::blue = stdcol[9];
+QT_STATIC_CONST_IMPL QColor & Qt::cyan = stdcol[10];
+QT_STATIC_CONST_IMPL QColor & Qt::magenta = stdcol[11];
+QT_STATIC_CONST_IMPL QColor & Qt::yellow = stdcol[12];
+QT_STATIC_CONST_IMPL QColor & Qt::darkRed = stdcol[13];
+QT_STATIC_CONST_IMPL QColor & Qt::darkGreen = stdcol[14];
+QT_STATIC_CONST_IMPL QColor & Qt::darkBlue = stdcol[15];
+QT_STATIC_CONST_IMPL QColor & Qt::darkCyan = stdcol[16];
+QT_STATIC_CONST_IMPL QColor & Qt::darkMagenta = stdcol[17];
+QT_STATIC_CONST_IMPL QColor & Qt::darkYellow = stdcol[18];
+
+
+
+void QColor::initGlobalColors()
+{
+    NSAutoreleasePool *colorPool = [[NSAutoreleasePool allocWithZone:NULL] init];
+     
+    globals_init = TRUE;
+
+    stdcol[ 0].setRgb(255,   255,   255 );
+    stdcol[ 1].setRgb(   0,   0,   0 );
+    stdcol[ 2].setRgb(   0,   0,   0 );
+    stdcol[ 3].setRgb( 255, 255, 255 );
+    stdcol[ 4].setRgb( 128, 128, 128 );
+    stdcol[ 5].setRgb( 160, 160, 164 );
+    stdcol[ 6].setRgb( 192, 192, 192 );
+    stdcol[ 7].setRgb( 255,   0,   0 );
+    stdcol[ 8].setRgb(   0, 255,   0 );
+    stdcol[ 9].setRgb(   0,   0, 255 );
+    stdcol[10].setRgb(   0, 255, 255 );
+    stdcol[11].setRgb( 255,   0, 255 );
+    stdcol[12].setRgb( 255, 255,   0 );
+    stdcol[13].setRgb( 128,   0,   0 );
+    stdcol[14].setRgb(   0, 128,   0 );
+    stdcol[15].setRgb(   0,   0, 128 );
+    stdcol[16].setRgb(   0, 128, 128 );
+    stdcol[17].setRgb( 128,   0, 128 );
+    stdcol[18].setRgb( 128, 128,   0 );
+}
+
diff --git a/WebCore/kwq/kio/job.h b/WebCore/kwq/KWQColorGroup.mm
similarity index 62%
copy from WebCore/kwq/kio/job.h
copy to WebCore/kwq/KWQColorGroup.mm
index 8fbe161..438ae21 100644
--- a/WebCore/kwq/kio/job.h
+++ b/WebCore/kwq/KWQColorGroup.mm
@@ -23,27 +23,86 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JOB_H_
-#define JOB_H_
+#include <qpalette.h>
+#include <qcolor.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+QColorGroup::QColorGroup()
+{
+}
 
-#include <kurl.h>
-#include "jobclasses.h"
 
-// for time_t
-#include <sys/types.h>
+QColorGroup::QColorGroup(const QColorGroup &)
+{
+}
 
-// added to help in compilation of khtml/khtml_part.h:867
-namespace KIO {
 
-SimpleJob *http_update_cache(const KURL &, bool, time_t);
+QColorGroup::~QColorGroup()
+{
+}
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true);
 
-} // namespace KIO
+const QColor &color(QColorGroup::ColorRole cr)
+{
+}
+
+
+void setColor(QColorGroup::ColorRole cr, const QColor &)
+{
+}
+
+
+const QColor &QColorGroup::foreground() const
+{
+}
+
+
+const QColor &QColorGroup::shadow() const
+{
+}
+
+
+const QColor &QColorGroup::light() const
+{
+}
+
+
+const QColor &QColorGroup::midlight() const
+{
+}
+
+
+const QColor &QColorGroup::dark() const
+{
+}
+
+
+const QColor &QColorGroup::base() const
+{
+}
+
+
+const QColor &QColorGroup::buttonText() const
+{
+}
+
+
+const QColor &QColorGroup::button() const
+{
+}
+
+
+const QColor &QColorGroup::text() const
+{
+}
+
+
+const QColor &QColorGroup::background() const
+{
+}
+
+
+QColorGroup &QColorGroup::operator=(const QColorGroup &)
+{
+}
+
 
-#endif
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/kwq/KWQCursor.mm
similarity index 89%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/kwq/KWQCursor.mm
index 013222c..89a487c 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/kwq/KWQCursor.mm
@@ -23,11 +23,23 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qcursor.h>
+
+QCursor::QCursor()
+{
+}
+
+
+QCursor::QCursor(const QCursor &)
 {
 }
 
-void qWarning(const char *msg, ...)
+
+QCursor::~QCursor()
 {
 }
+      
 
+QCursor &QCursor::operator=(const QCursor &)
+{
+}
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 40f4b61..dc48703 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -23,4 +23,174 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#include <qstring.h>
 #include <qfont.h>
+
+#import <Cocoa/Cocoa.h>
+
+/*
+    For this implementation Qt pixelSize is interpreted as Cocoa pointSize.
+*/
+
+QFont::QFont()
+{
+    _initialize();
+}
+
+
+void QFont::_initialize()
+{
+    _initializeWithFont (0);
+}
+
+NSFont *QFont::defaultNSFont()
+{
+    return [NSFont userFontOfSize: (float)12.0];
+}
+
+void QFont::_initializeWithFont (const QFont *withFont)
+{
+    data = (struct KWQFontData *)calloc (1, sizeof (struct KWQFontData));
+    if (withFont == 0 || withFont->data == 0)
+        // Hmm...  What size should we use as a default font?
+        data->font = [defaultNSFont() retain];
+    else
+        data->font = [withFont->data->font retain];
+}
+
+
+QFont::QFont(const QFont &copyFrom)
+{
+    struct KWQFontData *oldData = data;
+    _initializeWithFont(&copyFrom);
+    _freeWithData (oldData);
+}
+
+
+QFont::~QFont()
+{
+    _free();
+}
+
+void QFont::_free(){
+    _freeWithData (data);
+}
+
+
+void QFont::_freeWithData(struct KWQFontData *freeData){
+    if (freeData != 0){
+        if (freeData->font != nil)
+            [freeData->font release];
+        free (freeData);
+    }
+}
+
+
+// member functions --------------------------------------------------------
+
+int QFont::pixelSize() const
+{
+    return (int)[data->font pointSize];
+}
+
+
+QString QFont::family() const
+{
+    return NSSTRING_TO_QSTRING([data->font familyName]);
+}
+
+
+void QFont::setFamily(const QString &qfamilyName)
+{
+    NSString *familyName;
+    NSFont *oldFont = data->font;
+    
+    familyName = QSTRING_TO_NSSTRING(qfamilyName);
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toFamily: familyName] retain];
+
+    [oldFont release];
+}
+
+
+void QFont::setPixelSizeFloat(float sz)
+{
+    NSFont *oldFont = data->font;
+
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toSize: sz] retain];
+
+    [oldFont release];
+}
+
+
+void QFont::setWeight(int weight)
+{
+    if (weight == Bold)
+        _setTrait (NSBoldFontMask);
+    else if (weight == Normal)
+        _setTrait (NSUnboldFontMask);
+}
+
+
+int QFont::weight() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSBoldFontMask)
+        return Bold;
+    return Normal;
+}
+
+
+bool QFont::setItalic(bool flag)
+{
+    if (flag)
+        _setTrait (NSItalicFontMask);
+    else
+        _setTrait (NSUnitalicFontMask);
+}
+
+
+bool QFont::italic() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSItalicFontMask)
+        return TRUE;
+    return FALSE;
+}
+
+
+bool QFont::bold() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSItalicFontMask)
+        return TRUE;
+    return FALSE;
+}
+
+
+// operators ---------------------------------------------------------------
+
+QFont &QFont::operator=(const QFont &assignFrom)
+{
+    _free();
+    _initializeWithFont(&assignFrom);
+    return *this;
+}
+
+
+bool QFont::operator==(const QFont &compareFont) const
+{
+    return [compareFont.data->font isEqual: data->font];
+}
+
+
+bool QFont::operator!=(const QFont &compareFont) const
+{
+    return !(operator==( compareFont ));
+}
+
+
+void QFont::_setTrait (NSFontTraitMask mask)
+{
+    NSFont *oldFont = data->font;
+
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toHaveTrait: mask] retain];
+
+    [oldFont release];
+}
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index 79e4d72..8cb322f 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -24,3 +24,148 @@
  */
 
 #include <qfontmetrics.h>
+
+
+QFontMetrics::QFontMetrics()
+{
+    _initialize();
+}
+
+
+QFontMetrics::QFontMetrics(const QFont &withFont)
+{
+    _initializeWithFont (withFont.data->font);
+}
+
+
+QFontMetrics::QFontMetrics(const QFontMetrics &copyFrom)
+{
+    struct KWQFontMetricsData *oldData = data;
+    _initializeWithFont(copyFrom.data->font);
+    _freeWithData (oldData);
+}
+
+void QFontMetrics::_initialize()
+{
+    _initializeWithFont (0);
+}
+
+void QFontMetrics::_initializeWithFont (NSFont *withFont)
+{
+    data = (struct KWQFontMetricsData *)calloc (1, sizeof (struct KWQFontMetricsData));
+    if (withFont == 0)
+        data->font = QFont::defaultNSFont();
+    else
+        data->font = [withFont retain];
+}
+
+void QFontMetrics::_free(){
+    _freeWithData (data);
+}
+
+
+void QFontMetrics::_freeWithData(struct KWQFontMetricsData *freeData){
+    if (freeData != 0){
+        [freeData->font release];
+        free (freeData);
+    }
+}
+
+QFontMetrics::~QFontMetrics()
+{
+    _free();
+}
+
+
+int QFontMetrics::ascent() const
+{
+    // Qt seems to use [font defaultLineHeightForFont] + [font descender] instead
+    // of what seems more natural [font ascender].
+    // Remember that descender is negative. 
+    return (int)([data->font defaultLineHeightForFont] + [data->font descender]);
+}
+
+
+int QFontMetrics::height() const
+{
+    // According to Qt documentation: 
+    // "This is always equal to ascent()+descent()+1 (the 1 is for the base line)."
+    // However, the [font defaultLineHeightForFont] seems more appropriate.
+    return (int)[data->font defaultLineHeightForFont];
+}
+
+
+int QFontMetrics::width(QChar qc) const
+{
+    ushort c = qc.unicode();
+    NSString *string = [NSString stringWithCharacters: (const unichar *)&c length: 1];
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::width(char c) const
+{
+    NSString *string = [NSString stringWithCString: &c length: 1];
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::width(const QString &qstring, int len) const
+{
+    NSString *string;
+
+    if (len != -1)
+        string = QSTRING_TO_NSSTRING_LENGTH (qstring, len);
+    else
+        string = QSTRING_TO_NSSTRING (qstring);
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::descent() const
+{
+    return -(int)[data->font descender];
+}
+
+
+QRect QFontMetrics::boundingRect(const QString &, int len=-1) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QRect QFontMetrics::boundingRect(const QString &, int len=-1)\n");
+}
+
+
+QRect QFontMetrics::boundingRect(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::boundingRect(QChar)\n");
+}
+
+
+QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, 
+    int *tabarray=0, char **intern=0 ) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, int *tabarray=0, char **intern=0 )\n");
+}
+
+
+int QFontMetrics::rightBearing(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::rightBearing(QChar)\n");
+    return 0;
+}
+
+
+int QFontMetrics::leftBearing(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) leftBearing(QChar)\n");
+    return 0;
+}
+
+
+QFontMetrics &QFontMetrics::operator=(const QFontMetrics &assignFrom)
+{
+    _free();
+    _initializeWithFont(assignFrom.data->font);
+    return *this;    
+}
+
+
diff --git a/WebCore/kwq/KWQObject.mm b/WebCore/kwq/KWQObject.mm
new file mode 100644
index 0000000..fbb7535
--- /dev/null
+++ b/WebCore/kwq/KWQObject.mm
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <qobject.h>
+
+bool QObject::connect(const QObject *, const char *, const QObject *, 
+    const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::connect\n");
+}
+
+
+bool QObject::disconnect( const QObject *, const char *, const QObject *, 
+    const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::disconnect\n");
+}
+
+
+QObject::QObject(QObject *parent=0, const char *name=0)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QObject::QObject(QObject *parent=0, const char *name=0)\n");
+}
+
+
+QObject::~QObject()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QObject::~QObject()\n");
+}
+
+
+// member functions --------------------------------------------------------
+
+const char *QObject::name() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) const char *QObject::name() const\n");
+}
+
+
+void QObject::setName(const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::setName(const char *)\n");
+}
+
+#ifdef DO_QVARIANT
+QVariant QObject::property(const char *name) const
+{
+}
+#endif
+
+bool QObject::inherits(const char *) const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::inherits(const char *) const\n");
+}
+
+
+bool QObject::connect(const QObject *, const char *, const char *) const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::connect(const QObject *, const char *, const char *) const\n");
+}
+
+
+int QObject:: startTimer(int)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) int QObject:: startTimer(int)\n");
+}
+
+
+void QObject::killTimer(int)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::killTimer(int)\n");
+}
+
+
+void QObject::killTimers()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::killTimers()\n");
+}
+
+
+void QObject::installEventFilter(const QObject *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::installEventFilter(const QObject *)\n");
+}
+
+
+void QObject::removeEventFilter(const QObject *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::removeEventFilter(const QObject *)\n");
+}
+
+
+void QObject::blockSignals(bool)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::blockSignals(bool)\n");
+}
+
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQPaintDevice.mm
similarity index 95%
copy from WebCore/kwq/KWQFont.mm
copy to WebCore/kwq/KWQPaintDevice.mm
index 40f4b61..c2bd48c 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQPaintDevice.mm
@@ -22,5 +22,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+#include <qpaintdevice.h>
+
+    
+QPaintDevice::~QPaintDevice()
+{
+}
+
 
-#include <qfont.h>
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/kwq/KWQPaintDeviceMetrics.mm
similarity index 87%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/kwq/KWQPaintDeviceMetrics.mm
index 013222c..d7e6b4f 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/kwq/KWQPaintDeviceMetrics.mm
@@ -23,11 +23,19 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qpaintdevicemetrics.h>
+
+QPaintDeviceMetrics::QPaintDeviceMetrics(const QPaintDevice *)
+{
+}
+
+
+int QPaintDeviceMetrics::logicalDpiY() const 
 {
 }
 
-void qWarning(const char *msg, ...)
+
+int QPaintDeviceMetrics::depth() const
 {
 }
 
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index b1a3327..9b27274 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -24,3 +24,486 @@
  */
 
 #include <qpainter.h>
+#include <qwidget.h>
+#include <qfontmetrics.h>
+#include <qpixmap.h>
+#include <qstack.h>
+#include <qpoint.h>
+
+
+#import <Cocoa/Cocoa.h>
+
+struct QPState {				// painter state
+    QFont	font;
+    QPen	pen;
+    QBrush	brush;
+    NSCompositingOperation compositingOperation;
+};
+
+typedef QStack<QPState> QPStateStack;
+
+
+QPainter::QPainter()
+{
+}
+
+
+QPainter::QPainter(const QPaintDevice *pdev)
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) QPainter::QPainter(const QPaintDevice *)\n");
+}
+
+
+//  How do we handle ownership of widget?
+QPainter::QPainter(QWidget *widget)
+{
+    _initialize (widget);
+}
+
+void QPainter::_initialize(QWidget *widget)
+{
+    data = (struct KWQPainterData *)calloc (1, sizeof (struct KWQPainterData));
+    data->widget = widget;
+    data->qpen = QPen (Qt::black);
+    data->isFocusLocked = 0;
+    data->compositingOperation = NSCompositeCopy;
+}
+
+
+QPainter::~QPainter()
+{
+    free (data);
+}
+
+    
+const QFont &QPainter::font() const
+{
+    return data->qfont;
+}
+
+
+void QPainter::setFont(const QFont &aFont)
+{
+    data->qfont = aFont;
+}
+
+
+QFontMetrics QPainter::fontMetrics() const
+{
+    return QFontMetrics( data->qfont );
+}
+
+const QPen &QPainter::pen() const
+{
+    return data->qpen;
+}
+
+
+void QPainter::setPen(const QPen &pen)
+{
+    data->qpen = pen;
+}
+
+
+void QPainter::setPen(PenStyle)
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QPainter::setPen(PenStyle)\n");
+}
+
+
+void QPainter::setBrush(const QBrush &brush)
+{
+    data->qbrush = brush;
+}
+
+
+void QPainter::setBrush(BrushStyle style)
+{
+    // Either NoBrush or SolidPattern.
+    data->qbrush.qbrushstyle = style;
+}
+
+
+QRect QPainter::xForm(const QRect &) const
+{
+}
+
+
+void QPainter::save()
+{
+    QPStateStack *pss = data->ps_stack;
+    if ( pss == 0 ) {
+	pss = new QStack<QPState>;
+	data->ps_stack = pss;
+    }
+    
+    QPState *ps = new QPState;
+
+    ps->font  = data->qfont;
+    ps->pen   = data->qpen;
+    ps->brush = data->qbrush;
+    ps->compositingOperation = data->compositingOperation;
+    pss->push( ps );
+}
+
+
+void QPainter::restore()
+{
+    QPStateStack *pss = (QPStateStack *)data->ps_stack;
+    if ( pss == 0 || pss->isEmpty() ) {
+        NSLog (@"ERROR void QPainter::restore() stack is empty\n");
+	return;
+    }
+    QPState *ps = pss->pop();
+
+    if ( ps->font != data->qfont )
+	setFont( ps->font );
+    if ( ps->pen != data->qpen )
+	setPen( ps->pen );
+    if ( ps->brush != data->qbrush )
+	setBrush( ps->brush );
+    ps->compositingOperation = data->compositingOperation;
+
+    delete ps;
+}
+
+
+// Draws a filled rectangle with a stroked border.
+void QPainter::drawRect(int x, int y, int w, int h)
+{
+    _lockFocus();
+    if (data->qbrush.qbrushstyle == SolidPattern){
+        _setColorFromBrush();
+        [NSBezierPath fillRect:NSMakeRect(x, y, w, h)];
+    }
+    _setColorFromPen();
+    [NSBezierPath strokeRect:NSMakeRect(x, y, w, h)];
+    _unlockFocus();
+}
+
+
+void QPainter::_setColorFromBrush()
+{
+    [data->qbrush.qcolor.color set];
+}
+
+
+void QPainter::_setColorFromPen()
+{
+    [data->qpen.qcolor.color set];
+}
+
+
+void QPainter::drawLine(int x1, int y1, int x2, int y2)
+{
+    _lockFocus();
+    _setColorFromPen();
+    [NSBezierPath strokeLineFromPoint:NSMakePoint(x1, y1) toPoint:NSMakePoint(x2, y2)];
+    _unlockFocus();
+}
+
+
+void QPainter::drawEllipse(int x, int y, int w, int h)
+{
+    NSBezierPath *path;
+
+    path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect (x, y, w, h)];
+    
+    _lockFocus();
+    if (data->qbrush.qbrushstyle == SolidPattern){
+        _setColorFromBrush();
+        [path fill];
+    }
+    _setColorFromPen();
+    [path stroke];
+    _unlockFocus();
+}
+
+
+// Only supports arc on circles.  That's all khtml needs.
+void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
+{
+    NSBezierPath *path;
+    float fa, falen;
+    
+    if (w != h){
+        NSLog (@"ERROR (INCOMPLETE IMPLEMENTATION) void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)\nOnly supports drawing arcs on a circle.\n");
+    }
+    
+    path = [[[NSBezierPath alloc] init] autorelease];
+    fa = (float)(a/16);
+    falen =  fa + (float)(alen/16);
+    [path appendBezierPathWithArcWithCenter: NSMakePoint(x + w/2, y + h/2) 
+                radius: (float)(w/2) 
+                startAngle: -fa
+                endAngle: -falen
+                clockwise: YES];
+
+    _lockFocus();
+
+    _setColorFromPen();
+    [path stroke];
+
+    _unlockFocus();
+}
+
+
+void QPainter::drawPolyline(const QPointArray &points, int index, int npoints)
+{
+    _drawPoints (points, 0, index, npoints, FALSE);
+}
+
+
+void QPainter::drawPolygon(const QPointArray &points, bool winding, int index,
+    int npoints)
+{
+    _drawPoints (points, winding, index, npoints, TRUE);
+}
+
+
+void QPainter::_drawPoints (const QPointArray &_points, bool winding, int index, int _npoints, bool fill)
+{
+    NSBezierPath *path;
+    float fa, falen;
+    int i;
+    int npoints = _npoints != -1 ? _npoints : _points.size()-index;
+
+        
+    {
+        NSPoint points[npoints];
+        
+        for (i = 0; i < npoints; i++){
+            points[i].x = _points[index+i].x();
+            points[i].y = _points[index+i].y();
+        }
+        
+        
+        path = [[[NSBezierPath alloc] init] autorelease];
+        [path appendBezierPathWithPoints: &points[0] count: npoints];
+        [path closePath];	// Qt always closes the path.  Determined empirically.
+        
+        _lockFocus();
+
+        if (fill == TRUE && data->qbrush.qbrushstyle == SolidPattern){
+            if (winding == TRUE)
+                [path setWindingRule: NSNonZeroWindingRule];
+            else
+                [path setWindingRule: NSEvenOddWindingRule];
+            _setColorFromBrush();
+            [path fill];
+        }
+        _setColorFromPen();
+        [path stroke];
+        
+        _unlockFocus();
+    }
+}
+
+
+void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix)
+{
+    drawPixmap (p.x(), p.y(), pix);
+}
+
+
+void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix, const QRect &r)
+{
+    drawPixmap (p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height());
+}
+
+
+void QPainter::drawPixmap( int x, int y, const QPixmap &pixmap,
+			int sx, int sy, int sw, int sh )
+{
+    NSSize originalSize;
+
+    _lockFocus();
+
+    if (pixmap.nsimage != nil){
+        if (pixmap.xmatrix.empty == FALSE){
+            originalSize = [pixmap.nsimage size];
+            [pixmap.nsimage setScalesWhenResized: YES];
+            [pixmap.nsimage setSize: NSMakeSize (originalSize.width * pixmap.xmatrix.sx,
+                                                originalSize.height * pixmap.xmatrix.sy)];
+        }
+        
+        if (sw == -1)
+            sw = (int)[pixmap.nsimage size].width;
+        if (sh == -1)
+            sh = (int)[pixmap.nsimage size].height;
+        [pixmap.nsimage drawInRect: NSMakeRect(x, y, sw, sh) 
+                    fromRect: NSMakeRect(sx, sy, sw, sh)
+                    operation: NSCompositeSourceOver	// Renders transparency correctly
+                    fraction: 1.0];
+                    
+        if (pixmap.xmatrix.empty == FALSE)
+            [pixmap.nsimage setSize: originalSize];
+    }
+    
+    _unlockFocus();
+}
+
+static void drawTile( QPainter *p, int x, int y, int w, int h,
+		      const QPixmap &pixmap, int xOffset, int yOffset )
+{
+    int yPos, xPos, drawH, drawW, yOff, xOff;
+    yPos = y;
+    yOff = yOffset;
+    while( yPos < y + h ) {
+	drawH = pixmap.height() - yOff;    // Cropping first row
+	if ( yPos + drawH > y + h )	   // Cropping last row
+	    drawH = y + h - yPos;
+	xPos = x;
+	xOff = xOffset;
+	while( xPos < x + w ) {
+	    drawW = pixmap.width() - xOff; // Cropping first column
+	    if ( xPos + drawW > x + w )	   // Cropping last column
+		drawW = x + w - xPos;
+	    p->drawPixmap( xPos, yPos, pixmap, xOff, yOff, drawW, drawH );
+	    xPos += drawW;
+	    xOff = 0;
+	}
+	yPos += drawH;
+	yOff = 0;
+    }
+}
+
+
+void QPainter::drawTiledPixmap( int x, int y, int w, int h,
+				const QPixmap &pixmap, int sx, int sy )
+{
+    int sw = pixmap.width();
+    int sh = pixmap.height();
+    if (!sw || !sh )
+	return;
+    if ( sx < 0 )
+	sx = sw - -sx % sw;
+    else
+	sx = sx % sw;
+    if ( sy < 0 )
+	sy = sh - -sy % sh;
+    else
+	sy = sy % sh;
+
+    drawTile( this, x, y, w, h, pixmap, sx, sy );
+}
+
+
+// y is the baseline
+void QPainter::drawText(int x, int y, const QString &qstring, int len)
+{
+    NSString *string;
+    NSFont *font;
+    const char *ascii;
+    
+    _lockFocus();
+    
+    // Draw another string in Helvetica 24 in green 
+    font = data->qfont.data->font;    
+    
+    if (len == -1)
+        string = QSTRING_TO_NSSTRING(qstring);
+    else
+        string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+    // This will draw the text from the top of the bounding box down.
+    // Qt expects to draw from the baseline.
+    y = y - (int)([font defaultLineHeightForFont] + [font descender]);
+    [string drawAtPoint:NSMakePoint(x, y) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, data->qpen.qcolor.color, NSForegroundColorAttributeName, nil]];
+
+    _unlockFocus();
+}
+
+
+void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)\n");
+}
+
+
+void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len, 
+    QRect *br, char **internal)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len, 
+    QRect *br, char **internal)\n");
+}
+
+
+void QPainter::fillRect(int x, int y, int w, int h, const QBrush &brush)
+{
+    _lockFocus();
+    if (brush.qbrushstyle == SolidPattern){
+        [brush.qcolor.color set];
+        [NSBezierPath fillRect:NSMakeRect(x, y, w, h)];
+    }
+    _unlockFocus();
+}
+
+
+void QPainter::setClipping(bool)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::setClipping(bool)\n");
+}
+
+
+void QPainter::setClipRegion(const QRegion &)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::setClipRegion(const QRegion &)\n");
+}
+
+
+const QRegion &QPainter::clipRegion() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) const QRegion &QPainter::clipRegion() const\n");
+}
+
+
+bool QPainter::hasClipping() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QPainter::hasClipping() const\n");
+}
+
+
+Qt::RasterOp QPainter::rasterOp() const
+{
+#ifdef _SUPPORT_RASTER_OP
+    if (data->compositingOperation == NSCompositeSourceOver)
+        rerturn OrROP;
+    else if (data->compositingOperation == NSCompositeXOR)
+        return XorROP;
+    return CopyROP;
+#else
+    NSLog (@"ERROR (NOT IMPLEMENTED) QPainter::RasterOp QPainter::rasterOp() const\n");
+#endif
+}
+
+
+void QPainter::setRasterOp(RasterOp op)
+{
+#ifdef _SUPPORT_RASTER_OP
+    if (op == OrROP)
+        data->compositingOperation = NSCompositeSourceOver;
+    else if (op == XorROP)
+        data->compositingOperation = NSCompositeXOR;
+    else
+        data->compositingOperation = NSCompositeCopy;
+#else
+    NSLog (@"ERROR (NOT IMPLEMENTED) void QPainter::setRasterOp(RasterOp op)\n");
+#endif
+}
+
+void QPainter::_lockFocus(){
+    if (data->isFocusLocked == 0){
+        [data->widget->getView() lockFocus];
+        data->isFocusLocked = 1;
+    }	
+}
+
+void QPainter::_unlockFocus(){
+    if (data->isFocusLocked == 1){
+        [data->widget->getView() unlockFocus];
+        data->isFocusLocked = 0;
+    }	
+}
+
+
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/kwq/KWQPalette.mm
similarity index 74%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/kwq/KWQPalette.mm
index 013222c..f3d2044 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/kwq/KWQPalette.mm
@@ -23,11 +23,49 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qpalette.h>
+
+QPalette::QPalette()
+{
+}
+
+
+QPalette::QPalette(const QPalette &)
+{
+}
+
+
+QPalette::~QPalette()
+{
+}
+
+
+void QPalette::setColor(ColorGroup, QColorGroup::ColorRole role, const QColor &color)
+{
+}
+
+
+const QColorGroup &QPalette::active() const
+{
+}
+
+
+const QColorGroup &QPalette::inactive() const
 {
 }
 
-void qWarning(const char *msg, ...)
+
+const QColorGroup &QPalette::disabled() const
+{
+}
+
+
+const QColorGroup &QPalette::normal() const
+{
+}
+
+
+QPalette &QPalette::operator=(const QPalette &)
 {
 }
 
diff --git a/WebCore/kwq/KWQPen.mm b/WebCore/kwq/KWQPen.mm
index 5d13afd..50735fe 100644
--- a/WebCore/kwq/KWQPen.mm
+++ b/WebCore/kwq/KWQPen.mm
@@ -24,3 +24,51 @@
  */
 
 #include <qpen.h>
+
+QPen::QPen()
+{
+    qcolor = Qt::black;
+}
+
+
+QPen::QPen(const QColor &color, uint width, PenStyle style)
+{
+    qcolor = color;
+}
+
+
+QPen::QPen(const QPen &copyFrom)
+{
+    qcolor = copyFrom.qcolor;
+}
+
+
+QPen::~QPen()
+{
+}
+
+
+const QColor &QPen::color() const
+{
+    return qcolor;
+}
+
+
+QPen &QPen::operator=(const QPen &assignFrom)
+{
+    qcolor = assignFrom.qcolor;
+    return *this;
+}
+
+bool QPen::operator==(const QPen &compareTo) const
+{
+    return qcolor == compareTo.qcolor;
+}
+
+
+bool QPen::operator!=(const QPen &compareTo) const
+{
+    return !(operator==( compareTo ));
+}
+
+
diff --git a/WebCore/kwq/KWQPixmap.mm b/WebCore/kwq/KWQPixmap.mm
index 415b8e2..37b3357 100644
--- a/WebCore/kwq/KWQPixmap.mm
+++ b/WebCore/kwq/KWQPixmap.mm
@@ -24,3 +24,126 @@
  */
 
 #include <qpixmap.h>
+
+
+QPixmap::QPixmap()
+{
+    nsimage = nil;
+}
+
+
+QPixmap::QPixmap(const QSize&sz)
+{
+    nsimage = [[NSImage alloc] initWithSize: NSMakeSize ((float)sz.width(), (float)sz.height())];
+}
+
+
+QPixmap::QPixmap(const QByteArray&bytes)
+{
+    NSData *nsdata = [[[NSData alloc] initWithBytesNoCopy: bytes.data() length: bytes.size()] autorelease];
+    nsimage = [[NSImage alloc] initWithData: nsdata];
+    [nsimage setFlipped: YES];
+}
+
+
+QPixmap::QPixmap(int w, int h)
+{
+    nsimage = [[NSImage alloc] initWithSize: NSMakeSize(w, h)];
+}
+
+
+QPixmap::QPixmap(const QPixmap &copyFrom)
+{
+    if (copyFrom.nsimage != nil)
+        nsimage = [copyFrom.nsimage retain];
+    else
+        nsimage = nil;
+    xmatrix = copyFrom.xmatrix;
+}
+
+
+QPixmap::~QPixmap()
+{
+    if (nsimage != nil){
+        [nsimage release];
+        nsimage = nil;
+    }
+}
+
+
+void QPixmap::setMask(const QBitmap &)
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) void QPixmap::setMask(const QBitmap &) Not needed?\n");
+}
+
+
+const QBitmap *QPixmap::mask() const
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) const QBitmap *QPixmap::mask() const Not needed?\n");
+}
+
+
+bool QPixmap::isNull() const
+{
+    if (nsimage == nil)
+        return TRUE;
+    return false;
+}
+
+
+QSize QPixmap::size() const
+{
+    NSSize sz = [nsimage size];
+    return QSize (sz.width, sz.height);
+}
+
+
+QRect QPixmap::rect() const
+{
+    NSSize sz = [nsimage size];
+    return QRect (0,0,sz.width, sz.height);
+}
+
+
+int QPixmap::width() const
+{
+    return (int)[nsimage size].width;
+}
+
+
+int QPixmap::height() const
+{
+    return (int)[nsimage size].height;
+}
+
+
+void QPixmap::resize(const QSize &sz)
+{
+    [nsimage setSize: NSMakeSize ((float)(sz.width()), (float)(sz.height()))];
+}
+
+
+QPixmap QPixmap::xForm(const QWMatrix &xmatrix) const
+{
+    QPixmap xPix = *this;
+    xPix.xmatrix = xmatrix;
+    return xPix;
+}
+
+
+QImage QPixmap::convertToImage() const
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) QImage QPixmap::convertToImage() This method should never be called.  It is only used by Qt drag and drop (I think!)\n");
+}
+
+
+QPixmap &QPixmap::operator=(const QPixmap &assignFrom)
+{
+    if (assignFrom.nsimage == nsimage)
+        return *this;
+    [nsimage release];
+    nsimage = [assignFrom.nsimage retain];
+    xmatrix = assignFrom.xmatrix;
+    return *this;
+}
+
diff --git a/WebCore/src/kwq/kio/job.h b/WebCore/kwq/KWQPointArray.mm
similarity index 60%
copy from WebCore/src/kwq/kio/job.h
copy to WebCore/kwq/KWQPointArray.mm
index 8fbe161..ed56148 100644
--- a/WebCore/src/kwq/kio/job.h
+++ b/WebCore/kwq/KWQPointArray.mm
@@ -23,27 +23,50 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JOB_H_
-#define JOB_H_
+#include "qpoint.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 
-#include <kurl.h>
-#include "jobclasses.h"
 
-// for time_t
-#include <sys/types.h>
+QPointArray::QPointArray(int nPoints, const QCOORD *points)
+{
+    setPoints( nPoints, points );
+}
 
-// added to help in compilation of khtml/khtml_part.h:867
-namespace KIO {
 
-SimpleJob *http_update_cache(const KURL &, bool, time_t);
+void QPointArray::setPoint( uint index, int x, int y )
+{
+    QArray<QPoint>::at( index ) = QPoint( x, y );
+}
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true);
 
-} // namespace KIO
+bool QPointArray::setPoints( int nPoints, const QCOORD *points )
+{
+    if ( !resize(nPoints) )
+	return FALSE;
+    int i = 0;
+    while ( nPoints-- ) {			// make array of points
+	setPoint( i++, *points, *(points+1) );
+	points++;
+	points++;
+    }
+    return TRUE;
+}
 
-#endif
+
+bool QPointArray::setPoints( int nPoints, int firstx, int firsty, ... )
+{
+    va_list ap;
+    if ( !resize(nPoints) )
+	return FALSE;
+    setPoint( 0, firstx, firsty );		// set first point
+    int i = 1, x, y;
+    nPoints--;
+    va_start( ap, firsty );
+    while ( nPoints-- ) {
+	x = va_arg( ap, int );
+	y = va_arg( ap, int );
+	setPoint( i++, x, y );
+    }
+    va_end( ap );
+    return TRUE;
+}
diff --git a/WebCore/kwq/KWQView.mm b/WebCore/kwq/KWQView.mm
new file mode 100644
index 0000000..59d92c5
--- /dev/null
+++ b/WebCore/kwq/KWQView.mm
@@ -0,0 +1,25 @@
+#import "KWQView.h"
+
+#import <qwidget.h>
+
+ at implementation KWQView
+
+- initWithFrame: (NSRect) r widget: (QWidget *)w 
+{
+    [super initWithFrame: r];
+    widget = w;
+}
+
+
+- (void)drawRect:(NSRect)rect {
+    NSLog (@"drawRect\n", nil);
+    widget->paint((void *)0);
+}
+
+
+- (BOOL)isFlipped 
+{
+	return YES;
+}
+
+ at end
diff --git a/WebCore/kwq/KWQWMatrix.mm b/WebCore/kwq/KWQWMatrix.mm
index bcfc143..e448b20 100644
--- a/WebCore/kwq/KWQWMatrix.mm
+++ b/WebCore/kwq/KWQWMatrix.mm
@@ -23,4 +23,24 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <qpainter.h>
\ No newline at end of file
+#include <qpainter.h>
+
+
+// Simple implementation.  Only allows for scaling, and scaling once! 
+// This class is used by khtml to scale images.
+QWMatrix::QWMatrix()
+{
+    empty = TRUE;
+}
+    
+
+QWMatrix &QWMatrix::scale(double _sx, double _sy)
+{
+    if (empty != TRUE){
+        NSLog (@"ERROR (INCOMPLETE IMPLEMENTATION) QWMatrix &QWMatrix::scale(double _sx, double _sy) scale may only be called once.\n");
+    }
+    empty = FALSE;
+    sx = _sx;
+    sy = _sy;
+}
+
diff --git a/WebCore/kwq/KWQWidget.mm b/WebCore/kwq/KWQWidget.mm
index 98800b1..f7a17d4 100644
--- a/WebCore/kwq/KWQWidget.mm
+++ b/WebCore/kwq/KWQWidget.mm
@@ -24,3 +24,379 @@
  */
 
 #include <qwidget.h>
+
+#import "KWQView.h"
+
+/*
+    A QWidget rougly corresponds to an NSView.  In Qt a QFrame and QMainWindow inherit
+    from a QWidget.  In Cocoa a NSWindow does not inherit from NSView.  We will
+    emulate QWidgets using NSViews.
+    
+    The only QWidget emulated should be KHTMLView.  It's inheritance graph is
+        KHTMLView
+            QScrollView
+                QFrame
+                    QWidget
+    
+    We may not need to emulate any of the QScrollView behaviour as we MAY
+    get scrolling behaviour for free simply be implementing all rendering 
+    in an NSView and using NSScrollView.
+    
+    It appears that the only dependence of the window in khtml and kjs is
+    the javascript functions that manipulate a window.  We may want to
+    rework work that code rather than add NSWindow glue code.
+*/
+
+QWidget::QWidget(QWidget *parent=0, const char *name=0, WFlags f=0) 
+{
+    _initialize();
+}
+
+
+void QWidget::_initialize()
+{
+    data = (struct KWQWidgetData *)calloc (1, sizeof (struct KWQWidgetData));
+    data->view = [[KWQView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this];
+}
+
+
+
+QWidget::~QWidget() 
+{
+    [data->view release];
+
+    // What about:
+    // 	data->style
+    // 	data->font
+    // 	data->cursor
+    
+    free (data);
+}
+
+
+QSize QWidget::sizeHint() const 
+{
+}
+
+void QWidget::resize(int w, int h) 
+{
+    internalSetGeometry( data->rect.x(), data->rect.y(), w, h, FALSE );
+}
+
+void QWidget::setActiveWindow() 
+{
+    // Map onto [NSView window] equivalent.
+}
+
+
+void QWidget::setEnabled(bool) 
+{
+    // Not relevant.
+}
+
+
+void QWidget::setAutoMask(bool) 
+{
+    // Not relevant. ??
+}
+
+
+void QWidget::setMouseTracking(bool) 
+{
+    // Not relevant. ??
+}
+
+
+int QWidget::winId() const
+{
+/*
+    Does this winId need to be valid across sessions?  It appears to
+    be used by HTMLDocument::setCookie( const DOMString & value ).  If
+    so we have to rethink the current approach.
+    
+    Just return the hash of the NSView.
+*/
+    return (int)[data->view hash];
+}
+
+
+int QWidget::x() const 
+{
+    return data->rect.x();
+}
+
+
+int QWidget::y() const 
+{
+    return data->rect.y();
+}
+
+
+int QWidget::width() const 
+{ 
+    return data->rect.width();
+}
+
+
+int QWidget::height() const 
+{
+    return data->rect.height();
+}
+
+
+QSize QWidget::size() const 
+{
+    return data->rect.size();
+}
+
+
+void QWidget::resize(const QSize &s) 
+{
+    resize( s.width(), s.height());
+}
+
+
+QPoint QWidget::pos() const 
+{
+    return data->pos;
+}
+
+
+void QWidget::move(int x, int y) 
+{
+    internalSetGeometry( x + data->rect.x(),
+			 y + data->rect.y(),
+			 width(), height(), TRUE );
+}
+
+
+void QWidget::move(const QPoint &p) 
+{
+    move( p.x(), p.y() );
+}
+
+
+QWidget *QWidget::topLevelWidget() const 
+{
+    // This is only used by JavaScript to implement the various
+    // window geometry manipulations and accessors, i.e.:
+    // window.moveTo(), window.moveBy(), window.resizeBy(), window.resizeTo(),
+    // outerWidth, outerHeight.
+    
+    // This should return a subclass of QWidget that fronts for an
+    // NSWindow.
+    return (QWidget *)this;
+}
+
+
+QPoint QWidget::mapToGlobal(const QPoint &p) const
+{
+    // This is only used by JavaScript to implement the getting
+    // the screenX and screen Y coordinates.
+    NSPoint sp;
+    sp = [[data->view window] convertBaseToScreen: [data->view convertPoint: NSMakePoint ((float)p.x(), (float)p.y()) toView: nil]];
+    return QPoint (sp.x, sp.y);
+}
+
+
+void QWidget::setFocus()
+{
+    // TBD
+}
+
+
+void QWidget::clearFocus()
+{
+    // TBD
+}
+
+
+QWidget::FocusPolicy QWidget::focusPolicy() const
+{
+    return data->focusPolicy;
+}
+
+
+void QWidget::setFocusPolicy(FocusPolicy fp)
+{
+    data->focusPolicy = fp;
+}
+
+
+void QWidget::setFocusProxy( QWidget * )
+{
+    // TBD
+}
+
+
+const QPalette& QWidget::palette() const
+{
+    return data->pal;
+}
+
+
+void QWidget::setPalette(const QPalette &palette)
+{
+    // FIXME!  What do we do about releasing the old palette?
+    data->pal = palette;
+}
+
+void QWidget::unsetPalette()
+{
+    // Only called by RenderFormElement::layout, which I suspect will
+    // have to be rewritten.  Do nothing.
+}
+
+
+QStyle &QWidget::style() const
+{
+    return *data->style;
+}
+
+
+void QWidget::setStyle(QStyle *style)
+{
+    // According to the Qt implementation 
+    /*
+    Sets the widget's GUI style to \a style. Ownership of the style
+    object is not transferred.
+    */
+    data->style = style;
+}
+
+
+QFont QWidget::font() const
+{
+}
+
+
+void QWidget::setFont(const QFont &font)
+{
+    // FIXME Not clear what we should do with old font!
+    data->font = new QFont (font);
+}
+
+
+void QWidget::constPolish() const
+{
+    // Is this necessary?
+}
+
+
+QSize QWidget::minimumSizeHint() const
+{
+    // Used by embedded java (KJavaEmbed::sizeHint().  Will be replaced.
+    // Used by RenderSubmitButton::calcMinMaxWidth(), where it is called
+    // on a button widget.  Will be replaced.
+    NSLog (@"ERROR:  QWidget::minimumSizeHint() called.  Should never be called.\n", nil);
+    return QSize (0,0);
+}
+
+
+bool QWidget::isVisible() const
+{
+    return [[data->view window] isVisible];
+}
+
+
+void QWidget::setCursor(const QCursor &cur)
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::setCursor()\n", nil);
+    if (data->cursor)
+        delete data->cursor;
+    data->cursor = new QCursor (cur);
+}
+
+
+bool QWidget::event(QEvent *)
+{
+    // This will eventually not be called, or called from our implementation
+    // of run loop, or something???
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::event(QEvent *)\n", nil);
+    return TRUE;
+}
+
+
+bool QWidget::focusNextPrevChild(bool)
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::focusNextPrevChild()\n", nil);
+    return TRUE;
+}
+
+
+bool QWidget::hasMouseTracking() const
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::hasMouseTracking()\n", nil);
+    return true;
+}
+
+
+void QWidget::show()
+{
+    [[data->view window] deminiaturize: data->view];
+}
+
+
+void QWidget::hide()
+{
+    [[data->view window] miniaturize: data->view];
+}
+
+
+// no copying or assignment
+// note that these are "standard" (no pendantic stuff needed)
+
+
+
+// Non-public
+void QWidget::setCRect( const QRect &r )
+{
+    // One rect is both the same.
+    data->pos = r.topLeft();
+    data->rect = r;
+}
+
+void QWidget::internalSetGeometry( int x, int y, int w, int h, bool isMove )
+{
+    if ( w < 1 )				// invalid size
+	w = 1;
+    if ( h < 1 )
+	h = 1;
+
+    QRect  r( x, y, w, h );
+
+    // We only care about stuff that changes the geometry, or may
+    // cause the window manager to change its state
+    if ( data->rect == r )
+	return;
+
+    QSize oldSize( size() );
+
+    setCRect( r );
+
+    bool isResize = size() != oldSize;
+
+    // FIXME!  First approximation.  May need to translate coordinates.
+    [data->view setFrame: NSMakeRect (data->rect.x(), data->rect.y(), data->rect.width(), data->rect.height())];
+}
+
+#ifdef _KWQ_
+
+void QWidget::paint (void *)
+{
+}
+
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+NSView *QWidget::getView()
+{
+    return data->view;
+}
+#else
+void *QWidget::getView()
+{
+    return data->view;
+}
+#endif
+
+#endif _KWQ_
+
diff --git a/WebCore/src/kwq/KWQApplication.mm b/WebCore/src/kwq/KWQApplication.mm
index 9070707..122fa85 100644
--- a/WebCore/src/kwq/KWQApplication.mm
+++ b/WebCore/src/kwq/KWQApplication.mm
@@ -24,3 +24,115 @@
  */
 
 #include <qapplication.h>
+
+#import "_KWQOwner.h"
+
+QPalette QApplication::palette(const QWidget *p)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QPalette QApplication::palette(const QWidget *p)\n");
+}
+
+
+QWidget *QApplication::desktop()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QWidget *QApplication::desktop()\n");
+}
+
+
+int QApplication::startDragDistance()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) int QApplication::startDragDistance()\n");
+}
+
+
+QSize QApplication::globalStrut()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QSize QApplication::globalStrut()\n");
+}
+
+
+void QApplication::setOverrideCursor(const QCursor &c)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QApplication::setOverrideCursor(const QCursor &c)\n");
+}
+
+
+void QApplication::restoreOverrideCursor()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QApplication::restoreOverrideCursor()\n");
+}
+
+
+bool QApplication::sendEvent(QObject *o, QEvent *e)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QApplication::sendEvent(QObject *o, QEvent *e)\n");
+}
+
+
+QApplication::QApplication( int &argc, char **argv)
+{
+    _initialize();
+}
+
+
+void QApplication::_initialize(){
+    NSDictionary *info;
+    NSString *principalClassName;
+    NSString *mainNibFile;
+
+    globalPool = [[NSAutoreleasePool allocWithZone:NULL] init];
+    info = [[NSBundle mainBundle] infoDictionary];
+    principalClassName = [info objectForKey:@"NSPrincipalClass"];
+    mainNibFile = [info objectForKey:@"NSMainNibFile"];
+
+    if (principalClassName) {
+        Class principalClass = NSClassFromString(principalClassName);
+	if (principalClass) {
+            application = [principalClass sharedApplication];
+	    if (![NSBundle loadNibNamed: mainNibFile owner: application]) {
+                NSLog (@"ERROR:  QApplication::_initialize() unable to load %@\n", mainNibFile, nil);
+            }
+        }
+    }	
+    
+    //  Force linkage
+    [_KWQOwner class];
+}
+
+
+QApplication::~QApplication()
+{
+    [globalPool release];
+}
+
+
+void QApplication::setMainWidget(QWidget *w)
+{
+    if (application == nil){
+        NSLog (@"ERROR: QApplication::setMainWidget() application not set.\n");
+        return;
+    }
+    if (w == 0){
+        NSLog (@"ERROR: QApplication::setMainWidget() widget not valid.\n");
+        return;
+    }
+    
+    NSScrollView *sv = [[NSScrollView alloc] initWithFrame: NSMakeRect (0,0,0,0)];
+    [sv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+    [sv setHasVerticalScroller: YES];
+    [sv setHasHorizontalScroller: YES];
+    [sv setDocumentView: w->getView()];
+    [((_KWQOwner *)application)->window setContentView: sv];
+}
+
+
+int QApplication::exec()
+{
+    if (application == nil){
+        NSLog (@"ERROR: QApplication::exec() application not set.\n");
+        return 0;
+    }
+    [application run];
+    return 1;
+}
+
diff --git a/WebCore/src/kwq/KWQBrush.mm b/WebCore/src/kwq/KWQBrush.mm
index c9e7c2b..f5bd45f 100644
--- a/WebCore/src/kwq/KWQBrush.mm
+++ b/WebCore/src/kwq/KWQBrush.mm
@@ -24,3 +24,49 @@
  */
 
 #include <qbrush.h>
+
+QBrush::QBrush()
+{
+    qcolor = Qt::black;
+    qbrushstyle = NoBrush;
+}
+
+
+QBrush::QBrush(const QColor &c)
+{
+    qcolor = c;
+    qbrushstyle = SolidPattern;
+}
+
+
+QBrush::QBrush(const QBrush &copyFrom)
+{
+    qcolor = copyFrom.qcolor;
+    qbrushstyle = copyFrom.qbrushstyle;
+}
+
+
+QBrush &QBrush::operator=(const QBrush &assignFrom)
+{
+    qcolor = assignFrom.qcolor;
+    qbrushstyle = assignFrom.qbrushstyle;
+    return *this;
+}
+
+
+QBrush::~QBrush()
+{
+}
+
+
+bool QBrush::operator==(const QBrush &compareTo) const
+{
+    return qcolor == compareTo.qcolor;
+}
+
+
+bool QBrush::operator!=(const QBrush &compareTo) const
+{
+    return !(operator==( compareTo ));
+}
+
diff --git a/WebCore/src/kwq/KWQColor.mm b/WebCore/src/kwq/KWQColor.mm
new file mode 100644
index 0000000..6089c85
--- /dev/null
+++ b/WebCore/src/kwq/KWQColor.mm
@@ -0,0 +1,279 @@
+/****************************************************************************
+** $Id$
+**
+** Implementation of QColor class
+**
+** Created : 940112
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of the kernel module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+** licenses may use this file in accordance with the Qt Commercial License
+** Agreement provided with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales at trolltech.com for
+**   information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info at trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include <qcolor.h>
+
+QRgb qRgb(int r, int g, int b)
+{
+    return r << 16 | g << 8 | b;
+}
+
+
+QRgb qRgba(int r, int g, int b, int a)
+{
+    return a << 24 | r << 16 | g << 8 | b;
+}
+
+
+
+QColor::QColor()
+{
+    color = nil;
+}
+
+
+QColor::QColor(int r, int g, int b)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    else
+        _initialize (r, g, b);
+}
+
+
+QColor::QColor(const char *)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor::QColor(const char *)\n");
+}
+
+
+void QColor::_initialize(int r, int g, int b)
+{
+    color = [[NSColor colorWithCalibratedRed: ((float)(r)) / (float)255.0
+                    green: ((float)(g)) / (float)255.0
+                    blue: ((float)(b)) / (float)255.0
+                    alpha: 1.0] retain];
+}
+
+
+QColor::~QColor(){
+    if (color != nil)
+        [color release];
+}
+
+
+QColor::QColor(const QColor &copyFrom)
+{
+    if (color == copyFrom.color)
+        return;
+    if (color != nil)
+        [color release];
+    if (copyFrom.color != nil)
+        color = [copyFrom.color retain];
+    else
+        color = nil;
+}
+
+
+QString QColor::name() const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QString QColor::name() const\n");
+}
+
+
+void QColor::setNamedColor(const QString&)
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QColor::setNamedColor(const QString&)\n");
+}
+
+
+bool QColor::isValid() const
+{
+    return TRUE;
+}
+
+
+int QColor::red() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color redComponent] * 255);
+}
+
+
+int QColor::QColor::green() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color greenComponent] * 255);
+}
+
+int QColor::blue() const
+{
+    if (color == nil)
+        return 0;
+    return (int)([color blueComponent] * 255);
+}
+
+
+QRgb QColor::rgb() const
+{
+    if (color == nil)
+        return 0;
+    return qRgb (red(),green(),blue());
+}
+
+
+void QColor::setRgb(int r, int g, int b)
+{
+    if (color != nil)
+        [color release];
+    color = [[NSColor colorWithCalibratedRed: ((float)(r)) / (float)255.0
+                    green: ((float)(g)) / (float)255.0
+                    blue: ((float)(b)) / (float)255.0
+                    alpha: 1.0] retain];
+}
+
+
+void QColor::setRgb(int rgb)
+{
+    if (color != nil)
+        [color release];
+    color = [[NSColor colorWithCalibratedRed: ((float)(rgb >> 16)) / 255.0
+                    green: ((float)(rgb >> 8)) / 255.0
+                    blue: ((float)(rgb & 0xff)) / 255.0
+                    alpha: 1.0] retain];
+}
+
+
+void QColor::hsv(int *, int *, int *) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QColor::hsv(int *, int *, int *) const\n");
+}
+
+QColor QColor::light(int f = 150) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor QColor::light(int f = 150) const\n");
+}
+
+
+QColor QColor::dark(int f = 200) const
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) QColor QColor::dark(int f = 200) const\n");
+}
+
+
+QColor &QColor::operator=(const QColor &assignFrom)
+{
+    if ( !globals_init )
+	initGlobalColors();
+    if (color != assignFrom.color){ 
+        if (color != nil)
+            [color release];
+        if (assignFrom.color != nil)
+            color = [assignFrom.color retain];
+        else
+            color = nil;
+    }
+    return *this;
+}
+
+
+bool QColor::operator==(const QColor &compareTo) const
+{
+    return [color isEqual: compareTo.color];
+}
+
+
+bool QColor::operator!=(const QColor &compareTo) const
+{
+    return !(operator==(compareTo));
+}
+
+
+
+
+/*****************************************************************************
+  Global colors
+ *****************************************************************************/
+
+bool QColor::globals_init = FALSE;		// global color not initialized
+
+
+static QColor stdcol[19];
+
+QT_STATIC_CONST_IMPL QColor & Qt::color0 = stdcol[0];
+QT_STATIC_CONST_IMPL QColor & Qt::color1  = stdcol[1];
+QT_STATIC_CONST_IMPL QColor & Qt::black  = stdcol[2];
+QT_STATIC_CONST_IMPL QColor & Qt::white = stdcol[3];
+QT_STATIC_CONST_IMPL QColor & Qt::darkGray = stdcol[4];
+QT_STATIC_CONST_IMPL QColor & Qt::gray = stdcol[5];
+QT_STATIC_CONST_IMPL QColor & Qt::lightGray = stdcol[6];
+QT_STATIC_CONST_IMPL QColor & Qt::red = stdcol[7];
+QT_STATIC_CONST_IMPL QColor & Qt::green = stdcol[8];
+QT_STATIC_CONST_IMPL QColor & Qt::blue = stdcol[9];
+QT_STATIC_CONST_IMPL QColor & Qt::cyan = stdcol[10];
+QT_STATIC_CONST_IMPL QColor & Qt::magenta = stdcol[11];
+QT_STATIC_CONST_IMPL QColor & Qt::yellow = stdcol[12];
+QT_STATIC_CONST_IMPL QColor & Qt::darkRed = stdcol[13];
+QT_STATIC_CONST_IMPL QColor & Qt::darkGreen = stdcol[14];
+QT_STATIC_CONST_IMPL QColor & Qt::darkBlue = stdcol[15];
+QT_STATIC_CONST_IMPL QColor & Qt::darkCyan = stdcol[16];
+QT_STATIC_CONST_IMPL QColor & Qt::darkMagenta = stdcol[17];
+QT_STATIC_CONST_IMPL QColor & Qt::darkYellow = stdcol[18];
+
+
+
+void QColor::initGlobalColors()
+{
+    NSAutoreleasePool *colorPool = [[NSAutoreleasePool allocWithZone:NULL] init];
+     
+    globals_init = TRUE;
+
+    stdcol[ 0].setRgb(255,   255,   255 );
+    stdcol[ 1].setRgb(   0,   0,   0 );
+    stdcol[ 2].setRgb(   0,   0,   0 );
+    stdcol[ 3].setRgb( 255, 255, 255 );
+    stdcol[ 4].setRgb( 128, 128, 128 );
+    stdcol[ 5].setRgb( 160, 160, 164 );
+    stdcol[ 6].setRgb( 192, 192, 192 );
+    stdcol[ 7].setRgb( 255,   0,   0 );
+    stdcol[ 8].setRgb(   0, 255,   0 );
+    stdcol[ 9].setRgb(   0,   0, 255 );
+    stdcol[10].setRgb(   0, 255, 255 );
+    stdcol[11].setRgb( 255,   0, 255 );
+    stdcol[12].setRgb( 255, 255,   0 );
+    stdcol[13].setRgb( 128,   0,   0 );
+    stdcol[14].setRgb(   0, 128,   0 );
+    stdcol[15].setRgb(   0,   0, 128 );
+    stdcol[16].setRgb(   0, 128, 128 );
+    stdcol[17].setRgb( 128,   0, 128 );
+    stdcol[18].setRgb( 128, 128,   0 );
+}
+
diff --git a/WebCore/kwq/kio/job.h b/WebCore/src/kwq/KWQColorGroup.mm
similarity index 62%
copy from WebCore/kwq/kio/job.h
copy to WebCore/src/kwq/KWQColorGroup.mm
index 8fbe161..438ae21 100644
--- a/WebCore/kwq/kio/job.h
+++ b/WebCore/src/kwq/KWQColorGroup.mm
@@ -23,27 +23,86 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JOB_H_
-#define JOB_H_
+#include <qpalette.h>
+#include <qcolor.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+QColorGroup::QColorGroup()
+{
+}
 
-#include <kurl.h>
-#include "jobclasses.h"
 
-// for time_t
-#include <sys/types.h>
+QColorGroup::QColorGroup(const QColorGroup &)
+{
+}
 
-// added to help in compilation of khtml/khtml_part.h:867
-namespace KIO {
 
-SimpleJob *http_update_cache(const KURL &, bool, time_t);
+QColorGroup::~QColorGroup()
+{
+}
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true);
 
-} // namespace KIO
+const QColor &color(QColorGroup::ColorRole cr)
+{
+}
+
+
+void setColor(QColorGroup::ColorRole cr, const QColor &)
+{
+}
+
+
+const QColor &QColorGroup::foreground() const
+{
+}
+
+
+const QColor &QColorGroup::shadow() const
+{
+}
+
+
+const QColor &QColorGroup::light() const
+{
+}
+
+
+const QColor &QColorGroup::midlight() const
+{
+}
+
+
+const QColor &QColorGroup::dark() const
+{
+}
+
+
+const QColor &QColorGroup::base() const
+{
+}
+
+
+const QColor &QColorGroup::buttonText() const
+{
+}
+
+
+const QColor &QColorGroup::button() const
+{
+}
+
+
+const QColor &QColorGroup::text() const
+{
+}
+
+
+const QColor &QColorGroup::background() const
+{
+}
+
+
+QColorGroup &QColorGroup::operator=(const QColorGroup &)
+{
+}
+
 
-#endif
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/src/kwq/KWQCursor.mm
similarity index 89%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/src/kwq/KWQCursor.mm
index 013222c..89a487c 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/src/kwq/KWQCursor.mm
@@ -23,11 +23,23 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qcursor.h>
+
+QCursor::QCursor()
+{
+}
+
+
+QCursor::QCursor(const QCursor &)
 {
 }
 
-void qWarning(const char *msg, ...)
+
+QCursor::~QCursor()
 {
 }
+      
 
+QCursor &QCursor::operator=(const QCursor &)
+{
+}
diff --git a/WebCore/src/kwq/KWQFont.mm b/WebCore/src/kwq/KWQFont.mm
index 40f4b61..dc48703 100644
--- a/WebCore/src/kwq/KWQFont.mm
+++ b/WebCore/src/kwq/KWQFont.mm
@@ -23,4 +23,174 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#include <qstring.h>
 #include <qfont.h>
+
+#import <Cocoa/Cocoa.h>
+
+/*
+    For this implementation Qt pixelSize is interpreted as Cocoa pointSize.
+*/
+
+QFont::QFont()
+{
+    _initialize();
+}
+
+
+void QFont::_initialize()
+{
+    _initializeWithFont (0);
+}
+
+NSFont *QFont::defaultNSFont()
+{
+    return [NSFont userFontOfSize: (float)12.0];
+}
+
+void QFont::_initializeWithFont (const QFont *withFont)
+{
+    data = (struct KWQFontData *)calloc (1, sizeof (struct KWQFontData));
+    if (withFont == 0 || withFont->data == 0)
+        // Hmm...  What size should we use as a default font?
+        data->font = [defaultNSFont() retain];
+    else
+        data->font = [withFont->data->font retain];
+}
+
+
+QFont::QFont(const QFont &copyFrom)
+{
+    struct KWQFontData *oldData = data;
+    _initializeWithFont(&copyFrom);
+    _freeWithData (oldData);
+}
+
+
+QFont::~QFont()
+{
+    _free();
+}
+
+void QFont::_free(){
+    _freeWithData (data);
+}
+
+
+void QFont::_freeWithData(struct KWQFontData *freeData){
+    if (freeData != 0){
+        if (freeData->font != nil)
+            [freeData->font release];
+        free (freeData);
+    }
+}
+
+
+// member functions --------------------------------------------------------
+
+int QFont::pixelSize() const
+{
+    return (int)[data->font pointSize];
+}
+
+
+QString QFont::family() const
+{
+    return NSSTRING_TO_QSTRING([data->font familyName]);
+}
+
+
+void QFont::setFamily(const QString &qfamilyName)
+{
+    NSString *familyName;
+    NSFont *oldFont = data->font;
+    
+    familyName = QSTRING_TO_NSSTRING(qfamilyName);
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toFamily: familyName] retain];
+
+    [oldFont release];
+}
+
+
+void QFont::setPixelSizeFloat(float sz)
+{
+    NSFont *oldFont = data->font;
+
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toSize: sz] retain];
+
+    [oldFont release];
+}
+
+
+void QFont::setWeight(int weight)
+{
+    if (weight == Bold)
+        _setTrait (NSBoldFontMask);
+    else if (weight == Normal)
+        _setTrait (NSUnboldFontMask);
+}
+
+
+int QFont::weight() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSBoldFontMask)
+        return Bold;
+    return Normal;
+}
+
+
+bool QFont::setItalic(bool flag)
+{
+    if (flag)
+        _setTrait (NSItalicFontMask);
+    else
+        _setTrait (NSUnitalicFontMask);
+}
+
+
+bool QFont::italic() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSItalicFontMask)
+        return TRUE;
+    return FALSE;
+}
+
+
+bool QFont::bold() const
+{
+    if ([[NSFontManager sharedFontManager] traitsOfFont: data->font] & NSItalicFontMask)
+        return TRUE;
+    return FALSE;
+}
+
+
+// operators ---------------------------------------------------------------
+
+QFont &QFont::operator=(const QFont &assignFrom)
+{
+    _free();
+    _initializeWithFont(&assignFrom);
+    return *this;
+}
+
+
+bool QFont::operator==(const QFont &compareFont) const
+{
+    return [compareFont.data->font isEqual: data->font];
+}
+
+
+bool QFont::operator!=(const QFont &compareFont) const
+{
+    return !(operator==( compareFont ));
+}
+
+
+void QFont::_setTrait (NSFontTraitMask mask)
+{
+    NSFont *oldFont = data->font;
+
+    data->font = [[[NSFontManager sharedFontManager] convertFont: data->font toHaveTrait: mask] retain];
+
+    [oldFont release];
+}
diff --git a/WebCore/src/kwq/KWQFontMetrics.mm b/WebCore/src/kwq/KWQFontMetrics.mm
index 79e4d72..8cb322f 100644
--- a/WebCore/src/kwq/KWQFontMetrics.mm
+++ b/WebCore/src/kwq/KWQFontMetrics.mm
@@ -24,3 +24,148 @@
  */
 
 #include <qfontmetrics.h>
+
+
+QFontMetrics::QFontMetrics()
+{
+    _initialize();
+}
+
+
+QFontMetrics::QFontMetrics(const QFont &withFont)
+{
+    _initializeWithFont (withFont.data->font);
+}
+
+
+QFontMetrics::QFontMetrics(const QFontMetrics &copyFrom)
+{
+    struct KWQFontMetricsData *oldData = data;
+    _initializeWithFont(copyFrom.data->font);
+    _freeWithData (oldData);
+}
+
+void QFontMetrics::_initialize()
+{
+    _initializeWithFont (0);
+}
+
+void QFontMetrics::_initializeWithFont (NSFont *withFont)
+{
+    data = (struct KWQFontMetricsData *)calloc (1, sizeof (struct KWQFontMetricsData));
+    if (withFont == 0)
+        data->font = QFont::defaultNSFont();
+    else
+        data->font = [withFont retain];
+}
+
+void QFontMetrics::_free(){
+    _freeWithData (data);
+}
+
+
+void QFontMetrics::_freeWithData(struct KWQFontMetricsData *freeData){
+    if (freeData != 0){
+        [freeData->font release];
+        free (freeData);
+    }
+}
+
+QFontMetrics::~QFontMetrics()
+{
+    _free();
+}
+
+
+int QFontMetrics::ascent() const
+{
+    // Qt seems to use [font defaultLineHeightForFont] + [font descender] instead
+    // of what seems more natural [font ascender].
+    // Remember that descender is negative. 
+    return (int)([data->font defaultLineHeightForFont] + [data->font descender]);
+}
+
+
+int QFontMetrics::height() const
+{
+    // According to Qt documentation: 
+    // "This is always equal to ascent()+descent()+1 (the 1 is for the base line)."
+    // However, the [font defaultLineHeightForFont] seems more appropriate.
+    return (int)[data->font defaultLineHeightForFont];
+}
+
+
+int QFontMetrics::width(QChar qc) const
+{
+    ushort c = qc.unicode();
+    NSString *string = [NSString stringWithCharacters: (const unichar *)&c length: 1];
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::width(char c) const
+{
+    NSString *string = [NSString stringWithCString: &c length: 1];
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::width(const QString &qstring, int len) const
+{
+    NSString *string;
+
+    if (len != -1)
+        string = QSTRING_TO_NSSTRING_LENGTH (qstring, len);
+    else
+        string = QSTRING_TO_NSSTRING (qstring);
+    return (int)[data->font widthOfString: string];
+}
+
+
+int QFontMetrics::descent() const
+{
+    return -(int)[data->font descender];
+}
+
+
+QRect QFontMetrics::boundingRect(const QString &, int len=-1) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QRect QFontMetrics::boundingRect(const QString &, int len=-1)\n");
+}
+
+
+QRect QFontMetrics::boundingRect(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::boundingRect(QChar)\n");
+}
+
+
+QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, 
+    int *tabarray=0, char **intern=0 ) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, int *tabarray=0, char **intern=0 )\n");
+}
+
+
+int QFontMetrics::rightBearing(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::rightBearing(QChar)\n");
+    return 0;
+}
+
+
+int QFontMetrics::leftBearing(QChar) const
+{
+    NSLog (@"WARNING (NOT IMPLEMENTED) leftBearing(QChar)\n");
+    return 0;
+}
+
+
+QFontMetrics &QFontMetrics::operator=(const QFontMetrics &assignFrom)
+{
+    _free();
+    _initializeWithFont(assignFrom.data->font);
+    return *this;    
+}
+
+
diff --git a/WebCore/src/kwq/KWQObject.mm b/WebCore/src/kwq/KWQObject.mm
new file mode 100644
index 0000000..fbb7535
--- /dev/null
+++ b/WebCore/src/kwq/KWQObject.mm
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2001 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include <qobject.h>
+
+bool QObject::connect(const QObject *, const char *, const QObject *, 
+    const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::connect\n");
+}
+
+
+bool QObject::disconnect( const QObject *, const char *, const QObject *, 
+    const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::disconnect\n");
+}
+
+
+QObject::QObject(QObject *parent=0, const char *name=0)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QObject::QObject(QObject *parent=0, const char *name=0)\n");
+}
+
+
+QObject::~QObject()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) QObject::~QObject()\n");
+}
+
+
+// member functions --------------------------------------------------------
+
+const char *QObject::name() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) const char *QObject::name() const\n");
+}
+
+
+void QObject::setName(const char *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::setName(const char *)\n");
+}
+
+#ifdef DO_QVARIANT
+QVariant QObject::property(const char *name) const
+{
+}
+#endif
+
+bool QObject::inherits(const char *) const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::inherits(const char *) const\n");
+}
+
+
+bool QObject::connect(const QObject *, const char *, const char *) const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QObject::connect(const QObject *, const char *, const char *) const\n");
+}
+
+
+int QObject:: startTimer(int)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) int QObject:: startTimer(int)\n");
+}
+
+
+void QObject::killTimer(int)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::killTimer(int)\n");
+}
+
+
+void QObject::killTimers()
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::killTimers()\n");
+}
+
+
+void QObject::installEventFilter(const QObject *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::installEventFilter(const QObject *)\n");
+}
+
+
+void QObject::removeEventFilter(const QObject *)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::removeEventFilter(const QObject *)\n");
+}
+
+
+void QObject::blockSignals(bool)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QObject::blockSignals(bool)\n");
+}
+
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/src/kwq/KWQPaintDevice.mm
similarity index 95%
copy from WebCore/kwq/KWQFont.mm
copy to WebCore/src/kwq/KWQPaintDevice.mm
index 40f4b61..c2bd48c 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/src/kwq/KWQPaintDevice.mm
@@ -22,5 +22,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+#include <qpaintdevice.h>
+
+    
+QPaintDevice::~QPaintDevice()
+{
+}
+
 
-#include <qfont.h>
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/src/kwq/KWQPaintDeviceMetrics.mm
similarity index 87%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/src/kwq/KWQPaintDeviceMetrics.mm
index 013222c..d7e6b4f 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/src/kwq/KWQPaintDeviceMetrics.mm
@@ -23,11 +23,19 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qpaintdevicemetrics.h>
+
+QPaintDeviceMetrics::QPaintDeviceMetrics(const QPaintDevice *)
+{
+}
+
+
+int QPaintDeviceMetrics::logicalDpiY() const 
 {
 }
 
-void qWarning(const char *msg, ...)
+
+int QPaintDeviceMetrics::depth() const
 {
 }
 
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index b1a3327..9b27274 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -24,3 +24,486 @@
  */
 
 #include <qpainter.h>
+#include <qwidget.h>
+#include <qfontmetrics.h>
+#include <qpixmap.h>
+#include <qstack.h>
+#include <qpoint.h>
+
+
+#import <Cocoa/Cocoa.h>
+
+struct QPState {				// painter state
+    QFont	font;
+    QPen	pen;
+    QBrush	brush;
+    NSCompositingOperation compositingOperation;
+};
+
+typedef QStack<QPState> QPStateStack;
+
+
+QPainter::QPainter()
+{
+}
+
+
+QPainter::QPainter(const QPaintDevice *pdev)
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) QPainter::QPainter(const QPaintDevice *)\n");
+}
+
+
+//  How do we handle ownership of widget?
+QPainter::QPainter(QWidget *widget)
+{
+    _initialize (widget);
+}
+
+void QPainter::_initialize(QWidget *widget)
+{
+    data = (struct KWQPainterData *)calloc (1, sizeof (struct KWQPainterData));
+    data->widget = widget;
+    data->qpen = QPen (Qt::black);
+    data->isFocusLocked = 0;
+    data->compositingOperation = NSCompositeCopy;
+}
+
+
+QPainter::~QPainter()
+{
+    free (data);
+}
+
+    
+const QFont &QPainter::font() const
+{
+    return data->qfont;
+}
+
+
+void QPainter::setFont(const QFont &aFont)
+{
+    data->qfont = aFont;
+}
+
+
+QFontMetrics QPainter::fontMetrics() const
+{
+    return QFontMetrics( data->qfont );
+}
+
+const QPen &QPainter::pen() const
+{
+    return data->qpen;
+}
+
+
+void QPainter::setPen(const QPen &pen)
+{
+    data->qpen = pen;
+}
+
+
+void QPainter::setPen(PenStyle)
+{
+    NSLog (@"WARNING (NOT YET IMPLEMENTED) void QPainter::setPen(PenStyle)\n");
+}
+
+
+void QPainter::setBrush(const QBrush &brush)
+{
+    data->qbrush = brush;
+}
+
+
+void QPainter::setBrush(BrushStyle style)
+{
+    // Either NoBrush or SolidPattern.
+    data->qbrush.qbrushstyle = style;
+}
+
+
+QRect QPainter::xForm(const QRect &) const
+{
+}
+
+
+void QPainter::save()
+{
+    QPStateStack *pss = data->ps_stack;
+    if ( pss == 0 ) {
+	pss = new QStack<QPState>;
+	data->ps_stack = pss;
+    }
+    
+    QPState *ps = new QPState;
+
+    ps->font  = data->qfont;
+    ps->pen   = data->qpen;
+    ps->brush = data->qbrush;
+    ps->compositingOperation = data->compositingOperation;
+    pss->push( ps );
+}
+
+
+void QPainter::restore()
+{
+    QPStateStack *pss = (QPStateStack *)data->ps_stack;
+    if ( pss == 0 || pss->isEmpty() ) {
+        NSLog (@"ERROR void QPainter::restore() stack is empty\n");
+	return;
+    }
+    QPState *ps = pss->pop();
+
+    if ( ps->font != data->qfont )
+	setFont( ps->font );
+    if ( ps->pen != data->qpen )
+	setPen( ps->pen );
+    if ( ps->brush != data->qbrush )
+	setBrush( ps->brush );
+    ps->compositingOperation = data->compositingOperation;
+
+    delete ps;
+}
+
+
+// Draws a filled rectangle with a stroked border.
+void QPainter::drawRect(int x, int y, int w, int h)
+{
+    _lockFocus();
+    if (data->qbrush.qbrushstyle == SolidPattern){
+        _setColorFromBrush();
+        [NSBezierPath fillRect:NSMakeRect(x, y, w, h)];
+    }
+    _setColorFromPen();
+    [NSBezierPath strokeRect:NSMakeRect(x, y, w, h)];
+    _unlockFocus();
+}
+
+
+void QPainter::_setColorFromBrush()
+{
+    [data->qbrush.qcolor.color set];
+}
+
+
+void QPainter::_setColorFromPen()
+{
+    [data->qpen.qcolor.color set];
+}
+
+
+void QPainter::drawLine(int x1, int y1, int x2, int y2)
+{
+    _lockFocus();
+    _setColorFromPen();
+    [NSBezierPath strokeLineFromPoint:NSMakePoint(x1, y1) toPoint:NSMakePoint(x2, y2)];
+    _unlockFocus();
+}
+
+
+void QPainter::drawEllipse(int x, int y, int w, int h)
+{
+    NSBezierPath *path;
+
+    path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect (x, y, w, h)];
+    
+    _lockFocus();
+    if (data->qbrush.qbrushstyle == SolidPattern){
+        _setColorFromBrush();
+        [path fill];
+    }
+    _setColorFromPen();
+    [path stroke];
+    _unlockFocus();
+}
+
+
+// Only supports arc on circles.  That's all khtml needs.
+void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
+{
+    NSBezierPath *path;
+    float fa, falen;
+    
+    if (w != h){
+        NSLog (@"ERROR (INCOMPLETE IMPLEMENTATION) void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)\nOnly supports drawing arcs on a circle.\n");
+    }
+    
+    path = [[[NSBezierPath alloc] init] autorelease];
+    fa = (float)(a/16);
+    falen =  fa + (float)(alen/16);
+    [path appendBezierPathWithArcWithCenter: NSMakePoint(x + w/2, y + h/2) 
+                radius: (float)(w/2) 
+                startAngle: -fa
+                endAngle: -falen
+                clockwise: YES];
+
+    _lockFocus();
+
+    _setColorFromPen();
+    [path stroke];
+
+    _unlockFocus();
+}
+
+
+void QPainter::drawPolyline(const QPointArray &points, int index, int npoints)
+{
+    _drawPoints (points, 0, index, npoints, FALSE);
+}
+
+
+void QPainter::drawPolygon(const QPointArray &points, bool winding, int index,
+    int npoints)
+{
+    _drawPoints (points, winding, index, npoints, TRUE);
+}
+
+
+void QPainter::_drawPoints (const QPointArray &_points, bool winding, int index, int _npoints, bool fill)
+{
+    NSBezierPath *path;
+    float fa, falen;
+    int i;
+    int npoints = _npoints != -1 ? _npoints : _points.size()-index;
+
+        
+    {
+        NSPoint points[npoints];
+        
+        for (i = 0; i < npoints; i++){
+            points[i].x = _points[index+i].x();
+            points[i].y = _points[index+i].y();
+        }
+        
+        
+        path = [[[NSBezierPath alloc] init] autorelease];
+        [path appendBezierPathWithPoints: &points[0] count: npoints];
+        [path closePath];	// Qt always closes the path.  Determined empirically.
+        
+        _lockFocus();
+
+        if (fill == TRUE && data->qbrush.qbrushstyle == SolidPattern){
+            if (winding == TRUE)
+                [path setWindingRule: NSNonZeroWindingRule];
+            else
+                [path setWindingRule: NSEvenOddWindingRule];
+            _setColorFromBrush();
+            [path fill];
+        }
+        _setColorFromPen();
+        [path stroke];
+        
+        _unlockFocus();
+    }
+}
+
+
+void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix)
+{
+    drawPixmap (p.x(), p.y(), pix);
+}
+
+
+void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix, const QRect &r)
+{
+    drawPixmap (p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height());
+}
+
+
+void QPainter::drawPixmap( int x, int y, const QPixmap &pixmap,
+			int sx, int sy, int sw, int sh )
+{
+    NSSize originalSize;
+
+    _lockFocus();
+
+    if (pixmap.nsimage != nil){
+        if (pixmap.xmatrix.empty == FALSE){
+            originalSize = [pixmap.nsimage size];
+            [pixmap.nsimage setScalesWhenResized: YES];
+            [pixmap.nsimage setSize: NSMakeSize (originalSize.width * pixmap.xmatrix.sx,
+                                                originalSize.height * pixmap.xmatrix.sy)];
+        }
+        
+        if (sw == -1)
+            sw = (int)[pixmap.nsimage size].width;
+        if (sh == -1)
+            sh = (int)[pixmap.nsimage size].height;
+        [pixmap.nsimage drawInRect: NSMakeRect(x, y, sw, sh) 
+                    fromRect: NSMakeRect(sx, sy, sw, sh)
+                    operation: NSCompositeSourceOver	// Renders transparency correctly
+                    fraction: 1.0];
+                    
+        if (pixmap.xmatrix.empty == FALSE)
+            [pixmap.nsimage setSize: originalSize];
+    }
+    
+    _unlockFocus();
+}
+
+static void drawTile( QPainter *p, int x, int y, int w, int h,
+		      const QPixmap &pixmap, int xOffset, int yOffset )
+{
+    int yPos, xPos, drawH, drawW, yOff, xOff;
+    yPos = y;
+    yOff = yOffset;
+    while( yPos < y + h ) {
+	drawH = pixmap.height() - yOff;    // Cropping first row
+	if ( yPos + drawH > y + h )	   // Cropping last row
+	    drawH = y + h - yPos;
+	xPos = x;
+	xOff = xOffset;
+	while( xPos < x + w ) {
+	    drawW = pixmap.width() - xOff; // Cropping first column
+	    if ( xPos + drawW > x + w )	   // Cropping last column
+		drawW = x + w - xPos;
+	    p->drawPixmap( xPos, yPos, pixmap, xOff, yOff, drawW, drawH );
+	    xPos += drawW;
+	    xOff = 0;
+	}
+	yPos += drawH;
+	yOff = 0;
+    }
+}
+
+
+void QPainter::drawTiledPixmap( int x, int y, int w, int h,
+				const QPixmap &pixmap, int sx, int sy )
+{
+    int sw = pixmap.width();
+    int sh = pixmap.height();
+    if (!sw || !sh )
+	return;
+    if ( sx < 0 )
+	sx = sw - -sx % sw;
+    else
+	sx = sx % sw;
+    if ( sy < 0 )
+	sy = sh - -sy % sh;
+    else
+	sy = sy % sh;
+
+    drawTile( this, x, y, w, h, pixmap, sx, sy );
+}
+
+
+// y is the baseline
+void QPainter::drawText(int x, int y, const QString &qstring, int len)
+{
+    NSString *string;
+    NSFont *font;
+    const char *ascii;
+    
+    _lockFocus();
+    
+    // Draw another string in Helvetica 24 in green 
+    font = data->qfont.data->font;    
+    
+    if (len == -1)
+        string = QSTRING_TO_NSSTRING(qstring);
+    else
+        string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+    // This will draw the text from the top of the bounding box down.
+    // Qt expects to draw from the baseline.
+    y = y - (int)([font defaultLineHeightForFont] + [font descender]);
+    [string drawAtPoint:NSMakePoint(x, y) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, data->qpen.qcolor.color, NSForegroundColorAttributeName, nil]];
+
+    _unlockFocus();
+}
+
+
+void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)\n");
+}
+
+
+void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len, 
+    QRect *br, char **internal)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len, 
+    QRect *br, char **internal)\n");
+}
+
+
+void QPainter::fillRect(int x, int y, int w, int h, const QBrush &brush)
+{
+    _lockFocus();
+    if (brush.qbrushstyle == SolidPattern){
+        [brush.qcolor.color set];
+        [NSBezierPath fillRect:NSMakeRect(x, y, w, h)];
+    }
+    _unlockFocus();
+}
+
+
+void QPainter::setClipping(bool)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::setClipping(bool)\n");
+}
+
+
+void QPainter::setClipRegion(const QRegion &)
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::setClipRegion(const QRegion &)\n");
+}
+
+
+const QRegion &QPainter::clipRegion() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) const QRegion &QPainter::clipRegion() const\n");
+}
+
+
+bool QPainter::hasClipping() const
+{
+    NSLog (@"ERROR (NOT YET IMPLEMENTED) bool QPainter::hasClipping() const\n");
+}
+
+
+Qt::RasterOp QPainter::rasterOp() const
+{
+#ifdef _SUPPORT_RASTER_OP
+    if (data->compositingOperation == NSCompositeSourceOver)
+        rerturn OrROP;
+    else if (data->compositingOperation == NSCompositeXOR)
+        return XorROP;
+    return CopyROP;
+#else
+    NSLog (@"ERROR (NOT IMPLEMENTED) QPainter::RasterOp QPainter::rasterOp() const\n");
+#endif
+}
+
+
+void QPainter::setRasterOp(RasterOp op)
+{
+#ifdef _SUPPORT_RASTER_OP
+    if (op == OrROP)
+        data->compositingOperation = NSCompositeSourceOver;
+    else if (op == XorROP)
+        data->compositingOperation = NSCompositeXOR;
+    else
+        data->compositingOperation = NSCompositeCopy;
+#else
+    NSLog (@"ERROR (NOT IMPLEMENTED) void QPainter::setRasterOp(RasterOp op)\n");
+#endif
+}
+
+void QPainter::_lockFocus(){
+    if (data->isFocusLocked == 0){
+        [data->widget->getView() lockFocus];
+        data->isFocusLocked = 1;
+    }	
+}
+
+void QPainter::_unlockFocus(){
+    if (data->isFocusLocked == 1){
+        [data->widget->getView() unlockFocus];
+        data->isFocusLocked = 0;
+    }	
+}
+
+
diff --git a/WebCore/src/kwq/qt/_qglobal.cpp b/WebCore/src/kwq/KWQPalette.mm
similarity index 74%
copy from WebCore/src/kwq/qt/_qglobal.cpp
copy to WebCore/src/kwq/KWQPalette.mm
index 013222c..f3d2044 100644
--- a/WebCore/src/kwq/qt/_qglobal.cpp
+++ b/WebCore/src/kwq/KWQPalette.mm
@@ -23,11 +23,49 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-void qDebug(const char *msg, ...)
+#include <qpalette.h>
+
+QPalette::QPalette()
+{
+}
+
+
+QPalette::QPalette(const QPalette &)
+{
+}
+
+
+QPalette::~QPalette()
+{
+}
+
+
+void QPalette::setColor(ColorGroup, QColorGroup::ColorRole role, const QColor &color)
+{
+}
+
+
+const QColorGroup &QPalette::active() const
+{
+}
+
+
+const QColorGroup &QPalette::inactive() const
 {
 }
 
-void qWarning(const char *msg, ...)
+
+const QColorGroup &QPalette::disabled() const
+{
+}
+
+
+const QColorGroup &QPalette::normal() const
+{
+}
+
+
+QPalette &QPalette::operator=(const QPalette &)
 {
 }
 
diff --git a/WebCore/src/kwq/KWQPen.mm b/WebCore/src/kwq/KWQPen.mm
index 5d13afd..50735fe 100644
--- a/WebCore/src/kwq/KWQPen.mm
+++ b/WebCore/src/kwq/KWQPen.mm
@@ -24,3 +24,51 @@
  */
 
 #include <qpen.h>
+
+QPen::QPen()
+{
+    qcolor = Qt::black;
+}
+
+
+QPen::QPen(const QColor &color, uint width, PenStyle style)
+{
+    qcolor = color;
+}
+
+
+QPen::QPen(const QPen &copyFrom)
+{
+    qcolor = copyFrom.qcolor;
+}
+
+
+QPen::~QPen()
+{
+}
+
+
+const QColor &QPen::color() const
+{
+    return qcolor;
+}
+
+
+QPen &QPen::operator=(const QPen &assignFrom)
+{
+    qcolor = assignFrom.qcolor;
+    return *this;
+}
+
+bool QPen::operator==(const QPen &compareTo) const
+{
+    return qcolor == compareTo.qcolor;
+}
+
+
+bool QPen::operator!=(const QPen &compareTo) const
+{
+    return !(operator==( compareTo ));
+}
+
+
diff --git a/WebCore/src/kwq/KWQPixmap.mm b/WebCore/src/kwq/KWQPixmap.mm
index 415b8e2..37b3357 100644
--- a/WebCore/src/kwq/KWQPixmap.mm
+++ b/WebCore/src/kwq/KWQPixmap.mm
@@ -24,3 +24,126 @@
  */
 
 #include <qpixmap.h>
+
+
+QPixmap::QPixmap()
+{
+    nsimage = nil;
+}
+
+
+QPixmap::QPixmap(const QSize&sz)
+{
+    nsimage = [[NSImage alloc] initWithSize: NSMakeSize ((float)sz.width(), (float)sz.height())];
+}
+
+
+QPixmap::QPixmap(const QByteArray&bytes)
+{
+    NSData *nsdata = [[[NSData alloc] initWithBytesNoCopy: bytes.data() length: bytes.size()] autorelease];
+    nsimage = [[NSImage alloc] initWithData: nsdata];
+    [nsimage setFlipped: YES];
+}
+
+
+QPixmap::QPixmap(int w, int h)
+{
+    nsimage = [[NSImage alloc] initWithSize: NSMakeSize(w, h)];
+}
+
+
+QPixmap::QPixmap(const QPixmap &copyFrom)
+{
+    if (copyFrom.nsimage != nil)
+        nsimage = [copyFrom.nsimage retain];
+    else
+        nsimage = nil;
+    xmatrix = copyFrom.xmatrix;
+}
+
+
+QPixmap::~QPixmap()
+{
+    if (nsimage != nil){
+        [nsimage release];
+        nsimage = nil;
+    }
+}
+
+
+void QPixmap::setMask(const QBitmap &)
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) void QPixmap::setMask(const QBitmap &) Not needed?\n");
+}
+
+
+const QBitmap *QPixmap::mask() const
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) const QBitmap *QPixmap::mask() const Not needed?\n");
+}
+
+
+bool QPixmap::isNull() const
+{
+    if (nsimage == nil)
+        return TRUE;
+    return false;
+}
+
+
+QSize QPixmap::size() const
+{
+    NSSize sz = [nsimage size];
+    return QSize (sz.width, sz.height);
+}
+
+
+QRect QPixmap::rect() const
+{
+    NSSize sz = [nsimage size];
+    return QRect (0,0,sz.width, sz.height);
+}
+
+
+int QPixmap::width() const
+{
+    return (int)[nsimage size].width;
+}
+
+
+int QPixmap::height() const
+{
+    return (int)[nsimage size].height;
+}
+
+
+void QPixmap::resize(const QSize &sz)
+{
+    [nsimage setSize: NSMakeSize ((float)(sz.width()), (float)(sz.height()))];
+}
+
+
+QPixmap QPixmap::xForm(const QWMatrix &xmatrix) const
+{
+    QPixmap xPix = *this;
+    xPix.xmatrix = xmatrix;
+    return xPix;
+}
+
+
+QImage QPixmap::convertToImage() const
+{
+    NSLog (@"ERROR (NOT IMPLEMENTED) QImage QPixmap::convertToImage() This method should never be called.  It is only used by Qt drag and drop (I think!)\n");
+}
+
+
+QPixmap &QPixmap::operator=(const QPixmap &assignFrom)
+{
+    if (assignFrom.nsimage == nsimage)
+        return *this;
+    [nsimage release];
+    nsimage = [assignFrom.nsimage retain];
+    xmatrix = assignFrom.xmatrix;
+    return *this;
+}
+
diff --git a/WebCore/src/kwq/kio/job.h b/WebCore/src/kwq/KWQPointArray.mm
similarity index 60%
copy from WebCore/src/kwq/kio/job.h
copy to WebCore/src/kwq/KWQPointArray.mm
index 8fbe161..ed56148 100644
--- a/WebCore/src/kwq/kio/job.h
+++ b/WebCore/src/kwq/KWQPointArray.mm
@@ -23,27 +23,50 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef JOB_H_
-#define JOB_H_
+#include "qpoint.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 
-#include <kurl.h>
-#include "jobclasses.h"
 
-// for time_t
-#include <sys/types.h>
+QPointArray::QPointArray(int nPoints, const QCOORD *points)
+{
+    setPoints( nPoints, points );
+}
 
-// added to help in compilation of khtml/khtml_part.h:867
-namespace KIO {
 
-SimpleJob *http_update_cache(const KURL &, bool, time_t);
+void QPointArray::setPoint( uint index, int x, int y )
+{
+    QArray<QPoint>::at( index ) = QPoint( x, y );
+}
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true);
 
-} // namespace KIO
+bool QPointArray::setPoints( int nPoints, const QCOORD *points )
+{
+    if ( !resize(nPoints) )
+	return FALSE;
+    int i = 0;
+    while ( nPoints-- ) {			// make array of points
+	setPoint( i++, *points, *(points+1) );
+	points++;
+	points++;
+    }
+    return TRUE;
+}
 
-#endif
+
+bool QPointArray::setPoints( int nPoints, int firstx, int firsty, ... )
+{
+    va_list ap;
+    if ( !resize(nPoints) )
+	return FALSE;
+    setPoint( 0, firstx, firsty );		// set first point
+    int i = 1, x, y;
+    nPoints--;
+    va_start( ap, firsty );
+    while ( nPoints-- ) {
+	x = va_arg( ap, int );
+	y = va_arg( ap, int );
+	setPoint( i++, x, y );
+    }
+    va_end( ap );
+    return TRUE;
+}
diff --git a/WebCore/src/kwq/KWQView.mm b/WebCore/src/kwq/KWQView.mm
new file mode 100644
index 0000000..59d92c5
--- /dev/null
+++ b/WebCore/src/kwq/KWQView.mm
@@ -0,0 +1,25 @@
+#import "KWQView.h"
+
+#import <qwidget.h>
+
+ at implementation KWQView
+
+- initWithFrame: (NSRect) r widget: (QWidget *)w 
+{
+    [super initWithFrame: r];
+    widget = w;
+}
+
+
+- (void)drawRect:(NSRect)rect {
+    NSLog (@"drawRect\n", nil);
+    widget->paint((void *)0);
+}
+
+
+- (BOOL)isFlipped 
+{
+	return YES;
+}
+
+ at end
diff --git a/WebCore/src/kwq/KWQWMatrix.mm b/WebCore/src/kwq/KWQWMatrix.mm
index bcfc143..e448b20 100644
--- a/WebCore/src/kwq/KWQWMatrix.mm
+++ b/WebCore/src/kwq/KWQWMatrix.mm
@@ -23,4 +23,24 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <qpainter.h>
\ No newline at end of file
+#include <qpainter.h>
+
+
+// Simple implementation.  Only allows for scaling, and scaling once! 
+// This class is used by khtml to scale images.
+QWMatrix::QWMatrix()
+{
+    empty = TRUE;
+}
+    
+
+QWMatrix &QWMatrix::scale(double _sx, double _sy)
+{
+    if (empty != TRUE){
+        NSLog (@"ERROR (INCOMPLETE IMPLEMENTATION) QWMatrix &QWMatrix::scale(double _sx, double _sy) scale may only be called once.\n");
+    }
+    empty = FALSE;
+    sx = _sx;
+    sy = _sy;
+}
+
diff --git a/WebCore/src/kwq/KWQWidget.mm b/WebCore/src/kwq/KWQWidget.mm
index 98800b1..f7a17d4 100644
--- a/WebCore/src/kwq/KWQWidget.mm
+++ b/WebCore/src/kwq/KWQWidget.mm
@@ -24,3 +24,379 @@
  */
 
 #include <qwidget.h>
+
+#import "KWQView.h"
+
+/*
+    A QWidget rougly corresponds to an NSView.  In Qt a QFrame and QMainWindow inherit
+    from a QWidget.  In Cocoa a NSWindow does not inherit from NSView.  We will
+    emulate QWidgets using NSViews.
+    
+    The only QWidget emulated should be KHTMLView.  It's inheritance graph is
+        KHTMLView
+            QScrollView
+                QFrame
+                    QWidget
+    
+    We may not need to emulate any of the QScrollView behaviour as we MAY
+    get scrolling behaviour for free simply be implementing all rendering 
+    in an NSView and using NSScrollView.
+    
+    It appears that the only dependence of the window in khtml and kjs is
+    the javascript functions that manipulate a window.  We may want to
+    rework work that code rather than add NSWindow glue code.
+*/
+
+QWidget::QWidget(QWidget *parent=0, const char *name=0, WFlags f=0) 
+{
+    _initialize();
+}
+
+
+void QWidget::_initialize()
+{
+    data = (struct KWQWidgetData *)calloc (1, sizeof (struct KWQWidgetData));
+    data->view = [[KWQView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this];
+}
+
+
+
+QWidget::~QWidget() 
+{
+    [data->view release];
+
+    // What about:
+    // 	data->style
+    // 	data->font
+    // 	data->cursor
+    
+    free (data);
+}
+
+
+QSize QWidget::sizeHint() const 
+{
+}
+
+void QWidget::resize(int w, int h) 
+{
+    internalSetGeometry( data->rect.x(), data->rect.y(), w, h, FALSE );
+}
+
+void QWidget::setActiveWindow() 
+{
+    // Map onto [NSView window] equivalent.
+}
+
+
+void QWidget::setEnabled(bool) 
+{
+    // Not relevant.
+}
+
+
+void QWidget::setAutoMask(bool) 
+{
+    // Not relevant. ??
+}
+
+
+void QWidget::setMouseTracking(bool) 
+{
+    // Not relevant. ??
+}
+
+
+int QWidget::winId() const
+{
+/*
+    Does this winId need to be valid across sessions?  It appears to
+    be used by HTMLDocument::setCookie( const DOMString & value ).  If
+    so we have to rethink the current approach.
+    
+    Just return the hash of the NSView.
+*/
+    return (int)[data->view hash];
+}
+
+
+int QWidget::x() const 
+{
+    return data->rect.x();
+}
+
+
+int QWidget::y() const 
+{
+    return data->rect.y();
+}
+
+
+int QWidget::width() const 
+{ 
+    return data->rect.width();
+}
+
+
+int QWidget::height() const 
+{
+    return data->rect.height();
+}
+
+
+QSize QWidget::size() const 
+{
+    return data->rect.size();
+}
+
+
+void QWidget::resize(const QSize &s) 
+{
+    resize( s.width(), s.height());
+}
+
+
+QPoint QWidget::pos() const 
+{
+    return data->pos;
+}
+
+
+void QWidget::move(int x, int y) 
+{
+    internalSetGeometry( x + data->rect.x(),
+			 y + data->rect.y(),
+			 width(), height(), TRUE );
+}
+
+
+void QWidget::move(const QPoint &p) 
+{
+    move( p.x(), p.y() );
+}
+
+
+QWidget *QWidget::topLevelWidget() const 
+{
+    // This is only used by JavaScript to implement the various
+    // window geometry manipulations and accessors, i.e.:
+    // window.moveTo(), window.moveBy(), window.resizeBy(), window.resizeTo(),
+    // outerWidth, outerHeight.
+    
+    // This should return a subclass of QWidget that fronts for an
+    // NSWindow.
+    return (QWidget *)this;
+}
+
+
+QPoint QWidget::mapToGlobal(const QPoint &p) const
+{
+    // This is only used by JavaScript to implement the getting
+    // the screenX and screen Y coordinates.
+    NSPoint sp;
+    sp = [[data->view window] convertBaseToScreen: [data->view convertPoint: NSMakePoint ((float)p.x(), (float)p.y()) toView: nil]];
+    return QPoint (sp.x, sp.y);
+}
+
+
+void QWidget::setFocus()
+{
+    // TBD
+}
+
+
+void QWidget::clearFocus()
+{
+    // TBD
+}
+
+
+QWidget::FocusPolicy QWidget::focusPolicy() const
+{
+    return data->focusPolicy;
+}
+
+
+void QWidget::setFocusPolicy(FocusPolicy fp)
+{
+    data->focusPolicy = fp;
+}
+
+
+void QWidget::setFocusProxy( QWidget * )
+{
+    // TBD
+}
+
+
+const QPalette& QWidget::palette() const
+{
+    return data->pal;
+}
+
+
+void QWidget::setPalette(const QPalette &palette)
+{
+    // FIXME!  What do we do about releasing the old palette?
+    data->pal = palette;
+}
+
+void QWidget::unsetPalette()
+{
+    // Only called by RenderFormElement::layout, which I suspect will
+    // have to be rewritten.  Do nothing.
+}
+
+
+QStyle &QWidget::style() const
+{
+    return *data->style;
+}
+
+
+void QWidget::setStyle(QStyle *style)
+{
+    // According to the Qt implementation 
+    /*
+    Sets the widget's GUI style to \a style. Ownership of the style
+    object is not transferred.
+    */
+    data->style = style;
+}
+
+
+QFont QWidget::font() const
+{
+}
+
+
+void QWidget::setFont(const QFont &font)
+{
+    // FIXME Not clear what we should do with old font!
+    data->font = new QFont (font);
+}
+
+
+void QWidget::constPolish() const
+{
+    // Is this necessary?
+}
+
+
+QSize QWidget::minimumSizeHint() const
+{
+    // Used by embedded java (KJavaEmbed::sizeHint().  Will be replaced.
+    // Used by RenderSubmitButton::calcMinMaxWidth(), where it is called
+    // on a button widget.  Will be replaced.
+    NSLog (@"ERROR:  QWidget::minimumSizeHint() called.  Should never be called.\n", nil);
+    return QSize (0,0);
+}
+
+
+bool QWidget::isVisible() const
+{
+    return [[data->view window] isVisible];
+}
+
+
+void QWidget::setCursor(const QCursor &cur)
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::setCursor()\n", nil);
+    if (data->cursor)
+        delete data->cursor;
+    data->cursor = new QCursor (cur);
+}
+
+
+bool QWidget::event(QEvent *)
+{
+    // This will eventually not be called, or called from our implementation
+    // of run loop, or something???
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::event(QEvent *)\n", nil);
+    return TRUE;
+}
+
+
+bool QWidget::focusNextPrevChild(bool)
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::focusNextPrevChild()\n", nil);
+    return TRUE;
+}
+
+
+bool QWidget::hasMouseTracking() const
+{
+    NSLog (@"WARNING(UNIMPLEMENTED):  QWidget::hasMouseTracking()\n", nil);
+    return true;
+}
+
+
+void QWidget::show()
+{
+    [[data->view window] deminiaturize: data->view];
+}
+
+
+void QWidget::hide()
+{
+    [[data->view window] miniaturize: data->view];
+}
+
+
+// no copying or assignment
+// note that these are "standard" (no pendantic stuff needed)
+
+
+
+// Non-public
+void QWidget::setCRect( const QRect &r )
+{
+    // One rect is both the same.
+    data->pos = r.topLeft();
+    data->rect = r;
+}
+
+void QWidget::internalSetGeometry( int x, int y, int w, int h, bool isMove )
+{
+    if ( w < 1 )				// invalid size
+	w = 1;
+    if ( h < 1 )
+	h = 1;
+
+    QRect  r( x, y, w, h );
+
+    // We only care about stuff that changes the geometry, or may
+    // cause the window manager to change its state
+    if ( data->rect == r )
+	return;
+
+    QSize oldSize( size() );
+
+    setCRect( r );
+
+    bool isResize = size() != oldSize;
+
+    // FIXME!  First approximation.  May need to translate coordinates.
+    [data->view setFrame: NSMakeRect (data->rect.x(), data->rect.y(), data->rect.width(), data->rect.height())];
+}
+
+#ifdef _KWQ_
+
+void QWidget::paint (void *)
+{
+}
+
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+NSView *QWidget::getView()
+{
+    return data->view;
+}
+#else
+void *QWidget::getView()
+{
+    return data->view;
+}
+#endif
+
+#endif _KWQ_
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list