FLTK
Fl_Copy_Surface.H
1 //
2 // Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
3 //
4 // Copyright 1998-2014 by Bill Spitzak and others.
5 //
6 // This library is free software. Distribution and use rights are outlined in
7 // the file "COPYING" which should have been included with this file. If this
8 // file is missing or damaged, see the license at:
9 //
10 // https://www.fltk.org/COPYING.php
11 //
12 // Please see the following page on how to report bugs and issues:
13 //
14 // https://www.fltk.org/bugs.php
15 //
16 
17 #ifndef Fl_Copy_Surface_H
18 #define Fl_Copy_Surface_H
19 
20 #include <FL/Fl_Widget_Surface.H>
21 
49 class FL_EXPORT Fl_Copy_Surface : public Fl_Widget_Surface {
50 private:
51  class Fl_Copy_Surface_Driver *platform_surface;
52 protected:
53  void translate(int x, int y);
54  void untranslate();
55 public:
56  Fl_Copy_Surface(int w, int h);
57  ~Fl_Copy_Surface();
58  void set_current();
59  virtual bool is_current();
61  int w();
63  int h();
64  void origin(int *x, int *y);
65  void origin(int x, int y);
66  int printable_rect(int *w, int *h);
67  virtual void draw_decorated_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
68 };
69 
70 
85 class Fl_Copy_Surface_Driver : public Fl_Widget_Surface {
86  friend class Fl_Copy_Surface;
87 protected:
88  int width;
89  int height;
90  Fl_Copy_Surface_Driver(int w, int h) : Fl_Widget_Surface(NULL), width(w), height(h) {}
91  virtual ~Fl_Copy_Surface_Driver() {}
92  virtual void set_current() = 0;
93  virtual void translate(int x, int y) = 0;
94  virtual void untranslate() = 0;
95  int printable_rect(int *w, int *h);
100  static Fl_Copy_Surface_Driver *newCopySurfaceDriver(int w, int h);
101 };
102 
108 #endif // Fl_Copy_Surface_H
int h()
Returns the pixel height of the copy surface.
Definition: Fl_Copy_Surface.cxx:53
This widget produces an actual window.
Definition: Fl_Window.H:53
int w()
Returns the pixel width of the copy surface.
Definition: Fl_Copy_Surface.cxx:51
void set_current()
Make this surface the current drawing surface.
Definition: Fl_Copy_Surface.cxx:35
void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Definition: Fl_Copy_Surface.cxx:43
virtual void set_current(void)
Make this surface the current drawing surface.
Definition: Fl_Device.cxx:67
Supports copying of graphical data to the clipboard.
Definition: Fl_Copy_Surface.H:49
virtual void untranslate()
Undoes the effect of a previous translate() call.
Definition: Fl_Widget_Surface.cxx:121
virtual int printable_rect(int *w, int *h)
Computes the width and height of the drawable area of the drawing surface.
Definition: Fl_Widget_Surface.cxx:190
virtual void draw_decorated_window(Fl_Window *win, int x_offset=0, int y_offset=0)
Draws a window with its title bar and frame if any.
Definition: Fl_Widget_Surface.cxx:198
virtual bool is_current()
Is this surface the current drawing surface?
Definition: Fl_Device.cxx:79
Fl_Widget_Surface(Fl_Graphics_Driver *d)
The constructor.
Definition: Fl_Widget_Surface.cxx:28
A surface on which any FLTK widget can be drawn.
Definition: Fl_Widget_Surface.H:25
int printable_rect(int *w, int *h)
Computes the width and height of the drawable area of the drawing surface.
Definition: Fl_Copy_Surface.cxx:55
void untranslate()
Undoes the effect of a previous translate() call.
Definition: Fl_Copy_Surface.cxx:47
virtual void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Definition: Fl_Widget_Surface.cxx:114
virtual void origin(int x, int y)
Sets the position of the origin of graphics in the drawable part of the drawing surface.
Definition: Fl_Widget_Surface.cxx:145