Skip to main content
summaryrefslogtreecommitdiffstats
blob: 33282850142a7c7cf1100e7fc39b8cd5b762fcee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.jface.text.source;


import org.eclipse.swt.widgets.Control;


/**
 * A vertical ruler is a visual component which may serve text viewers as an
 * annotation presentation area. The vertical ruler info provides interested
 * clients with the mapping and interaction aspect of the vertical ruler. This
 * covers the mapping between coordinates of the ruler's control and line
 * numbers based on the connected text viewer's document.
 *
 * In order to provide backward compatibility for clients of
 * <code>IVerticalRulerInfo</code>, extension interfaces are used as a means
 * of evolution. The following extension interfaces exist:
 * <ul>
 * <li>{@link org.eclipse.jface.text.source.IVerticalRulerInfoExtension} since
 * version 3.0 allowing custom annotation hovers and specific annotation models.
 * </li>
 * </ul>
 *
 * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension
 * @since 2.0
 */
public interface IVerticalRulerInfo {

	/**
	 * Returns the ruler's SWT control.
	 *
	 * @return the ruler's SWT control
	 */
	Control getControl();

	/**
	 * Returns the line number of the last mouse button activity.
	 * Based on the input document of the connected text viewer.
	 * The smallest possible line number is <code>0</code>.
	 *
	 * @return the line number of the last mouse button activity
	 */
	int getLineOfLastMouseButtonActivity();

	/**
	 * Translates a y-coordinate of the ruler's SWT control into
	 * the according line number of the document of the connected text viewer.
	 *
	 * @param y_coordinate a y-coordinate of the ruler's SWT control
	 * @return the line number of that coordinate or <code>-1</code> if that
	 * 			coordinate does not correspond to a valid document line
	 */
	int toDocumentLineNumber(int y_coordinate);

	/**
	 * Returns the width of this ruler's control.
	 *
	 * @return the width of this ruler's control
	 */
	int getWidth();
}

Back to the top