1 /*
2  *                            COPYRIGHT
3  *
4  *  PCB, interactive printed circuit board design
5  *  Copyright (C) 2009  PCB Contributors (see ChangeLog for details)
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License along
18  *  with this program; if not, write to the Free Software Foundation, Inc.,
19  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  *  Contact addresses for paper mail and Email:
22  *  Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23  *  Thomas.Nau@rz.uni-ulm.de
24  *
25  */
26 
27 #ifndef __GHID_TRACKBALL_H__
28 #define __GHID_TRACKBALL_H__
29 
30 
31 #define GHID_TYPE_TRACKBALL           (ghid_trackball_get_type())
32 #define GHID_TRACKBALL(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_TYPE_TRACKBALL, GhidTrackball))
33 #define GHID_TRACKBALL_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),  GHID_TYPE_TRACKBALL, GhidTrackballClass))
34 #define GHID_IS_TRACKBALL(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_TYPE_TRACKBALL))
35 #define GHID_TRACKBALL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),  GHID_TYPE_TRACKBALL, GhidTrackballClass))
36 
37 typedef struct _GhidTrackballClass GhidTrackballClass;
38 typedef struct _GhidTrackball GhidTrackball;
39 
40 
41 struct _GhidTrackballClass
42 {
43   GtkVBoxClass parent_class;
44 
45   void (*rotation_changed) (GhidTrackball *ball, gpointer rotation, gpointer user_data);
46   void (*view_2d_changed) (GhidTrackball *ball, gboolean view_2d, gpointer user_data);
47 };
48 
49 struct _GhidTrackball
50 {
51   GtkVBox parent_instance;
52 
53   GtkWidget *drawing_area;
54   GtkWidget *view_2d;
55 
56   gboolean dragging;
57   gdouble x1, y1;
58 
59   float quart1[4];
60   float quart2[4];
61 };
62 
63 
64 GType ghid_trackball_get_type (void);
65 
66 GtkWidget *ghid_trackball_new (void);
67 
68 #endif /* __GHID_TRACKBALL_H__ */
69