Update MANIFEST.MF, replaced deprecated Provide-Package with Export-Package.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / util / PixelConverter.java
1 package net.sourceforge.phpdt.internal.ui.util;
2
3 import org.eclipse.jface.dialogs.Dialog;
4 import org.eclipse.swt.graphics.FontMetrics;
5 import org.eclipse.swt.graphics.GC;
6 import org.eclipse.swt.widgets.Control;
7
8 public class PixelConverter {
9
10         private FontMetrics fFontMetrics;
11
12         public PixelConverter(Control control) {
13                 GC gc = new GC(control);
14                 gc.setFont(control.getFont());
15                 fFontMetrics = gc.getFontMetrics();
16                 gc.dispose();
17         }
18
19         private FontMetrics fgFontMetrics;
20
21         /**
22          * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
23          */
24         public int convertHeightInCharsToPixels(int chars) {
25                 return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
26         }
27
28         /**
29          * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
30          */
31         public int convertHorizontalDLUsToPixels(int dlus) {
32                 return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
33         }
34
35         /**
36          * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
37          */
38         public int convertVerticalDLUsToPixels(int dlus) {
39                 return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
40         }
41
42         /**
43          * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
44          */
45         public int convertWidthInCharsToPixels(int chars) {
46                 return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
47         }
48
49 }