FLTK 1.3.3
Fl_Copy_Surface.H
1 //
2 // "$Id: Fl_Copy_Surface.H 10406 2014-10-29 19:57:42Z cand $"
3 //
4 // Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2014 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 
19 #ifndef Fl_Copy_Surface_H
20 #define Fl_Copy_Surface_H
21 
22 #include <FL/Fl_Paged_Device.H>
23 #include <FL/Fl_Printer.H>
24 
25 #if defined(__APPLE__)
26 #include <ApplicationServices/ApplicationServices.h>
27 #endif
28 
54 class FL_EXPORT Fl_Copy_Surface : public Fl_Surface_Device {
55 private:
56  int width;
57  int height;
58  Fl_Paged_Device *helper;
59 #ifdef __APPLE__
60  CFMutableDataRef pdfdata;
61  CGContextRef oldgc;
62  CGContextRef gc;
63  void prepare_copy_pdf_and_tiff(int w, int h);
64  void complete_copy_pdf_and_tiff();
65  void init_PDF_context(int w, int h);
66  static size_t MyPutBytes(void* info, const void* buffer, size_t count);
67 #elif defined(WIN32)
68  HDC oldgc;
69  HDC gc;
70 #else // Xlib
71  Fl_Offscreen xid;
72  Window oldwindow;
73  Fl_Surface_Device *_ss;
74 #endif
75 public:
76  static const char *class_id;
77  const char *class_name() {return class_id;};
78  Fl_Copy_Surface(int w, int h);
79  ~Fl_Copy_Surface();
80  void set_current();
81  void draw(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
82 };
83 
84 #if defined(__APPLE__)
85 
86 /* Mac class to reimplement Fl_Paged_Device::printable_rect() */
87 class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer {
88 protected:
89  int width;
90  int height;
91 public:
92  static const char *class_id;
93  const char *class_name() {return class_id;};
94  Fl_Quartz_Surface_(int w, int h);
95  virtual int printable_rect(int *w, int *h);
96  virtual ~Fl_Quartz_Surface_() {};
97 };
98 
99 #elif defined(WIN32)
100 
101 /* Win class to implement translate()/untranslate() */
102 class FL_EXPORT Fl_GDI_Surface_ : public Fl_Paged_Device {
103  int width;
104  int height;
105  unsigned depth;
106  POINT origins[10];
107 public:
108  static const char *class_id;
109  const char *class_name() {return class_id;};
110  Fl_GDI_Surface_();
111  virtual void translate(int x, int y);
112  virtual void untranslate();
113  virtual ~Fl_GDI_Surface_();
114 };
115 
116 #elif !defined(FL_DOXYGEN)
117 
118 /* Xlib class to implement translate()/untranslate() */
119 class FL_EXPORT Fl_Xlib_Surface_ : public Fl_Paged_Device {
120 public:
121  static const char *class_id;
122  const char *class_name() {return class_id;};
123  Fl_Xlib_Surface_();
124  virtual void translate(int x, int y);
125  virtual void untranslate();
126  virtual ~Fl_Xlib_Surface_();
127 };
128 
129 #endif
130 
131 #endif // Fl_Copy_Surface_H
132 
133 //
134 // End of "$Id: Fl_Copy_Surface.H 10406 2014-10-29 19:57:42Z cand $".
135 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:38
A surface that's susceptible to receive graphical output.
Definition: Fl_Device.H:523
virtual void set_current(void)
Use this drawing surface for future graphics requests.
Definition: Fl_Device.cxx:40
Supports copying of graphical data to the clipboard.
Definition: Fl_Copy_Surface.H:54
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Paged_Device.H:120
int printable_rect(int *w, int *h)
Computes the width and height of the printable area of the page.
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Copy_Surface.H:77
virtual void untranslate(void)
Undoes the effect of a previous translate() call.
Definition: Fl_Paged_Device.cxx:249
declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.
declaration of class Fl_Paged_Device.
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Printer.H:74
Print support under MSWindows and Mac OS.
Definition: Fl_Printer.H:47
virtual void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Definition: Fl_Paged_Device.cxx:244