• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Copy_Surface.H

00001 //
00002 // "$Id$"
00003 //
00004 // Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2014 by Bill Spitzak and others.
00007 //
00008 // This library is free software. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00019 #ifndef Fl_Copy_Surface_H
00020 #define Fl_Copy_Surface_H
00021 
00022 #include <FL/Fl_Paged_Device.H>
00023 #include <FL/Fl_Printer.H>
00024 #include <FL/x.H>
00025 
00051 class FL_EXPORT Fl_Copy_Surface : public Fl_Surface_Device {
00052 private:
00053   int width;
00054   int height;
00055   Fl_Paged_Device *helper;
00056 #ifdef __APPLE__
00057   CFMutableDataRef pdfdata;
00058   CGContextRef oldgc;
00059   CGContextRef gc;
00060   void prepare_copy_pdf_and_tiff(int w, int h);
00061   void complete_copy_pdf_and_tiff();
00062   void init_PDF_context(int w, int h);
00063   static size_t MyPutBytes(void* info, const void* buffer, size_t count);
00064 #elif defined(WIN32)
00065   HDC oldgc;
00066   HDC gc;
00067 #else // Xlib
00068   Fl_Offscreen xid;
00069   Window oldwindow;
00070   Fl_Surface_Device *_ss;
00071 #endif
00072 public:
00073   static const char *class_id;
00074   const char *class_name() {return class_id;};
00075   Fl_Copy_Surface(int w, int h);
00076   ~Fl_Copy_Surface();
00077   void set_current();
00078   void draw(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
00079   void draw_decorated_window(Fl_Window* win, int delta_x = 0, int delta_y = 0);
00081   int w() { return width; }
00083   int h() { return height; }
00084 };
00085 
00086 #if defined(__APPLE__)
00087 
00088 /* Mac class to reimplement Fl_Paged_Device::printable_rect() */
00089 class FL_EXPORT Fl_Quartz_Surface_ : public Fl_System_Printer {
00090 protected:
00091   int width;
00092   int height;
00093 public:
00094   static const char *class_id;
00095   const char *class_name() {return class_id;};
00096   Fl_Quartz_Surface_(int w, int h);
00097   virtual int printable_rect(int *w, int *h);
00098   virtual ~Fl_Quartz_Surface_() {};
00099 };
00100 
00101 #elif defined(WIN32)
00102 
00103 /* Win class to implement translate()/untranslate() */
00104 class FL_EXPORT Fl_GDI_Surface_ : public Fl_Paged_Device {
00105   int width;
00106   int height;
00107   unsigned depth;
00108   POINT origins[10];
00109 public:
00110   static const char *class_id;
00111   const char *class_name() {return class_id;};
00112   Fl_GDI_Surface_();
00113   virtual void translate(int x, int y);
00114   virtual void untranslate();
00115   virtual ~Fl_GDI_Surface_();
00116 };
00117 
00118 #elif !defined(FL_DOXYGEN)
00119 
00120 /* Xlib class to implement translate()/untranslate() */
00121 class FL_EXPORT Fl_Xlib_Surface_ : public Fl_Paged_Device {
00122 public:
00123   static const char *class_id;
00124   const char *class_name() {return class_id;};
00125   Fl_Xlib_Surface_();
00126   virtual void translate(int x, int y);
00127   virtual void untranslate();
00128   virtual ~Fl_Xlib_Surface_();
00129 };
00130 
00131 #endif
00132 
00133 #endif // Fl_Copy_Surface_H
00134 
00135 //
00136 // End of "$Id$".
00137 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.