Fl_Copy_Surface Class Reference

Supports copying of graphical data to the clipboard. More...

#include <Fl_Copy_Surface.H>

Inheritance diagram for Fl_Copy_Surface:
Fl_Surface_Device Fl_Device

List of all members.

Public Member Functions

const char * class_name ()
 Returns the name of the class of this object.
void draw (Fl_Widget *widget, int delta_x=0, int delta_y=0)
 Copies a widget in the clipboard.
void draw_decorated_window (Fl_Window *win, int delta_x=0, int delta_y=0)
 Copies a window and its borders and title bar to the clipboard.
 Fl_Copy_Surface (int w, int h)
 Constructor.
int h ()
 Returns the pixel height of the copy surface.
void set_current ()
 Make this surface the current drawing surface.
int w ()
 Returns the pixel width of the copy surface.
 ~Fl_Copy_Surface ()
 Destructor.

Static Public Attributes

static const char * class_id = "Fl_Copy_Surface"
 A string that identifies each subclass of Fl_Device.

Detailed Description

Supports copying of graphical data to the clipboard.


After creation of an Fl_Copy_Surface object, call set_current() on it, and all subsequent graphics requests will be recorded in the clipboard. It's possible to draw widgets (using Fl_Copy_Surface::draw() ) or to use any of the Drawing functions or the Color & Font functions. Finally, delete the Fl_Copy_Surface object to load the clipboard with the graphical data.
Fl_GL_Window 's can be copied to the clipboard as well.
Usage example:

 Fl_Widget *g = ...; // a widget you want to copy to the clipboard
 Fl_Copy_Surface *copy_surf = new Fl_Copy_Surface(g->w(), g->h()); // create an Fl_Copy_Surface object
 copy_surf->set_current(); // direct graphics requests to the clipboard
 fl_color(FL_WHITE); fl_rectf(0, 0, g->w(), g->h()); // draw a white background
 copy_surf->draw(g); // draw the g widget in the clipboard
 delete copy_surf; // after this, the clipboard is loaded
 Fl_Display_Device::display_device()->set_current();  // direct graphics requests back to the display

Platform details:


Constructor & Destructor Documentation

Fl_Copy_Surface::Fl_Copy_Surface ( int  w,
int  h 
)

Constructor.

Parameters:
w and
h are the width and height of the clipboard surface in pixels where drawing will occur.

Member Function Documentation

const char* Fl_Copy_Surface::class_name (  )  [inline, virtual]

Returns the name of the class of this object.

Use of the class_name() function is discouraged because it will be removed from future FLTK versions.

The class of an instance of an Fl_Device subclass can be checked with code such as:

   if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Surface_Device.

void Fl_Copy_Surface::draw ( Fl_Widget widget,
int  delta_x = 0,
int  delta_y = 0 
)

Copies a widget in the clipboard.

Parameters:
widget any FLTK widget (e.g., standard, custom, window, GL view) to copy
delta_x and
delta_y give the position in the clipboard of the top-left corner of the widget
void Fl_Copy_Surface::draw_decorated_window ( Fl_Window win,
int  delta_x = 0,
int  delta_y = 0 
)

Copies a window and its borders and title bar to the clipboard.

Parameters:
win an FLTK window to copy
delta_x and
delta_y give the position in the clipboard of the top-left corner of the window's title bar
void Fl_Copy_Surface::set_current ( void   )  [virtual]

Make this surface the current drawing surface.

This surface will receive all future graphics requests.

Reimplemented from Fl_Surface_Device.


Member Data Documentation

const char * Fl_Copy_Surface::class_id = "Fl_Copy_Surface" [static]

A string that identifies each subclass of Fl_Device.

Function class_name() applied to a device of this class returns this string.

Reimplemented from Fl_Surface_Device.


The documentation for this class was generated from the following files: