Fl_Paged_Device.H 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // "$Id: Fl_Paged_Device.H 11364 2016-03-18 18:20:11Z manolo $"
  3. //
  4. // Printing support for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 2010-2016 by Bill Spitzak and others.
  7. //
  8. // This library is free software. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. /** \file Fl_Paged_Device.H
  19. \brief declaration of class Fl_Paged_Device.
  20. */
  21. #ifndef Fl_Paged_Device_H
  22. #define Fl_Paged_Device_H
  23. #include <FL/Fl_Widget_Surface.H>
  24. /** \brief Number of elements in enum Page_Format */
  25. #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
  26. /**
  27. \brief Represents page-structured drawing surfaces.
  28. *
  29. This class has no public constructor: don't instantiate it; use Fl_Printer
  30. or Fl_PostScript_File_Device instead.
  31. */
  32. class FL_EXPORT Fl_Paged_Device : public Fl_Widget_Surface {
  33. protected:
  34. /** \brief The constructor */
  35. Fl_Paged_Device() : Fl_Widget_Surface(NULL) {};
  36. /** A platform should implement this function to support printing via the Fl_Printer class. */
  37. static Fl_Paged_Device* newPrinterDriver(void);
  38. public:
  39. /**
  40. \brief Possible page formats.
  41. All paper formats with pre-defined width and height.
  42. */
  43. enum Page_Format {
  44. A0 = 0, /**< A0 format */
  45. A1,
  46. A2,
  47. A3,
  48. A4, /**< A4 format */
  49. A5,
  50. A6,
  51. A7,
  52. A8,
  53. A9,
  54. B0,
  55. B1,
  56. B2,
  57. B3,
  58. B4,
  59. B5,
  60. B6,
  61. B7,
  62. B8,
  63. B9,
  64. B10,
  65. C5E,
  66. DLE,
  67. EXECUTIVE,
  68. FOLIO,
  69. LEDGER,
  70. LEGAL,
  71. LETTER, /**< Letter format */
  72. TABLOID,
  73. ENVELOPE,
  74. MEDIA = 0x1000
  75. };
  76. /**
  77. \brief Possible page layouts.
  78. */
  79. enum Page_Layout {
  80. PORTRAIT = 0, /**< Portrait orientation */
  81. LANDSCAPE = 0x100, /**< Landscape orientation */
  82. REVERSED = 0x200, /**< Reversed orientation */
  83. ORIENTATION = 0x300 /**< orientation */
  84. };
  85. /** \brief width, height and name of a page format
  86. */
  87. typedef struct {
  88. /** \brief width in points */
  89. int width;
  90. /** \brief height in points */
  91. int height;
  92. /** \brief format name */
  93. const char *name;
  94. } page_format;
  95. /** \brief width, height and name of all elements of the enum \ref Page_Format.
  96. */
  97. static const page_format page_formats[NO_PAGE_FORMATS];
  98. /** \brief The destructor */
  99. virtual ~Fl_Paged_Device() {};
  100. virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
  101. virtual int start_page(void);
  102. virtual void margins(int *left, int *top, int *right, int *bottom);
  103. virtual void scale(float scale_x, float scale_y = 0.);
  104. virtual void rotate(float angle);
  105. /** Synonym of draw(Fl_Widget*, int, int) */
  106. void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0) {draw(widget, delta_x, delta_y);}
  107. /** Synonym of draw_decorated_window(Fl_Window*, int, int) */
  108. void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0) {
  109. draw_decorated_window(win, x_offset, y_offset);
  110. }
  111. virtual int end_page (void);
  112. virtual void end_job (void);
  113. };
  114. #endif // Fl_Paged_Device_H
  115. //
  116. // End of "$Id: Fl_Paged_Device.H 11364 2016-03-18 18:20:11Z manolo $"
  117. //