155
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
|
|
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.TextChangingEvent;
|
|
14
|
|
15
|
|
16 import dwt.events.TypedEvent;
|
|
17 import dwt.custom.StyledTextContent;
|
|
18 import dwt.custom.StyledTextEvent;
|
|
19
|
|
20 /**
|
|
21 * This event is sent by the StyledTextContent implementor when a change
|
|
22 * to the text is about to occur.
|
|
23 */
|
|
24 public class TextChangingEvent : TypedEvent {
|
|
25 /**
|
|
26 * Start offset of the text that is going to be replaced
|
|
27 */
|
|
28 public int start;
|
|
29 /**
|
|
30 * Text that is going to be inserted or empty string
|
|
31 * if no text will be inserted
|
|
32 */
|
|
33 public char[] newText;
|
|
34 /**
|
|
35 * Length of text that is going to be replaced
|
|
36 */
|
|
37 public int replaceCharCount;
|
|
38 /**
|
|
39 * Length of text that is going to be inserted
|
|
40 */
|
|
41 public int newCharCount;
|
|
42 /**
|
|
43 * Number of lines that are going to be replaced
|
|
44 */
|
|
45 public int replaceLineCount;
|
|
46 /**
|
|
47 * Number of new lines that are going to be inserted
|
|
48 */
|
|
49 public int newLineCount;
|
|
50
|
|
51 static final long serialVersionUID = 3257290210114352439L;
|
|
52
|
|
53 /**
|
|
54 * Create the TextChangedEvent to be used by the StyledTextContent implementor.
|
|
55 * <p>
|
|
56 *
|
|
57 * @param source the object that will be sending the new TextChangingEvent,
|
|
58 * cannot be null
|
|
59 */
|
|
60 public this(StyledTextContent source) {
|
|
61 super( cast(Object)source);
|
|
62 }
|
|
63 this(StyledTextContent source, StyledTextEvent e) {
|
|
64 super( cast(Object)source);
|
|
65 start = e.start;
|
|
66 replaceCharCount = e.replaceCharCount;
|
|
67 newCharCount = e.newCharCount;
|
|
68 replaceLineCount = e.replaceLineCount;
|
|
69 newLineCount = e.newLineCount;
|
|
70 newText = e.text;
|
|
71 }
|
|
72
|
|
73 }
|