FLTK 1.3.8: Fl_Copy_Surface.H Source File

FLTK 1.3.8

Fl_Copy_Surface.H
1//
2// "$Id$"
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#include <FL/x.H>
25
51 class FL_EXPORT Fl_Copy_Surface : public Fl_Surface_Device {
52private:
53 int width;
54 int height;
55 Fl_Paged_Device *helper;
56#ifdef __APPLE__
57 CFMutableDataRef pdfdata;
58 CGContextRef oldgc;
59 CGContextRef gc;
60 void prepare_copy_pdf_and_tiff(int w, int h);
61 void complete_copy_pdf_and_tiff();
62 void init_PDF_context(int w, int h);
63 static size_t MyPutBytes(void* info, const void* buffer, size_t count);
64#elif defined(WIN32)
65 HDC oldgc;
66 HDC gc;
67#else // Xlib
68 Fl_Offscreen xid;
69 Window oldwindow;
70 Fl_Surface_Device *_ss;
71#endif
72public:
73 static const char *class_id;
74 const char *class_name() {return class_id;};
75 Fl_Copy_Surface(int w, int h);
76 ~Fl_Copy_Surface();
77 void set_current();
78 void draw(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
79 void draw_decorated_window(Fl_Window* win, int delta_x = 0, int delta_y = 0);
81 int w() { return width; }
83 int h() { return height; }
84};
85
86#if defined(__APPLE__)
87
88/* Mac class to reimplement Fl_Paged_Device::printable_rect() */
89class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer {
90protected:
91 int width;
92 int height;
93public:
94 static const char *class_id;
95 const char *class_name() {return class_id;};
96 Fl_Quartz_Surface_(int w, int h);
97 virtual int printable_rect(int *w, int *h);
98 virtual ~Fl_Quartz_Surface_() {};
99};
100
101#elif defined(WIN32)
102
103/* Win class to implement translate()/untranslate() */
104class FL_EXPORT Fl_GDI_Surface_ : public Fl_Paged_Device {
105 int width;
106 int height;
107 unsigned depth;
108 POINT origins[10];
109public:
110 static const char *class_id;
111 const char *class_name() {return class_id;};
112 Fl_GDI_Surface_();
113 virtual void translate(int x, int y);
114 virtual void untranslate();
115 virtual ~Fl_GDI_Surface_();
116};
117
118#elif !defined(FL_DOXYGEN)
119
120/* Xlib class to implement translate()/untranslate() */
121class FL_EXPORT Fl_Xlib_Surface_ : public Fl_Paged_Device {
122public:
123 static const char *class_id;
124 const char *class_name() {return class_id;};
125 Fl_Xlib_Surface_();
126 virtual void translate(int x, int y);
127 virtual void untranslate();
128 virtual ~Fl_Xlib_Surface_();
129};
130
131#endif
132
133#endif // Fl_Copy_Surface_H
134
135//
136// End of "$Id$".
137//
Fl_Paged_Device.H
declaration of class Fl_Paged_Device.
Fl_Printer.H
declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.
Fl_Copy_Surface
Supports copying of graphical data to the clipboard.
Definition: Fl_Copy_Surface.H:51
Fl_Copy_Surface::h
int h()
Returns the pixel height of the copy surface.
Definition: Fl_Copy_Surface.H:83
Fl_Copy_Surface::w
int w()
Returns the pixel width of the copy surface.
Definition: Fl_Copy_Surface.H:81
Fl_Copy_Surface::class_name
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Copy_Surface.H:74
Fl_Paged_Device
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:38
Fl_Surface_Device
A drawing surface that's susceptible to receive graphical output.
Definition: Fl_Device.H:556
Fl_Surface_Device::set_current
virtual void set_current(void)
Make this surface the current drawing surface.
Definition: Fl_Device.cxx:44
Fl_Surface_Device::class_name
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Device.H:566
Fl_System_Printer
Print support under MSWindows and Mac OS.
Definition: Fl_Printer.H:47
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Window
This widget produces an actual window.
Definition: Fl_Window.H:57
- Copyright © 1998-2021 by Bill Spitzak and others.