FLTK 1.3.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
Fl_Cairo.H
1
//
2
// "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $"
3
//
4
// Main header file for the Fast Light Tool Kit (FLTK).
5
//
6
// Copyright 1998-2010 by Bill Spitzak and others.
7
//
8
// This library is free software; you can redistribute it and/or
9
// modify it under the terms of the GNU Library General Public
10
// License as published by the Free Software Foundation; either
11
// version 2 of the License, or (at your option) any later version.
12
//
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
// Library General Public License for more details.
17
//
18
// You should have received a copy of the GNU Library General Public
19
// License along with this library; if not, write to the Free Software
20
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
// USA.
22
//
23
// Please report all bugs and problems on the following page:
24
//
25
// http://www.fltk.org/str.php
26
//
27
28
/* \file
29
Handling transparently platform dependent cairo include files
30
*/
31
32
#ifndef FL_CAIRO_H
33
# define FL_CAIRO_H
34
# ifdef FLTK_HAVE_CAIRO
35
36
// Cairo is currently supported for the following platforms:
37
// Win32, Apple Quartz, X11
38
39
# include <FL/Fl_Export.H>
40
41
# if defined(USE_X11) // X11
42
# include <cairo-xlib.h>
43
# elif defined(WIN32)
44
# include <cairo-win32.h>
45
# elif defined(__APPLE_QUARTZ__)
46
# include <cairo-quartz.h>
47
# else
48
# error Cairo is not supported on that platform.
49
# endif
50
63
class
FL_EXPORT
Fl_Cairo_State
{
64
public
:
65
Fl_Cairo_State
() : cc_(0), own_cc_(
false
), autolink_(
false
), window_(0), gc_(0) {}
66
67
// access attributes
68
cairo_t*
cc
()
const
{
return
cc_;}
69
bool
autolink
()
const
{
return
autolink_;}
70
71
void
cc
(cairo_t* c,
bool
own=
true
) {
72
if
(cc_ && own_cc_) cairo_destroy(cc_);
73
cc_=c;
74
if
(!cc_) window_=0;
75
own_cc_=own;
76
}
77
void
autolink(
bool
b);
78
void
window
(
void
* w) {window_=w;}
79
void
*
window
()
const
{
return
window_;}
80
void
gc
(
void
* c) {gc_=c;}
81
void
*
gc
()
const
{
return
gc_;}
82
83
private
:
84
cairo_t * cc_;
// contains the unique autoupdated cairo context
85
bool
own_cc_;
// indicates whether we must delete the cc, useful for internal cleanup
86
bool
autolink_;
// true by default, permits to prevent the automatic cairo mapping on fltk windows for custom cairo implementations
87
void
* window_, *gc_;
// for keeping track internally of last win+gc treated
88
};
89
92
# endif // FLTK_HAVE_CAIRO
93
#endif // FL_CAIRO_H
94
95
//
96
// End of "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $" .
97
//
© 1998-2011 by Bill Spitzak and others.
© 1998-2011 by Bill Spitzak and others. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.