+//----------------------------------------------------------------------------
+// wxGnomePrintLibrary
+//----------------------------------------------------------------------------
+
+#define wxDL_METHOD_DEFINE( rettype, name, args, shortargs, defret ) \
+ typedef rettype (* name ## Type) args ; \
+ name ## Type pfn_ ## name; \
+ rettype name args \
+ { if (m_ok) return pfn_ ## name shortargs ; return defret; }
+
+#define wxDL_METHOD_LOAD( lib, name, success ) \
+ pfn_ ## name = (name ## Type) lib->GetSymbol( wxT(#name), &success ); \
+ if (!success) return;
+
+class wxGnomePrintLibrary
+{
+public:
+ wxGnomePrintLibrary();
+ ~wxGnomePrintLibrary();
+
+ bool IsOk();
+ void InitializeMethods();
+
+private:
+ bool m_ok;
+ wxDynamicLibrary *m_gnome_print_lib;
+
+public:
+ wxDL_METHOD_DEFINE( gint, gnome_print_newpath,
+ (GnomePrintContext *pc), (pc), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_moveto,
+ (GnomePrintContext *pc, gdouble x, gdouble y), (pc, x, y), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_lineto,
+ (GnomePrintContext *pc, gdouble x, gdouble y), (pc, x, y), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_curveto,
+ (GnomePrintContext *pc, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3), (pc, x1, y1, x2, y2, x3, y3), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_closepath,
+ (GnomePrintContext *pc), (pc), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_stroke,
+ (GnomePrintContext *pc), (pc), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_fill,
+ (GnomePrintContext *pc), (pc), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_setrgbcolor,
+ (GnomePrintContext *pc, gdouble r, gdouble g, gdouble b), (pc, r, g, b), 0 )
+ wxDL_METHOD_DEFINE( gint, gnome_print_setlinewidth,
+ (GnomePrintContext *pc, gdouble width), (pc, width), 0 )
+};
+
+wxGnomePrintLibrary::wxGnomePrintLibrary()
+{
+ wxLogNull log;
+ m_gnome_print_lib = new wxDynamicLibrary( wxT("libgnomeprint-2-2.so") );
+ m_ok = m_gnome_print_lib->IsLoaded();
+
+ if (m_ok)
+ InitializeMethods();
+}
+
+wxGnomePrintLibrary::~wxGnomePrintLibrary()
+{
+ delete m_gnome_print_lib;
+}
+
+bool wxGnomePrintLibrary::IsOk()
+{
+ return m_ok;
+}
+
+void wxGnomePrintLibrary::InitializeMethods()
+{
+ m_ok = false;
+ bool success;
+
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_newpath, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_moveto, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_lineto, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_curveto, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_closepath, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_stroke, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_fill, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_setrgbcolor, success )
+ wxDL_METHOD_LOAD( m_gnome_print_lib, gnome_print_setlinewidth, success )
+
+ m_ok = true;
+}
+
+static wxGnomePrintLibrary* gs_lgp = NULL;
+