[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:50:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d0b6dbe2d47df679ee53c6bf77030f565c1ec3d4
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 13 00:18:36 2001 +0000

    Fixed compile brain damage.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/KWQKLineEdit.mm b/WebCore/kwq/KWQKLineEdit.mm
index 5230f1b..2060317 100644
--- a/WebCore/kwq/KWQKLineEdit.mm
+++ b/WebCore/kwq/KWQKLineEdit.mm
@@ -30,10 +30,12 @@
 
 KLineEdit::KLineEdit(QWidget *parent, const char *name)
 {
+    // This space intentionally left blank.
 }
 
 KLineEdit::~KLineEdit()
 {
+    // This space intentionally left blank.
 }
 
 
diff --git a/WebCore/kwq/KWQKListBox.mm b/WebCore/kwq/KWQKListBox.mm
index 8fb9018..789a09a 100644
--- a/WebCore/kwq/KWQKListBox.mm
+++ b/WebCore/kwq/KWQKListBox.mm
@@ -28,12 +28,12 @@
 
 KListBox::KListBox()
 {
-    _logNotYetImplemented();
+    // This space intentionally left blank.
 }
 
 
-KListBox::KListBox(QWidget *)
+KListBox::KListBox(QWidget *w)
 {
-    _logNotYetImplemented();
+    // This space intentionally left blank.
 }
 
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index db8daf5..c65a0ba 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -53,6 +53,13 @@ void QLineEdit::setCursorPosition(int)
 }
 
 
+int QLineEdit::cursorPosition() const
+{
+    // Not needed.  We ignore setCursorPosition().
+    return 0;
+}
+
+
 void QLineEdit::setText(const QString &s)
 {
     KWQNSTextField *field = (KWQNSTextField *)getView();
@@ -97,13 +104,6 @@ bool QLineEdit::frame() const
 }
 
 
