FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Cairo.H

    00001 //
    00002 // "$Id: Fl_Cairo.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
    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 # if defined(USE_X11) // X11
    00033 #  include <cairo-xlib.h>
    00034 # elif defined(WIN32)
    00035 #  include <cairo-win32.h>
    00036 # elif defined(__APPLE_QUARTZ__)
    00037 #  include <cairo-quartz.h>
    00038 # else
    00039 #  error Cairo is not supported on that platform.
    00040 # endif
    00041
    00054 class FL_EXPORT Fl_Cairo_State {
    00055 public:
    00056   Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {}
    00057
    00058     // access attributes
    00059     cairo_t* cc() const {return cc_;}
    00060     bool autolink() const {return autolink_;}
    00061
    00062     void cc(cairo_t* c, bool own=true)  {
    00063         if (cc_ && own_cc_) cairo_destroy(cc_);
    00064         cc_=c;
    00065         if (!cc_) window_=0;
    00066         own_cc_=own;
    00067     }
    00068     void  autolink(bool b);
    00069     void  window(void* w)  {window_=w;}
    00070     void* window() const {return window_;}
    00071     void  gc(void* c)  {gc_=c;}
    00072     void* gc() const {return gc_;}
    00073
    00074 private:
    00075     cairo_t * cc_;       // contains the unique autoupdated cairo context
    00076     bool own_cc_;        // indicates whether we must delete the cc, useful for internal cleanup
    00077     bool autolink_;      // true by default, permits to prevent the automatic cairo mapping on fltk windows 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: Fl_Cairo.H 8864 2011-07-19 04:49:30Z greg.ercolano $" .
    00088 //