Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drawing_manipulator.h
1 
2 /***************************************************************************
3  * drawing_manipulator.h - Manipulates things like point size, line
4  * width, etc.
5  *
6  * Created: Fri Oct 10 18:09:38 2008
7  * Copyright 2008 Daniel Beck
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef __GEOMETRY_DRAWING_MANIPULATOR_H_
26 #define __GEOMETRY_DRAWING_MANIPULATOR_H_
27 
28 #include <geometry/gtk/geom_drawer.h>
29 
30 namespace fawkes {
31 
33 {
34  public:
36  virtual ~DrawingManipulator();
37 
38  enum Color
39  {
40  BLACK, /**< black */
41  WHITE, /**< white */
42  RED, /**< red */
43  GREEN, /**< green */
44  BLUE /**< blue */
45  };
46 
47  void integrate(const DrawingManipulator* m);
48 
49  void set_line_width(float w);
50  float get_line_width() const;
51 
52  void set_point_size(float s);
53  float get_point_size() const;
54 
55  void set_color(Color c);
56  void set_color(float r, float g, float b);
57  void get_color(float& r, float& g, float& b) const;
58 
59  virtual void draw(Cairo::RefPtr<Cairo::Context>& context);
60 
61  private:
62  float m_line_width;
63  float m_point_size;
64  float m_color_r;
65  float m_color_g;
66  float m_color_b;
67 
68  bool m_line_width_set;
69  bool m_point_size_set;
70  bool m_color_set;
71 };
72 
73 DrawingManipulator* set_line_width(float w);
74 DrawingManipulator* set_point_size(float s);
75 DrawingManipulator* set_color(float r, float g, float b);
76 DrawingManipulator* set_color(DrawingManipulator::Color c);
77 
78 } // end namespace fawkes
79 
80 #endif /* __GEOMETRY_DRAWING_MANIPULATOR_H_ */
float get_point_size() const
Get the point size.
virtual ~DrawingManipulator()
Desctructor.
float get_line_width() const
Get the line width.
DrawingManipulator * set_point_size(float s)
Creates a drawing manipulator which sets the given point size.
Color
Some pre-defined colors.
DrawingManipulator * set_color(float r, float g, float b)
Creates a drawing manipulator which sets the given color.
Abstract base class for all drawer classes.
Definition: geom_drawer.h:30
void set_point_size(float s)
Set the point size.
DrawingManipulator * set_line_width(float w)
Creates a drawing manipulator which sets the given line width.
void set_color(Color c)
Set the color.
void get_color(float &r, float &g, float &b) const
Get the color.
void set_line_width(float w)
Set the line width.
void integrate(const DrawingManipulator *m)
Integrates the parameters of another manipulator.
Allows to control some aspects of the rendering of objects.
virtual void draw(Cairo::RefPtr< Cairo::Context > &context)
This method is called by the GeomDrawingArea.