Commit 5026e915 authored by mjs's avatar mjs
Browse files

Reviewed by Ken.

	More Cocoa exception blocking work.

        * kwq/KWQFrame.mm:
        (QFrame::setFrameStyle):
        * kwq/KWQLineEdit.mm:
        (QLineEdit::QLineEdit):
        (QLineEdit::~QLineEdit):
        (QLineEdit::setEchoMode):
        (QLineEdit::setFont):
        (QLineEdit::setText):
        (QLineEdit::text):
        (QLineEdit::isReadOnly):
        (QLineEdit::setReadOnly):
        (QLineEdit::maxLength):
        (QLineEdit::selectAll):
        (QLineEdit::edited):
        (QLineEdit::setEdited):
        (QLineEdit::sizeForCharacterWidth):
        (QLineEdit::baselinePosition):
        (QLineEdit::setAlignment):
        * kwq/KWQListBox.mm:
        (QListBox::QListBox):
        (QListBox::~QListBox):
        (QListBox::count):
        (QListBox::clear):
        (QListBox::setSelectionMode):
        (QListBox::insertItem):
        (QListBox::insertGroupLabel):
        (QListBox::endBatchInsert):
        (QListBox::setSelected):
        (QListBox::isSelected):
        (QListBox::setEnabled):
        (QListBox::sizeForNumberOfLines):
        (QListBox::focusPolicy):
        * kwq/KWQPushButton.mm:
        (QPushButton::QPushButton):
        (QPushButton::sizeHint):
        (QPushButton::baselinePosition):
        (QPushButton::dimensions):
        * kwq/KWQRadioButton.mm:
        (QRadioButton::QRadioButton):
        (QRadioButton::setChecked):
        (QRadioButton::isChecked):
        (QRadioButton::dimensions):
        * kwq/KWQScrollBar.mm:
        (-[KWQScrollBar initWithQScrollBar:]):
        (:m_valueChanged):
        (QScrollBar::~QScrollBar):
        (QScrollBar::setValue):
        (QScrollBar::setKnobProportion):
        (QScrollBar::scrollbarHit):
        * kwq/KWQScrollView.mm:
        (QScrollView::visibleWidth):
        (QScrollView::visibleHeight):
        (QScrollView::contentsWidth):
        (QScrollView::contentsHeight):
        (QScrollView::contentsX):
        (QScrollView::contentsY):
        (QScrollView::setContentsPos):
        (QScrollView::setVScrollBarMode):
        (QScrollView::setHScrollBarMode):
        (QScrollView::setScrollBarsMode):
        (QScrollView::vScrollBarMode):
        (QScrollView::hScrollBarMode):
        (QScrollView::hasVerticalScrollBar):
        (QScrollView::hasHorizontalScrollBar):
        (QScrollView::suppressScrollBars):
        (QScrollView::addChild):
        (QScrollView::removeChild):
        (QScrollView::resizeContents):
        (QScrollView::updateContents):
        (QScrollView::contentsToViewport):
        (QScrollView::viewportToContents):
        (QScrollView::setStaticBackground):
        (QScrollView::ensureVisible):
        (QScrollView::getDocumentView):
        * kwq/KWQTextEdit.mm:
        (QTextEdit::QTextEdit):
        (QTextEdit::setText):
        (QTextEdit::text):
        (QTextEdit::textWithHardLineBreaks):
        (QTextEdit::getCursorPosition):
        (QTextEdit::setCursorPosition):
        (QTextEdit::wordWrap):
        (QTextEdit::setWordWrap):
        (QTextEdit::isReadOnly):
        (QTextEdit::setReadOnly):
        (QTextEdit::selectAll):
        (QTextEdit::setFont):
        (QTextEdit::setAlignment):
        (QTextEdit::sizeWithColumnsAndRows):
        * kwq/KWQWidget.mm:
        (QWidget::QWidget):
        (QWidget::~QWidget):
        (QWidget::setActiveWindow):
        (QWidget::setEnabled):
        (QWidget::isEnabled):
        (QWidget::frameGeometry):
        (QWidget::hasFocus):
        (QWidget::setFocus):
        (QWidget::focusPolicy):
        (QWidget::isVisible):
        (QWidget::setCursor):
        (QWidget::cursor):
        (QWidget::setFrameGeometry):
        (QWidget::mapFromGlobal):
        (QWidget::setView):
        (QWidget::getOuterView):
        (QWidget::lockDrawingFocus):
        (QWidget::unlockDrawingFocus):
        (QWidget::disableFlushDrawing):
        (QWidget::enableFlushDrawing):
        (QWidget::setDrawingAlpha):
        (QWidget::paint):
        (QWidget::sendConsumedMouseUp):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9953125e
