FLTK 1.3.4: Fl_Cairo.H Source File

FLTK 1.3.4

Fl_Cairo.H
1 //
2 // "$Id: Fl_Cairo.H 11167 2016-02-13 17:35:36Z AlbrechtS $"
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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 /* \file
20 Handling transparently platform dependent cairo include files
21 */
22
23 #ifndef FL_CAIRO_H
24 # define FL_CAIRO_H
25 # ifdef FLTK_HAVE_CAIRO
26
27 // Cairo is currently supported for the following platforms:
28 // Win32, Apple Quartz, X11
29
30 # include <FL/Fl_Export.H>
31
32 # include <cairo.h>
33
46 class FL_EXPORT Fl_Cairo_State {
47 public:
48 Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {}
49
50 // access attributes
51 cairo_t* cc() const {return cc_;}
52 bool autolink() const {return autolink_;}
53
61 void cc(cairo_t* c, bool own=true) {
62 if (cc_ && own_cc_) cairo_destroy(cc_);
63 cc_=c;
64 if (!cc_) window_=0;
65 own_cc_=own;
66 }
67 void autolink(bool b);
68 void window(void* w) {window_=w;}
69 void* window() const {return window_;}
70 void gc(void* c) {gc_=c;}
71 void* gc() const {return gc_;}
72
73 private:
74 cairo_t * cc_; // contains the unique autoupdated cairo context
75 bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup
76 bool autolink_; // false by default, prevents the automatic cairo mapping on fltk windows
77 // for custom cairo implementations.
78 void* window_, *gc_; // for keeping track internally of last win+gc treated
79 };
80
83 # endif // FLTK_HAVE_CAIRO
84 #endif // FL_CAIRO_H
85
86 //
87 // End of "$Id: Fl_Cairo.H 11167 2016-02-13 17:35:36Z AlbrechtS $" .
88 //
Fl_Cairo_State::window
void window(void *w)
Sets the window w to keep track on.
Definition: Fl_Cairo.H:68
Fl_Cairo_State::autolink
bool autolink() const
Gets the autolink option. See Fl::cairo_autolink_context(bool)
Definition: Fl_Cairo.H:52
Fl_Cairo_State::cc
cairo_t * cc() const
Gets the current cairo context.
Definition: Fl_Cairo.H:51
Fl_Cairo_State::gc
void * gc() const
Gets the last gc attached to a cc.
Definition: Fl_Cairo.H:71
Fl_Cairo_State::gc
void gc(void *c)
Sets the gc c to keep track on.
Definition: Fl_Cairo.H:70
Fl_Cairo_State::cc
void cc(cairo_t *c, bool own=true)
Sets the current cairo context.
Definition: Fl_Cairo.H:61
Fl_Cairo_State::window
void * window() const
Gets the last window attached to a cc.
Definition: Fl_Cairo.H:69
Fl_Cairo_State
Contains all the necessary info on the current cairo context.
Definition: Fl_Cairo.H:46
- © 1998-2016 by Bill Spitzak and others.