Minsky
cairoItems.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2012
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 CAIRO_ITEMS_H
20 #define CAIRO_ITEMS_H
21 #include <geometry.h>
22 #include <plot.h>
23 #include <pango.h>
24 #include <cairo_base.h>
25 #include <cairo/cairo.h>
26 #include "operation.h"
27 #include "variable.h"
28 
29 namespace minsky
30 {
34  class RenderVariable: public ecolab::Pango
35  {
36  const VariableBase& var;
37  cairo_t *cairo;
38  float w, h, hoffs;
39  public:
40  // render a variable to a given cairo context
41  RenderVariable(const VariableBase& var, cairo_t* cairo=NULL);
43  void draw();
45  float width() const {return w;}
47  float height() const {return h;}
49  //Polygon geom() const;
50  bool inImage(float x, float y);
51  double handlePos() const;
54  };
55 
56  void drawTriangle(cairo_t* cairo, double x, double y, const ecolab::cairo::Colour& col, double angle=0);
57 }
58 #endif
double handlePos() const
Definition: cairoItems.cc:97
const VariableBase & var
Definition: cairoItems.h:36
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
bool inImage(float x, float y)
return the boost geometry corresponding to this variable&#39;s shape
Definition: cairoItems.cc:89
void drawTriangle(cairo_t *cairo, double x, double y, const ecolab::cairo::Colour &col, double angle=0)
void draw()
render the cairo image
Definition: cairoItems.cc:83
RenderVariable(const VariableBase &var, cairo_t *cairo=NULL)
Definition: cairoItems.cc:50
float height() const
half height of unrotated image
Definition: cairoItems.h:47
float width() const
half width of unrotated image
Definition: cairoItems.h:45