1 /*******************************************************************************
2 * Copyright (c) 2010, 2011 IBM Corporation and others.
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/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.accessibility;
16 import org.eclipse.swt.internal.SWTEventListener;
19 * Classes which implement this interface provide methods
20 * that handle AccessibleEditableText events.
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.
28 * @see AccessibleEditableTextAdapter
29 * @see AccessibleEditableTextEvent
30 * @see AccessibleTextAttributeEvent
34 public interface AccessibleEditableTextListener extends SWTEventListener {
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.
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>
47 public void copyText(AccessibleEditableTextEvent e);
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.
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>
61 public void cutText(AccessibleEditableTextEvent e);
64 * Inserts the text in the clipboard at the leading edge of the specified <code>start</code> offset.
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>
72 public void pasteText(AccessibleEditableTextEvent e);
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.
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.
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
85 * <li>[in] end - the 0 based offset after the last character of the substring
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>
92 public void replaceText(AccessibleEditableTextEvent e);
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.
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>
112 public void setTextAttributes(AccessibleTextAttributeEvent e);