1 /******************************************************************************* 2 * Copyright (c) 2000, 2003 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 *******************************************************************************/ 11 package org.eclipse.swt.custom; 12 13 14 import org.eclipse.swt.internal.SWTEventListener; 15 16 /** 17 * The StyledText widget implements this listener to receive 18 * notifications when changes to the model occur. 19 * It is not intended to be implemented by clients or by 20 * implementors of StyledTextContent. 21 * Clients should listen to the ModifyEvent or ExtendedModifyEvent 22 * that is sent by the StyledText widget to receive text change 23 * notifications. 24 * Implementors of StyledTextContent should call the textChanging 25 * and textChanged methods when text changes occur as described 26 * below. If the entire text is replaced the textSet method 27 * should be called instead. 28 */ 29 public interface TextChangeListener extends SWTEventListener { 30 31 /** 32 * This method is called when the content is about to be changed. 33 * Callers also need to call the textChanged method after the 34 * content change has been applied. The widget only updates the 35 * screen properly when it receives both events. 36 * 37 * @param event the text changing event. All event fields need 38 * to be set by the sender. 39 * @see TextChangingEvent 40 */ 41 public void textChanging(TextChangingEvent event); 42 /** 43 * This method is called when the content has changed. 44 * Callers need to have called the textChanging method prior to 45 * applying the content change and calling this method. The widget 46 * only updates the screen properly when it receives both events. 47 * 48 * @param event the text changed event 49 */ 50 public void textChanged(TextChangedEvent event); 51 /** 52 * This method is called instead of the textChanging/textChanged 53 * combination when the entire old content has been replaced 54 * (e.g., by a call to StyledTextContent.setText()). 55 * 56 * @param event the text changed event 57 */ 58 public void textSet(TextChangedEvent event); 59 } 60 61 62