2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _LIBGNOMECANVASMM_PATH_DEF_H
4 #define _LIBGNOMECANVASMM_PATH_DEF_H
13 * Copyright (C) 2002 The libgnomecanvasmm Development Team
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.
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.
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.
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>
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 typedef PathDef CppObjectType;
49 typedef GnomeCanvasPathDef BaseObjectType;
50 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
52 static Glib::RefPtr<PathDef> create();
54 // For use with Glib::RefPtr<> only.
55 void reference() const;
56 void unreference() const;
58 ///Provides access to the underlying C instance.
59 GnomeCanvasPathDef* gobj();
61 ///Provides access to the underlying C instance.
62 const GnomeCanvasPathDef* gobj() const;
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;
68 // Do not derive this. Gnome::Canvas::PathDef can neither be constructed nor deleted.
70 void operator delete(void*, size_t);
74 PathDef(const PathDef&);
75 PathDef& operator=(const PathDef&);
79 //gtkmmproc error: gnome_canvas_path_def_new : method defs lookup failed (1)
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
85 * @param length Number of points to allocate for the path.
86 * @return The new canvas path definition.
88 static Glib::RefPtr<PathDef> create(int length);
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.
102 static Glib::RefPtr<PathDef> create(ArtBpath& bpath);
104 //GnomeCanvasPathDef * gnome_canvas_path_def_new_from_static_bpath (ArtBpath * bpath);
105 //GnomeCanvasPathDef * gnome_canvas_path_def_new_from_foreign_bpath (ArtBpath * bpath);
107 //GnomeCanvasPathDef * gnome_canvas_path_def_concat (const GSList * list);
108 //GSList * gnome_canvas_path_def_split (const GnomeCanvasPathDef * path);
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 .
114 Glib::RefPtr<PathDef> open_parts();
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 .
121 Glib::RefPtr<PathDef> closed_parts();
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.
128 Glib::RefPtr<PathDef> close_all();
131 /** Trims dynamic point array to exact length of path.
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
140 void ensure_space(int space);
143 /** This function clears the contents of the passed @a path .
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.
154 void moveto(double x, double y);
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.
161 void lineto(double x, double y);
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.
172 void lineto_moving(double x, double y);
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.
182 void curveto(double x1, double y1, double x2, double y2, double x3, double y3);
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
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.
194 void closepath_current();
196 Gnome::Art::Point currentpoint() const;
199 /** This function returns a ArtBpath that consists of the path
203 ArtBpath* get_bpath() const;
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.
209 ArtBpath* first_bpath() const;
211 /** This function returns pointer to the last ArtBpath segment in the path
213 * @return ArtBpath, being the last segment in the path definition or
214 * null if no line segments have been defined.
216 ArtBpath* last_bpath() const;
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.
223 bool is_empty() const;
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
228 * @return Integer, number of points on the path.
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.
237 bool has_currentpoint() const;
239 /** This function returns a boolean value indicating if the path has
241 * @return Boolean, indicating if the path has any open segments.
243 bool any_open() const;
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.
249 bool all_open() const;
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.
255 bool any_closed() const;
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.
261 bool all_closed() const;
266 } /* namespace Canvas */
268 } /* namespace Gnome */
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.
279 Glib::RefPtr<Gnome::Canvas::PathDef> wrap(GnomeCanvasPathDef* object, bool take_copy = false);
283 #endif /* _LIBGNOMECANVASMM_PATH_DEF_H */