Minsky
SVGItem.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2014
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef SVGITEM_H
20 #define SVGITEM_H
21 #include <classdesc.h>
22 #include "classdesc_access.h"
23 #include <cairo/cairo.h>
24 #include <librsvg/rsvg.h>
25 #include <string>
26 
27 namespace minsky
28 {
30  {
31  classdesc::Exclude<RsvgHandle*> svg;
33  double m_width, m_height;
34  public:
36  SVGRenderer(const std::string& resource) {setResource(resource);}
37  SVGRenderer(const SVGRenderer&)=delete;
38  void operator=(const SVGRenderer&)=delete;
39  ~SVGRenderer();
40 
42  void setResource(const std::string& resource);
43  void render(cairo_t*) const;
44  double width() const {return m_width;}
45  double height() const {return m_height;}
46  };
47 
48 
49 }
50 
51 #include "SVGItem.cd"
52 #include "SVGItem.xcd"
53 #endif
classdesc::Exclude< RsvgHandle * > svg
Definition: SVGItem.h:31
void operator=(const SVGRenderer &)=delete
void setResource(const std::string &resource)
initialise object from an SVG file
Definition: SVGItem.cc:57
double width() const
Definition: SVGItem.h:44
CLASSDESC_ACCESS(SVGRenderer)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
double height() const
Definition: SVGItem.h:45
SVGRenderer(const std::string &resource)
Definition: SVGItem.h:36
void render(cairo_t *) const
Definition: SVGItem.cc:82