~ubuntu-branches/ubuntu/gutsy/goocanvas/gutsy

« back to all changes in this revision

Viewing changes to src/goocanvaspolyline.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-08-28 11:47:12 UTC
  • Revision ID: james.westby@ubuntu.com-20060828114712-ejoo9vy6ckao9cvs
Tags: upstream-0.4
ImportĀ upstreamĀ versionĀ 0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * GooCanvas. Copyright (C) 2005 Damon Chaplin.
 
3
 * Released under the GNU LGPL license. See COPYING for details.
 
4
 *
 
5
 * goocanvaspolyline.h - polyline item, with optional arrows.
 
6
 */
 
7
#ifndef __GOO_CANVAS_POLYLINE_H__
 
8
#define __GOO_CANVAS_POLYLINE_H__
 
9
 
 
10
#include <gtk/gtk.h>
 
11
#include "goocanvasitemsimple.h"
 
12
 
 
13
G_BEGIN_DECLS
 
14
 
 
15
 
 
16
/**
 
17
 * GooCanvasPoints
 
18
 * @coords: the coordinates of the points, in pairs.
 
19
 * @num_points: the number of points.
 
20
 * @ref_count: the reference count of the struct.
 
21
 *
 
22
 * #GooCairoPoints represents an array of points.
 
23
 */
 
24
typedef struct {
 
25
  double *coords;
 
26
  int num_points;
 
27
  int ref_count;
 
28
} GooCanvasPoints;
 
29
 
 
30
#define GOO_TYPE_CANVAS_POINTS goo_canvas_points_get_type()
 
31
GType            goo_canvas_points_get_type (void);
 
32
GooCanvasPoints* goo_canvas_points_new      (int              num_points);
 
33
GooCanvasPoints* goo_canvas_points_ref      (GooCanvasPoints *points);
 
34
void             goo_canvas_points_unref    (GooCanvasPoints *points);
 
35
 
 
36
 
 
37
#define GOO_TYPE_CANVAS_POLYLINE            (goo_canvas_polyline_get_type ())
 
38
#define GOO_CANVAS_POLYLINE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GOO_TYPE_CANVAS_POLYLINE, GooCanvasPolyline))
 
39
#define GOO_CANVAS_POLYLINE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GOO_TYPE_CANVAS_POLYLINE, GooCanvasPolylineClass))
 
40
#define GOO_IS_CANVAS_POLYLINE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GOO_TYPE_CANVAS_POLYLINE))
 
41
#define GOO_IS_CANVAS_POLYLINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GOO_TYPE_CANVAS_POLYLINE))
 
42
#define GOO_CANVAS_POLYLINE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GOO_TYPE_CANVAS_POLYLINE, GooCanvasPolylineClass))
 
43
 
 
44
#define NUM_ARROW_POINTS     5          /* number of points in an arrowhead */
 
45
 
 
46
typedef struct _GooCanvasPolylineArrowData GooCanvasPolylineArrowData;
 
47
struct _GooCanvasPolylineArrowData
 
48
{
 
49
  /* These are specified in multiples of the line width, e.g. if arrow_width
 
50
     is 2 the width of the arrow will be twice the width of the line. */
 
51
  gdouble arrow_width, arrow_length, arrow_tip_length;
 
52
 
 
53
  gdouble line_start[2], line_end[2];
 
54
  gdouble start_arrow_coords[NUM_ARROW_POINTS * 2];
 
55
  gdouble end_arrow_coords[NUM_ARROW_POINTS * 2];
 
56
};
 
57
 
 
58
 
 
59
typedef struct _GooCanvasPolyline       GooCanvasPolyline;
 
60
typedef struct _GooCanvasPolylineClass  GooCanvasPolylineClass;
 
61
 
 
62
/**
 
63
 * GooCanvasPolyline
 
64
 *
 
65
 * The #GooCanvasPolyline-struct struct contains private data only.
 
66
 */
 
67
struct _GooCanvasPolyline
 
68
{
 
69
  GooCanvasItemSimple parent;
 
70
 
 
71
  gdouble *coords;
 
72
 
 
73
  GooCanvasPolylineArrowData *arrow_data;
 
74
 
 
75
  guint num_points         : 16;
 
76
  guint close_path         : 1;
 
77
  guint start_arrow        : 1;
 
78
  guint end_arrow          : 1;
 
79
  guint reconfigure_arrows : 1;
 
80
};
 
81
 
 
82
struct _GooCanvasPolylineClass
 
83
{
 
84
  GooCanvasItemSimpleClass parent_class;
 
85
};
 
86
 
 
87
 
 
88
GType           goo_canvas_polyline_get_type      (void) G_GNUC_CONST;
 
89
GooCanvasItem*  goo_canvas_polyline_new           (GooCanvasItem *parent,
 
90
                                                   gboolean       close_path,
 
91
                                                   gint           num_points,
 
92
                                                   ...);
 
93
 
 
94
GooCanvasItem*  goo_canvas_polyline_new_line      (GooCanvasItem *parent,
 
95
                                                   gdouble        x1,
 
96
                                                   gdouble        y1,
 
97
                                                   gdouble        x2,
 
98
                                                   gdouble        y2,
 
99
                                                   const gchar   *first_property,
 
100
                                                   ...);
 
101
 
 
102
 
 
103
G_END_DECLS
 
104
 
 
105
#endif /* __GOO_CANVAS_POLYLINE_H__ */