Remove warnings and fix a windows bug with CtfTmfTrace.getName()
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / viewers / timeAnalysis / widgets / TraceCtrl.java
CommitLineData
b0d3496e
ASL
1/*****************************************************************************\r
2 * Copyright (c) 2007, Intel Corporation.\r
3 * All rights reserved. This program and the accompanying materials\r
4 * are made available under the terms of the Eclipse Public License v1.0\r
5 * which accompanies this distribution, and is available at\r
6 * http://www.eclipse.org/legal/epl-v10.html\r
7 *\r
8 * Contributors:\r
9 * Intel Corporation - Initial API and implementation\r
10 * Ruslan A. Scherbakov, Intel - Initial API and implementation\r
11 * Alvaro Sanchex-Leon - Udpated for TMF\r
12 *\r
13 * $Id: TraceCtrl.java,v 1.2 2007/02/27 18:37:36 ewchan Exp $ \r
14 *****************************************************************************/\r
15\r
16package org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.widgets;\r
17\r
18import org.eclipse.swt.SWT;\r
19import org.eclipse.swt.events.PaintEvent;\r
20import org.eclipse.swt.events.PaintListener;\r
21import org.eclipse.swt.graphics.Color;\r
22import org.eclipse.swt.graphics.Rectangle;\r
23import org.eclipse.swt.widgets.Canvas;\r
24import org.eclipse.swt.widgets.Composite;\r
25\r
26public abstract class TraceCtrl extends Canvas implements PaintListener {\r
27\r
28 static public final int MARGIN = 4;\r
8b9fa226 29 static public final int RIGHT_MARGIN = 2; // 2 pixels less to make sure end time is visible\r
b0d3496e
ASL
30 static public final int SMALL_ICON_SIZE = 16;\r
31\r
32 protected TraceColorScheme _colors;\r
33 protected int _fontHeight = 0;\r
34\r
35 public TraceCtrl(Composite parent, TraceColorScheme colors) {\r
36 this(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS);\r
37 }\r
38\r
39 public TraceCtrl(Composite parent, TraceColorScheme colors, int style) {\r
40 super(parent, style);\r
41 _colors = colors;\r
42 addPaintListener(this);\r
43 }\r
44\r
4e3aa37d 45 @Override\r
b0d3496e
ASL
46 public void dispose() {\r
47 super.dispose();\r
48 }\r
49\r
d4011df2 50 @Override\r
b0d3496e
ASL
51 public void paintControl(PaintEvent e) {\r
52 if (e.widget != this)\r
53 return;\r
54 _fontHeight = e.gc.getFontMetrics().getHeight();\r
55 Rectangle bound = getClientArea();\r
56 if (!bound.isEmpty()) {\r
57 Color colBackup = e.gc.getBackground();\r
58 paint(bound, e);\r
59 e.gc.setBackground(colBackup);\r
60 }\r
61 }\r
62\r
63 public int getFontHeight() {\r
64 return _fontHeight;\r
65 }\r
66\r
67 abstract void paint(Rectangle bound, PaintEvent e);\r
68}\r
This page took 0.033544 seconds and 5 git commands to generate.