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