-int QLineEdit::cursorPosition() const
-{
-    // Not needed.  We ignore setCursorPosition().
-    return 0;
-}
-
-
 int QLineEdit::maxLength() const
 {
     KWQNSTextField *field = (KWQNSTextField *)getView();
diff --git a/WebCore/kwq/KWQListBox.h b/WebCore/kwq/KWQListBox.h
index 8400281..9e6bdd4 100644
--- a/WebCore/kwq/KWQListBox.h
+++ b/WebCore/kwq/KWQListBox.h
@@ -33,12 +33,17 @@
 #include <qscrollview.h>
 #include <qstring.h>
 
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+#include <Cocoa/Cocoa.h>
+#endif
+
 class QListBoxItem;
 class QListBoxText;
 
 // class QListBox ==============================================================
 
 class QListBox : public QScrollView {
+friend class QListBoxItem;
 public:
 
     // structs -----------------------------------------------------------------
@@ -79,12 +84,21 @@ private:
     QListBox(const QListBox &);
     QListBox &operator=(const QListBox &);
 
+    QListBoxItem *head;
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSMatrix *matrix;
+#else
+    void *matrix;
+#endif
+
 }; // class QListBox ===========================================================
 
 
 // class QListBoxItem ==========================================================
 
 class QListBoxItem {
+friend class QListBox;
+friend class QListBoxText;
 public:
 
     // structs -----------------------------------------------------------------
@@ -118,6 +132,15 @@ private:
     QListBoxItem(const QListBoxItem &);
     QListBoxItem &operator=(const QListBoxItem &);
 
+    QString text;
+    QListBoxItem *previousItem, *nextItem;
+    QListBox *box;
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSButtonCell *cell;
+#else
+    void *cell;
+#endif
+
 }; // class QListBoxItem =======================================================
 
 
diff --git a/WebCore/kwq/KWQListBox.mm b/WebCore/kwq/KWQListBox.mm
index 2b49f7e..840efc5 100644
--- a/WebCore/kwq/KWQListBox.mm
+++ b/WebCore/kwq/KWQListBox.mm
@@ -24,72 +24,136 @@
  */
 #include <kwqdebug.h>
 
+#include <KWQView.h>
 #include <KWQListBox.h>
 
 
+// Emulated with a NSScrollView that contains a NSMatrix.  Use a prototype cell.
 QListBox::QListBox()
 {
-    _logNotYetImplemented();
+    KWQNSScrollView *scrollview = [[NSScrollView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this];
+    NSButtonCell *cell = [[[NSButtonCell alloc] init] autorelease];
+    
+    [cell setBordered: NO];
+    [cell setAlignment: NSLeftTextAlignment];
+       
+    matrix  = [[NSMatrix alloc] initWithFrame: NSMakeRect (0,0,0,0) mode:NSHighlightModeMatrix prototype:cell numberOfRows:0 numberOfColumns:0];
+    
+    [scrollview setHasVerticalScroller: NO];
+    [scrollview setHasHorizontalScroller: YES];
+    [scrollview setDocumentView: matrix];
+
+    head = 0L;
+    
+    setView (scrollview);
 }
 
 
 QListBox::~QListBox()
 {
-    _logNotYetImplemented();
+    KWQNSScrollView *scrollview = (KWQNSScrollView *)getView();
+
+    [scrollview setDocumentView: nil];
+    [matrix release];
 }
 
 
 uint QListBox::count() const
 {
-    _logNotYetImplemented();
+    (uint)[matrix numberOfRows];
 }
 
 
 void QListBox::clear()
 {
-    _logNotYetImplemented();
+    [matrix renewRows: 0 columns: 0];
+    [matrix sizeToCells];
 }
 
 
-void QListBox::setSelectionMode(SelectionMode)
+void QListBox::setSelectionMode(SelectionMode mode)
 {
-    _logNotYetImplemented();
+    if (mode == QListBox::Extended){
+        [matrix setMode: NSListModeMatrix];
+    }
+    else {
+        [matrix setMode: NSHighlightModeMatrix];
+    }
 }
 
 
 QListBoxItem *QListBox::firstItem() const
 {
-    _logNotYetImplemented();
+    return head;
 }
 
 
 int QListBox::currentItem() const
 {
-    _logNotYetImplemented();
+    return [matrix selectedRow];
 }
 
 
-void QListBox::insertItem(const QString &, int index=-1)
+void QListBox::insertItem(const QString &t, int index)
 {
-    _logNotYetImplemented();
+    insertItem( new QListBoxText(t), index );
 }
 
 
-void QListBox::insertItem(const QListBoxItem *, int index=-1)
+void QListBox::insertItem(const QListBoxItem *newItem, int index)
 {
-    _logNotYetImplemented();
-}
+    if ( !newItem )
+	return;
 
+    if ( index < 0 || index >= count())
+	index = count();
+
+    QListBoxItem *item = (QListBoxItem *)newItem;
+
+    item->box = this;
+    if ( !head || index == 0 ) {
+	item->nextItem = head;
+	item->previousItem = 0;
+	head = item;
+	if ( item->nextItem )
+	    item->nextItem->previousItem = item;
+    } else {
+	QListBoxItem * i = head;
+	while ( i->nextItem && index > 1 ) {
+	    i = i->nextItem;
+	    index--;
+	}
+	if ( i->nextItem ) {
+	    item->nextItem = i->nextItem;
+	    item->previousItem = i;
+	    item->nextItem->previousItem = item;
+	    item->previousItem->nextItem = item;
+	} else {
+	    i->nextItem = item;
+	    item->previousItem = i;
+	    item->nextItem = 0;
+	}
+    }
+    [matrix insertRow: index];
+    
+    NSButtonCell *cell = [matrix cellAtRow: index column: 0];
+    [cell setTitle:  QSTRING_TO_NSSTRING(item->text)];
+    
+    item->cell = [cell retain];
+}
 
-void QListBox::setSelected(int, bool)
+void QListBox::setSelected(int index, bool selectIt)
 {
-    _logNotYetImplemented();
+    if (selectIt)
+        [matrix selectCellAtRow: index column: 0];
+    else
+        [matrix deselectSelectedCell];
 }
 
 
-bool QListBox::isSelected(int)
+bool QListBox::isSelected(int index)
 {
-    _logNotYetImplemented();
+    return [matrix selectedRow] == index;
 }
 
 
@@ -97,61 +161,65 @@ bool QListBox::isSelected(int)
 
 QListBoxItem::QListBoxItem()
 {
-    _logNotYetImplemented();
+    cell = 0L;
 }
 
 QListBoxItem::~QListBoxItem()
 {
-    _logNotYetImplemented();
+    [cell release];
 }
 
 
-void QListBoxItem::setSelectable(bool)
+void QListBoxItem::setSelectable(bool flag)
 {
+    [cell setSelectable: flag];
 }
 
 
 QListBox *QListBoxItem::listBox() const
 {
-    _logNotYetImplemented();
+    return box;
 }
 
 
 int QListBoxItem::width(const QListBox *) const
 {
-    _logNotYetImplemented();
+    // Is this right?
+    NSSize size = [cell cellSizeForBounds: NSMakeRect (0,0,10000,10000)];
+    return (int)size.width;
 }
 
 
 int QListBoxItem::height(const QListBox *) const
 {
-    _logNotYetImplemented();
+    // Is this right?
+    NSSize size = [cell cellSizeForBounds: NSMakeRect (0,0,10000,10000)];
+    return (int)size.height;
 }
 
 
 QListBoxItem *QListBoxItem::next() const
 {
-    _logNotYetImplemented();
+    return nextItem;
 }
 
 
 QListBoxItem *QListBoxItem::prev() const
 {
-    _logNotYetImplemented();
+    return previousItem;
 }
 
 
 
 // class QListBoxText ==========================================================
 
-QListBoxText::QListBoxText(const QString &text=QString::null)
+QListBoxText::QListBoxText(const QString &t)
 {
-    _logNotYetImplemented();
+    text = t;
 }
 
 
 QListBoxText::~QListBoxText()
 {
-    _logNotYetImplemented();
 }
 
diff --git a/WebCore/kwq/KWQView.h b/WebCore/kwq/KWQView.h
index 2b077fe..7b83bad 100644
--- a/WebCore/kwq/KWQView.h
+++ b/WebCore/kwq/KWQView.h
@@ -26,3 +26,10 @@ class QWidget;
 - initWithFrame: (NSRect)r widget: (QWidget *)w; 
 @end
 
+ at interface KWQNSScrollView : NSScrollView
+{
+    QWidget *widget;
+}
+- initWithFrame: (NSRect)r widget: (QWidget *)w; 
+ at end
+
diff --git a/WebCore/kwq/qt/qhbox.h b/WebCore/kwq/qt/qhbox.h
index dc2d12c..02ec2d0 100644
--- a/WebCore/kwq/qt/qhbox.h
+++ b/WebCore/kwq/qt/qhbox.h
@@ -57,6 +57,9 @@ public:
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+#ifdef _KWQ_
+    void setFocusProxy( QWidget *lineEdit);
+#endif
 
 private:
 
@@ -72,9 +75,6 @@ private:
     QHBox &operator=(const QHBox &);
 #endif
 
-#ifdef _KWQ_
-    void setFocusProxy( QWidget *lineEdit);
-#endif
 
 }; // class QHBox ==============================================================
 
