Mercurial > projects > dwt-win
annotate dwt/custom/BidiSegmentEvent.d @ 246:fd9c62a2998e
Updater SWT 3.4M7 to 3.4
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 01 Jul 2008 10:15:59 +0200 |
parents | ab60f3309436 |
children | 349b8c12e243 |
rev | line source |
---|---|
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
1 /******************************************************************************* |
246 | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
155 | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwt.custom.BidiSegmentEvent; | |
14 | |
15 | |
16 import dwt.events.TypedEvent; | |
17 import dwt.custom.StyledTextEvent; | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
18 import dwt.dwthelper.utils; |
155 | 19 |
20 /** | |
21 * This event is sent to BidiSegmentListeners when a line is to | |
22 * be measured or rendered in a bidi locale. The segments field is | |
23 * used to specify text ranges in the line that should be treated as | |
24 * separate segments for bidi reordering. Each segment will be reordered | |
25 * and rendered separately. | |
26 * <p> | |
27 * The elements in the segments field specify the start offset of | |
28 * a segment relative to the start of the line. They must follow | |
29 * the following rules: | |
30 * <ul> | |
31 * <li>first element must be 0 | |
32 * <li>elements must be in ascending order and must not have duplicates | |
33 * <li>elements must not exceed the line length | |
34 * </ul> | |
35 * In addition, the last element may be set to the end of the line | |
36 * but this is not required. | |
37 * | |
38 * The segments field may be left null if the entire line should | |
39 * be reordered as is. | |
40 * </p> | |
41 * A BidiSegmentListener may be used when adjacent segments of | |
42 * right-to-left text should not be reordered relative to each other. | |
43 * For example, within a Java editor, you may wish multiple | |
44 * right-to-left string literals to be reordered differently than the | |
45 * bidi algorithm specifies. | |
46 * | |
47 * Example: | |
48 * <pre> | |
49 * stored line = "R1R2R3" + "R4R5R6" | |
50 * R1 to R6 are right-to-left characters. The quotation marks | |
51 * are part of the line text. The line is 13 characters long. | |
52 * | |
53 * segments = null: | |
54 * entire line will be reordered and thus the two R2L segments | |
55 * swapped (as per the bidi algorithm). | |
56 * visual line (rendered on screen) = "R6R5R4" + "R3R2R1" | |
57 * | |
58 * segments = [0, 5, 8] | |
59 * "R1R2R3" will be reordered, followed by [blank]+[blank] and | |
60 * "R4R5R6". | |
61 * visual line = "R3R2R1" + "R6R5R4" | |
62 * </pre> | |
246 | 63 * |
64 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
155 | 65 */ |
66 public class BidiSegmentEvent : TypedEvent { | |
67 | |
68 /** | |
69 * line start offset | |
70 */ | |
71 public int lineOffset; | |
72 | |
73 /** | |
74 * line text | |
75 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
76 public String lineText; |
155 | 77 |
78 /** | |
79 * bidi segments, see above | |
80 */ | |
81 public int[] segments; | |
82 | |
83 this(StyledTextEvent e) { | |
84 super(cast(Object)e); | |
85 lineOffset = e.detail; | |
86 lineText = e.text; | |
87 } | |
88 } |