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 *******************************************************************************/ 11 12 package org.eclipse.jface.text.source; 13 14 15 import org.eclipse.swt.widgets.Control; 16 17 18 /** 19 * A vertical ruler is a visual component which may serve text viewers as an 20 * annotation presentation area. The vertical ruler info provides interested 21 * clients with the mapping and interaction aspect of the vertical ruler. This 22 * covers the mapping between coordinates of the ruler's control and line 23 * numbers based on the connected text viewer's document. 24 * 25 * In order to provide backward compatibility for clients of 26 * <code>IVerticalRulerInfo</code>, extension interfaces are used as a means 27 * of evolution. The following extension interfaces exist: 28 * <ul> 29 * <li>{@link org.eclipse.jface.text.source.IVerticalRulerInfoExtension} since 30 * version 3.0 allowing custom annotation hovers and specific annotation models. 31 * </li> 32 * </ul> 33 * 34 * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension 35 * @since 2.0 36 */ 37 public interface IVerticalRulerInfo { 38 39 /** 40 * Returns the ruler's SWT control. 41 * 42 * @return the ruler's SWT control 43 */ 44 Control getControl(); 45 46 /** 47 * Returns the line number of the last mouse button activity. 48 * Based on the input document of the connected text viewer. 49 * The smallest possible line number is <code>0</code>. 50 * 51 * @return the line number of the last mouse button activity 52 */ 53 int getLineOfLastMouseButtonActivity(); 54 55 /** 56 * Translates a y-coordinate of the ruler's SWT control into 57 * the according line number of the document of the connected text viewer. 58 * 59 * @param y_coordinate a y-coordinate of the ruler's SWT control 60 * @return the line number of that coordinate or <code>-1</code> if that 61 * coordinate does not correspond to a valid document line 62 */ 63 int toDocumentLineNumber(int y_coordinate); 64 65 /** 66 * Returns the width of this ruler's control. 67 * 68 * @return the width of this ruler's control 69 */ 70 int getWidth(); 71 } 72