SVGLoader.h
00001 #ifndef _SVGLOADER_H_
00002 #define _SVGLOADER_H_
00003
00004 #include <cairomm/context.h>
00005
00006
00007 #include <iostream>
00008
00009
00010 static std::string svg_path = "/usr/share/uniwidgets/svg/";
00011 static const std::string no_svg = "empty.svg";
00012
00013 static const std::string true_svg = "true.svg";
00014 static const std::string false_svg = "false.svg";
00015
00016 struct _RsvgHandle;
00017 typedef _RsvgHandle RsvgHandle;
00018
00027 class SVGLoader
00028 {
00029 private:
00030 RsvgHandle* handle;
00031 std::string path;
00032 std::string filename;
00033 int svg_width;
00034 int svg_height;
00036 public:
00037 SVGLoader();
00038 SVGLoader(std::string path);
00039 ~SVGLoader();
00041 bool loadRsvgFile(std::string filename, bool throw_exception = true );
00042 SVGLoader& operator=(const SVGLoader&);
00044 int get_svg_width() {return svg_width;}
00046 int get_svg_height() {return svg_height;}
00048 std::string get_filename() {return filename;}
00050 static std::string get_path(std::string str_file="");
00052 bool renderSurface(Cairo::RefPtr<Cairo::Surface> surf, int width, int height);
00054 bool renderWithCairoContext(Cairo::RefPtr<Cairo::Context> &cr);
00055
00056 bool isLoaded() { return handle?true:false;}
00057
00058 };
00059 #endif