mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-02 19:29:17 +00:00
Added showPrintDialog.
This commit is contained in:
parent
cb50b1748f
commit
4818d61436
@ -23,6 +23,10 @@ import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.printing.PrintDialog;
|
||||
import org.eclipse.swt.printing.Printer;
|
||||
import org.eclipse.swt.printing.PrinterData;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
@ -63,4 +67,13 @@ public class SwtUtil {
|
||||
composite.getHorizontalBar().setIncrement(fontWidth);
|
||||
composite.getHorizontalBar().setPageIncrement(pageWidth);
|
||||
}
|
||||
/**
|
||||
* Display the Print dialog helper method.
|
||||
*/
|
||||
public static Printer showPrintDialog(Control control) {
|
||||
PrintDialog dialog = new PrintDialog(control.getShell());
|
||||
PrinterData printerData = dialog.open();
|
||||
if (printerData == null) return null;
|
||||
return new Printer(printerData);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user