diff --git a/WebCore/src/kwq/KWQKLineEdit.mm b/WebCore/src/kwq/KWQKLineEdit.mm
index 5230f1b..2060317 100644
--- a/WebCore/src/kwq/KWQKLineEdit.mm
+++ b/WebCore/src/kwq/KWQKLineEdit.mm
@@ -30,10 +30,12 @@
 
 KLineEdit::KLineEdit(QWidget *parent, const char *name)
 {
+    // This space intentionally left blank.
 }
 
 KLineEdit::~KLineEdit()
 {
+    // This space intentionally left blank.
 }
 
 
diff --git a/WebCore/src/kwq/KWQKListBox.mm b/WebCore/src/kwq/KWQKListBox.mm
index 8fb9018..789a09a 100644
--- a/WebCore/src/kwq/KWQKListBox.mm
+++ b/WebCore/src/kwq/KWQKListBox.mm
@@ -28,12 +28,12 @@
 
 KListBox::KListBox()
 {
-    _logNotYetImplemented();
+    // This space intentionally left blank.
 }
 
 
-KListBox::KListBox(QWidget *)
+KListBox::KListBox(QWidget *w)
 {
-    _logNotYetImplemented();
+    // This space intentionally left blank.
 }
 
diff --git a/WebCore/src/kwq/KWQLineEdit.mm b/WebCore/src/kwq/KWQLineEdit.mm
index db8daf5..c65a0ba 100644
--- a/WebCore/src/kwq/KWQLineEdit.mm
+++ b/WebCore/src/kwq/KWQLineEdit.mm
@@ -53,6 +53,13 @@ void QLineEdit::setCursorPosition(int)
 }
 
 
+int QLineEdit::cursorPosition() const
+{
+    // Not needed.  We ignore setCursorPosition().
+    return 0;
+}
+
+
 void QLineEdit::setText(const QString &s)
 {
     KWQNSTextField *field = (KWQNSTextField *)getView();
@@ -97,13 +104,6 @@ bool QLineEdit::frame() const
 }
 
 
