Reviewed by Eric. Landed by rwlbuis.
authorrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2006 22:47:37 +0000 (22:47 +0000)
committerrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2006 22:47:37 +0000 (22:47 +0000)
        First chunk of the implementation for:
        http://bugzilla.opendarwin.org/show_bug.cgi?id=10467

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/ComboBoxQt.cpp [new file with mode: 0644]
WebCore/platform/qt/LineEditQt.cpp [new file with mode: 0644]
WebCore/platform/qt/ListBoxQt.cpp [new file with mode: 0644]
WebCore/platform/qt/ScrollViewQt.cpp [new file with mode: 0644]
WebCore/platform/qt/TextEditQt.cpp [new file with mode: 0644]
WebCore/platform/qt/WidgetQt.cpp [new file with mode: 0644]

index 1a67ee1..46ae79b 100644 (file)
@@ -1,3 +1,202 @@
+2006-08-19  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Eric. Landed by rwlbuis.
+
+        First chunk of the implementation for:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10467
+
+        WebKit should have Qt platform support
+
+        * platform/qt/ComboBoxQt.cpp: Added.
+        (WebCore::PlatformComboBox::PlatformComboBox):
+        (WebCore::PlatformComboBox::~PlatformComboBox):
+        (WebCore::PlatformComboBox::setParentWidget):
+        (WebCore::PlatformComboBox::clear):
+        (WebCore::PlatformComboBox::appendItem):
+        (WebCore::PlatformComboBox::appendGroupLabel):
+        (WebCore::PlatformComboBox::appendSeparator):
+        (WebCore::PlatformComboBox::setCurrentItem):
+        (WebCore::PlatformComboBox::sizeHint):
+        (WebCore::PlatformComboBox::frameGeometry):
+        (WebCore::PlatformComboBox::setFrameGeometry):
+        (WebCore::PlatformComboBox::baselinePosition):
+        (WebCore::PlatformComboBox::setFont):
+        (WebCore::PlatformComboBox::focusPolicy):
+        (WebCore::PlatformComboBox::itemSelected):
+        (WebCore::PlatformComboBox::setWritingDirection):
+        (WebCore::PlatformComboBox::populate):
+        (WebCore::PlatformComboBox::populateMenu):
+        * platform/qt/LineEditQt.cpp: Added.
+        (WebCore::PlatformLineEdit::PlatformLineEdit):
+        (WebCore::PlatformLineEdit::~PlatformLineEdit):
+        (WebCore::PlatformLineEdit::setParentWidget):
+        (WebCore::PlatformLineEdit::setColors):
+        (WebCore::PlatformLineEdit::setAlignment):
+        (WebCore::PlatformLineEdit::setCursorPosition):
+        (WebCore::PlatformLineEdit::cursorPosition):
+        (WebCore::PlatformLineEdit::setEdited):
+        (WebCore::PlatformLineEdit::edited):
+        (WebCore::PlatformLineEdit::setFont):
+        (WebCore::PlatformLineEdit::setMaxLength):
+        (WebCore::PlatformLineEdit::maxLength):
+        (WebCore::PlatformLineEdit::setReadOnly):
+        (WebCore::PlatformLineEdit::isReadOnly):
+        (WebCore::PlatformLineEdit::setText):
+        (WebCore::PlatformLineEdit::text):
+        (WebCore::PlatformLineEdit::setWritingDirection):
+        (WebCore::PlatformLineEdit::selectAll):
+        (WebCore::PlatformLineEdit::hasSelectedText):
+        (WebCore::PlatformLineEdit::selectionStart):
+        (WebCore::PlatformLineEdit::selectedText):
+        (WebCore::PlatformLineEdit::setSelection):
+        (WebCore::PlatformLineEdit::sizeForCharacterWidth):
+        (WebCore::PlatformLineEdit::baselinePosition):
+        (WebCore::PlatformLineEdit::focusPolicy):
+        (WebCore::PlatformLineEdit::checksDescendantsForFocus):
+        (WebCore::PlatformLineEdit::setLiveSearch):
+        (WebCore::PlatformLineEdit::setAutoSaveName):
+        (WebCore::PlatformLineEdit::setMaxResults):
+        (WebCore::PlatformLineEdit::setPlaceholderString):
+        (WebCore::PlatformLineEdit::addSearchResult):
+        * platform/qt/ListBoxQt.cpp: Added.
+        (WebCore::ListBox::ListBox):
+        (WebCore::ListBox::~ListBox):
+        (WebCore::ListBox::setParentWidget):
+        (WebCore::ListBox::sizeForNumberOfLines):
+        (WebCore::ListBox::setSelectionMode):
+        (WebCore::ListBox::clear):
+        (WebCore::ListBox::doneAppendingItems):
+        (WebCore::ListBox::setSelected):
+        (WebCore::ListBox::isSelected):
+        (WebCore::ListBox::setEnabled):
+        (WebCore::ListBox::isEnabled):
+        (WebCore::ListBox::setWritingDirection):
+        (WebCore::ListBox::focusPolicy):
+        (WebCore::ListBox::checksDescendantsForFocus):
+        (WebCore::ListBox::clearCachedTextRenderers):
+        (WebCore::ListBox::setFont):
+        (WebCore::ListBox::appendItem):
+        * platform/qt/ScrollViewQt.cpp: Added.
+        (WebCore::ScrollView::ScrollView):
+        (WebCore::ScrollView::~ScrollView):
+        (WebCore::ScrollView::setParentWidget):
+        (WebCore::ScrollView::updateContents):
+        (WebCore::ScrollView::visibleWidth):
+        (WebCore::ScrollView::visibleHeight):
+        (WebCore::ScrollView::visibleContentRect):
+        (WebCore::ScrollView::setContentsPos):
+        (WebCore::ScrollView::resizeContents):
+        (WebCore::ScrollView::contentsX):
+        (WebCore::ScrollView::contentsY):
+        (WebCore::ScrollView::contentsWidth):
+        (WebCore::ScrollView::contentsHeight):
+        (WebCore::ScrollView::viewportToContents):
+        (WebCore::ScrollView::contentsToViewport):
+        (WebCore::ScrollView::scrollOffset):
+        (WebCore::ScrollView::scrollBy):
+        (WebCore::ScrollView::hScrollBarMode):
+        (WebCore::ScrollView::vScrollBarMode):
+        (WebCore::ScrollView::suppressScrollBars):
+        (WebCore::ScrollView::setHScrollBarMode):
+        (WebCore::ScrollView::setVScrollBarMode):
+        (WebCore::ScrollView::setScrollBarsMode):
+        (WebCore::ScrollView::setStaticBackground):
+        (WebCore::ScrollView::addChild):
+        (WebCore::ScrollView::removeChild):
+        (WebCore::ScrollView::scrollPointRecursively):
+        (WebCore::ScrollView::inWindow):
+        * platform/qt/TextEditQt.cpp: Added.
+        (WebCore::PlatformTextEdit::PlatformTextEdit):
+        (WebCore::PlatformTextEdit::~PlatformTextEdit):
+        (WebCore::PlatformTextEdit::setParentWidget):
+        (WebCore::PlatformTextEdit::setColors):
+        (WebCore::PlatformTextEdit::setAlignment):
+        (WebCore::PlatformTextEdit::setLineHeight):
+        (WebCore::PlatformTextEdit::setCursorPosition):
+        (WebCore::PlatformTextEdit::getCursorPosition):
+        (WebCore::PlatformTextEdit::setFont):
+        (WebCore::PlatformTextEdit::setReadOnly):
+        (WebCore::PlatformTextEdit::isReadOnly):
+        (WebCore::PlatformTextEdit::setDisabled):
+        (WebCore::PlatformTextEdit::isDisabled):
+        (WebCore::PlatformTextEdit::hasSelectedText):
+        (WebCore::PlatformTextEdit::setText):
+        (WebCore::PlatformTextEdit::text):
+        (WebCore::PlatformTextEdit::textWithHardLineBreaks):
+        (WebCore::PlatformTextEdit::focusPolicy):
+        (WebCore::PlatformTextEdit::setWordWrap):
+        (WebCore::PlatformTextEdit::wordWrap):
+        (WebCore::PlatformTextEdit::setScrollBarModes):
+        (WebCore::PlatformTextEdit::setWritingDirection):
+        (WebCore::PlatformTextEdit::selectionStart):
+        (WebCore::PlatformTextEdit::selectionEnd):
+        (WebCore::PlatformTextEdit::setSelectionStart):
+        (WebCore::PlatformTextEdit::setSelectionEnd):
+        (WebCore::PlatformTextEdit::selectAll):
+        (WebCore::PlatformTextEdit::setSelectionRange):
+        (WebCore::PlatformTextEdit::sizeWithColumnsAndRows):
+        (WebCore::PlatformTextEdit::checksDescendantsForFocus):
+        * platform/qt/WidgetQt.cpp: Added.
+        (WebCore::WidgetPrivate::WidgetPrivate):
+        (WebCore::WidgetPrivate::~WidgetPrivate):
+        (WebCore::Widget::Widget):
+        (WebCore::Widget::~Widget):
+        (WebCore::Widget::setClient):
+        (WebCore::Widget::client):
+        (WebCore::Widget::frameGeometry):
+        (WebCore::Widget::hasFocus):
+        (WebCore::Widget::setFocus):
+        (WebCore::Widget::clearFocus):
+        (WebCore::Widget::font):
+        (WebCore::Widget::setFont):
+        (WebCore::Widget::setCursor):
+        (WebCore::Widget::show):
+        (WebCore::Widget::hide):
+        (WebCore::Widget::setQWidget):
+        (WebCore::Widget::qwidget):
+        (WebCore::Widget::setParentWidget):
+        (WebCore::Widget::parentWidget):
+        (WebCore::Widget::setFrameGeometry):
+        (WebCore::Widget::mapFromGlobal):
+        (WebCore::Widget::scaleFactor):
+        (WebCore::Widget::lockDrawingFocus):
+        (WebCore::Widget::unlockDrawingFocus):
+        (WebCore::Widget::paint):
+        (WebCore::Widget::enableFlushDrawing):
+        (WebCore::Widget::isEnabled):
+        (WebCore::Widget::setIsSelected):
+        (WebCore::Widget::disableFlushDrawing):
+        (WebCore::Widget::setEnabled):
+        (WebCore::Widget::focusPolicy):
+
+2006-08-19  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Eric. Landed by rwlbuis.
+
+        First chunk of the implementation for:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10467
+
+        WebKit should have Qt platform support
+
+        * platform/qt/ColorQt.cpp: Added.
+        (WebCore::Color::Color):
+        (WebCore::Color::operator QColor):
+        * platform/qt/FloatPointQt.cpp: Added.
+        (WebCore::FloatPoint::FloatPoint):
+        (WebCore::FloatPoint::operator QPointF):
+        * platform/qt/FloatRectQt.cpp: Added.
+        (WebCore::FloatRect::FloatRect):
+        (WebCore::FloatRect::operator QRectF):
+        * platform/qt/IntPointQt.cpp: Added.
+        (WebCore::IntPoint::IntPoint):
+        (WebCore::IntPoint::operator QPoint):
+        * platform/qt/IntRectQt.cpp: Added.
+        (WebCore::IntRect::IntRect):
+        (WebCore::IntRect::operator QRect):
+        * platform/qt/IntSizeQt.cpp: Added.
+        (WebCore::IntSize::IntSize):
+        (WebCore::IntSize::operator QSize):
+
  2006-08-18  Nikolas Zimmermann  <zimmermann@kde.org>
  
          Reviewed by Eric. Landed by rwlbuis.
