summaryrefslogtreecommitdiff
path: root/FL/Fl_Cairo_Window.H
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2008-09-25 18:26:33 +0000
committerFabien Costantini <fabien@onepost.net>2008-09-25 18:26:33 +0000
commitffad932289d17877a506a51c5f2f32c743d747d8 (patch)
treef45d4fa0e5b42f4faad7c5aba99a3da01d243a9c /FL/Fl_Cairo_Window.H
parentf9dc24a096d98abf3d3176eee74a759f886c4134 (diff)
+ Cairo branch merged after successful testing on Mac OS X 10.5.4, Linux Ubuntu 8.04,Windows XPSP2.
This integration is minimum as discussed, in particular it does not feature any fltk cairo drawing substitution as in fltk2. Still it provides all the fundations to go further even in next 1.4 ... By default *no* cairo features are implemented nor linked, it can only be activated by --enable-cairo whose default is false. Please visit the README.cairo for complete description. + fixed UTF8 compilation pb on linux ubuntu + minor comments fixes on the fly git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6350 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Cairo_Window.H')
-rw-r--r--FL/Fl_Cairo_Window.H87
1 files changed, 87 insertions, 0 deletions
diff --git a/FL/Fl_Cairo_Window.H b/FL/Fl_Cairo_Window.H
new file mode 100644
index 000000000..3914657a9
--- /dev/null
+++ b/FL/Fl_Cairo_Window.H
@@ -0,0 +1,87 @@
+//
+// "$Id$"
+//
+// Main header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2008 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+/** \file
+ Fl_Cairo_Window Hanling transparently a fltk window incorporte a cairo draw callback.
+*/
+
+#ifndef FL_CAIRO_WINDOW_H
+# define FL_CAIRO_WINDOW_H
+# ifdef HAVE_CAIRO
+
+// Cairo is currently supported for the following platforms:
+// Win32, Apple Quartz, X11
+# include <FL/Fl.H>
+# include <FL/Fl_Double_Window.H>
+
+/**
+ \addtogroup group_cairo
+ @{
+*/
+
+/**
+ This defines a pre-configured cairo fltk window.
+ This class overloads for you the virtual draw() method,
+ so that the only thing you have to do is to provide your cairo code.
+ All cairo context handling is achieved transparently.
+ \note You can alternatively define your custom cairo fltk window,
+ and thus at least override the draw() method to provide custom cairo
+ support. In this case you will probably use Fl:cairo_make_current(Fl_Window*)
+ to attach a context to your window. You should do it on ly when your Window is
+ the current window. \see Fl_Window::current()
+*/
+class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window {
+public:
+ Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {}
+ /** Overloaded to provide cairo callback support */
+ void draw() {
+ Fl_Double_Window::draw();
+ // manual method ? if yes explicitly get a cairo_context here
+ if (!Fl::cairo_autolink_context())
+ Fl::cairo_make_current(this);
+ if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
+ }
+ /** This defines the cairo draw calback prototype that you must further */
+ typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
+ /**
+ You must provide a draw callback which will implement your cairo rendering,
+ This method will permit you to set you \a cb cairo callback.
+ */
+ void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;}
+private:
+ cairo_draw_cb draw_cb_;
+};
+
+
+/** @} */
+
+# endif // HAVE_CAIRO
+#endif // FL_CAIRO_WINDOW_H
+
+//
+// End of "$Id$" .
+//