[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:48:17 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 4ab12e5d1dfefa5adc8a5e75e13025a1f5e1322c
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 1 17:55:29 2001 +0000
Added additional methods for text drawing.
Fixed problems with qnamespace.h enumurations.
Added more text tests to draw.mm
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@241 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/KWQApplication.mm b/WebCore/kwq/KWQApplication.mm
index 122fa85..a737982 100644
--- a/WebCore/kwq/KWQApplication.mm
+++ b/WebCore/kwq/KWQApplication.mm
@@ -122,6 +122,11 @@ void QApplication::setMainWidget(QWidget *w)
[sv setHasVerticalScroller: YES];
[sv setHasHorizontalScroller: YES];
[sv setDocumentView: w->getView()];
+
+ [((_KWQOwner *)application)->window setOpaque: FALSE];
+ [((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
+
+
[((_KWQOwner *)application)->window setContentView: sv];
}
diff --git a/WebCore/kwq/KWQNamespace.h b/WebCore/kwq/KWQNamespace.h
index 55a0316..ee81ee9 100644
--- a/WebCore/kwq/KWQNamespace.h
+++ b/WebCore/kwq/KWQNamespace.h
@@ -47,21 +47,33 @@ public:
// enums -------------------------------------------------------------------
enum ButtonState {
- LeftButton,
- MidButton,
- RightButton,
- ControlButton,
- AltButton,
- ShiftButton,
+ NoButton = 0x0000,
+ LeftButton = 0x0001,
+ RightButton = 0x0002,
+ MidButton = 0x0004,
+ MouseButtonMask = 0x0007,
+ ShiftButton = 0x0008,
+ ControlButton = 0x0010,
+ AltButton = 0x0020,
+ KeyButtonMask = 0x0038,
+ Keypad = 0x4000
};
enum AlignmentFlags {
- AlignLeft,
- AlignCenter,
- AlignRight,
- WordBreak,
- ShowPrefix,
- DontClip,
+ AlignLeft = 0x0001, // text alignment
+ AlignRight = 0x0002,
+ AlignHCenter = 0x0004,
+ AlignTop = 0x0008,
+ AlignBottom = 0x0010,
+ AlignVCenter = 0x0020,
+ AlignCenter = AlignVCenter | AlignHCenter,
+
+ SingleLine = 0x0040, // misc. flags
+ DontClip = 0x0080,
+ ExpandTabs = 0x0100,
+ ShowPrefix = 0x0200,
+ WordBreak = 0x0400,
+ DontPrint = 0x1000 // internal
};
enum PenStyle {
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index fdeace3..45e8717 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -142,7 +142,6 @@ public:
int sx=0, int sy=0, int sw=-1, int sh=-1 );
void drawTiledPixmap(int, int, int, int, const QPixmap &, int sx=0, int sy=0);
void drawText(int x, int y, const QString &, int len=-1);
- void drawText(int, int, int, int, AlignmentFlags, const QString &);
void drawText(int, int, int, int, int flags, const QString&, int len=-1,
QRect *br=0, char **internal=0);
void fillRect(int, int, int, int, const QBrush &);
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 64529aa..a468931 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -415,20 +415,45 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
}
-void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)
-{
- NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)\n");
-}
-
-
void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
QRect *br, char **internal)
{
- NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
- QRect *br, char **internal)\n");
+ NSString *string;
+ NSFont *font;
+ const char *ascii;
+ NSMutableParagraphStyle *style = [[[NSMutableParagraphStyle alloc] init] autorelease];
+
+ _lockFocus();
+
+ font = data->qfont.data->font;
+
+ if (len == -1)
+ string = QSTRING_TO_NSSTRING(qstring);
+ else
+ string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+ if (flags & Qt::WordBreak){
+ [style setLineBreakMode: NSLineBreakByWordWrapping];
+ }
+ else {
+ [style setLineBreakMode: NSLineBreakByClipping];
+ }
+
+ if (flags & Qt::AlignRight){
+ [style setAlignment: NSRightTextAlignment];
+ }
+
+ if (flags & Qt::AlignLeft){
+ [style setAlignment: NSLeftTextAlignment];
+ }
+
+ [string drawInRect:NSMakeRect(x, y, w, h) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, data->qpen.qcolor.color, NSForegroundColorAttributeName, style, NSParagraphStyleAttributeName, nil]];
+
+ _unlockFocus();
}
+
void QPainter::fillRect(int x, int y, int w, int h, const QBrush &brush)
{
_lockFocus();
diff --git a/WebCore/kwq/KWQView.mm b/WebCore/kwq/KWQView.mm
index 59d92c5..8887988 100644
--- a/WebCore/kwq/KWQView.mm
+++ b/WebCore/kwq/KWQView.mm
@@ -12,7 +12,6 @@
- (void)drawRect:(NSRect)rect {
- NSLog (@"drawRect\n", nil);
widget->paint((void *)0);
}
diff --git a/WebCore/kwq/qt/qnamespace.h b/WebCore/kwq/qt/qnamespace.h
index 55a0316..ee81ee9 100644
--- a/WebCore/kwq/qt/qnamespace.h
+++ b/WebCore/kwq/qt/qnamespace.h
@@ -47,21 +47,33 @@ public:
// enums -------------------------------------------------------------------
enum ButtonState {
- LeftButton,
- MidButton,
- RightButton,
- ControlButton,
- AltButton,
- ShiftButton,
+ NoButton = 0x0000,
+ LeftButton = 0x0001,
+ RightButton = 0x0002,
+ MidButton = 0x0004,
+ MouseButtonMask = 0x0007,
+ ShiftButton = 0x0008,
+ ControlButton = 0x0010,
+ AltButton = 0x0020,
+ KeyButtonMask = 0x0038,
+ Keypad = 0x4000
};
enum AlignmentFlags {
- AlignLeft,
- AlignCenter,
- AlignRight,
- WordBreak,
- ShowPrefix,
- DontClip,
+ AlignLeft = 0x0001, // text alignment
+ AlignRight = 0x0002,
+ AlignHCenter = 0x0004,
+ AlignTop = 0x0008,
+ AlignBottom = 0x0010,
+ AlignVCenter = 0x0020,
+ AlignCenter = AlignVCenter | AlignHCenter,
+
+ SingleLine = 0x0040, // misc. flags
+ DontClip = 0x0080,
+ ExpandTabs = 0x0100,
+ ShowPrefix = 0x0200,
+ WordBreak = 0x0400,
+ DontPrint = 0x1000 // internal
};
enum PenStyle {
diff --git a/WebCore/kwq/qt/qpainter.h b/WebCore/kwq/qt/qpainter.h
index fdeace3..45e8717 100644
--- a/WebCore/kwq/qt/qpainter.h
+++ b/WebCore/kwq/qt/qpainter.h
@@ -142,7 +142,6 @@ public:
int sx=0, int sy=0, int sw=-1, int sh=-1 );
void drawTiledPixmap(int, int, int, int, const QPixmap &, int sx=0, int sy=0);
void drawText(int x, int y, const QString &, int len=-1);
- void drawText(int, int, int, int, AlignmentFlags, const QString &);
void drawText(int, int, int, int, int flags, const QString&, int len=-1,
QRect *br=0, char **internal=0);
void fillRect(int, int, int, int, const QBrush &);
diff --git a/WebCore/kwq/tests/draw/draw.mm b/WebCore/kwq/tests/draw/draw.mm
index c39144b..69091e2 100644
--- a/WebCore/kwq/tests/draw/draw.mm
+++ b/WebCore/kwq/tests/draw/draw.mm
@@ -216,6 +216,23 @@ void drawFonts( QPainter *p )
}
f++;
}
+
+ QFont font;
+ font.setFamily ("Helvetica");
+ font.setPixelSizeFloat ((float)12);
+ p->setFont( font );
+ p->setBrush ( Qt::white );
+ p->drawRect(700, 600, 150, 60);
+ p->drawText(700, 600, 150, 60 , Qt::WordBreak, "Some text in a box that should word break." );
+ p->drawRect(700, 670, 150, 60);
+ p->drawText(700, 670, 150, 60 , Qt::AlignLeft, "Some text in a box that should align left." );
+ p->drawRect(700, 740, 150, 60);
+ p->drawText(700, 740, 150, 60 , Qt::AlignRight, "Some text in a box that should align right." );
+ p->drawRect(700, 810, 100, 60);
+ p->drawText(700, 810, 100, 60 , Qt::AlignLeft|Qt::WordBreak, "Some text in a box that should align left and word break." );
+ p->drawRect(700, 880, 100, 60);
+ p->drawText(700, 880, 100, 60 , Qt::AlignRight|Qt::WordBreak, "Some text in a box that should align right and word break." );
+
p->restore();
}
diff --git a/WebCore/src/kwq/KWQApplication.mm b/WebCore/src/kwq/KWQApplication.mm
index 122fa85..a737982 100644
--- a/WebCore/src/kwq/KWQApplication.mm
+++ b/WebCore/src/kwq/KWQApplication.mm
@@ -122,6 +122,11 @@ void QApplication::setMainWidget(QWidget *w)
[sv setHasVerticalScroller: YES];
[sv setHasHorizontalScroller: YES];
[sv setDocumentView: w->getView()];
+
+ [((_KWQOwner *)application)->window setOpaque: FALSE];
+ [((_KWQOwner *)application)->window setAlphaValue: (float)0.8];
+
+
[((_KWQOwner *)application)->window setContentView: sv];
}
diff --git a/WebCore/src/kwq/KWQPainter.mm b/WebCore/src/kwq/KWQPainter.mm
index 64529aa..a468931 100644
--- a/WebCore/src/kwq/KWQPainter.mm
+++ b/WebCore/src/kwq/KWQPainter.mm
@@ -415,20 +415,45 @@ void QPainter::drawText(int x, int y, const QString &qstring, int len)
}
-void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)
-{
- NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y , int w, int h, AlignmentFlags flags, const QString &qstring)\n");
-}
-
-
void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
QRect *br, char **internal)
{
- NSLog (@"ERROR (NOT YET IMPLEMENTED) void QPainter::drawText(int x, int y, int w, int h, int flags, const QString&qstring, int len,
- QRect *br, char **internal)\n");
+ NSString *string;
+ NSFont *font;
+ const char *ascii;
+ NSMutableParagraphStyle *style = [[[NSMutableParagraphStyle alloc] init] autorelease];
+
+ _lockFocus();
+
+ font = data->qfont.data->font;
+
+ if (len == -1)
+ string = QSTRING_TO_NSSTRING(qstring);
+ else
+ string = QSTRING_TO_NSSTRING_LENGTH(qstring,len);
+
+ if (flags & Qt::WordBreak){
+ [style setLineBreakMode: NSLineBreakByWordWrapping];
+ }
+ else {
+ [style setLineBreakMode: NSLineBreakByClipping];
+ }
+
+ if (flags & Qt::AlignRight){
+ [style setAlignment: NSRightTextAlignment];
+ }
+
+ if (flags & Qt::AlignLeft){
+ [style setAlignment: NSLeftTextAlignment];
+ }
+
+ [string drawInRect:NSMakeRect(x, y, w, h) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, data->qpen.qcolor.color, NSForegroundColorAttributeName, style, NSParagraphStyleAttributeName, nil]];
+
+ _unlockFocus();
}
+
void QPainter::fillRect(int x, int y, int w, int h, const QBrush &brush)
{
_lockFocus();
diff --git a/WebCore/src/kwq/KWQView.mm b/WebCore/src/kwq/KWQView.mm
index 59d92c5..8887988 100644
--- a/WebCore/src/kwq/KWQView.mm
+++ b/WebCore/src/kwq/KWQView.mm
@@ -12,7 +12,6 @@
- (void)drawRect:(NSRect)rect {
- NSLog (@"drawRect\n", nil);
widget->paint((void *)0);
}
diff --git a/WebCore/src/kwq/qt/qnamespace.h b/WebCore/src/kwq/qt/qnamespace.h
index 55a0316..ee81ee9 100644
--- a/WebCore/src/kwq/qt/qnamespace.h
+++ b/WebCore/src/kwq/qt/qnamespace.h
@@ -47,21 +47,33 @@ public:
// enums -------------------------------------------------------------------
enum ButtonState {
- LeftButton,
- MidButton,
- RightButton,
- ControlButton,
- AltButton,
- ShiftButton,
+ NoButton = 0x0000,
+ LeftButton = 0x0001,
+ RightButton = 0x0002,
+ MidButton = 0x0004,
+ MouseButtonMask = 0x0007,
+ ShiftButton = 0x0008,
+ ControlButton = 0x0010,
+ AltButton = 0x0020,
+ KeyButtonMask = 0x0038,
+ Keypad = 0x4000
};
enum AlignmentFlags {
- AlignLeft,
- AlignCenter,
- AlignRight,
- WordBreak,
- ShowPrefix,
- DontClip,
+ AlignLeft = 0x0001, // text alignment
+ AlignRight = 0x0002,
+ AlignHCenter = 0x0004,
+ AlignTop = 0x0008,
+ AlignBottom = 0x0010,
+ AlignVCenter = 0x0020,
+ AlignCenter = AlignVCenter | AlignHCenter,
+
+ SingleLine = 0x0040, // misc. flags
+ DontClip = 0x0080,
+ ExpandTabs = 0x0100,
+ ShowPrefix = 0x0200,
+ WordBreak = 0x0400,
+ DontPrint = 0x1000 // internal
};
enum PenStyle {
diff --git a/WebCore/src/kwq/qt/qpainter.h b/WebCore/src/kwq/qt/qpainter.h
index fdeace3..45e8717 100644
--- a/WebCore/src/kwq/qt/qpainter.h
+++ b/WebCore/src/kwq/qt/qpainter.h
@@ -142,7 +142,6 @@ public:
int sx=0, int sy=0, int sw=-1, int sh=-1 );
void drawTiledPixmap(int, int, int, int, const QPixmap &, int sx=0, int sy=0);
void drawText(int x, int y, const QString &, int len=-1);
- void drawText(int, int, int, int, AlignmentFlags, const QString &);
void drawText(int, int, int, int, int flags, const QString&, int len=-1,
QRect *br=0, char **internal=0);
void fillRect(int, int, int, int, const QBrush &);
diff --git a/WebCore/src/kwq/tests/draw/draw.mm b/WebCore/src/kwq/tests/draw/draw.mm
index c39144b..69091e2 100644
--- a/WebCore/src/kwq/tests/draw/draw.mm
+++ b/WebCore/src/kwq/tests/draw/draw.mm
@@ -216,6 +216,23 @@ void drawFonts( QPainter *p )
}
f++;
}
+
+ QFont font;
+ font.setFamily ("Helvetica");
+ font.setPixelSizeFloat ((float)12);
+ p->setFont( font );
+ p->setBrush ( Qt::white );
+ p->drawRect(700, 600, 150, 60);
+ p->drawText(700, 600, 150, 60 , Qt::WordBreak, "Some text in a box that should word break." );
+ p->drawRect(700, 670, 150, 60);
+ p->drawText(700, 670, 150, 60 , Qt::AlignLeft, "Some text in a box that should align left." );
+ p->drawRect(700, 740, 150, 60);
+ p->drawText(700, 740, 150, 60 , Qt::AlignRight, "Some text in a box that should align right." );
+ p->drawRect(700, 810, 100, 60);
+ p->drawText(700, 810, 100, 60 , Qt::AlignLeft|Qt::WordBreak, "Some text in a box that should align left and word break." );
+ p->drawRect(700, 880, 100, 60);
+ p->drawText(700, 880, 100, 60 , Qt::AlignRight|Qt::WordBreak, "Some text in a box that should align right and word break." );
+
p->restore();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list