X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf509a9038c95c541f4080f2592924e82577af3f..f2b099261f9e46d65f1fbcfd2a35aa816d5a2818:/include/wx/cairo.h diff --git a/include/wx/cairo.h b/include/wx/cairo.h index 4c9b725072..88d570586b 100644 --- a/include/wx/cairo.h +++ b/include/wx/cairo.h @@ -3,7 +3,7 @@ // Purpose: Cairo library // Author: Anthony Bretaudeau // Created: 2007-08-25 -// RCS-ID: $Id: cairo.h 47254 2007-08-25 10:09:52Z VS $ +// RCS-ID: $Id$ // Copyright: (c) Anthony Bretaudeau // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -11,11 +11,6 @@ #ifndef _WX_CAIRO_H_BASE_ #define _WX_CAIRO_H_BASE_ - // for now GTK+ only -#ifdef __WXGTK210__ - #define wxUSE_CAIRO 1 -#endif - #if wxUSE_CAIRO #include "wx/dynlib.h" @@ -25,21 +20,31 @@ class wxCairoLibrary { public: - wxCairoLibrary(); - ~wxCairoLibrary(); + // return the pointer to the global instance of this class or NULL if we + // failed to load/initialize it + static wxCairoLibrary *Get(); + - static wxCairoLibrary* Get(); + // for internal use only static void CleanUp(); +private: + // the single wxCairoLibrary instance or NULL + static wxCairoLibrary *ms_lib; + + wxCairoLibrary(); + ~wxCairoLibrary(); + bool IsOk(); - void InitializeMethods(); + bool InitializeMethods(); -private: - bool m_ok; - wxDynamicLibrary *m_cairo_lib; - wxDynamicLibrary *m_pango_cairo_lib; - - static wxCairoLibrary *s_lib; + wxDynamicLibrary m_libCairo; + wxDynamicLibrary m_libPangoCairo; + + // true if we successfully loaded the libraries and can use them + // + // note that this field must have this name as it's used by wxDL_XXX macros + bool m_ok; public: wxDL_VOIDMETHOD_DEFINE( cairo_arc, @@ -88,32 +93,34 @@ public: (cairo_pattern_t *pattern, cairo_filter_t filter), (pattern, filter) ) wxDL_VOIDMETHOD_DEFINE( cairo_rectangle, (cairo_t *cr, double x, double y, double width, double height), (cr, x, y, width, height) ) - wxDL_METHOD_DEFINE( void, cairo_reset_clip, - (cairo_t *cr), (cr), /**/) - wxDL_METHOD_DEFINE( void, cairo_restore, - (cairo_t *cr), (cr), /**/) - wxDL_METHOD_DEFINE( void, cairo_rotate, - (cairo_t *cr, double angle), (cr, angle), /**/) - wxDL_METHOD_DEFINE( void, cairo_save, - (cairo_t *cr), (cr), /**/) - wxDL_METHOD_DEFINE( void, cairo_scale, - (cairo_t *cr, double sx, double sy), (cr, sx, sy), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_dash, - (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_fill_rule, - (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_line_cap, - (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_line_join, - (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_line_width, - (cairo_t *cr, double width), (cr, width), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_operator, - (cairo_t *cr, cairo_operator_t op), (cr, op), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_source, - (cairo_t *cr, cairo_pattern_t *source), (cr, source), /**/) - wxDL_METHOD_DEFINE( void, cairo_set_source_rgba, - (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha), /**/) + wxDL_METHOD_DEFINE( cairo_t*, cairo_reference, + (cairo_t *cr), (cr), NULL ) + wxDL_VOIDMETHOD_DEFINE( cairo_reset_clip, + (cairo_t *cr), (cr) ) + wxDL_VOIDMETHOD_DEFINE( cairo_restore, + (cairo_t *cr), (cr) ) + wxDL_VOIDMETHOD_DEFINE( cairo_rotate, + (cairo_t *cr, double angle), (cr, angle) ) + wxDL_VOIDMETHOD_DEFINE( cairo_save, + (cairo_t *cr), (cr) ) + wxDL_VOIDMETHOD_DEFINE( cairo_scale, + (cairo_t *cr, double sx, double sy), (cr, sx, sy) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_dash, + (cairo_t *cr, const double *dashes, int num_dashes, double offset), (cr, dashes, num_dashes, offset) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_fill_rule, + (cairo_t *cr, cairo_fill_rule_t fill_rule), (cr, fill_rule) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_line_cap, + (cairo_t *cr, cairo_line_cap_t line_cap), (cr, line_cap) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_line_join, + (cairo_t *cr, cairo_line_join_t line_join), (cr, line_join) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_line_width, + (cairo_t *cr, double width), (cr, width) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_operator, + (cairo_t *cr, cairo_operator_t op), (cr, op) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_source, + (cairo_t *cr, cairo_pattern_t *source), (cr, source) ) + wxDL_VOIDMETHOD_DEFINE( cairo_set_source_rgba, + (cairo_t *cr, double red, double green, double blue, double alpha), (cr, red, green, blue, alpha) ) wxDL_VOIDMETHOD_DEFINE( cairo_stroke, (cairo_t *cr), (cr) ) wxDL_VOIDMETHOD_DEFINE( cairo_stroke_preserve, @@ -125,16 +132,15 @@ public: wxDL_VOIDMETHOD_DEFINE( cairo_translate, (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) +#if wxUSE_PANGO wxDL_VOIDMETHOD_DEFINE( pango_cairo_update_layout, (cairo_t *cr, PangoLayout *layout), (cr, layout) ) wxDL_VOIDMETHOD_DEFINE( pango_cairo_show_layout, (cairo_t *cr, PangoLayout *layout), (cr, layout) ) - - DECLARE_NO_COPY_CLASS(wxCairoLibrary) +#endif + wxDECLARE_NO_COPY_CLASS(wxCairoLibrary); }; -#endif - // wxUSE_CAIRO +#endif // wxUSE_CAIRO -#endif - // _WX_CAIRO_H_BASE_ +#endif // _WX_CAIRO_H_BASE_