129
|
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 module dwtx.jface.text.source.IOverviewRuler;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwt.graphics.Color;
|
|
18 import dwt.widgets.Control;
|
|
19
|
|
20 /**
|
|
21 * This interface defines a visual component which may serve
|
|
22 * text viewers as an overview annotation presentation area. This means,
|
|
23 * presentation of annotations is independent from the actual view port of
|
|
24 * the text viewer. The annotations of the viewer's whole document are
|
|
25 * visible in the overview ruler.
|
|
26 * <p>
|
|
27 * This interfaces embodies three contracts:
|
|
28 * <ul>
|
|
29 * <li> The overview ruler retrieves the annotations it presents from an annotation model.
|
|
30 * <li> The ruler is a visual component which must be integrated in a hierarchy of DWT controls.
|
|
31 * <li> The ruler provides interested clients with mapping and
|
|
32 * interaction information. This covers the mapping between
|
|
33 * coordinates of the ruler's control and line numbers based
|
|
34 * on the connected text viewer's document (<code>IVerticalRulerInfo</code>).
|
|
35 * </ul></p>
|
|
36 * <p>
|
|
37 * Clients may implement this interface or use the default implementation provided
|
|
38 * by <code>OverviewlRuler</code>.</p>
|
|
39 *
|
|
40 * @see dwtx.jface.text.ITextViewer
|
|
41 * @since 2.1
|
|
42 */
|
|
43 public interface IOverviewRuler : IVerticalRuler {
|
|
44
|
|
45 /**
|
|
46 * Returns whether there is an annotation an the given vertical coordinate. This
|
|
47 * method takes the compression factor of the overview ruler into account.
|
|
48 *
|
|
49 * @param y the y-coordinate
|
|
50 * @return <code>true</code> if there is an annotation, <code>false</code> otherwise
|
|
51 */
|
|
52 bool hasAnnotation(int y);
|
|
53
|
|
54 /**
|
|
55 * Returns the height of the visual presentation of an annotation in this
|
|
56 * overview ruler. Assumes that all annotations are represented using the
|
|
57 * same height.
|
|
58 *
|
|
59 * @return int the visual height of an annotation
|
|
60 */
|
|
61 int getAnnotationHeight();
|
|
62
|
|
63 /**
|
|
64 * Sets the color for the given annotation type in this overview ruler.
|
|
65 *
|
|
66 * @param annotationType the annotation type
|
|
67 * @param color the color
|
|
68 */
|
|
69 void setAnnotationTypeColor(Object annotationType, Color color);
|
|
70
|
|
71 /**
|
|
72 * Sets the drawing layer for the given annotation type in this overview ruler.
|
|
73 *
|
|
74 * @param annotationType the annotation type
|
|
75 * @param layer the drawing layer
|
|
76 */
|
|
77 void setAnnotationTypeLayer(Object annotationType, int layer);
|
|
78
|
|
79 /**
|
|
80 * Adds the given annotation type to this overview ruler. Starting with this
|
|
81 * call, annotations of the given type are shown in the overview ruler.
|
|
82 *
|
|
83 * @param annotationType the annotation type
|
|
84 */
|
|
85 void addAnnotationType(Object annotationType);
|
|
86
|
|
87 /**
|
|
88 * Removes the given annotation type from this overview ruler. Annotations
|
|
89 * of the given type are no longer shown in the overview ruler.
|
|
90 *
|
|
91 * @param annotationType the annotation type
|
|
92 */
|
|
93 void removeAnnotationType(Object annotationType);
|
|
94
|
|
95 /**
|
|
96 * Adds the given annotation type to the header of this ruler. Starting with
|
|
97 * this call, the presence of annotations is tracked and the header is drawn
|
|
98 * in the configured color.
|
|
99 *
|
|
100 * @param annotationType the annotation type to be tracked
|
|
101 */
|
|
102 void addHeaderAnnotationType(Object annotationType);
|
|
103
|
|
104 /**
|
|
105 * Removes the given annotation type from the header of this ruler. The
|
|
106 * presence of annotations of the given type is no longer tracked and the
|
|
107 * header is drawn in the default color, depending on the other configured
|
|
108 * configured annotation types.
|
|
109 *
|
|
110 * @param annotationType the annotation type to be removed
|
|
111 */
|
|
112 void removeHeaderAnnotationType(Object annotationType);
|
|
113
|
|
114 /**
|
|
115 * Returns this rulers header control. This is the little area between the
|
|
116 * top of the text widget and the top of this overview ruler.
|
|
117 *
|
|
118 * @return the header control of this overview ruler.
|
|
119 */
|
|
120 Control getHeaderControl();
|
|
121 }
|