diff --git a/WebCore/platform/qt/ComboBoxQt.cpp b/WebCore/platform/qt/ComboBoxQt.cpp
new file mode 100644 (file)
index 0000000..36af72c
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 <QComboBox>
+
+#include "PlatformComboBox.h"
+#include "IntSize.h"
+#include "IntRect.h"
+#include "HelperQt.h"
+
+namespace WebCore {
+
+PlatformComboBox::PlatformComboBox()
+    : Widget()
+    , m_comboBox(0)
+{
+    qDebug("PlatformComboBox::PlatformComboBox(), this=%p", this);
+}
+
+PlatformComboBox::~PlatformComboBox()
+{
+    qDebug("PlatformComboBox::~PlatformComboBox(), this=%p", this);
+}
+
+void PlatformComboBox::setParentWidget(QWidget* parent)
+{
+    qDebug("PlatformComboBox::setParentWidget(), parent=%p", parent);
+    Widget::setParentWidget(parent);
+
+    Q_ASSERT(m_comboBox == 0);
+    m_comboBox = new QComboBox(parent);
+
+    setQWidget(m_comboBox);
+}
+
+void PlatformComboBox::clear()
+{
+    m_comboBox->clear();
+}
+
+void PlatformComboBox::appendItem(const DeprecatedString& text, bool enabled)
+{
+    m_comboBox->addItem(toQString(text));
+}
+
+void PlatformComboBox::appendGroupLabel(const DeprecatedString& text)
+{
+    // TODO: Group label?
+    m_comboBox->addItem(toQString(text));
+}
+
+void PlatformComboBox::appendSeparator()
+{
+    notImplemented();
+}
+
+void PlatformComboBox::setCurrentItem(int index)
+{
+    m_comboBox->setCurrentIndex(index);
+}
+
+IntSize PlatformComboBox::sizeHint() const
+{
+    return m_comboBox->sizeHint();
+}
+
+IntRect PlatformComboBox::frameGeometry() const
+{
+    return Widget::frameGeometry();
+}
+
+void PlatformComboBox::setFrameGeometry(const IntRect& r)
+{
+    return Widget::setFrameGeometry(r);
+}
+
+int PlatformComboBox::baselinePosition(int height) const
+{
+    notImplemented();
+    return 0;
+}
+
+void PlatformComboBox::setFont(const Font& font)
+{
+    m_comboBox->setFont(toQFont(font));
+}
+
+Widget::FocusPolicy PlatformComboBox::focusPolicy() const
+{
+    return Widget::focusPolicy();
+}
+
+void PlatformComboBox::itemSelected()
+{
+    notImplemented();
+}
+
+void PlatformComboBox::setWritingDirection(TextDirection dir)
+{
+    Qt::LayoutDirection qDir;
+
+    switch(dir)
+    {
+        case LTR:
+            qDir = Qt::LeftToRight;
+            break;
+        case RTL:
+            qDir = Qt::RightToLeft;
+            break;
+    }
+
+    m_comboBox->setLayoutDirection(qDir);
+}
+
+void PlatformComboBox::populate()
+{
+    populateMenu();
+}
+
+void PlatformComboBox::populateMenu()
+{
+    notImplemented();
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/LineEditQt.cpp b/WebCore/platform/qt/LineEditQt.cpp
new file mode 100644 (file)
index 0000000..486172b
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ *               2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 <QDebug>
+#include <QLineEdit>
+
+#include <config.h>
+#include "GraphicsTypes.h"
+#include "TextDirection.h"
+#include "Widget.h"
+#include "PlatformLineEdit.h"
+#include "Color.h"
+#include "IntSize.h"
+#include "HelperQt.h"
+
+namespace WebCore {
+
+PlatformLineEdit::PlatformLineEdit(PlatformLineEdit::Type type)
+    : m_lineEdit(0)
+    , m_type(type)
+{
+    qDebug("PlatformLineEdit::PlatformLineEdit(), this=%p", this);
+}
+
+PlatformLineEdit::~PlatformLineEdit()
+{
+    qDebug("PlatformLineEdit::~PlatformLineEdit()");
+}
+
+void PlatformLineEdit::setParentWidget(QWidget* parent)
+{
+    qDebug("PlatformLineEdit::setParentWidget(), parent=%p", parent);
+    Widget::setParentWidget(parent);
+
+    Q_ASSERT(m_lineEdit == 0);
+    m_lineEdit = new QLineEdit(parent);
+
+    if (m_type == Password)
+        m_lineEdit->setEchoMode(QLineEdit::Password);
+
+    setQWidget(m_lineEdit);
+}
+
+void PlatformLineEdit::setColors(const Color& background, const Color& foreground)
+{
+    notImplemented();
+}
+
+void PlatformLineEdit::setAlignment(HorizontalAlignment align)
+{
+    Qt::Alignment qtAlign;
+
+    switch (align)
+    {
+        case AlignLeft:
+            qtAlign = Qt::AlignLeft;
+            break;
+        case AlignRight:
+            qtAlign = Qt::AlignRight;
+            break;
+        case AlignHCenter:
+            qtAlign = Qt::AlignHCenter;
+            break;
+    }
+
+    m_lineEdit->setAlignment(qtAlign);
+}
+
+void PlatformLineEdit::setCursorPosition(int pos)
+{
+    m_lineEdit->setCursorPosition(pos);
+}
+
+int PlatformLineEdit::cursorPosition() const
+{
+    return m_lineEdit->cursorPosition();
+}
+
+void PlatformLineEdit::setEdited(bool)
+{
+    notImplemented();
+}
+
+bool PlatformLineEdit::edited() const
+{
+    notImplemented();
+    return false;
+}
+
+void PlatformLineEdit::setFont(const Font& font)
+{
+    m_lineEdit->setFont(toQFont(font));
+}
+
+void PlatformLineEdit::setMaxLength(int length)
+{
+    m_lineEdit->setMaxLength(length);
+}
+
+int PlatformLineEdit::maxLength() const
+{
+    return m_lineEdit->maxLength();
+}
+
+void PlatformLineEdit::setReadOnly(bool value)
+{
+    m_lineEdit->setReadOnly(value);
+}
+
+bool PlatformLineEdit::isReadOnly() const
+{
+    return m_lineEdit->isReadOnly();
+}
+
+void PlatformLineEdit::setText(const String& str)
+{
+    m_lineEdit->setText(toQString(str));
+}
+
+String PlatformLineEdit::text() const
+{
+    return fromQString(m_lineEdit->text());
+}
+
+void PlatformLineEdit::setWritingDirection(TextDirection dir)
+{
+    Qt::LayoutDirection qDir;
+
+    switch(dir)
+    {
+        case LTR:
+            qDir = Qt::LeftToRight;
+            break;
+        case RTL:
+            qDir = Qt::RightToLeft;
+            break;
+    }
+
+    m_lineEdit->setLayoutDirection(qDir);
+}
+
+void PlatformLineEdit::selectAll()
+{
+    m_lineEdit->selectAll();
+}
+
+bool PlatformLineEdit::hasSelectedText() const
+{
+    return m_lineEdit->hasSelectedText();
+}
+
+int PlatformLineEdit::selectionStart() const
+{
+    return m_lineEdit->selectionStart();
+}
+
+String PlatformLineEdit::selectedText() const
+{
+    return fromQString(m_lineEdit->selectedText());
+}
+
+void PlatformLineEdit::setSelection(int start, int length)
+{
+    m_lineEdit->setSelection(start, length);
+}
+
+IntSize PlatformLineEdit::sizeForCharacterWidth(int numCharacters) const
+{
+    notImplemented();
+    return IntSize();
+}
+
+int PlatformLineEdit::baselinePosition(int height) const
+{
+    notImplemented();
+    return 0;
+}
+
+Widget::FocusPolicy PlatformLineEdit::focusPolicy() const
+{
+    return Widget::focusPolicy();
+}
+
+bool PlatformLineEdit::checksDescendantsForFocus() const
+{
+    return true;
+}
+
+void PlatformLineEdit::setLiveSearch(bool liveSearch)
+{
+    notImplemented();
+}
+
+void PlatformLineEdit::setAutoSaveName(const String& name)
+{
+    notImplemented();
+}
+
+void PlatformLineEdit::setMaxResults(int maxResults)
+{
+    notImplemented();
+}
+
+void PlatformLineEdit::setPlaceholderString(const String& placeholder)
+{
+    notImplemented();
+}
+
+void PlatformLineEdit::addSearchResult()
+{
+    notImplemented();
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ListBoxQt.cpp b/WebCore/platform/qt/ListBoxQt.cpp
new file mode 100644 (file)
index 0000000..3faba4b
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ *           (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 <QScrollBar>
+#include <QListWidget>
+
+#include "IntSize.h"
+#include "HelperQt.h"
+#include "ListBox.h"
+
+namespace WebCore {
+
+ListBox::ListBox()
+    : ScrollView()
+    , m_listWidget(0)
+    , m_selectionMode(Single)
+    , _width(0.0)
+    , _widthGood(false)
+{
+    qDebug("ListBox::ListBox(), this=%p", this);
+}
+
+ListBox::~ListBox()
+{
+    qDebug("ListBox::~ListBox(), this=%p", this);
+}
+
+void ListBox::setParentWidget(QWidget* parent)
+{
+    qDebug("ListBox::setParentWidget(), parent=%p", parent);
+    ScrollView::setParentWidget(parent);
+
+    Q_ASSERT(m_listWidget == 0);
+    m_listWidget = new QListWidget(parent);
+
+    if(m_selectionMode == Single)
+        m_listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    else
+        m_listWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+    setQWidget(m_listWidget);
+}
+
+IntSize ListBox::sizeForNumberOfLines(int numLines) const
+{
+    QSize size(0, 0);
+
+    for (int i = 0; i <= numLines; i++) {
+        QListWidgetItem *item = m_listWidget->item(i);
+        Q_ASSERT(item != 0);
+
+        QRect visual = m_listWidget->visualItemRect(item);
+
+        size.setWidth(qMax(size.width(), visual.width()));
+        size.setHeight(qMax(size.height(), visual.height()));
+    }
+
+    // Logic taken from our khtml :-)
+    size.setWidth(size.width() + 2 * m_listWidget->frameWidth() + m_listWidget->verticalScrollBar()->sizeHint().width());
+    size.setHeight(numLines * size.height() + 2 * m_listWidget->frameWidth());
+
+    return size;
+}
+
+void ListBox::setSelectionMode(SelectionMode mode)
+{
+    // We can not directly assign to m_listWidget here, as
+    // setSelectionMode() is called from DeprecatedRenderSelect before
+    // setWidget() and our setParentWidget() functions have been called...
+    m_selectionMode = mode;
+}
+
+void ListBox::clear()
+{
+    m_listWidget->clear();
+}
+
+void ListBox::doneAppendingItems()
+{
+    // no-op
+}
+
+void ListBox::setSelected(int row, bool selected)
+{
+    QListWidgetItem *item = m_listWidget->item(row);
+    if (!item)
+        return;
+
+    m_listWidget->setItemSelected(item, selected);
+}
+
+bool ListBox::isSelected(int row) const
+{
+    QListWidgetItem *item = m_listWidget->item(row);
+    if (!item)
+        return false;
+
+    return m_listWidget->isItemSelected(item);
+}
+
+void ListBox::setEnabled(bool value)
+{
+    m_listWidget->setEnabled(value);
+}
+
+bool ListBox::isEnabled()
+{
+    return m_listWidget->isEnabled();
+}
+
+void ListBox::setWritingDirection(TextDirection dir)
+{
+    Qt::LayoutDirection qDir;
+
+    switch(dir)
+    {
+        case LTR:
+            qDir = Qt::LeftToRight;
+            break;
+        case RTL:
+            qDir = Qt::RightToLeft;
+            break;
+    }
+
+    m_listWidget->setLayoutDirection(qDir);
+}
+
+Widget::FocusPolicy ListBox::focusPolicy() const
+{
+    return Widget::focusPolicy();
+}
+
+bool ListBox::checksDescendantsForFocus() const
+{
+    return true;
+}
+
+void ListBox::clearCachedTextRenderers()
+{
+    // no-op
+}
+
+void ListBox::setFont(const Font& font)
+{
+    m_listWidget->setFont(toQFont(font));
+}
+
+void ListBox::appendItem(const DeprecatedString& string, ListBoxItemType type, bool enabled)
+{
+    // FIXME: take into account type/enabled...
+    Q_ASSERT(m_listWidget != 0);
+    (void) new QListWidgetItem(toQString(string), m_listWidget); // No this does not leak...
+}
+
+};
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ScrollViewQt.cpp b/WebCore/platform/qt/ScrollViewQt.cpp
new file mode 100644 (file)
index 0000000..5bd7252
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 "config.h"
+#include "ScrollView.h"
+#include "FloatRect.h"
+#include "IntPoint.h"
+
+#include "FrameQt.h"
+#include "CanvasQt.h"
+#include "HelperQt.h"
+
+#include <QScrollBar>
+#include <QScrollArea>
+
+namespace WebCore {
+
+ScrollView::ScrollView()
+    : m_area(new QScrollArea(0))
+{
+    qDebug("ScrollView::ScrollView()");
+}
+
+ScrollView::~ScrollView()
+{
+    qDebug("ScrollView::~ScrollView()");
+}
+
+void ScrollView::setParentWidget(QWidget* parent)
+{
+    qDebug("ScrollView::setParentWidget(), parent=%p", parent);
+    Widget::setParentWidget(parent);
+
+    // 'isFrameView()' can not be called yet in the constructor!
+    if (isFrameView()) {
+        CanvasQt* canvas = new CanvasQt(this, m_area);
+
+        setQWidget(m_area);
+        m_area->setWidget(canvas);
+    }
+}
+
+void ScrollView::updateContents(const IntRect& updateRect, bool now)
+{
+    if (m_area->widget())
+        m_area->widget()->update(updateRect);
+}
+
+int ScrollView::visibleWidth() const
+{
+    return m_area->maximumViewportSize().width();
+}
+
+int ScrollView::visibleHeight() const
+{
+    return m_area->maximumViewportSize().height();
+}
+
+FloatRect ScrollView::visibleContentRect() const
+{
+    const QSize s(m_area->maximumViewportSize());
+
+    return FloatRect(m_area->horizontalScrollBar()->value(),
+                     m_area->verticalScrollBar()->value(),
+                     s.width(), s.height());
+}
+
+void ScrollView::setContentsPos(int newX, int newY)
+{
+    m_area->horizontalScrollBar()->setValue(newX);
+    m_area->verticalScrollBar()->setValue(newY);
+}
+
+void ScrollView::resizeContents(int w, int h)
+{
+    if (m_area->widget())
+        m_area->widget()->resize(w, h);
+}
+
+int ScrollView::contentsX() const
+{
+    return m_area->horizontalScrollBar()->value();
+}
+
+int ScrollView::contentsY() const
+{
+    return m_area->verticalScrollBar()->value();
+}
+
+int ScrollView::contentsWidth() const
+{
+    if (!m_area->widget())
+        return 0;
+
+    return m_area->widget()->width();
+}
+
+int ScrollView::contentsHeight() const
+{
+    if (!m_area->widget())
+        return 0;
+
+    return m_area->widget()->height();
+}
+
+IntPoint ScrollView::viewportToContents(const IntPoint& viewportPoint)
+{
+    // Qt already handles this in the coordinates we get from the mouse events...
+    return viewportPoint;
+}
+
+IntPoint ScrollView::contentsToViewport(const IntPoint& contentsPoint)
+{
+    // Qt already handles this in the coordinates we get from the mouse events...
+    return contentsPoint;
+}
+
+IntSize ScrollView::scrollOffset() const
+{
+    return IntSize(m_area->horizontalScrollBar()->value(), m_area->verticalScrollBar()->value());
+}
+
+void ScrollView::scrollBy(int dx, int dy)
+{
+    m_area->horizontalScrollBar()->setValue(m_area->horizontalScrollBar()->value() + dx);
+    m_area->verticalScrollBar()->setValue(m_area->verticalScrollBar()->value() + dy);
+}
+
+ScrollBarMode ScrollView::hScrollBarMode() const
+{
+    switch (m_area->horizontalScrollBarPolicy())
+    {
+        case Qt::ScrollBarAsNeeded:
+            return ScrollBarAuto;
+        case Qt::ScrollBarAlwaysOff:
+            return ScrollBarAlwaysOff;
+        case Qt::ScrollBarAlwaysOn:
+            return ScrollBarAlwaysOn;
+    }
+
+    return ScrollBarAuto;
+}
+
+ScrollBarMode ScrollView::vScrollBarMode() const
+{
+    switch (m_area->verticalScrollBarPolicy())
+    {
+        case Qt::ScrollBarAsNeeded:
+            return ScrollBarAuto;
+        case Qt::ScrollBarAlwaysOff:
+            return ScrollBarAlwaysOff;
+        case Qt::ScrollBarAlwaysOn:
+            return ScrollBarAlwaysOn;
+    }
+
+    return ScrollBarAuto;
+}
+
+void ScrollView::suppressScrollBars(bool suppressed, bool repaintOnSuppress)
+{
+    notImplemented();
+}
+
+void ScrollView::setHScrollBarMode(ScrollBarMode newMode)
+{
+    switch (newMode)
+    {
+        case ScrollBarAuto:
+            m_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+        case ScrollBarAlwaysOff:
+            m_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+        case ScrollBarAlwaysOn:
+            m_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    }
+}
+
+void ScrollView::setVScrollBarMode(ScrollBarMode newMode)
+{
+    switch (newMode)
+    {
+        case ScrollBarAuto:
+            m_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+        case ScrollBarAlwaysOff:
+            m_area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+        case ScrollBarAlwaysOn:
+            m_area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    }
+}
+
+void ScrollView::setScrollBarsMode(ScrollBarMode newMode)
+{
+    setHScrollBarMode(newMode);
+    setVScrollBarMode(newMode);
+}
+
+void ScrollView::setStaticBackground(bool flag)
+{
+    notImplemented();
+}
+
+void ScrollView::addChild(Widget* child, int x, int y)
+{
+    qDebug("ScrollView::addChild(), child=%p, x=%i, y=%i", child, x, y);
+    Q_ASSERT(child != 0);
+    Q_ASSERT(m_area && m_area->widget());
+
+    child->setParentWidget(m_area->widget());
+}
+
+void ScrollView::removeChild(Widget*)
+{ 
+    notImplemented();
+}
+
+void ScrollView::scrollPointRecursively(int x, int y)
+{ 
+    notImplemented();
+}
+
+bool ScrollView::inWindow() const
+{
+    return true;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/TextEditQt.cpp b/WebCore/platform/qt/TextEditQt.cpp
new file mode 100644 (file)
index 0000000..afbef7f
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 <QDebug>
+#include <QTextEdit>
+
+#include <config.h>
+#include "GraphicsTypes.h"
+#include "ScrollView.h"
+#include "TextDirection.h"
+#include "PlatformTextEdit.h"
+#include "PlatformString.h"
+#include "IntSize.h"
+#include "HelperQt.h"
+
+namespace WebCore {
+
+PlatformTextEdit::PlatformTextEdit(Widget* parent)
+    : ScrollView()
+{
+    qDebug("PlatformTextEdit::PlatformTextEdit(), this=%p", this);
+}
+
+PlatformTextEdit::~PlatformTextEdit()
+{
+    qDebug("PlatformTextEdit::~PlatformTextEdit()");
+}
+
+void PlatformTextEdit::setParentWidget(QWidget* parent)
+{
+    qDebug("PlatformTextEdit::setParentWidget(), parent=%p", parent);
+    Widget::setParentWidget(parent);
+
+    QTextEdit *widget = new QTextEdit(parent, "");
+    setQWidget(widget);
+}
+
+void PlatformTextEdit::setColors(const Color& background, const Color& foreground)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setAlignment(HorizontalAlignment)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setLineHeight(int lineHeight)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setCursorPosition(int, int)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::getCursorPosition(int *, int *) const
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setFont(const Font&)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setReadOnly(bool)
+{
+    notImplemented();
+}
+
+bool PlatformTextEdit::isReadOnly() const
+{
+    notImplemented();
+    return false;
+}
+
+void PlatformTextEdit::setDisabled(bool)
+{
+    notImplemented();
+}
+
+bool PlatformTextEdit::isDisabled() const
+{
+    notImplemented();
+    return false;
+}
+
+bool PlatformTextEdit::hasSelectedText() const
+{
+    notImplemented();
+    return false;
+}
+
+void PlatformTextEdit::setText(const String&)
+{
+    notImplemented();
+}
+
+String PlatformTextEdit::text() const
+{
+    notImplemented();
+}
+
+String PlatformTextEdit::textWithHardLineBreaks() const
+{
+    notImplemented();
+}
+
+Widget::FocusPolicy PlatformTextEdit::focusPolicy() const
+{
+    return Widget::focusPolicy();
+}
+
+void PlatformTextEdit::setWordWrap(PlatformTextEdit::WrapStyle)
+{
+    notImplemented();
+}
+
+PlatformTextEdit::WrapStyle PlatformTextEdit::wordWrap() const
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setScrollBarModes(ScrollBarMode hMode, ScrollBarMode vMode)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setWritingDirection(TextDirection)
+{
+    notImplemented();
+}
+
+int PlatformTextEdit::selectionStart()
+{
+    notImplemented();
+    return 0;
+}
+
+int PlatformTextEdit::selectionEnd()
+{
+    notImplemented();
+    return 0;
+}
+
+void PlatformTextEdit::setSelectionStart(int)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setSelectionEnd(int)
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::selectAll()
+{
+    notImplemented();
+}
+
+void PlatformTextEdit::setSelectionRange(int, int)
+{
+    notImplemented();
+}
+
+IntSize PlatformTextEdit::sizeWithColumnsAndRows(int numColumns, int numRows) const
+{
+    notImplemented();
+}
+
+bool PlatformTextEdit::checksDescendantsForFocus() const
+{
+    notImplemented();
+    return false;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp
new file mode 100644 (file)
index 0000000..6812f5f
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 George Stiakos <staikos@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 "config.h"
+#include "Widget.h"
+
+#include "Cursor.h"
+#include "HelperQt.h"
+#include "Font.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "RenderObject.h"
+
+#include <QDebug>
+#include <QWidget>
+
+namespace WebCore {
+
+struct WidgetPrivate
+{
+    WidgetPrivate() : m_parent(0), m_widget(0) { }
+    ~WidgetPrivate() { delete m_widget; }
+
+    QWidget* m_parent;
+    QWidget* m_widget;
+    Font m_font;
+};
+
+Widget::Widget()
+    : data(new WidgetPrivate())
+{
+}
+
+Widget::~Widget()
+{
+    delete data;
+    data = 0;
+}
+
+void Widget::setClient(WidgetClient* c)
+{
+    notImplemented();
+}
+
+WidgetClient* Widget::client() const
+{
+    notImplemented();
+    return 0;
+}
+
+IntRect Widget::frameGeometry() const
+{
+    if (!data->m_widget)
+        return IntRect();
+
+    return data->m_widget->geometry();
+}
+
+bool Widget::hasFocus() const
+{
+    if (!data->m_widget)
+        return false;
+
+    return data->m_widget->hasFocus();
+}
+
+void Widget::setFocus()
+{
+    if (data->m_widget)
+        data->m_widget->setFocus();
+}
+
+void Widget::clearFocus()
+{
+    if (data->m_widget)
+        data->m_widget->clearFocus();
+}
+
+const Font& Widget::font() const
+{
+    return data->m_font;
+}
+
+void Widget::setFont(const Font& font)
+{
+    if (data->m_widget)
+        data->m_widget->setFont(toQFont(font));
+}
+
+void Widget::setCursor(const Cursor& cursor)
+{
+    if (data->m_widget)
+        data->m_widget->setCursor(cursor.impl());
+}
+
+void Widget::show()
+{
+    if (data->m_widget)
+        data->m_widget->show();
+}
+
+void Widget::hide()
+{
+    if (data->m_widget)
+        data->m_widget->hide();
+}
+
+void Widget::setQWidget(QWidget*child)
+{
+    delete data->m_widget;
+    data->m_widget = child;
+}
+
+QWidget* Widget::qwidget()
+{
+    return data->m_widget;
+}
+
+void Widget::setParentWidget(QWidget* parent)
+{
+    data->m_parent = parent;
+}
+
+QWidget* Widget::parentWidget() const
+{
+    return data->m_parent;
+}
+
+void Widget::setFrameGeometry(const IntRect& r)
+{
+    if (!data->m_widget)
+        return;
+
+    data->m_widget->setGeometry(r);
+}
+
+IntPoint Widget::mapFromGlobal(const IntPoint& p) const
+{
+    if (!data->m_widget)
+        return IntPoint();
+
+    return data->m_widget->mapFromGlobal(p);
+}
+
+float Widget::scaleFactor() const
+{
+    return 1.0f;
+}
+
+GraphicsContext* Widget::lockDrawingFocus()
+{
+    notImplemented();
+    return 0;
+}
+
+void Widget::unlockDrawingFocus(GraphicsContext*)
+{
+    notImplemented();
+}
+
+void Widget::paint(GraphicsContext*, IntRect const&)
+{
+    notImplemented();
+}
+
+void Widget::enableFlushDrawing()
+{
+    notImplemented();
+}
+
+bool Widget::isEnabled() const
+{
+    if (!data->m_widget)
+        return false;
+
+    return data->m_widget->isEnabled();
+}
+
+void Widget::setIsSelected(bool)
+{
+    notImplemented();
+}
+
+void Widget::disableFlushDrawing()
+{
+    notImplemented();
+}
+
+void Widget::setEnabled(bool en)
+{
+    if (data->m_widget)
+        data->m_widget->setEnabled(en);
+}
+
+Widget::FocusPolicy Widget::focusPolicy() const
+{
+    if (!data->m_widget)
+        return NoFocus;
+
+    switch (data->m_widget->focusPolicy())
+    {
+        case Qt::TabFocus:
+            return TabFocus;
+        case Qt::ClickFocus:
+            return ClickFocus;
+        case Qt::StrongFocus:
+            return StrongFocus;
+        case Qt::WheelFocus:
+            return WheelFocus;
+        case Qt::NoFocus:
+            return NoFocus;    
+    }
+
+    return NoFocus;
+}
+
+}
+
+// vim: ts=4 sw=4 et