summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2009-10-29 16:37:41 +0000
committerFelipe Heidrich <fheidric>2009-10-29 16:37:41 +0000
commitb7eb92c5547ec6892d8c204c9a5ef6e804d7e1a2 (patch)
tree1dc1d49b33f246a9260b42ecaa87184fa5b5dcfb
parent85566517171b8fbf5ab016d6bc2d04ae82f0bc02 (diff)
downloadeclipse.platform.swt-b7eb92c5547ec6892d8c204c9a5ef6e804d7e1a2.tar.gz
eclipse.platform.swt-b7eb92c5547ec6892d8c204c9a5ef6e804d7e1a2.tar.xz
eclipse.platform.swt-b7eb92c5547ec6892d8c204c9a5ef6e804d7e1a2.zip
Bug 115432 - [Graphics] TextLayout.setIndent not supporting "out-denting"
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/TextLayout.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/TextLayout.java
index a03a44526c..83d3757597 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/TextLayout.java
@@ -41,7 +41,7 @@ public final class TextLayout extends Resource {
int alignment;
int wrapWidth;
int orientation;
- int indent;
+ int indent, wrapIndent;
boolean justify;
int[] tabs;
int[] segments;
@@ -114,7 +114,7 @@ void computeRuns () {
StyleItem run = allRuns[i];
place(run);
}
- int lineWidth = 0, lineStart = 0, lineCount = 1;
+ int lineWidth = indent, lineStart = 0, lineCount = 1;
for (int i=0; i<allRuns.length - 1; i++) {
StyleItem run = allRuns[i];
if (run.length == 1) {
@@ -219,7 +219,7 @@ void computeRuns () {
lineWidth += run.width;
if (run.lineBreak) {
lineStart = i + 1;
- lineWidth = 0;
+ lineWidth = run.softBreak ? wrapIndent : indent;;
lineCount++;
}
}
@@ -866,7 +866,7 @@ public int getLineCount () {
}
int getLineIndent (int lineIndex) {
- int lineIndent = 0;
+ int lineIndent = wrapIndent;
if (lineIndex == 0) {
lineIndent = indent;
} else {
@@ -1422,6 +1422,11 @@ public int getWidth () {
return wrapWidth;
}
+public int getWrapIndent () {
+ checkLayout();
+ return wrapIndent;
+}
+
/**
* Returns <code>true</code> if the text layout has been disposed,
* and <code>false</code> otherwise.
@@ -1922,6 +1927,14 @@ public void setWidth (int width) {
this.wrapWidth = width;
}
+public void setWrapIndent (int wrapIndent) {
+ checkLayout();
+ if (wrapIndent < 0) return;
+ if (this.wrapIndent == wrapIndent) return;
+ freeRuns();
+ this.wrapIndent = wrapIndent;
+}
+
/**
* Returns a string containing a concise, human-readable
* description of the receiver.