2003-10-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
More Cocoa exception blocking work.
* kwq/KWQFrame.mm:
(QFrame::setFrameStyle):
* kwq/KWQLineEdit.mm:
(QLineEdit::QLineEdit):
(QLineEdit::~QLineEdit):
(QLineEdit::setEchoMode):
(QLineEdit::setFont):
(QLineEdit::setText):
(QLineEdit::text):
(QLineEdit::isReadOnly):
(QLineEdit::setReadOnly):
(QLineEdit::maxLength):
(QLineEdit::selectAll):
(QLineEdit::edited):
(QLineEdit::setEdited):
(QLineEdit::sizeForCharacterWidth):
(QLineEdit::baselinePosition):
(QLineEdit::setAlignment):
* kwq/KWQListBox.mm:
(QListBox::QListBox):
(QListBox::~QListBox):
(QListBox::count):
(QListBox::clear):
(QListBox::setSelectionMode):
(QListBox::insertItem):
(QListBox::insertGroupLabel):
(QListBox::endBatchInsert):
(QListBox::setSelected):
(QListBox::isSelected):
(QListBox::setEnabled):
(QListBox::sizeForNumberOfLines):
(QListBox::focusPolicy):
* kwq/KWQPushButton.mm:
(QPushButton::QPushButton):
(QPushButton::sizeHint):
(QPushButton::baselinePosition):
(QPushButton::dimensions):
* kwq/KWQRadioButton.mm:
(QRadioButton::QRadioButton):
(QRadioButton::setChecked):
(QRadioButton::isChecked):
(QRadioButton::dimensions):
* kwq/KWQScrollBar.mm:
(-[KWQScrollBar initWithQScrollBar:]):
(:m_valueChanged):
(QScrollBar::~QScrollBar):
(QScrollBar::setValue):
(QScrollBar::setKnobProportion):
(QScrollBar::scrollbarHit):
* kwq/KWQScrollView.mm:
(QScrollView::visibleWidth):
(QScrollView::visibleHeight):
(QScrollView::contentsWidth):
(QScrollView::contentsHeight):
(QScrollView::contentsX):
(QScrollView::contentsY):
(QScrollView::setContentsPos):
(QScrollView::setVScrollBarMode):
(QScrollView::setHScrollBarMode):
(QScrollView::setScrollBarsMode):
(QScrollView::vScrollBarMode):
(QScrollView::hScrollBarMode):
(QScrollView::hasVerticalScrollBar):
(QScrollView::hasHorizontalScrollBar):
(QScrollView::suppressScrollBars):
(QScrollView::addChild):
(QScrollView::removeChild):
(QScrollView::resizeContents):
(QScrollView::updateContents):
(QScrollView::contentsToViewport):
(QScrollView::viewportToContents):
(QScrollView::setStaticBackground):
(QScrollView::ensureVisible):
(QScrollView::getDocumentView):
* kwq/KWQTextEdit.mm:
(QTextEdit::QTextEdit):
(QTextEdit::setText):
(QTextEdit::text):
(QTextEdit::textWithHardLineBreaks):
(QTextEdit::getCursorPosition):
(QTextEdit::setCursorPosition):
(QTextEdit::wordWrap):
(QTextEdit::setWordWrap):
(QTextEdit::isReadOnly):
(QTextEdit::setReadOnly):
(QTextEdit::selectAll):
(QTextEdit::setFont):
(QTextEdit::setAlignment):
(QTextEdit::sizeWithColumnsAndRows):
* kwq/KWQWidget.mm:
(QWidget::QWidget):
(QWidget::~QWidget):
(QWidget::setActiveWindow):
(QWidget::setEnabled):
(QWidget::isEnabled):
(QWidget::frameGeometry):
(QWidget::hasFocus):
(QWidget::setFocus):
(QWidget::focusPolicy):
(QWidget::isVisible):
(QWidget::setCursor):
(QWidget::cursor):
(QWidget::setFrameGeometry):
(QWidget::mapFromGlobal):
(QWidget::setView):
(QWidget::getOuterView):
(QWidget::lockDrawingFocus):
(QWidget::unlockDrawingFocus):
(QWidget::disableFlushDrawing):
(QWidget::enableFlushDrawing):
(QWidget::setDrawingAlpha):
(QWidget::paint):
(QWidget::sendConsumedMouseUp):
2003-10-09 David Hyatt <hyatt@apple.com>
 
Stop printing extra spaces before list items. Fixes ordered lists with list-style-position: inside.
......
2003-10-09 Maciej Stachowiak <mjs@apple.com>
Reviewed by Ken.
More Cocoa exception blocking work.
* kwq/KWQFrame.mm:
(QFrame::setFrameStyle):
* kwq/KWQLineEdit.mm:
(QLineEdit::QLineEdit):
(QLineEdit::~QLineEdit):
(QLineEdit::setEchoMode):
(QLineEdit::setFont):
(QLineEdit::setText):
(QLineEdit::text):
(QLineEdit::isReadOnly):
(QLineEdit::setReadOnly):
(QLineEdit::maxLength):
(QLineEdit::selectAll):
(QLineEdit::edited):
(QLineEdit::setEdited):
(QLineEdit::sizeForCharacterWidth):
(QLineEdit::baselinePosition):
(QLineEdit::setAlignment):
* kwq/KWQListBox.mm:
(QListBox::QListBox):
(QListBox::~QListBox):
(QListBox::count):
(QListBox::clear):
(QListBox::setSelectionMode):
(QListBox::insertItem):
(QListBox::insertGroupLabel):
(QListBox::endBatchInsert):
(QListBox::setSelected):
(QListBox::isSelected):
(QListBox::setEnabled):
(QListBox::sizeForNumberOfLines):
(QListBox::focusPolicy):
* kwq/KWQPushButton.mm:
(QPushButton::QPushButton):
(QPushButton::sizeHint):
(QPushButton::baselinePosition):
(QPushButton::dimensions):
* kwq/KWQRadioButton.mm:
(QRadioButton::QRadioButton):
(QRadioButton::setChecked):
(QRadioButton::isChecked):
(QRadioButton::dimensions):
* kwq/KWQScrollBar.mm:
(-[KWQScrollBar initWithQScrollBar:]):
(:m_valueChanged):
(QScrollBar::~QScrollBar):
(QScrollBar::setValue):
(QScrollBar::setKnobProportion):
(QScrollBar::scrollbarHit):
* kwq/KWQScrollView.mm:
(QScrollView::visibleWidth):
(QScrollView::visibleHeight):
(QScrollView::contentsWidth):
(QScrollView::contentsHeight):
(QScrollView::contentsX):
(QScrollView::contentsY):
(QScrollView::setContentsPos):
(QScrollView::setVScrollBarMode):
(QScrollView::setHScrollBarMode):
(QScrollView::setScrollBarsMode):
(QScrollView::vScrollBarMode):
(QScrollView::hScrollBarMode):
(QScrollView::hasVerticalScrollBar):
(QScrollView::hasHorizontalScrollBar):
(QScrollView::suppressScrollBars):
(QScrollView::addChild):
(QScrollView::removeChild):
(QScrollView::resizeContents):
(QScrollView::updateContents):
(QScrollView::contentsToViewport):
(QScrollView::viewportToContents):
(QScrollView::setStaticBackground):
(QScrollView::ensureVisible):
(QScrollView::getDocumentView):
* kwq/KWQTextEdit.mm:
(QTextEdit::QTextEdit):
(QTextEdit::setText):
(QTextEdit::text):
(QTextEdit::textWithHardLineBreaks):
(QTextEdit::getCursorPosition):
(QTextEdit::setCursorPosition):
(QTextEdit::wordWrap):
(QTextEdit::setWordWrap):
(QTextEdit::isReadOnly):
(QTextEdit::setReadOnly):
(QTextEdit::selectAll):
(QTextEdit::setFont):
(QTextEdit::setAlignment):
(QTextEdit::sizeWithColumnsAndRows):
* kwq/KWQWidget.mm:
(QWidget::QWidget):
(QWidget::~QWidget):
(QWidget::setActiveWindow):
(QWidget::setEnabled):
(QWidget::isEnabled):
(QWidget::frameGeometry):
(QWidget::hasFocus):
(QWidget::setFocus):
(QWidget::focusPolicy):
(QWidget::isVisible):
(QWidget::setCursor):
(QWidget::cursor):
(QWidget::setFrameGeometry):
(QWidget::mapFromGlobal):
(QWidget::setView):
(QWidget::getOuterView):
(QWidget::lockDrawingFocus):
(QWidget::unlockDrawingFocus):
(QWidget::disableFlushDrawing):
(QWidget::enableFlushDrawing):
(QWidget::setDrawingAlpha):
(QWidget::paint):
(QWidget::sendConsumedMouseUp):
2003-10-09 David Hyatt <hyatt@apple.com>
 