-int QLineEdit::cursorPosition() const
-{
-    // Not needed.  We ignore setCursorPosition().
-    return 0;
-}
-
-
 int QLineEdit::maxLength() const
 {
     KWQNSTextField *field = (KWQNSTextField *)getView();
diff --git a/WebCore/src/kwq/KWQListBox.h b/WebCore/src/kwq/KWQListBox.h
index 8400281..9e6bdd4 100644
--- a/WebCore/src/kwq/KWQListBox.h
+++ b/WebCore/src/kwq/KWQListBox.h
@@ -33,12 +33,17 @@
 #include <qscrollview.h>
 #include <qstring.h>
 
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+#include <Cocoa/Cocoa.h>
+#endif
+
 class QListBoxItem;
 class QListBoxText;
 
 // class QListBox ==============================================================
 
 class QListBox : public QScrollView {
+friend class QListBoxItem;
 public:
 
     // structs -----------------------------------------------------------------
@@ -79,12 +84,21 @@ private:
     QListBox(const QListBox &);
     QListBox &operator=(const QListBox &);
 
+    QListBoxItem *head;
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSMatrix *matrix;
+#else
+    void *matrix;
+#endif
+
 }; // class QListBox ===========================================================
 
 
 // class QListBoxItem ==========================================================
 
 class QListBoxItem {
+friend class QListBox;
+friend class QListBoxText;
 public:
 
     // structs -----------------------------------------------------------------
@@ -118,6 +132,15 @@ private:
     QListBoxItem(const QListBoxItem &);
     QListBoxItem &operator=(const QListBoxItem &);
 
+    QString text;
+    QListBoxItem *previousItem, *nextItem;
+    QListBox *box;
+#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
+    NSButtonCell *cell;
+#else
+    void *cell;
+#endif
+
 }; // class QListBoxItem =======================================================
 
 
diff --git a/WebCore/src/kwq/KWQListBox.mm b/WebCore/src/kwq/KWQListBox.mm
index 2b49f7e..840efc5 100644
--- a/WebCore/src/kwq/KWQListBox.mm
+++ b/WebCore/src/kwq/KWQListBox.mm
@@ -24,72 +24,136 @@
  */
 #include <kwqdebug.h>
 
+#include <KWQView.h>
 #include <KWQListBox.h>
 
 
+// Emulated with a NSScrollView that contains a NSMatrix.  Use a prototype cell.
 QListBox::QListBox()
 {
-    _logNotYetImplemented();
+    KWQNSScrollView *scrollview = [[NSScrollView alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this];
+    NSButtonCell *cell = [[[NSButtonCell alloc] init] autorelease];
+    
+    [cell setBordered: NO];
+    [cell setAlignment: NSLeftTextAlignment];
+       
+    matrix  = [[NSMatrix alloc] initWithFrame: NSMakeRect (0,0,0,0) mode:NSHighlightModeMatrix prototype:cell numberOfRows:0 numberOfColumns:0];
+    
+    [scrollview setHasVerticalScroller: NO];
+    [scrollview setHasHorizontalScroller: YES];
+    [scrollview setDocumentView: matrix];
+
+    head = 0L;
+    
+    setView (scrollview);
 }
 
 
 QListBox::~QListBox()
 {
-    _logNotYetImplemented();
+    KWQNSScrollView *scrollview = (KWQNSScrollView *)getView();
+
+    [scrollview setDocumentView: nil];
+    [matrix release];
 }
 
 
 uint QListBox::count() const
 {
-    _logNotYetImplemented();
+    (uint)[matrix numberOfRows];
 }
 
 
 void QListBox::clear()
 {
-    _logNotYetImplemented();
+    [matrix renewRows: 0 columns: 0];
+    [matrix sizeToCells];
 }
 
 
-void QListBox::setSelectionMode(SelectionMode)
+void QListBox::setSelectionMode(SelectionMode mode)
 {
-    _logNotYetImplemented();
+    if (mode == QListBox::Extended){
+        [matrix setMode: NSListModeMatrix];
+    }
+    else {
+        [matrix setMode: NSHighlightModeMatrix];
+    }
 }
 
 
 QListBoxItem *QListBox::firstItem() const
 {
-    _logNotYetImplemented();
+    return head;
 }
 
 
 int QListBox::currentItem() const
 {
-    _logNotYetImplemented();
+    return [matrix selectedRow];
 }
 
 
-void QListBox::insertItem(const QString &, int index=-1)
+void QListBox::insertItem(const QString &t, int index)
 {
-    _logNotYetImplemented();
+    insertItem( new QListBoxText(t), index );
 }
 
 
-void QListBox::insertItem(const QListBoxItem *, int index=-1)
+void QListBox::insertItem(const QListBoxItem *newItem, int index)
 {
-    _logNotYetImplemented();
-}
+    if ( !newItem )
+	return;
 
+    if ( index < 0 || index >= count())
+	index = count();
+
+    QListBoxItem *item = (QListBoxItem *)newItem;
+
+    item->box = this;
+    if ( !head || index == 0 ) {
+	item->nextItem = head;
+	item->previousItem = 0;
+	head = item;
+	if ( item->nextItem )
+	    item->nextItem->previousItem = item;
+    } else {
+	QListBoxItem * i = head;
+	while ( i->nextItem && index > 1 ) {
+	    i = i->nextItem;
+	    index--;
+	}
+	if ( i->nextItem ) {
+	    item->nextItem = i->nextItem;
+	    item->previousItem = i;
+	    item->nextItem->previousItem = item;
+	    item->previousItem->nextItem = item;
+	} else {
+	    i->nextItem = item;
+	    item->previousItem = i;
+	    item->nextItem = 0;
+	}
+    }
+    [matrix insertRow: index];
+    
+    NSButtonCell *cell = [matrix cellAtRow: index column: 0];
+    [cell setTitle:  QSTRING_TO_NSSTRING(item->text)];
+    
+    item->cell = [cell retain];
+}
 
-void QListBox::setSelected(int, bool)
+void QListBox::setSelected(int index, bool selectIt)
 {
-    _logNotYetImplemented();
+    if (selectIt)
+        [matrix selectCellAtRow: index column: 0];
+    else
+        [matrix deselectSelectedCell];
 }
 
 
-bool QListBox::isSelected(int)
+bool QListBox::isSelected(int index)
 {
-    _logNotYetImplemented();
+    return [matrix selectedRow] == index;
 }
 
 
@@ -97,61 +161,65 @@ bool QListBox::isSelected(int)
 
 QListBoxItem::QListBoxItem()
 {
-    _logNotYetImplemented();
+    cell = 0L;
 }
 
 QListBoxItem::~QListBoxItem()
 {
-    _logNotYetImplemented();
+    [cell release];
 }
 
 
-void QListBoxItem::setSelectable(bool)
+void QListBoxItem::setSelectable(bool flag)
 {
+    [cell setSelectable: flag];
 }
 
 
 QListBox *QListBoxItem::listBox() const
 {
-    _logNotYetImplemented();
+    return box;
 }
 
 
 int QListBoxItem::width(const QListBox *) const
 {
-    _logNotYetImplemented();
+    // Is this right?
+    NSSize size = [cell cellSizeForBounds: NSMakeRect (0,0,10000,10000)];
+    return (int)size.width;
 }
 
 
 int QListBoxItem::height(const QListBox *) const
 {
-    _logNotYetImplemented();
+    // Is this right?
+    NSSize size = [cell cellSizeForBounds: NSMakeRect (0,0,10000,10000)];
+    return (int)size.height;
 }
 
 
 QListBoxItem *QListBoxItem::next() const
 {
-    _logNotYetImplemented();
+    return nextItem;
 }
 
 
 QListBoxItem *QListBoxItem::prev() const
 {
-    _logNotYetImplemented();
+    return previousItem;
 }
 
 
 
 // class QListBoxText ==========================================================
 
-QListBoxText::QListBoxText(const QString &text=QString::null)
+QListBoxText::QListBoxText(const QString &t)
 {
-    _logNotYetImplemented();
+    text = t;
 }
 
 
 QListBoxText::~QListBoxText()
 {
-    _logNotYetImplemented();
 }
 
diff --git a/WebCore/src/kwq/KWQView.h b/WebCore/src/kwq/KWQView.h
index 2b077fe..7b83bad 100644
--- a/WebCore/src/kwq/KWQView.h
+++ b/WebCore/src/kwq/KWQView.h
@@ -26,3 +26,10 @@ class QWidget;
 - initWithFrame: (NSRect)r widget: (QWidget *)w; 
 @end
 
+ at interface KWQNSScrollView : NSScrollView
+{
+    QWidget *widget;
+}
+- initWithFrame: (NSRect)r widget: (QWidget *)w; 
+ at end
+
diff --git a/WebCore/src/kwq/qt/qhbox.h b/WebCore/src/kwq/qt/qhbox.h
index dc2d12c..02ec2d0 100644
--- a/WebCore/src/kwq/qt/qhbox.h
+++ b/WebCore/src/kwq/qt/qhbox.h
@@ -57,6 +57,9 @@ public:
 
 // protected -------------------------------------------------------------------
 // private ---------------------------------------------------------------------
+#ifdef _KWQ_
+    void setFocusProxy( QWidget *lineEdit);
+#endif
 
 private:
 
@@ -72,9 +75,6 @@ private:
     QHBox &operator=(const QHBox &);
 #endif
 
-#ifdef _KWQ_
-    void setFocusProxy( QWidget *lineEdit);
-#endif
 
 }; // class QHBox ==============================================================
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list