1 /*******************************************************************************
2  * Copyright (c) 2010, 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.accessibility;
15 
16 import org.eclipse.swt.internal.SWTEventListener;
17 
18 /**
19  * Classes which implement this interface provide methods
20  * that handle AccessibleEditableText events.
21  * <p>
22  * After creating an instance of a class that implements
23  * this interface it can be added to an accessible using the
24  * <code>addAccessibleEditableTextListener</code> method and removed using
25  * the <code>removeAccessibleEditableTextListener</code> method.
26  * </p>
27  *
28  * @see AccessibleEditableTextAdapter
29  * @see AccessibleEditableTextEvent
30  * @see AccessibleTextAttributeEvent
31  *
32  * @since 3.7
33  */
34 public interface AccessibleEditableTextListener extends SWTEventListener {
35 	/**
36 	 * Copies the substring beginning at the specified <code>start</code> offset
37 	 * and extending to the character at offset <code>end - 1</code> to the clipboard.
38 	 *
39 	 * @param e an event object containing the following information:<ul>
40 	 * <li>[in] start - the 0 based offset of the first character of the substring
41 	 * 		to be copied to the clipboard</li>
42 	 * <li>[in] end - the 0 based offset after the last character of the substring
43 	 * 		to be copied to the clipboard</li>
44 	 * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
45 	 * </ul>
46 	 */
copyText(AccessibleEditableTextEvent e)47 	public void copyText(AccessibleEditableTextEvent e);
48 
49 	/**
50 	 * Moves the substring beginning at the specified <code>start</code> offset
51 	 * and extending to the character at offset <code>end - 1</code> to the clipboard.
52 	 *
53 	 * @param e an event object containing the following information:<ul>
54 	 * <li>[in] start - the 0 based offset of the first character of the substring
55 	 * 		to be moved to the clipboard</li>
56 	 * <li>[in] end - the 0 based offset after the last character of the substring
57 	 * 		to be moved to the clipboard</li>
58 	 * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
59 	 * </ul>
60 	 */
cutText(AccessibleEditableTextEvent e)61 	public void cutText(AccessibleEditableTextEvent e);
62 
63 	/**
64 	 * Inserts the text in the clipboard at the leading edge of the specified <code>start</code> offset.
65 	 *
66 	 * @param e an event object containing the following information:<ul>
67 	 * <li>[in] start - the offset at which to insert the text from the clipboard.
68 	 * 		The valid range is 0..length</li>
69 	 * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
70 	 * </ul>
71 	 */
pasteText(AccessibleEditableTextEvent e)72 	public void pasteText(AccessibleEditableTextEvent e);
73 
74 	/**
75 	 * Replaces the substring beginning at the specified <code>start</code> offset
76 	 * and extending to the character at offset <code>end - 1</code> by the specified string.
77 	 * <p>
78 	 * This event notification is also used to delete text if <code>string</code> is an empty string,
79 	 * or to insert text at the leading edge of the specified offset if <code>start</code> and <code>end</code> are equal.
80 	 * </p>
81 	 *
82 	 * @param e an event object containing the following information:<ul>
83 	 * <li>[in] start - the 0 based offset of the first character of the substring
84 	 * 		to be replaced</li>
85 	 * <li>[in] end - the 0 based offset after the last character of the substring
86 	 * 		to be replaced</li>
87 	 * <li>[in] string - the string that replaces the substring beginning at
88 	 * 		<code>start</code> and extending to <code>end - 1</code></li>
89 	 * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
90 	 * </ul>
91 	 */
replaceText(AccessibleEditableTextEvent e)92 	public void replaceText(AccessibleEditableTextEvent e);
93 
94 	/**
95 	 * Replaces the set of attributes of the substring beginning at the specified <code>start</code> offset
96 	 * and extending to the character at offset <code>end - 1</code> by the specified set of attributes.
97 	 *
98 	 * @param e an event object containing the following information:<ul>
99 	 * <li>[in] start - the 0 based offset of the first character of the substring
100 	 * 		whose attributes are modified</li>
101 	 * <li>[in] end - the 0 based offset after the last character of the substring
102 	 * 		whose attributes are modified</li>
103 	 * <li>[in] textStyle - the TextStyle which contains attributes that replace the old set of attributes.
104 	 * 		The foreground, background, and font fields of this TextStyle are only valid for the duration of the event.
105 	 * 		The value of this field may be null if none of the attributes to be set correspond to TextStyle fields.</li>
106 	 * <li>[in] attributes - an array of alternating key and value Strings that represent the complete
107 	 * 		set of attributes to replace the old set of attributes.
108 	 * 		The value of this field may be null if no attributes are to be set.</li>
109 	 * <li>[out] result - set to {@link ACC#OK} if the operation was completed successfully</li>
110 	 * </ul>
111 	 */
setTextAttributes(AccessibleTextAttributeEvent e)112 	public void setTextAttributes(AccessibleTextAttributeEvent e);
113 }
114