1 /*
2 * File: TimeBarMarkerRenderer.java
3 * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de)
4 * A commercial license is available, see http://www.jaret.de.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 package de.jaret.util.ui.timebars.swt.renderer;
21
22 import org.eclipse.swt.graphics.GC;
23 import org.eclipse.swt.printing.Printer;
24
25 import de.jaret.util.ui.timebars.TimeBarMarker;
26 import de.jaret.util.ui.timebars.TimeBarViewerDelegate;
27
28 /**
29 * Interface for drawing markers in a timebar viewer.
30 *
31 * @author Peter Kliem
32 * @version $Id: TimeBarMarkerRenderer.java 821 2009-02-04 21:12:16Z kliem $
33 */
34 public interface TimeBarMarkerRenderer {
35 /**
36 * Darw a marker.
37 *
38 * @param gc GC to use
39 * @param delegate TimeBarViewerDelegate for retrieving information.
40 * @param marker marker to be drawn
41 * @param isDragged true if the marker is currently dragged
42 * @param printing flag indicating that the draw operation is for a printer
43 */
44 void draw(GC gc, TimeBarViewerDelegate delegate, TimeBarMarker marker, boolean isDragged, boolean printing);
45
46 /**
47 * Get the width for the marker rendering.
48 *
49 * @param marker the marker to get the width for
50 * @return width for rendering
51 */
52 int getWidth(TimeBarMarker marker);
53
54 /**
55 * Dispose the renderer. Should free up any resources locked.
56 *
57 */
58 void dispose();
59
60 /**
61 * Create a similar renderer for printing. The creation should copy settings made to the producing renderer.
62 *
63 * @param printer Printer device
64 * @return a configured renderer for printing.
65 */
66 TimeBarMarkerRenderer createPrintRenderer(Printer printer);
67
68 }