summaryrefslogtreecommitdiff
path: root/src/Fl_Copy_Surface.cxx
blob: 21ad19d408efea66612ee310ef43bd6b6adb8483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// "$Id$"
//
// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file.  If this
// file is missing or damaged, see the license at:
//
//     http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
//     http://www.fltk.org/str.php
//

#include <FL/Fl_Copy_Surface.H>

#if defined(FL_PORTING)
# pragma message "FL_PORTING: optionally implement class Fl_XXX_Copy_Surface_Driver for your platform"

Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h)
{
  return NULL;
}

#endif

/** the constructor */
Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Widget_Surface(NULL) {
  platform_surface = Fl_Copy_Surface_Driver::newCopySurfaceDriver(w, h);
  if (platform_surface) driver(platform_surface->driver());
}

Fl_Copy_Surface::~Fl_Copy_Surface() { delete platform_surface; }

void Fl_Copy_Surface::origin(int x, int y) {platform_surface->origin(x, y);}

void Fl_Copy_Surface::origin(int *x, int *y) {
  if (platform_surface) platform_surface->origin(x, y);
}

void Fl_Copy_Surface::set_current() {
  if (platform_surface) platform_surface->set_current();
}

void Fl_Copy_Surface::translate(int x, int y) {
  if (platform_surface) platform_surface->translate(x, y);
}

void Fl_Copy_Surface::untranslate() {
  if (platform_surface) platform_surface->untranslate();
}

int Fl_Copy_Surface::w() {return platform_surface ? platform_surface->width : 0;}

int Fl_Copy_Surface::h() {return platform_surface ? platform_surface->height : 0;}

int Fl_Copy_Surface::printable_rect(int *w, int *h)  {
  if (platform_surface)
    return platform_surface->printable_rect(w, h);
  else {
    *w  = *h = 0;
  }
  return 1;
}

//
// End of "$Id$".
//