• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

Fl_Cairo.H

00001 //
00002 // "$Id$"
00003 //
00004 // Main header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2010 by Bill Spitzak and others.
00007 //
00008 // This library is free software. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00019 /* \file
00020     Handling transparently platform dependent cairo include files 
00021 */
00022 
00023 #ifndef FL_CAIRO_H
00024 # define FL_CAIRO_H
00025 # ifdef FLTK_HAVE_CAIRO
00026 
00027 // Cairo is currently supported for the following platforms:
00028 // Win32, Apple Quartz, X11
00029 
00030 # include <FL/Fl_Export.H>
00031 
00032 # include <cairo.h>
00033 
00046 class FL_EXPORT Fl_Cairo_State {
00047 public:
00048   Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {}
00049 
00050     // access attributes
00051     cairo_t* cc() const {return cc_;}            
00052     bool autolink() const {return autolink_;}    
00053 
00061     void cc(cairo_t* c, bool own=true)  {
00062         if (cc_ && own_cc_) cairo_destroy(cc_);
00063         cc_=c;
00064         if (!cc_) window_=0;
00065         own_cc_=own;
00066     }
00067     void  autolink(bool b);                     
00068     void  window(void* w)  {window_=w;}         
00069     void* window() const {return window_;}      
00070     void  gc(void* c)  {gc_=c;}                 
00071     void* gc() const {return gc_;}              
00072 
00073 private:
00074     cairo_t * cc_;       // contains the unique autoupdated cairo context
00075     bool own_cc_;        // indicates whether we must delete the cc, useful for internal cleanup
00076     bool autolink_;      // false by default, prevents the automatic cairo mapping on fltk windows
00077                          // for custom cairo implementations.
00078     void* window_, *gc_; // for keeping track internally of last win+gc treated
00079 };
00080 
00083 # endif // FLTK_HAVE_CAIRO
00084 #endif // FL_CAIRO_H
00085 
00086 //
00087 // End of "$Id$" .
00088 //
  • © 1998-2016 by Bill Spitzak and others.     FLTK

  • © 1998-2016 by Bill Spitzak and others.     FLTK

    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.