KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > forms > widgets > ParagraphSegment


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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 package org.eclipse.ui.internal.forms.widgets;
12
13 import java.util.Hashtable JavaDoc;
14
15 import org.eclipse.swt.graphics.*;
16 import org.eclipse.swt.graphics.GC;
17
18 /**
19  * @version 1.0
20  * @author
21  */

22 public abstract class ParagraphSegment {
23     /**
24      * Moves the locator according to the content of this segment.
25      * @param gc
26      * @param wHint
27      * @param loc
28      * @param objectTable
29      * @param computeHeightOnly
30      * @return <code>true</code> if text wrapped to the new line, <code>false</code> otherwise.
31      */

32     public abstract boolean advanceLocator(GC gc, int wHint, Locator loc, Hashtable JavaDoc objectTable, boolean computeHeightOnly);
33     /**
34      * Computes bounding rectangles and row heights of this segments.
35      * @param gc
36      * @param width
37      * @param loc
38      * @param resourceTable
39      * @param selected
40      */

41     public abstract void layout(GC gc, int width, Locator loc, Hashtable JavaDoc resourceTable, boolean selected);
42     /**
43      * Paints this segment.
44      * @param gc
45      * @param hover
46      * @param resourceTable
47      * @param selected
48      * @param selData
49      * @param region
50      */

51     public abstract void paint(GC gc, boolean hover, Hashtable JavaDoc resourceTable, boolean selected, SelectionData selData, Rectangle region);
52     /**
53      * Paints this segment.
54      * @param gc
55      * @param resourceTable
56      * @param selData
57      */

58     public abstract void computeSelection(GC gc, Hashtable JavaDoc resourceTable, SelectionData selData);
59     /**
60      * Tests if the coordinates are contained in one of the
61      * bounding rectangles of this segment.
62      * @param x
63      * @param y
64      * @return true if inside the bounding rectangle, false otherwise.
65      */

66     public abstract boolean contains(int x, int y);
67     /**
68      * Tests if the source rectangle intersects with
69      * one of the bounding rectangles of this segment.
70      * @param rect
71      * @return true if the two rectangles intersect, false otherwise.
72      */

73     public abstract boolean intersects(Rectangle rect);
74     /**
75      * Returns the tool tip of this segment or <code>null</code>
76      * if not defined.
77      * @return tooltip or <code>null</code>.
78      */

79     public String JavaDoc getTooltipText() {
80         return null;
81     }
82     /**
83      * Clears the text metrics cache for the provided font id.
84      * @param fontId the id of the font that the cache is kept for.
85      *
86      */

87     public void clearCache(String JavaDoc fontId) {
88     }
89 }
90
Popular Tags