FLTK 1.4.4: Fl_Widget_Surface Class Reference

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Widget_Surface Class Reference

A surface on which any FLTK widget can be drawn. More...

`#include <Fl_Widget_Surface.H>`

Inheritance diagram for Fl_Widget_Surface:

## Public Member Functions
void | draw (Fl_Widget *widget, int delta_x=0, int delta_y=0)
| Draws the widget on the drawing surface.
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.
virtual void | origin (int *x, int *y)
| Computes the coordinates of the current origin of graphics functions.
virtual void | origin (int x, int y)
| Sets the position of the origin of graphics in the drawable part of the drawing surface.
void | print_window_part (Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
| Draws a rectangular part of an on-screen window.
virtual int | printable_rect (int *w, int *h)
| Computes the width and height of the drawable area of the drawing surface.
virtual void | translate (int x, int y)
| Translates the current graphics origin accounting for the current rotation.
virtual void | untranslate ()
| Undoes the effect of a previous translate() call.
Public Member Functions inherited from Fl_Surface_Device
Fl_Graphics_Driver * | driver ()
| Returns the graphics driver of this drawing surface.
virtual bool | is_current ()
| Is this surface the current drawing surface?
virtual void | set_current (void)
| Make this surface the current drawing surface.
virtual | ~Fl_Surface_Device ()
| The destructor.

## Protected Member Functions
| Fl_Widget_Surface (Fl_Graphics_Driver *d)
| The constructor.
Protected Member Functions inherited from Fl_Surface_Device
void | driver (Fl_Graphics_Driver *graphics_driver)
| Sets the graphics driver of this drawing surface.
virtual void | end_current ()
| FLTK calls this each time a surface ceases to be the current drawing surface.
| Fl_Surface_Device (Fl_Graphics_Driver *graphics_driver)
| Constructor that sets the graphics driver to use for the created surface.

## Protected Attributes
int | x_offset
| horizontal offset to the origin of graphics coordinates
int | y_offset
| vertical offset to the origin of graphics coordinates

## Additional Inherited Members
Static Public Member Functions inherited from Fl_Surface_Device
static Fl_Surface_Device * | pop_current ()
| Removes the top element from the current drawing surface stack, and makes the new top element current.
static void | push_current (Fl_Surface_Device *new_current)
| Pushes `new_current` on top of the stack of current drawing surfaces, and makes it current.
static Fl_Surface_Device * | surface ()
| The current drawing surface.

## Detailed Description

A surface on which any FLTK widget can be drawn.

## Constructor & Destructor Documentation

## ◆ Fl_Widget_Surface()

Fl_Widget_Surface::Fl_Widget_Surface | ( | Fl_Graphics_Driver * | d | ) |
| protected

The constructor.

Parameters

  d | can be nul.

## Member Function Documentation

## ◆ draw()

void Fl_Widget_Surface::draw | ( | Fl_Widget * | widget,
|  | int | delta_x = 0,
|  | int | delta_y = 0 )

Draws the widget on the drawing surface.

The widget's position on the surface is determined by the last call to origin() and by the optional delta_x and delta_y arguments. Its dimensions are in points unless there was a previous call to scale().

Parameters

  [in] | widget | Any FLTK widget (e.g., standard, custom, window).
  [in] | delta_x,delta_y | Optional horizontal and vertical offsets for positioning the widget top left relatively to the current origin of graphics.

## ◆ draw_decorated_window()

void Fl_Widget_Surface::draw_decorated_window | ( | Fl_Window * | win,
|  | int | win_offset_x = 0,
|  | int | win_offset_y = 0 )

Draws a window with its title bar and frame if any.

`win_offset_x` and `win_offset_y` are optional coordinates of where to position the window top left. Equivalent to draw() if `win` is a subwindow or has no border. Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the framed window.

## ◆ origin() [1/2]

void Fl_Widget_Surface::origin | ( | int * | x,
|  | int * | y )
| virtual

Computes the coordinates of the current origin of graphics functions.

Parameters

  [out] | x,y | If non-null, *x and *y are set to the horizontal and vertical coordinates of the graphics origin.

Reimplemented in Fl_Copy_Surface, Fl_EPS_File_Surface, Fl_Image_Surface, Fl_PDF_File_Surface, Fl_PostScript_File_Device, Fl_Printer, and Fl_SVG_File_Surface.

## ◆ origin() [2/2]

void Fl_Widget_Surface::origin | ( | int | x,
|  | int | y )
| virtual

Sets the position of the origin of graphics in the drawable part of the drawing surface.

Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the top center of the drawable area. Successive origin() calls don't combine their effects. Origin() calls are not affected by rotate() calls (for classes derived from Fl_Paged_Device).

Parameters

  [in] | x,y | Horizontal and vertical positions in the drawing surface of the desired origin of graphics.

Reimplemented in Fl_Copy_Surface, Fl_EPS_File_Surface, Fl_Image_Surface, Fl_PDF_File_Surface, Fl_PostScript_File_Device, Fl_Printer, and Fl_SVG_File_Surface.

## ◆ print_window_part()

void Fl_Widget_Surface::print_window_part | ( | Fl_Window * | win,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | int | delta_x = 0,
|  | int | delta_y = 0 )

Draws a rectangular part of an on-screen window.

Parameters

  win | The window from where to capture. Can be an Fl_Gl_Window. Sub-windows that intersect the rectangle are also captured.
  x | The rectangle left
  y | The rectangle top
  w | The rectangle width
  h | The rectangle height
  delta_x,delta_y | Optional horizontal and vertical offsets from current graphics origin where to draw the top left of the captured rectangle.

## ◆ printable_rect()

int Fl_Widget_Surface::printable_rect | ( | int * | w,
|  | int * | h )
| virtual

Computes the width and height of the drawable area of the drawing surface.

Values are in the same unit as that used by FLTK drawing functions and are unchanged by calls to origin(). If the object is derived from class Fl_Paged_Device, values account for the user-selected paper type and print orientation and are changed by scale() calls.

Returns
  0 if OK, non-zero if any error

Reimplemented in Fl_Copy_Surface, Fl_EPS_File_Surface, Fl_Image_Surface, Fl_PDF_File_Surface, Fl_PostScript_File_Device, Fl_Printer, and Fl_SVG_File_Surface.

## ◆ translate()

void Fl_Widget_Surface::translate | ( | int | x,
|  | int | y )
| virtual

Translates the current graphics origin accounting for the current rotation.

Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects.

Reimplemented in Fl_Copy_Surface, Fl_EPS_File_Surface, Fl_Image_Surface, Fl_PDF_File_Surface, Fl_PostScript_File_Device, Fl_Printer, and Fl_SVG_File_Surface.

## ◆ untranslate()

void Fl_Widget_Surface::untranslate | ( | void |  | ) |
| virtual

Undoes the effect of a previous translate() call.

Reimplemented in Fl_Copy_Surface, Fl_EPS_File_Surface, Fl_Image_Surface, Fl_PDF_File_Surface, Fl_PostScript_File_Device, Fl_Printer, and Fl_SVG_File_Surface.

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

- Fl_Widget_Surface.H
- Fl_Widget_Surface.cxx