3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Hans Petter Jansson <hpj@ximian.com>
19 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
23 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
24 #error "Only <e-util/e-util.h> should be included directly."
32 /* Standard GObject macros */
36 (G_TYPE_CHECK_INSTANCE_CAST \
37 ((obj), E_TYPE_MAP, EMap))
38 #define E_MAP_CLASS(cls) \
39 (G_TYPE_CHECK_CLASS_CAST \
40 ((cls), E_TYPE_MAP, EMapClass))
41 #define E_IS_MAP(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE \
44 #define E_IS_MAP_CLASS(cls) \
45 (G_TYPE_CHECK_CLASS_TYPE \
47 #define E_MAP_GET_CLASS(obj) \
48 (G_TYPE_INSTANCE_GET_CLASS \
49 ((obj), E_TYPE_MAP, EMapClass))
53 typedef struct _EMap EMap
;
54 typedef struct _EMapClass EMapClass
;
55 typedef struct _EMapPrivate EMapPrivate
;
56 typedef struct _EMapPoint EMapPoint
;
64 GtkWidgetClass parent_class
;
66 /* Notification signals */
67 void (*zoom_fit
) (EMap
* view
);
69 /* GTK+ scrolling interface */
70 void (*set_scroll_adjustments
) (GtkWidget
* widget
,
72 GtkAdjustment
* vadj
);
75 /* The definition of Dot */
78 gchar
*name
; /* Can be NULL */
79 gdouble longitude
, latitude
;
86 GType
e_map_get_type (void) G_GNUC_CONST
;
88 EMap
*e_map_new (void);
90 /* Stop doing redraws when map data changes (e.g. by modifying points) */
91 void e_map_freeze (EMap
*map
);
93 /* Do an immediate repaint, and start doing realtime repaints again */
94 void e_map_thaw (EMap
*map
);
96 /* --- Coordinate translation --- */
98 /* Translates window-relative coords to lat/long */
99 void e_map_window_to_world (EMap
*map
,
100 gdouble win_x
, gdouble win_y
,
101 gdouble
*world_longitude
, gdouble
*world_latitude
);
103 /* Translates lat/long to window-relative coordinates. Note that the
104 * returned coordinates can be negative or greater than the current size
105 * of the allocation area */
106 void e_map_world_to_window (EMap
*map
,
107 gdouble world_longitude
, gdouble world_latitude
,
108 gdouble
*win_x
, gdouble
*win_y
);
112 gdouble
e_map_get_magnification (EMap
*map
);
114 /* Pass TRUE if we want the smooth zoom hack */
115 void e_map_set_smooth_zoom (EMap
*map
, gboolean state
);
117 /* TRUE if smooth zoom hack will be employed */
118 gboolean
e_map_get_smooth_zoom (EMap
*map
);
120 /* NB: Function definition will change shortly */
121 void e_map_zoom_to_location (EMap
*map
, gdouble longitude
, gdouble latitude
);
123 /* Zoom to mag factor 1.0 */
124 void e_map_zoom_out (EMap
*map
);
128 EMapPoint
*e_map_add_point (EMap
*map
, gchar
*name
,
129 gdouble longitude
, gdouble latitude
,
132 void e_map_remove_point (EMap
*map
, EMapPoint
*point
);
134 void e_map_point_get_location (EMapPoint
*point
,
135 gdouble
*longitude
, gdouble
*latitude
);
137 gchar
*e_map_point_get_name (EMapPoint
*point
);
139 guint32
e_map_point_get_color_rgba (EMapPoint
*point
);
141 void e_map_point_set_color_rgba (EMap
*map
, EMapPoint
*point
, guint32 color_rgba
);
143 void e_map_point_set_data (EMapPoint
*point
, gpointer data
);
145 gpointer
e_map_point_get_data (EMapPoint
*point
);
147 gboolean
e_map_point_is_in_view (EMap
*map
, EMapPoint
*point
);
149 EMapPoint
*e_map_get_closest_point (EMap
*map
, gdouble longitude
, gdouble latitude
,