Stop printing extra spaces before list items. Fixes ordered lists with list-style-position: inside.
......
......@@ -25,9 +25,10 @@
#import "KWQFrame.h"
#import "khtmlview.h"
#import "KWQExceptions.h"
#import "KWQKHTMLPart.h"
#import "WebCoreBridge.h"
#import "khtmlview.h"
void QFrame::setFrameStyle(int s)
{
......@@ -38,7 +39,9 @@ void QFrame::setFrameStyle(int s)
if (view) {
KHTMLPart *part = view->part();
if (part) {
KWQ_BLOCK_NS_EXCEPTIONS;
[KWQ(part)->bridge() setHasBorder:(s != NoFrame)];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
}
}
......
......@@ -25,8 +25,9 @@
#import "KWQLineEdit.h"
#import "KWQTextField.h"
#import "KWQExceptions.h"
#import "KWQLogging.h"
#import "KWQTextField.h"
#import "WebCoreTextRendererFactory.h"
// This replicates constants from [NSTextFieldCell drawingRectForBounds].
......@@ -37,22 +38,30 @@ QLineEdit::QLineEdit()
, m_textChanged(this, SIGNAL(textChanged(const QString &)))
, m_clicked(this, SIGNAL(clicked()))
{
KWQTextField *view = [[KWQTextField alloc] initWithQLineEdit:this];
[view setSelectable:YES]; // must do this explicitly so setEditable:NO does not make it NO
KWQTextField *view = nil;
KWQ_BLOCK_NS_EXCEPTIONS;
view = [[KWQTextField alloc] initWithQLineEdit:this];
setView(view);
[view release];
[view setSelectable:YES]; // must do this explicitly so setEditable:NO does not make it NO
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
QLineEdit::~QLineEdit()
{
KWQTextField* textField = (KWQTextField*)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField invalidate];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QLineEdit::setEchoMode(EchoMode mode)
{
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setPasswordMode:mode == Password];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QLineEdit::setCursorPosition(int)
......@@ -70,22 +79,32 @@ void QLineEdit::setFont(const QFont &font)
{
QWidget::setFont(font);
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setFont:font.getNSFont()];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QLineEdit::setText(const QString &s)
{
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setStringValue:s.getNSString()];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
QString QLineEdit::text()
{
KWQTextField *textField = (KWQTextField *)getView();
volatile NSString * volatile result = @"";
KWQ_BLOCK_NS_EXCEPTIONS;
NSMutableString *text = [[[textField stringValue] mutableCopy] autorelease];
result = text;
[text replaceOccurrencesOfString:@"\r\n" withString:@"\n" options:NSLiteralSearch range:NSMakeRange(0, [text length])];
[text replaceOccurrencesOfString:@"\r" withString:@"\n" options:NSLiteralSearch range:NSMakeRange(0, [text length])];
return QString::fromNSString(text);
KWQ_UNBLOCK_NS_EXCEPTIONS;
return QString::fromNSString((NSString *)result);
}
void QLineEdit::setMaxLength(int len)
......@@ -97,37 +116,61 @@ void QLineEdit::setMaxLength(int len)
bool QLineEdit::isReadOnly() const
{
KWQTextField *textField = (KWQTextField *)getView();
return ![textField isEditable];
volatile bool result = true;
KWQ_BLOCK_NS_EXCEPTIONS;
result = ![textField isEditable];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QLineEdit::setReadOnly(bool flag)
{
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setEditable:!flag];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
int QLineEdit::maxLength() const
{
KWQTextField *textField = (KWQTextField *)getView();
return [textField maximumLength];
volatile int result = 0;
KWQ_BLOCK_NS_EXCEPTIONS;
result = [textField maximumLength];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QLineEdit::selectAll()
{
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField selectText:nil];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
bool QLineEdit::edited() const
{
KWQTextField *textField = (KWQTextField *)getView();
return [textField edited];
volatile bool result = false;
KWQ_BLOCK_NS_EXCEPTIONS;
result = [textField edited];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QLineEdit::setEdited(bool flag)
{
KWQTextField *textField = (KWQTextField *)getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setEdited:flag];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
QSize QLineEdit::sizeForCharacterWidth(int numCharacters) const
......@@ -140,6 +183,9 @@ QSize QLineEdit::sizeForCharacterWidth(int numCharacters) const
ASSERT(numCharacters > 0);
NSSize size = {0,0};
KWQ_BLOCK_NS_EXCEPTIONS;
NSMutableString *nominalWidthString = [NSMutableString stringWithCapacity:numCharacters];
for (int i = 0; i < numCharacters; ++i) {
[nominalWidthString appendString:@"0"];
......@@ -149,9 +195,10 @@ QSize QLineEdit::sizeForCharacterWidth(int numCharacters) const
int maximumLength = [textField maximumLength];
[textField setMaximumLength:numCharacters];
[textField setStringValue:nominalWidthString];
NSSize size = [[textField cell] cellSize];
size = [[textField cell] cellSize];
[textField setMaximumLength:maximumLength];
[textField setStringValue:value];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return QSize(size);
}
......@@ -159,10 +206,17 @@ QSize QLineEdit::sizeForCharacterWidth(int numCharacters) const
int QLineEdit::baselinePosition() const
{
KWQTextField *textField = (KWQTextField *)getView();
volatile int result = 0;
KWQ_BLOCK_NS_EXCEPTIONS;
NSRect bounds = [textField bounds];
NSFont *font = [textField font];
return (int)ceil([[textField cell] drawingRectForBounds:bounds].origin.y - bounds.origin.y
result = (int)ceil([[textField cell] drawingRectForBounds:bounds].origin.y - bounds.origin.y
+ [font defaultLineHeightForFont] + [font descender]);
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QLineEdit::clicked()
......@@ -174,7 +228,9 @@ void QLineEdit::setAlignment(AlignmentFlags alignment)
{
ASSERT(alignment == AlignLeft || alignment == AlignRight);
KWQTextField *textField = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
[textField setAlignment:(alignment == AlignRight ? NSRightTextAlignment : NSLeftTextAlignment)];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
bool QLineEdit::checksDescendantsForFocus() const
......
......@@ -26,6 +26,7 @@
#import "KWQListBox.h"
#import "KWQAssertions.h"
#import "KWQExceptions.h"
#import "KWQKHTMLPart.h"
#import "KWQNSViewExtras.h"
#import "KWQView.h"
......@@ -52,7 +53,6 @@
QListBox::QListBox(QWidget *parent)
: QScrollView(parent)
, _items([[NSMutableArray alloc] init])
, _insertingItems(false)
, _changingSelection(false)
, _enabled(true)
......@@ -60,7 +60,12 @@ QListBox::QListBox(QWidget *parent)
, _clicked(this, SIGNAL(clicked(QListBoxItem *)))
, _selectionChanged(this, SIGNAL(selectionChanged()))
{
KWQ_BLOCK_NS_EXCEPTIONS;
_items = [[NSMutableArray alloc] init];
NSScrollView *scrollView = [[KWQListBoxScrollView alloc] init];
setView(scrollView);
[scrollView release];
[scrollView setBorderType:NSBezelBorder];
[scrollView setHasVerticalScroller:YES];
......@@ -78,51 +83,64 @@ QListBox::QListBox(QWidget *parent)
[[scrollView contentView] releaseGState];
KWQTableView *tableView = [[KWQTableView alloc] initWithListBox:this items:_items];
[scrollView setDocumentView:tableView];
[scrollView setVerticalLineScroll:[tableView rowHeight]];
[tableView release];
setView(scrollView);
[scrollView setVerticalLineScroll:[tableView rowHeight]];
[scrollView release];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
QListBox::~QListBox()
{
NSScrollView *scrollView = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
NSTableView *tableView = [scrollView documentView];
[tableView setDelegate:nil];
[tableView setDataSource:nil];
[_items release];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
uint QListBox::count() const
{
return [_items count];
volatile uint result = 0;
KWQ_BLOCK_NS_EXCEPTIONS;
result = [_items count];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QListBox::clear()
{
KWQ_BLOCK_NS_EXCEPTIONS;
[_items removeAllObjects];
if (!_insertingItems) {
NSScrollView *scrollView = getView();
NSTableView *tableView = [scrollView documentView];
[tableView reloadData];
}
KWQ_UNBLOCK_NS_EXCEPTIONS;
_widthGood = NO;
}
void QListBox::setSelectionMode(SelectionMode mode)
{
NSScrollView *scrollView = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
NSTableView *tableView = [scrollView documentView];
[tableView setAllowsMultipleSelection:mode != Single];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QListBox::insertItem(NSObject *o, unsigned index)
{
unsigned c = count();
KWQ_BLOCK_NS_EXCEPTIONS;
if (index >= c) {
[_items addObject:o];
} else {
......@@ -134,6 +152,8 @@ void QListBox::insertItem(NSObject *o, unsigned index)
NSTableView *tableView = [scrollView documentView];
[tableView reloadData];
}
KWQ_UNBLOCK_NS_EXCEPTIONS;
_widthGood = NO;
}
......@@ -145,6 +165,8 @@ void QListBox::insertItem(const QString &text, unsigned index)
void QListBox::insertGroupLabel(const QString &text, unsigned index)
{
static NSDictionary *groupLabelAttributes;
KWQ_BLOCK_NS_EXCEPTIONS;
if (groupLabelAttributes == nil) {
groupLabelAttributes = [[NSDictionary dictionaryWithObject:
[NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName] retain];
......@@ -154,6 +176,7 @@ void QListBox::insertGroupLabel(const QString &text, unsigned index)
initWithString:text.getNSString() attributes:groupLabelAttributes];
insertItem(s, index);
[s release];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QListBox::beginBatchInsert()
......@@ -167,14 +190,19 @@ void QListBox::endBatchInsert()
ASSERT(_insertingItems);
_insertingItems = false;
NSScrollView *scrollView = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
NSTableView *tableView = [scrollView documentView];
[tableView reloadData];
KWQ_UNBLOCK_NS_EXCEPTIONS;
}
void QListBox::setSelected(int index, bool selectIt)
{
ASSERT(!_insertingItems);
NSScrollView *scrollView = getView();
KWQ_BLOCK_NS_EXCEPTIONS;
NSTableView *tableView = [scrollView documentView];
_changingSelection = true;
if (selectIt) {
......@@ -183,6 +211,7 @@ void QListBox::setSelected(int index, bool selectIt)
} else {
[tableView deselectRow:index];
}
KWQ_UNBLOCK_NS_EXCEPTIONS;
_changingSelection = false;
}
......@@ -190,16 +219,25 @@ bool QListBox::isSelected(int index) const
{
ASSERT(!_insertingItems);
NSScrollView *scrollView = getView();
volatile bool result = false;
KWQ_BLOCK_NS_EXCEPTIONS;
NSTableView *tableView = [scrollView documentView];
return [tableView isRowSelected:index];
result = [tableView isRowSelected:index];
KWQ_UNBLOCK_NS_EXCEPTIONS;
return result;
}
void QListBox::setEnabled(bool enabled)
{
_enabled = enabled;
// You would think this would work, but not until AK fixes 2177792
//KWQ_BLOCK_NS_EXCEPTIONS;
//NSTableView *tableView = [(NSScrollView *)getView() documentView];