1 /*******************************************************************************
2 * Copyright (c) 2000, 2010 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.ui.util;
13 import org.eclipse.swt.graphics.Font;
14 import org.eclipse.swt.graphics.FontMetrics;
15 import org.eclipse.swt.graphics.GC;
16 import org.eclipse.swt.widgets.Control;
18 import org.eclipse.jface.dialogs.Dialog;
22 * DO NOT REMOVE, used in a product.
23 * @deprecated As of 3.5, replaced by {@link org.eclipse.jface.layout.PixelConverter}
25 public class PixelConverter {
27 private final FontMetrics fFontMetrics;
29 public PixelConverter(Control control) {
30 this(control.getFont());
33 public PixelConverter(Font font) {
34 GC gc = new GC(font.getDevice());
36 fFontMetrics= gc.getFontMetrics();
41 * see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int)
43 public int convertHeightInCharsToPixels(int chars) {
44 return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
48 * see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int)
50 public int convertHorizontalDLUsToPixels(int dlus) {
51 return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
55 * see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
57 public int convertVerticalDLUsToPixels(int dlus) {
58 return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
62 * see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int)
64 public int convertWidthInCharsToPixels(int chars) {
65 return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);