|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KWordWrap
public class KWordWrap
Word-wrap algorithm that takes into account beautifulness ;) That means:
Field Summary | |
---|---|
static int |
FadeOut
Use this flag in drawText() if you want to fade out the text if it does not fit into the constraining rectangle. |
static int |
Truncate
|
Constructor Summary | |
---|---|
protected |
KWordWrap(java.lang.Class dummy)
|
Method Summary | |
---|---|
org.kde.qt.QRect |
boundingRect()
|
static void |
drawFadeoutText(org.kde.qt.QPainter p,
int x,
int y,
int maxW,
java.lang.String t)
Draws the string t at the given coordinates, if it does not
fit into maxW the text will be faded out. |
void |
drawText(org.kde.qt.QPainter painter,
int x,
int y)
|
void |
drawText(org.kde.qt.QPainter painter,
int x,
int y,
int flags)
Draw the text that has been previously wrapped, at position x,y. |
static void |
drawTruncateText(org.kde.qt.QPainter p,
int x,
int y,
int maxW,
java.lang.String t)
Draws the string t at the given coordinates, if it does not
fit into maxW the text will be truncated. |
static KWordWrap |
formatText(org.kde.qt.QFontMetrics fm,
org.kde.qt.QRect r,
int flags,
java.lang.String str)
|
static KWordWrap |
formatText(org.kde.qt.QFontMetrics fm,
org.kde.qt.QRect r,
int flags,
java.lang.String str,
int len)
Main method for wrapping text. |
java.lang.String |
truncatedString()
|
java.lang.String |
truncatedString(boolean dots)
|
java.lang.String |
wrappedString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FadeOut
public static final int Truncate
Constructor Detail |
---|
protected KWordWrap(java.lang.Class dummy)
Method Detail |
---|
public org.kde.qt.QRect boundingRect()
public java.lang.String wrappedString()
public java.lang.String truncatedString(boolean dots)
dots
was set, '...' is appended in case the string was truncated.
Bug: Note that the '...' come out of the bounding rect.public java.lang.String truncatedString()
public void drawText(org.kde.qt.QPainter painter, int x, int y, int flags)
painter
- the QPainter to use.x
- the horizontal position of the texty
- the vertical position of the textflags
- the ORed text alignment flags from the Qt namespace,
ORed with FadeOut if you want the text to fade out if it
does not fit (the painter
's background must be set
accordingly)public void drawText(org.kde.qt.QPainter painter, int x, int y)
public static KWordWrap formatText(org.kde.qt.QFontMetrics fm, org.kde.qt.QRect r, int flags, java.lang.String str, int len)
fm
- Font metrics, for the chosen font. Better cache it, creating a QFontMetrics is expensive.r
- Constraining rectangle. Only the width and height matter. With
negative height the complete text will be renderedflags
- currently unusedstr
- The text to be wrapped.len
- Length of text to wrap (default is -1 for all).
public static KWordWrap formatText(org.kde.qt.QFontMetrics fm, org.kde.qt.QRect r, int flags, java.lang.String str)
public static void drawFadeoutText(org.kde.qt.QPainter p, int x, int y, int maxW, java.lang.String t)
t
at the given coordinates, if it does not
fit
into maxW
the text will be faded out.
p
- the painter to use. Must have set the pen for the text
color and the background for the color to fade outx
- the horizontal position of the texty
- the vertical position of the textmaxW
- the maximum width of the text (including the fade-out
effect)t
- the text to drawpublic static void drawTruncateText(org.kde.qt.QPainter p, int x, int y, int maxW, java.lang.String t)
t
at the given coordinates, if it does not
fit
into maxW
the text will be truncated.
p
- the painter to usex
- the horizontal position of the texty
- the vertical position of the textmaxW
- the maximum width of the text (including the '...')t
- the text to draw
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |