1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.custom;
15
16 import org.eclipse.swt.events.*;
17
18 /**
19 * This event is sent when a line is about to be drawn.
20 *
21 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
22 */
23 public class LineStyleEvent extends TypedEvent {
24
25 /**
26 * line start offset (input)
27 */
28 public int lineOffset;
29
30 /**
31 * line text (input)
32 */
33 public String lineText;
34
35 /**
36 * line ranges (output)
37 *
38 * @since 3.2
39 */
40 public int[] ranges;
41
42 /**
43 * line styles (output)
44 *
45 * Note: Because a StyleRange includes the start and length, the
46 * same instance cannot occur multiple times in the array of styles.
47 * If the same style attributes, such as font and color, occur in
48 * multiple StyleRanges, <code>ranges</code> can be used to share
49 * styles and reduce memory usage.
50 */
51 public StyleRange[] styles;
52
53 /**
54 * line alignment (input, output)
55 *
56 * @since 3.2
57 */
58 public int alignment;
59
60 /**
61 * line indent (input, output)
62 *
63 * @since 3.2
64 */
65 public int indent;
66
67 /**
68 * line vertical indent (input, output)
69 *
70 * @since 3.109
71 */
72 int verticalIndent;
73
74 /**
75 * line wrap indent (input, output)
76 *
77 * @since 3.6
78 */
79 public int wrapIndent;
80
81 /**
82 * line justification (input, output)
83 *
84 * @since 3.2
85 */
86 public boolean justify;
87
88 /**
89 * line bullet (output)
90 * @since 3.2
91 */
92 public Bullet bullet;
93
94 /**
95 * line bullet index (output)
96 * @since 3.2
97 */
98 public int bulletIndex;
99
100 /**
101 * line tab stops (output)
102 * @since 3.6
103 */
104 public int[] tabStops;
105
106
107 static final long serialVersionUID = 3906081274027192884L;
108
109 /**
110 * Constructs a new instance of this class based on the
111 * information in the given event.
112 *
113 * @param e the event containing the information
114 */
LineStyleEvent(StyledTextEvent e)115 public LineStyleEvent(StyledTextEvent e) {
116 super(e);
117 styles = e.styles;
118 ranges = e.ranges;
119 lineOffset = e.detail;
120 lineText = e.text;
121 alignment = e.alignment;
122 justify = e.justify;
123 indent = e.indent;
124 verticalIndent = e.verticalIndent;
125 wrapIndent = e.wrapIndent;
126 bullet = e.bullet;
127 bulletIndex = e.bulletIndex;
128 tabStops = e.tabStops;
129 }
130 }
131