Mercurial > projects > dwt-linux
comparison dwt/printing/Printer.d @ 259:c0d810de7093
Update SWT 3.4M7 to 3.4
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 29 Jun 2008 14:33:38 +0200 |
parents | 5a30aa9820f3 |
children | 4bffbf81e2d6 |
comparison
equal
deleted
inserted
replaced
257:cc1d3de0e80b | 259:c0d810de7093 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
49 * when those instances are no longer required. | 49 * when those instances are no longer required. |
50 * </p> | 50 * </p> |
51 * | 51 * |
52 * @see PrinterData | 52 * @see PrinterData |
53 * @see PrintDialog | 53 * @see PrintDialog |
54 * @see <a href="http://www.eclipse.org/swt/snippets/#printing">Printing snippets</a> | |
55 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
54 */ | 56 */ |
55 public final class Printer : Device { | 57 public final class Printer : Device { |
56 static PrinterData [] printerList; | 58 static PrinterData [] printerList; |
57 | 59 |
58 PrinterData data; | 60 PrinterData data; |
609 return new Point(resolution, resolution); | 611 return new Point(resolution, resolution); |
610 } | 612 } |
611 | 613 |
612 /** | 614 /** |
613 * Returns a rectangle describing the receiver's size and location. | 615 * Returns a rectangle describing the receiver's size and location. |
614 * For a printer, this is the size of a physical page, in pixels. | 616 * <p> |
617 * For a printer, this is the size of the physical page, in pixels. | |
618 * </p> | |
615 * | 619 * |
616 * @return the bounding rectangle | 620 * @return the bounding rectangle |
617 * | 621 * |
618 * @exception DWTException <ul> | 622 * @exception DWTException <ul> |
619 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> | 623 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> |
631 } | 635 } |
632 | 636 |
633 /** | 637 /** |
634 * Returns a rectangle which describes the area of the | 638 * Returns a rectangle which describes the area of the |
635 * receiver which is capable of displaying data. | 639 * receiver which is capable of displaying data. |
640 * <p> | |
636 * For a printer, this is the size of the printable area | 641 * For a printer, this is the size of the printable area |
637 * of a page, in pixels. | 642 * of the page, in pixels. |
643 * </p> | |
638 * | 644 * |
639 * @return the client area | 645 * @return the client area |
640 * | 646 * |
641 * @exception DWTException <ul> | 647 * @exception DWTException <ul> |
642 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> | 648 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> |
652 double height = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS); | 658 double height = OS.gtk_page_setup_get_page_height(pageSetup, OS.GTK_UNIT_POINTS); |
653 return new Rectangle(0, 0, cast(int) width, cast(int) height); | 659 return new Rectangle(0, 0, cast(int) width, cast(int) height); |
654 } | 660 } |
655 | 661 |
656 /** | 662 /** |
657 * Given a desired <em>client area</em> for the receiver | 663 * Given a <em>client area</em> (as described by the arguments), |
658 * (as described by the arguments), returns the bounding | 664 * returns a rectangle, relative to the client area's coordinates, |
659 * rectangle which would be required to produce that client | 665 * that is the client area expanded by the printer's trim (or minimum margins). |
660 * area. | 666 * <p> |
661 * <p> | 667 * Most printers have a minimum margin on each edge of the paper where the |
662 * In other words, it returns a rectangle such that, if the | 668 * printer device is unable to print. This margin is known as the "trim." |
663 * receiver's bounds were set to that rectangle, the area | 669 * This method can be used to calculate the printer's minimum margins |
664 * of the receiver which is capable of displaying data | 670 * by passing in a client area of 0, 0, 0, 0 and then using the resulting |
665 * (that is, not covered by the "trimmings") would be the | 671 * x and y coordinates (which will be <= 0) to determine the minimum margins |
666 * rectangle described by the arguments (relative to the | 672 * for the top and left edges of the paper, and the resulting width and height |
667 * receiver's parent). | 673 * (offset by the resulting x and y) to determine the minimum margins for the |
668 * </p><p> | 674 * bottom and right edges of the paper, as follows: |
669 * Note that there is no setBounds for a printer. This method | 675 * <ul> |
670 * is usually used by passing in the client area (the 'printable | 676 * <li>The left trim width is -x pixels</li> |
671 * area') of the printer. It can also be useful to pass in 0, 0, 0, 0. | 677 * <li>The top trim height is -y pixels</li> |
672 * </p> | 678 * <li>The right trim width is (x + width) pixels</li> |
673 * | 679 * <li>The bottom trim height is (y + height) pixels</li> |
674 * @param x the desired x coordinate of the client area | 680 * </ul> |
675 * @param y the desired y coordinate of the client area | 681 * </p> |
676 * @param width the desired width of the client area | 682 * |
677 * @param height the desired height of the client area | 683 * @param x the x coordinate of the client area |
678 * @return the required bounds to produce the given client area | 684 * @param y the y coordinate of the client area |
685 * @param width the width of the client area | |
686 * @param height the height of the client area | |
687 * @return a rectangle, relative to the client area's coordinates, that is | |
688 * the client area expanded by the printer's trim (or minimum margins) | |
679 * | 689 * |
680 * @exception DWTException <ul> | 690 * @exception DWTException <ul> |
681 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> | 691 * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> |
682 * </ul> | 692 * </ul> |
683 * | 693 * |