Commit ee912605 authored by rjw's avatar rjw

Support for forms. Incomplete. Lots of problems.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e4449c0d
......@@ -40,18 +40,22 @@ QPalette QApplication::palette(const QWidget *p)
QWidget *QApplication::desktop()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return 0;
}
int QApplication::startDragDistance()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return 2;
}
QSize QApplication::globalStrut()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
static QSize *structSize = new QSize(0,0);
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return *structSize;
}
......@@ -135,7 +139,7 @@ void QApplication::setMainWidget(QWidget *w)
[sv setDocumentView: w->getView()];
[((_KWQOwner *)application)->window setOpaque: FALSE];
[((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
//[((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
[((_KWQOwner *)application)->containerView addSubview: sv];
......
......@@ -25,6 +25,7 @@
#include <qfontmetrics.h>
#include <kwqdebug.h>
QFontMetrics::QFontMetrics()
{
......@@ -130,33 +131,49 @@ int QFontMetrics::descent() const
QRect QFontMetrics::boundingRect(const QString &, int len=-1) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QRect QFontMetrics::boundingRect(const QString &, int len=-1)\n");
_logNotYetImplemented();
}
QRect QFontMetrics::boundingRect(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::boundingRect(QChar)\n");
_logNotYetImplemented();
}
QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0,
int *tabarray=0, char **intern=0 ) const
QSize QFontMetrics::size(int, const QString &qstring, int len, int tabstops,
int *tabarray, char **intern ) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, int *tabarray=0, char **intern=0 )\n");
_logNotYetImplemented();
if (tabstops != 0){
NSLog (@"ERROR: QFontMetrics::size() tabs not supported.\n");
}
NSLog (@"string = %@\n", QSTRING_TO_NSSTRING(qstring));
int w, h;
NSString *string;
if (len != -1)
string = QSTRING_TO_NSSTRING_LENGTH (qstring, len);
else
string = QSTRING_TO_NSSTRING (qstring);
w = (int)[data->font widthOfString: string];
h = height();
return QSize (w,h);
}
int QFontMetrics::rightBearing(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::rightBearing(QChar)\n");
_logNotYetImplemented();
return 0;
}
int QFontMetrics::leftBearing(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) leftBearing(QChar)\n");
_logNotYetImplemented();
return 0;
}
......
......@@ -114,7 +114,7 @@ public:
// constructors, copy constructors, and destructors ------------------------
KConfig(const QString &, bool bReadOnly=false);
KConfig(const QString &n, bool bReadOnly=false);
virtual ~KConfig();
// member functions --------------------------------------------------------
......
......@@ -47,6 +47,14 @@ QPixmap::QPixmap(const QSize&sz)
}
@interface NSData (NSDataOpenStepExtensions)
- (id)initWithBytes:(void *)bytes length:(unsigned)length copy:(BOOL)copy freeWhenDone:(BOOL)freeBytes bytesAreVM:(BOOL)vm;
- (BOOL)_bytesAreVM;
@end
QPixmap::QPixmap(const QByteArray&bytes)
{
/*
......
......@@ -56,42 +56,44 @@ QWidget* QScrollView::viewport() const
int QScrollView::visibleWidth() const
{
//_logNeverImplemented();
return 800;
// ? Is this used to determined what is rendered
// by the engine.
NSRect bounds = [getView() bounds];
return (int)bounds.size.width;
}
int QScrollView::visibleHeight() const
{
//_logNeverImplemented();
return 800;
// ? Is this used to determined what is rendered
// by the engine.
NSRect bounds = [getView() bounds];
return (int)bounds.size.height;
}
int QScrollView::contentsWidth() const
{
_logNeverImplemented();
return 800;
NSRect bounds = [getView() bounds];
return (int)bounds.size.width;
}
int QScrollView::contentsHeight() const
{
_logNeverImplemented();
return 800;
NSRect bounds = [getView() bounds];
return (int)bounds.size.height;
}
int QScrollView::contentsX() const
{
_logNeverImplemented();
return 0;
}
int QScrollView::contentsY() const
{
_logNeverImplemented();
return 0;
}
......@@ -140,6 +142,9 @@ void QScrollView::addChild(QWidget* child, int x, int y)
thisView = getView();
subView = child->getView();
[subView removeFromSuperview];
NSLog (@"Adding %@ at (%d,%d)\n", [[subView class] className], x, y);
[thisView addSubview: subView];
}
......
......@@ -197,8 +197,11 @@ QPoint QWidget::pos() const
void QWidget::move(int x, int y)
{
internalSetGeometry( x + data->rect.x(),
y + data->rect.y(),
// internalSetGeometry( x + data->rect.x(),
// y + data->rect.y(),
// width(), height(), TRUE );
internalSetGeometry( x,
y,
width(), height(), TRUE );
}
......
......@@ -114,7 +114,7 @@ public:
// constructors, copy constructors, and destructors ------------------------
KConfig(const QString &, bool bReadOnly=false);
KConfig(const QString &n, bool bReadOnly=false);
virtual ~KConfig();
// member functions --------------------------------------------------------
......
/*
* 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 <qapplication.h>
#include <khtmlview.h>
#include <KWQView.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// Voodoo required to get compiler to compile correctly.
#undef DEBUG
#import <Cocoa/Cocoa.h>
//
// Create and display our widget.
//
/*
This program illustrates the canonical method for
creating a WebPageView. It currently use kde and Qt
API to create a web page view. Eventually it will
use WebPageView and WebKit API.
The following methods will eventually create a
web page view.
url = [NSURL URLWithString: @"http://www.apple.com"];
wpd = [[NSWebPageDataSource alloc] initWithURL: url];
wpv = [[NSWebPageView alloc] initWithFrame: NSMakeRect (0,0,500,500) dataSource: wpd]
*/
int main( int argc, char **argv )
{
QApplication app( argc, argv );
// This will eventually be replaced with a NSURL.
KURL url = "http://kocike.apple.com/foo.html";
// Use KHTMLPart as the model for the view. This will eventually be covered
// by WebPageDocument.
// [[WebPageDocument alloc] initWithURL: (NSURL *)url];
KHTMLPart *w = new KHTMLPart();
// Create the KHTMLView. This will eventually be covered by the
// WebPageView.
// [[WebPageView alloc] initWithFrame: (NSRect)rect document: (WebPageDocument *)doc]
KHTMLView *htmlView = new KHTMLView (w, 0);
htmlView->resize (800,800);
KWQHTMLView *kwqHTMLView = [[[KWQHTMLView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: htmlView] autorelease];
kwqHTMLView->part = w;
w->setView (htmlView);
w->openURL (url);
htmlView->setView (kwqHTMLView);
htmlView->resize(800, 800);
app.setMainWidget( htmlView );
htmlView->show();
return app.exec();
}
......@@ -40,18 +40,22 @@ QPalette QApplication::palette(const QWidget *p)
QWidget *QApplication::desktop()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return 0;
}
int QApplication::startDragDistance()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return 2;
}
QSize QApplication::globalStrut()
{
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
static QSize *structSize = new QSize(0,0);
NSLog (@"ERROR %s:%s:%d (NOT IMPLEMENTED)\n", __FILE__, __FUNCTION__, __LINE__);
return *structSize;
}
......@@ -135,7 +139,7 @@ void QApplication::setMainWidget(QWidget *w)
[sv setDocumentView: w->getView()];
[((_KWQOwner *)application)->window setOpaque: FALSE];
[((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
//[((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
[((_KWQOwner *)application)->containerView addSubview: sv];
......
......@@ -25,6 +25,7 @@
#include <qfontmetrics.h>
#include <kwqdebug.h>
QFontMetrics::QFontMetrics()
{
......@@ -130,33 +131,49 @@ int QFontMetrics::descent() const
QRect QFontMetrics::boundingRect(const QString &, int len=-1) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QRect QFontMetrics::boundingRect(const QString &, int len=-1)\n");
_logNotYetImplemented();
}
QRect QFontMetrics::boundingRect(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::boundingRect(QChar)\n");
_logNotYetImplemented();
}
QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0,
int *tabarray=0, char **intern=0 ) const
QSize QFontMetrics::size(int, const QString &qstring, int len, int tabstops,
int *tabarray, char **intern ) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QSize QFontMetrics::size(int, const QString &, int len=-1, int tabstops=0, int *tabarray=0, char **intern=0 )\n");
_logNotYetImplemented();
if (tabstops != 0){
NSLog (@"ERROR: QFontMetrics::size() tabs not supported.\n");
}
NSLog (@"string = %@\n", QSTRING_TO_NSSTRING(qstring));
int w, h;
NSString *string;
if (len != -1)
string = QSTRING_TO_NSSTRING_LENGTH (qstring, len);
else
string = QSTRING_TO_NSSTRING (qstring);
w = (int)[data->font widthOfString: string];
h = height();
return QSize (w,h);
}
int QFontMetrics::rightBearing(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) QFontMetrics::rightBearing(QChar)\n");
_logNotYetImplemented();
return 0;
}
int QFontMetrics::leftBearing(QChar) const
{
NSLog (@"WARNING (NOT IMPLEMENTED) leftBearing(QChar)\n");
_logNotYetImplemented();
return 0;
}
......
......@@ -47,6 +47,14 @@ QPixmap::QPixmap(const QSize&sz)
}
@interface NSData (NSDataOpenStepExtensions)
- (id)initWithBytes:(void *)bytes length:(unsigned)length copy:(BOOL)copy freeWhenDone:(BOOL)freeBytes bytesAreVM:(BOOL)vm;
- (BOOL)_bytesAreVM;
@end
QPixmap::QPixmap(const QByteArray&bytes)
{
/*
......
......@@ -56,42 +56,44 @@ QWidget* QScrollView::viewport() const
int QScrollView::visibleWidth() const
{
//_logNeverImplemented();
return 800;
// ? Is this used to determined what is rendered
// by the engine.
NSRect bounds = [getView() bounds];
return (int)bounds.size.width;
}
int QScrollView::visibleHeight() const
{
//_logNeverImplemented();
return 800;
// ? Is this used to determined what is rendered
// by the engine.
NSRect bounds = [getView() bounds];
return (int)bounds.size.height;
}
int QScrollView::contentsWidth() const
{
_logNeverImplemented();
return 800;
NSRect bounds = [getView() bounds];
return (int)bounds.size.width;
}
int QScrollView::contentsHeight() const
{
_logNeverImplemented();
return 800;
NSRect bounds = [getView() bounds];
return (int)bounds.size.height;
}
int QScrollView::contentsX() const
{
_logNeverImplemented();
return 0;
}
int QScrollView::contentsY() const
{
_logNeverImplemented();
return 0;
}
......@@ -140,6 +142,9 @@ void QScrollView::addChild(QWidget* child, int x, int y)
thisView = getView();
subView = child->getView();
[subView removeFromSuperview];
NSLog (@"Adding %@ at (%d,%d)\n", [[subView class] className], x, y);
[thisView addSubview: subView];
}
......
......@@ -197,8 +197,11 @@ QPoint QWidget::pos() const
void QWidget::move(int x, int y)
{
internalSetGeometry( x + data->rect.x(),
y + data->rect.y(),
// internalSetGeometry( x + data->rect.x(),
// y + data->rect.y(),
// width(), height(), TRUE );
internalSetGeometry( x,
y,
width(), height(), TRUE );
}
......
......@@ -114,7 +114,7 @@ public:
// constructors, copy constructors, and destructors ------------------------
KConfig(const QString &, bool bReadOnly=false);
KConfig(const QString &n, bool bReadOnly=false);
virtual ~KConfig();
// member functions --------------------------------------------------------
......
/*
* 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 <qapplication.h>
#include <khtmlview.h>
#include <KWQView.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// Voodoo required to get compiler to compile correctly.
#undef DEBUG
#import <Cocoa/Cocoa.h>
//
// Create and display our widget.
//
/*
This program illustrates the canonical method for
creating a WebPageView. It currently use kde and Qt
API to create a web page view. Eventually it will
use WebPageView and WebKit API.
The following methods will eventually create a
web page view.
url = [NSURL URLWithString: @"http://www.apple.com"];
wpd = [[NSWebPageDataSource alloc] initWithURL: url];
wpv = [[NSWebPageView alloc] initWithFrame: NSMakeRect (0,0,500,500) dataSource: wpd]
*/
int main( int argc, char **argv )
{
QApplication app( argc, argv );
// This will eventually be replaced with a NSURL.
KURL url = "http://kocike.apple.com/foo.html";
// Use KHTMLPart as the model for the view. This will eventually be covered
// by WebPageDocument.
// [[WebPageDocument alloc] initWithURL: (NSURL *)url];
KHTMLPart *w = new KHTMLPart();
// Create the KHTMLView. This will eventually be covered by the
// WebPageView.
// [[WebPageView alloc] initWithFrame: (NSRect)rect document: (WebPageDocument *)doc]
KHTMLView *htmlView = new KHTMLView (w, 0);
htmlView->resize (800,800);
KWQHTMLView *kwqHTMLView = [[[KWQHTMLView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: htmlView] autorelease];
kwqHTMLView->part = w;
w->setView (htmlView);
w->openURL (url);
htmlView->setView (kwqHTMLView);
htmlView->resize(800, 800);
app.setMainWidget( htmlView );
htmlView->show();
return app.exec();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment