annotate dwt/custom/StyledTextContent.d @ 156:969e7de37c3d default tip

Fixes to get dwt to work with dmd and ldc
author Jacob Carlborg <doob@me.com>
date Wed, 08 Jul 2009 21:56:44 +0200
parents 6337764516f1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
1 /*******************************************************************************
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
7 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
8 * Contributors:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
10 * Port to the D programming language:
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
11 * Frank Benoit <benoit@tionex.de>
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
12 *******************************************************************************/
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
13 module dwt.custom.StyledTextContent;
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
14
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
15 import dwt.dwthelper.utils;
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
16
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
17 import dwt.custom.TextChangeListener;
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
18 /**
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
19 * Clients may implement the StyledTextContent interface to provide a
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
20 * custom store for the StyledText widget content. The StyledText widget
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
21 * interacts with its StyledTextContent in order to access and update
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
22 * the text that is being displayed and edited in the widget.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
23 * A custom content implementation can be set in the widget using the
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
24 * StyledText.setContent API.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
25 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
26 public interface StyledTextContent {
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
27
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
28 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
29 * Called by StyledText to add itself as an Observer to content changes.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
30 * See TextChangeListener for a description of the listener methods that
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
31 * are called when text changes occur.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
32 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
33 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
34 * @param listener the listener
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
35 * @exception IllegalArgumentException <ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
36 * <li>ERROR_NULL_ARGUMENT when listener is null</li>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
37 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
38 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
39 public void addTextChangeListener(TextChangeListener listener);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
40
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
41 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
42 * Return the number of characters in the content.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
43 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
44 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
45 * @return the number of characters in the content.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
46 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
47 public int getCharCount();
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
48
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
49 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
50 * Return the line at the given line index without delimiters.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
51 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
52 *
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
53 * @param lineIndex index of the line to return. Does not include
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
54 * delimiters of preceding lines. Index 0 is the first line of the
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
55 * content.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
56 * @return the line text without delimiters
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
57 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
58 public String getLine(int lineIndex);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
59
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
60 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
61 * Return the line index at the given character offset.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
62 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
63 *
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
64 * @param offset offset of the line to return. The first character of the
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
65 * document is at offset 0. An offset of getLength() is valid and should
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
66 * answer the number of lines.
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
67 * @return the line index. The first line is at index 0. If the character
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
68 * at offset is a delimiter character, answer the line index of the line
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
69 * that is delimited.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
70 * For example, if text = "\r\n\r\n", and delimiter = "\r\n", then:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
71 * <ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
72 * <li>getLineAtOffset(0) is 0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
73 * <li>getLineAtOffset(1) is 0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
74 * <li>getLineAtOffset(2) is 1
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
75 * <li>getLineAtOffset(3) is 1
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
76 * <li>getLineAtOffset(4) is 2
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
77 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
78 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
79 public int getLineAtOffset(int offset);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
80
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
81 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
82 * Return the number of lines. Should answer 1 when no text is specified.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
83 * The StyledText widget relies on this behavior for drawing the cursor.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
84 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
85 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
86 * @return the number of lines. For example:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
87 * <ul>
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
88 * <li> text value is> getLineCount
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
89 * <li> null is> 1
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
90 * <li> "" is> 1
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
91 * <li> "a\n" is> 2
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
92 * <li> "\n\n" is> 3
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
93 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
94 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
95 public int getLineCount();
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
96
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
97 /**
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
98 * Return the line delimiter that should be used by the StyledText
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
99 * widget when inserting new lines. New lines entered using key strokes
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
100 * and paste operations use this line delimiter.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
101 * Implementors may use System.getProperty("line.separator") to return
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
102 * the platform line delimiter.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
103 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
104 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
105 * @return the line delimiter that should be used by the StyledText widget
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
106 * when inserting new lines.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
107 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
108 public String getLineDelimiter();
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
109
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
110 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
111 * Return the character offset of the first character of the given line.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
112 * <p>
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
113 * <b>NOTE:</b> When there is no text (i.e., no lines), getOffsetAtLine(0)
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
114 * is a valid call that should return 0.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
115 * </p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
116 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
117 * @param lineIndex index of the line. The first line is at index 0.
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
118 * @return offset offset of the first character of the line. The first
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
119 * character of the document is at offset 0. The return value should
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
120 * include line delimiters.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
121 * For example, if text = "\r\ntest\r\n" and delimiter = "\r\n", then:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
122 * <ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
123 * <li>getOffsetAtLine(0) is 0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
124 * <li>getOffsetAtLine(1) is 2
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
125 * <li>getOffsetAtLine(2) is 8
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
126 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
127 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
128 public int getOffsetAtLine(int lineIndex);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
129
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
130 /**
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
131 * Returns a string representing the content at the given range.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
132 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
133 *
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
134 * @param start the start offset of the text to return. Offset 0 is the
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
135 * first character of the document.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
136 * @param length the length of the text to return
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
137 * @return the text at the given range
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
138 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
139 public String getTextRange(int start, int length);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
140
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
141 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
142 * Remove the specified text changed listener.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
143 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
144 *
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
145 * @param listener the listener which should no longer be notified
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
146 *
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
147 * @exception IllegalArgumentException <ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
148 * <li>ERROR_NULL_ARGUMENT when listener is null</li>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
149 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
150 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
151 public void removeTextChangeListener(TextChangeListener listener);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
152
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
153 /**
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
154 * Replace the text with "newText" starting at position "start"
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
155 * for a length of "replaceLength".
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
156 * <p>
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
157 * Implementors have to notify the TextChangeListeners that were added
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
158 * using <code>addTextChangeListener</code> before and after the content
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
159 * is changed. A <code>TextChangingEvent</code> has to be sent to the
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
160 * textChanging method before the content is changed and a
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
161 * <code>TextChangedEvent</code> has to be sent to the textChanged method
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
162 * after the content has changed.
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
163 * The text change that occurs after the <code>TextChangingEvent</code>
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
164 * has been sent has to be consistent with the data provided in the
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
165 * <code>TextChangingEvent</code>.
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
166 * This data will be cached by the widget and will be used when the
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
167 * <code>TextChangedEvent</code> is received.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
168 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
169 * The <code>TextChangingEvent</code> should be set as follows:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
170 * <ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
171 * <li>event.start = start of the replaced text
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
172 * <li>event.newText = text that is going to be inserted or empty String
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
173 * if no text will be inserted
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
174 * <li>event.replaceCharCount = length of text that is going to be replaced
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
175 * <li>event.newCharCount = length of text that is going to be inserted
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
176 * <li>event.replaceLineCount = number of lines that are going to be replaced
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
177 * <li>event.newLineCount = number of new lines that are going to be inserted
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
178 * </ul>
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
179 * <b>NOTE:</b> newLineCount is the number of inserted lines and replaceLineCount
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
180 * is the number of deleted lines based on the change that occurs visually.
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
181 * For example:
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
182 * <ul>
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
183 * <li>(replaceText, newText) is> (replaceLineCount, newLineCount)
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
184 * <li>("", "\n") is> (0, 1)
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
185 * <li>("\n\n", "a") is> (2, 0)
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
186 * <li>("a", "\n\n") is> (0, 2)
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
187 * <li>("\n", "") is> (1, 0)
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
188 * </ul>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
189 * </p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
190 *
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
191 * @param start start offset of text to replace, none of the offsets include
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
192 * delimiters of preceding lines, offset 0 is the first character of the
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
193 * document
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
194 * @param replaceLength length of text to replace
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
195 * @param text text to replace
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
196 * @see TextChangeListener
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
197 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
198 public void replaceTextRange(int start, int replaceLength, String text);
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
199
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
200 /**
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
201 * Set text to "text".
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
202 * Implementors have to send a <code>TextChangedEvent</code> to the
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
203 * textSet method of the TextChangeListeners that were added using
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
204 * <code>addTextChangeListener</code>.
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
205 * <p>
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
206 *
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
207 * @param text the new text
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
208 * @see TextChangeListener
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
209 */
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
210 public void setText(String text);
41
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
211
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
212 /++
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
213 + DWT Extension
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
214 +/
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
215 int utf8AdjustOffset( int offset );
6337764516f1 Sync dwt/custom with dwt-linux (took copy of complete folder)
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
216
0
380af2bdd8e5 Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff changeset
217 }