Commit | Line | Data |
---|---|---|
73005152 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2005, 2008, 2011 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 | * $Id: FontImpl.java,v 1.3 2008/01/24 02:28:50 apnan Exp $ | |
8 | * | |
9 | * Contributors: | |
10 | * IBM - Initial API and implementation | |
11 | * Bernd Hufmann - Updated for TMF | |
12 | **********************************************************************/ | |
13 | package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl; | |
14 | ||
15 | import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont; | |
16 | import org.eclipse.swt.graphics.Font; | |
17 | import org.eclipse.swt.graphics.FontData; | |
18 | import org.eclipse.swt.widgets.Display; | |
19 | ||
20 | /** | |
21 | * @author sveyrier | |
22 | * | |
23 | */ | |
24 | public class FontImpl implements IFont { | |
25 | ||
26 | protected Font font = null; | |
27 | protected boolean manageFont = true; | |
28 | ||
29 | public FontImpl(Display display, FontData data) { | |
30 | font = new Font(display, data); | |
31 | } | |
32 | ||
33 | protected FontImpl(Font value) { | |
34 | font = value; | |
35 | manageFont = false; | |
36 | } | |
37 | ||
38 | @Override | |
39 | public Object getFont() { | |
40 | return font; | |
41 | } | |
42 | ||
43 | public static FontImpl getSystemFont() { | |
44 | return new FontImpl(Display.getDefault().getSystemFont()); | |
45 | } | |
46 | ||
47 | @Override | |
48 | public void dispose() { | |
49 | if (font != null) | |
50 | font.dispose(); | |
51 | } | |
52 | ||
53 | } |