probably fix cleanup issues, but testing required
[ardour.git] / libs / libgnomecanvasmm / libgnomecanvasmm / path-def.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _LIBGNOMECANVASMM_PATH_DEF_H
4 #define _LIBGNOMECANVASMM_PATH_DEF_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* path-def.h
11  * 
12  *
13  * Copyright (C) 2002 The libgnomecanvasmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 #include <libgnomecanvasmm/point.h>
31 #include <glibmm/containers.h>
32 #include <libgnomecanvas/gnome-canvas-path-def.h>
33 #include <libart_lgpl/art_bpath.h>
34 #include <libart_lgpl/art_point.h>
35 #include <libart_lgpl/art_bpath.h>
36
37
38 namespace Gnome
39 {
40
41 namespace Canvas
42 {
43
44 class PathDef
45 {
46   public:
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48   typedef PathDef CppObjectType;
49   typedef GnomeCanvasPathDef BaseObjectType;
50 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
51
52   static Glib::RefPtr<PathDef> create();
53
54   // For use with Glib::RefPtr<> only.
55   void reference()   const;
56   void unreference() const;
57
58   ///Provides access to the underlying C instance.
59   GnomeCanvasPathDef*       gobj();
60
61   ///Provides access to the underlying C instance.
62   const GnomeCanvasPathDef* gobj() const;
63
64   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
65   GnomeCanvasPathDef* gobj_copy() const;
66
67 protected:
68   // Do not derive this.  Gnome::Canvas::PathDef can neither be constructed nor deleted.
69   PathDef();
70   void operator delete(void*, size_t);
71
72 private:
73   // noncopyable
74   PathDef(const PathDef&);
75   PathDef& operator=(const PathDef&);
76
77
78 public:
79   //gtkmmproc error: gnome_canvas_path_def_new : method defs lookup failed (1)
80   
81   /** This funtion creates a new #gnome_canvas_path_def with @a length 
82    * number of points allocated. It is useful, if you know the exact
83    * number of points in path, so you can avoid automatic point
84    * array reallocation.
85    * @param length Number of points to allocate for the path.
86    * @return The new canvas path definition.
87    */
88   static Glib::RefPtr<PathDef> create(int length);
89   
90   /** This function constructs a new #gnome_canvas_path_def and uses the
91    * passed @a bpath  as the contents.  The passed bpath should not be
92    * static as the path definition is editable when constructed with
93    * this function. Also, passed bpath will be freed with art_free, if
94    * path is destroyed, so use it with caution.
95    * For constructing a #gnome_canvas_path_def
96    * from (non-modifiable) bpath use
97    * #gnome_canvas_path_def_new_from_static_bpath.
98    * @param bpath Libart bezier path.
99    * @return The new canvas path definition that is populated with the
100    * passed bezier path, if the @a bpath  is bad <tt>0</tt> is returned.
101    */
102   static Glib::RefPtr<PathDef> create(ArtBpath& bpath);
103
104   //GnomeCanvasPathDef * gnome_canvas_path_def_new_from_static_bpath (ArtBpath * bpath);
105   //GnomeCanvasPathDef * gnome_canvas_path_def_new_from_foreign_bpath (ArtBpath * bpath);
106
107   //GnomeCanvasPathDef * gnome_canvas_path_def_concat (const GSList * list);
108   //GSList * gnome_canvas_path_def_split (const GnomeCanvasPathDef * path);
109   
110   /** This function creates a new GnomeCanvasPathDef that contains all of
111    * the open segments on the passed @a path .
112    * @return A new GnomeCanvasPathDef that contains all of the open segemtns in @a path .
113    */
114   Glib::RefPtr<PathDef> open_parts();
115   
116   /** This function returns a new GnomeCanvasPathDef that contains the
117    * all of close parts of passed @a path .
118    * @return A new GnomeCanvasPathDef that contains all of the closed
119    * parts of passed @a path .
120    */
121   Glib::RefPtr<PathDef> closed_parts();
122   
123   /** This function closes all of the open segments in the passed path
124    * and returns a new GnomeCanvasPathDef.
125    * @return A GnomeCanvasPathDef that contains the contents of @a path 
126    * but has modified the path is fully closed.
127    */
128   Glib::RefPtr<PathDef> close_all();
129
130   
131   /** Trims dynamic point array to exact length of path.
132    */
133   void finish();
134   
135   /** This function ensures that enough space for @a space  points is
136    * allocated at the end of the path.
137    * @param space Number of points to guarantee are allocated at the end of
138    * the path.
139    */
140   void ensure_space(int space);
141
142   
143   /** This function clears the contents of the passed @a path .
144    */
145   void reset();
146
147   
148   /** This function adds starts new subpath on @a path , and sets its
149    * starting point to @a x  and @a y . If current subpath is empty, it
150    * simply changes its starting coordinates to new values.
151    * @param x X coordinate.
152    * @param y Y coordinate.
153    */
154   void moveto(double x, double y);
155   
156   /** This function add a line segment to the passed @a path  with the
157    * specified @a x  and @a y  coordinates.
158    * @param x X coordinate.
159    * @param y Y coordinate.
160    */
161   void lineto(double x, double y);
162
163   
164   /** This functions adds a new line segment with loose endpoint to the path, or
165    * if endpoint is already loose, changes its coordinates to @a x , @a y . You
166    * can change the coordinates of loose endpoint as many times as you want,
167    * the last ones set will be fixed, if you continue line. This is useful
168    * for handling drawing with mouse.
169    * @param x X coordinate.
170    * @param y Y coordinate.
171    */
172   void lineto_moving(double x, double y);
173   
174   /** This function adds a bezier curve segment to the path definition.
175    * @param x0 First control point x coordinate.
176    * @param y0 First control point y coordinate.
177    * @param x1 Second control point x coordinate.
178    * @param y1 Second control point y coordinate.
179    * @param x2 End of curve x coordinate.
180    * @param y2 End of curve y coordinate.
181    */
182   void curveto(double x1, double y1, double x2, double y2, double x3, double y3);
183   
184   /** This function closes the last subpath of @a path , adding a ART_LINETO to
185    * subpath starting point, if needed and changing starting pathcode to
186    * ART_MOVETO
187    */
188   void closepath();
189
190   
191   /** This function closes the last subpath by setting the coordinates of
192    * the endpoint of the last segment (line or curve) to starting point.
193    */
194   void closepath_current();
195
196   Gnome::Art::Point currentpoint() const;
197
198   
199   /** This function returns a ArtBpath that consists of the path
200    * definition.
201    * @return ArtBpath.
202    */
203   ArtBpath* get_bpath() const;
204   
205   /** This function returns the first ArtBpath point in the definition.
206    * @return ArtBpath being the first point in the path definition or
207    * null if no points are defined.
208    */
209   ArtBpath* first_bpath() const;
210   
211   /** This function returns pointer to the last ArtBpath segment in the path
212    * definition.
213    * @return ArtBpath, being the last segment in the path definition or
214    * null if no line segments have been defined.
215    */
216   ArtBpath* last_bpath() const;
217
218   
219   /** This function is a boolean test to see if the path is empty,
220    * meaning containing no line segments.
221    * @return Boolean, indicating if the path is empty.
222    */
223   bool is_empty() const;
224   
225   /** This function returns the length of the path definition.  Not
226    * Euclidian length of the path but rather the number of points on the
227    * path.
228    * @return Integer, number of points on the path.
229    */
230   int length() const;
231   
232   /** This function is a boolean test checking to see if the path has a
233    * current point defined. Current point will be set by line operators,
234    * and cleared by closing subpath.
235    * @return Boolean, indicating if the path has a current point defined.
236    */
237   bool has_currentpoint() const;
238   
239   /** This function returns a boolean value indicating if the path has
240    * any open segments.
241    * @return Boolean, indicating if the path has any open segments.
242    */
243   bool any_open() const;
244   
245   /** This function returns a boolean value indicating if the path only
246    * contains open segments.
247    * @return Boolean, indicating if the path has all open segments.
248    */
249   bool all_open() const;
250   
251   /** This function returns a boolean valid indicating if the path has
252    * any closed segements.
253    * @return Boolean, indicating if the path has any closed segments.
254    */
255   bool any_closed() const;
256   
257   /** This function returns a boolean value indicating if the path only
258    * contains closed segments.
259    * @return Boolean, indicating if the path has all closed segments.
260    */
261   bool all_closed() const;
262
263
264 };
265
266 } /* namespace Canvas */
267
268 } /* namespace Gnome */
269
270
271 namespace Glib
272 {
273
274   /** @relates Gnome::Canvas::PathDef
275    * @param object The C instance
276    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
277    * @result A C++ instance that wraps this C instance.
278    */
279   Glib::RefPtr<Gnome::Canvas::PathDef> wrap(GnomeCanvasPathDef* object, bool take_copy = false);
280
281 } // namespace Glib
282
283 #endif /* _LIBGNOMECANVASMM_PATH_DEF_H */
284