]> err.no Git - mapper/blob - src/gtkcompass.h
Add header and cast properly.
[mapper] / src / gtkcompass.h
1 /*
2  * GtkCompass: Display a compass with heading and target
3  * Copyright (C) 2007 Kaj-Michael Lang
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 #ifndef __GTK_COMPASS_H__
20 #define __GTK_COMPASS_H__
21
22 #include <gtk/gtk.h>
23
24 #include "gpsdata.h"
25
26 G_BEGIN_DECLS
27
28 #define GTK_COMPASS_TYPE                        (gtk_compass_get_type ())
29 #define GTK_COMPASS(obj)                        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_COMPASS_TYPE, GtkCompass))
30 #define GTK_COMPASS_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_COMPASS_TYPE, GtkCompassClass))
31 #define GTK_IS_COMPASS(obj)                     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_COMPASS_TYPE))
32
33 typedef struct _GtkCompass                      GtkCompass;
34 typedef struct _GtkCompassClass         GtkCompassClass;
35
36 struct _GtkCompass {
37         GtkDrawingArea widget;
38         GdkGC *gc_h;
39         GdkGC *gc_w;
40         GdkGC *gc_d;
41         guint width, height;
42         guint size;
43         guint xoffset, yoffset;
44
45         PangoContext *context;
46         PangoLayout *layout;
47         PangoFontDescription *fontdesc;
48
49         GpsData *data;
50         gfloat heading;
51         gboolean dest_valid;
52         gboolean way_valid;
53         gfloat dest_heading;
54         gfloat way_heading;
55         gint esid;
56 };
57
58 struct _GtkCompassClass {
59         GtkWidgetClass parent_class;
60 };
61
62 GType gtk_compass_get_type(void);
63 GtkWidget* gtk_compass_new(GpsData *data);
64 void gtk_compass_refresh(GtkWidget *widget);
65 void gtk_compass_set_way_heading(GtkWidget *widget, gboolean valid, gfloat heading);
66 void gtk_compass_set_dest_heading(GtkWidget *widget, gboolean valid, gfloat heading);
67
68 G_END_DECLS
69
70 #endif /* __GTK_COMPASS_H__ */