FLTK 1.3.11
Toggle main menu visibility
Loading...
Searching...
No Matches
Fl_Cairo_Window.H
1
//
2
// "$Id$"
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
36
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
() {
56
Fl_Double_Window::draw
();
57
// manual method ? if yes explicitly get a cairo_context here
58
if
(!
Fl::cairo_autolink_context
())
59
Fl::cairo_make_current
(
this
);
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
77
78
# endif
// FLTK_HAVE_CAIRO
79
#endif
// FL_CAIRO_WINDOW_H
80
81
//
82
// End of "$Id$" .
83
//
Fl.H
Fl static class.
Fl_Cairo_Window::cairo_draw_cb
void(* cairo_draw_cb)(Fl_Cairo_Window *self, cairo_t *def)
This defines the cairo draw callback prototype that you must further.
Definition
Fl_Cairo_Window.H:65
Fl_Cairo_Window::set_draw_cb
void set_draw_cb(cairo_draw_cb cb)
You must provide a draw callback which will implement your cairo rendering.
Definition
Fl_Cairo_Window.H:70
Fl_Cairo_Window::draw
void draw()
Overloaded to provide cairo callback support.
Definition
Fl_Cairo_Window.H:55
Fl_Double_Window::Fl_Double_Window
Fl_Double_Window(int W, int H, const char *l=0)
Creates a new Fl_Double_Window widget using the given position, size, and label (title) string.
Definition
Fl_Double_Window.cxx:63
Fl_Group::draw
void draw()
Draws the widget.
Definition
Fl_Group.cxx:738
Fl::cairo_cc
static cairo_t * cairo_cc()
Gets the current cairo context linked with a fltk window.
Definition
Fl.H:1347
Fl::cairo_make_current
static cairo_t * cairo_make_current(Fl_Window *w)
Provides a corresponding cairo context for window wi.
Definition
Fl_Cairo.cxx:75
Fl::cairo_autolink_context
static void cairo_autolink_context(bool alink)
when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, any current window dc is linked...
Definition
Fl.H:1337
FL
Fl_Cairo_Window.H
Generated by
1.17.0