Contents of /trunk/src/misc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 223 - (show annotations)
Tue Dec 1 20:03:51 2009 UTC (14 years, 5 months ago) by harbaum
File MIME type: text/plain
File size: 3916 byte(s)
Various pickers
1 /*
2 * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3 *
4 * This file is part of GPXView.
5 *
6 * GPXView is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GPXView is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GPXView. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef MISC_H
21 #define MISC_H
22
23 #define SIZE_NORMAL 0
24 #define SIZE_BIG 1 /* effect only on non-maemo */
25 #define SIZE_SMALL 2 /* effect only on maemo */
26
27 #define STRIKETHROUGH_NONE 0
28 #define STRIKETHROUGH 1
29 #define STRIKETHROUGH_RED 2
30
31 #ifdef USE_MAEMO
32 #define GTK_LABEL_BIG(a) gtk_label_new(a)
33 #define GTK_LABEL_SMALL(a) gtk_label_small(a)
34 GtkWidget *gtk_label_small(char *str);
35 #else
36 #define GTK_LABEL_SMALL(a) gtk_label_new(a)
37 #define GTK_LABEL_BIG(a) gtk_label_big(a)
38 GtkWidget *gtk_label_big(char *str);
39 #endif
40
41 gboolean pos_valid(pos_t *pos);
42
43 GtkWidget *gtk_label_attrib(char *str, int size, int strikethrough);
44 GtkWidget *gtk_button_attrib(char *str, int size, int strikethrough);
45 void gtk_label_attrib_set(GtkWidget *label,
46 char *str, int size, int strikethrough);
47
48 void pos_lat_str(char *str, int len, float latitude);
49 void pos_lon_str(char *str, int len, float longitude);
50 GtkWidget *pos_lat(float latitude, int size, int strikethrough);
51 GtkWidget *pos_lon(float longitude, int size, int strikethrough);
52 float pos_parse_lat(char *str);
53 float pos_parse_lon(char *str);
54 const char *pos_get_bearing_str(pos_t from, pos_t to);
55
56 void textbox_enable(GtkWidget *widget);
57 void textbox_disable(GtkWidget *widget);
58
59 int checkdir(char *dir);
60 char strlastchr(char *str);
61
62 pos_t *get_pos(appdata_t *appdata);
63
64 GtkWidget *lat_entry_new(float lat);
65 GtkWidget *lon_entry_new(float lon);
66 float lat_entry_get(GtkWidget *widget);
67 float lon_entry_get(GtkWidget *widget);
68 void lat_entry_set(GtkWidget *widget, float lat);
69 void lon_entry_set(GtkWidget *widget, float lon);
70
71 void lat_label_set(GtkWidget *widget, float lat);
72 void lon_label_set(GtkWidget *widget, float lon);
73 void lat_label_attrib_set(GtkWidget *widget, float lat,
74 int size, int strikethrough);
75 void lon_label_attrib_set(GtkWidget *widget, float lon,
76 int size, int strikethrough);
77
78 void distance_str(char *str, int len, float dist, gboolean mil);
79 float distance_parse(char *str, gboolean imperial);
80 GtkWidget *dist_entry_new(float dist, gboolean mil);
81 float dist_entry_get(GtkWidget *widget, gboolean mil);
82 void dist_entry_set(GtkWidget *widget, float dist, gboolean mil);
83
84 void angle_str(char *str, int len, float angle);
85 float angle_parse(char *str);
86 GtkWidget *angle_entry_new(float angle);
87 float angle_entry_get(GtkWidget *widget);
88 void angle_entry_set(GtkWidget *widget, float angle);
89
90 GtkWidget *left_label_new(char *str);
91
92 #ifndef USE_MAEMO
93 #ifdef ENABLE_BROWSER_INTERFACE
94 extern int browser_url(appdata_t *appdata, char *url);
95 #endif
96 #endif
97
98 void rmdir_recursive(char *path);
99 GtkWidget *link_button_attrib(appdata_t *appdata, char *str, char *url,
100 int size, int strikethrough);
101 GtkWidget *link_button_by_id(appdata_t *appdata, char *str,
102 const char *type, int id);
103 GtkWidget *link_icon_button_by_id(appdata_t *appdata, GtkWidget *icon,
104 const char *type, int id);
105 GtkWidget *simple_text_widget(char *text);
106
107 GtkWidget *preset_coordinate_picker(appdata_t *appdata, GtkWidget *lat_entry, GtkWidget *lon_entry);
108
109 GtkWidget *entry_new(void);
110
111 gboolean pos_differ(pos_t *pos1, pos_t *pos2);
112 gboolean pos_valid(pos_t *pos);
113
114 void misc_init(void);
115
116 #endif // MISC_H