FLTK 1.3.3
Fl_Cairo_Window.H
1 //
2 // "$Id: Fl_Cairo_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
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  Fl_Cairo_Window Handling transparently a fltk window incorporte a cairo draw callback.
21 */
22 
23 #ifndef FL_CAIRO_WINDOW_H
24 # define FL_CAIRO_WINDOW_H
25 # ifdef FLTK_HAVE_CAIRO
26 
27 // Cairo is currently supported for the following platforms:
28 // Win32, Apple Quartz, X11
29 # include <FL/Fl.H>
30 # include <FL/Fl_Double_Window.H>
31 
48 class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window {
49 
50 public:
51  Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {}
52 
53 protected:
55  void draw() {
57  // manual method ? if yes explicitly get a cairo_context here
60  if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
61  }
62 
63 public:
65  typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
70  void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;}
71 private:
72  cairo_draw_cb draw_cb_;
73 };
74 
75 
78 # endif // FLTK_HAVE_CAIRO
79 #endif // FL_CAIRO_WINDOW_H
80 
81 //
82 // End of "$Id: Fl_Cairo_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $" .
83 //