Mercurial > projects > dwt-addons
comparison dwtx/jface/text/ITextViewerExtension.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 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 | |
14 module dwtx.jface.text.ITextViewerExtension; | |
15 | |
16 import dwt.dwthelper.utils; | |
17 | |
18 | |
19 import dwt.custom.VerifyKeyListener; | |
20 import dwt.widgets.Control; | |
21 | |
22 | |
23 /** | |
24 * Extension interface for {@link dwtx.jface.text.ITextViewer}. | |
25 * <p> | |
26 * This extension interface replaces the event consumer mechanism ( | |
27 * {@link dwtx.jface.text.ITextViewer#setEventConsumer(IEventConsumer)}) | |
28 * with a set of methods that allow to manage a sequence of | |
29 * {@link dwt.custom.VerifyKeyListener}objects. It also adds | |
30 * <ul> | |
31 * <li>access to the control of this viewer</li> | |
32 * <li>marked region support as in emacs</li> | |
33 * <li>control of the viewer's redraw behavior by introducing | |
34 * <code>setRedraw(bool)</code> | |
35 * <li>access to the viewer's rewrite target. | |
36 * </ul> | |
37 * | |
38 * A rewrite target ({@link dwtx.jface.text.IRewriteTarget}) represents | |
39 * an facade offering the necessary methods to manipulate a document that is the | |
40 * input document of a text viewer. | |
41 * | |
42 * @since 2.0 | |
43 */ | |
44 public interface ITextViewerExtension { | |
45 | |
46 /** | |
47 * Inserts the verify key listener at the beginning of the viewer's list of | |
48 * verify key listeners. If the listener is already registered with the | |
49 * viewer this call moves the listener to the beginning of the list. | |
50 * | |
51 * @param listener the listener to be inserted | |
52 */ | |
53 void prependVerifyKeyListener(VerifyKeyListener listener); | |
54 | |
55 /** | |
56 * Appends a verify key listener to the viewer's list of verify key | |
57 * listeners. If the listener is already registered with the viewer this | |
58 * call moves the listener to the end of the list. | |
59 * | |
60 * @param listener the listener to be added | |
61 */ | |
62 void appendVerifyKeyListener(VerifyKeyListener listener); | |
63 | |
64 /** | |
65 * Removes the verify key listener from the viewer's list of verify key listeners. | |
66 * If the listener is not registered with this viewer, this call has no effect. | |
67 * | |
68 * @param listener the listener to be removed | |
69 */ | |
70 void removeVerifyKeyListener(VerifyKeyListener listener); | |
71 | |
72 /** | |
73 * Returns the control of this viewer. | |
74 * | |
75 * @return the control of this viewer | |
76 */ | |
77 Control getControl(); | |
78 | |
79 /** | |
80 * Sets a mark at the given offset or clears the mark if the specified | |
81 * offset is <code>-1</code>. If a mark is set and the selection is | |
82 * empty, cut and copy actions performed on this text viewer work on the | |
83 * region described by the positions of the mark and the cursor. | |
84 * | |
85 * @param offset the offset of the mark | |
86 */ | |
87 void setMark(int offset); | |
88 | |
89 /** | |
90 * Returns the position of the mark, <code>-1</code> if the mark is not set. | |
91 * | |
92 * @return the position of the mark or <code>-1</code> if no mark is set | |
93 */ | |
94 int getMark(); | |
95 | |
96 /** | |
97 * Enables/disables the redrawing of this text viewer. This temporarily | |
98 * disconnects the viewer from its underlying | |
99 * {@link dwt.custom.StyledText}widget. While being | |
100 * disconnected only the viewer's selection may be changed using | |
101 * <code>setSelectedRange</code>. Any direct manipulation of the widget | |
102 * as well as calls to methods that change the viewer's presentation state | |
103 * (such as enabling the segmented view) are not allowed. When redrawing is | |
104 * disabled the viewer does not send out any selection or view port change | |
105 * notification. When redrawing is enabled again, a selection change | |
106 * notification is sent out for the selected range and this range is | |
107 * revealed causing a view port changed notification. | |
108 * | |
109 * @param redraw <code>true</code> to enable redrawing, <code>false</code> | |
110 * otherwise | |
111 */ | |
112 void setRedraw(bool redraw); | |
113 | |
114 /** | |
115 * Returns the viewer's rewrite target. | |
116 * | |
117 * @return the viewer's rewrite target | |
118 */ | |
119 IRewriteTarget getRewriteTarget(); | |
120 } |