Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 953b1e63af765acf79dcc18fb053a2736c98ef87 (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
/*******************************************************************************
 * Copyright (c) 2012, 2014 Tilera 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:
 *     William R. Swanson (Tilera Corporation)
 *     Xavier Raynaud (Kalray) - Bug 430804
 *******************************************************************************/

package org.eclipse.cdt.visualizer.ui.canvas;

import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;


// ---------------------------------------------------------------------------
// IGraphicObject
// ---------------------------------------------------------------------------

/**
 * An object that can be displayed and manipulated on a GraphicCanvas.
 */
public interface IGraphicObject
{
	// --- methods ---
	
	/** Paints object using specified graphics context.
	 *  If decorations is false, draws ordinary object content.
	 *  If decorations is true, paints optional "decorations" layer.
	 */
	public void paint(GC gc, boolean decorations);

	/**
	 * Return the tooltip to display when mouse stays on this object.
	 * It may return <code>null</code> if there is nothing to display.
	 * @param x the x coordinate
	 * @param y the y coordinate
	 * @return the tooltip to display on this object.
	 */
	public String getTooltip(int x, int y);
	
	/** Returns true if object has decorations to paint. */
	public boolean hasDecorations();
	
	/** Gets model data (if any) associated with this graphic object */
	public Object getData();
	
	/** Sets model data (if any) associated with this graphic object */
	public void setData(Object data);
	
	/** Whether graphic object contains the specified point. */
	public boolean contains(int x, int y);
	
	/** Returns true if element bounds are within specified rectangle. */
	public boolean isWithin(Rectangle region);
}

Back to the top