Contents of /trunk/src/josm_presets.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Tue Dec 9 20:06:06 2008 UTC (15 years, 5 months ago) by harbaum
Original Path: src/josm_presets.h
File MIME type: text/plain
File size: 2124 byte(s)
Initial import
1 harbaum 1 /*
2     * Copyright (C) 2008 Till Harbaum <till@harbaum.org>.
3     *
4     * This file is part of OSM2Go.
5     *
6     * OSM2Go 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     * OSM2Go 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 OSM2Go. If not, see <http://www.gnu.org/licenses/>.
18     */
19    
20     #ifndef JOSM_PRESETS_H
21     #define JOSM_PRESETS_H
22    
23     // set this if _all_ josm icons are in data/presets
24     // #define JOSM_PATH_ADJUST
25    
26     typedef enum {
27     WIDGET_TYPE_LABEL = 0,
28     WIDGET_TYPE_SEPARATOR,
29     WIDGET_TYPE_COMBO,
30     WIDGET_TYPE_CHECK,
31     WIDGET_TYPE_TEXT,
32     WIDGET_TYPE_KEY
33     } presets_widget_type_t;
34    
35     typedef struct presets_value_s {
36     char *text;
37     struct presets_value_s *next;
38     } presets_value_t;
39    
40    
41     typedef struct presets_widget_s {
42     presets_widget_type_t type;
43    
44     char *key, *text;
45     gboolean del_if_empty;
46    
47     union {
48     /* a tag with an arbitrary text value */
49     struct {
50     char *def;
51     } text_w;
52    
53     /* a combo box with pre-defined values */
54     struct {
55     char *def;
56     presets_value_t *values;
57     } combo_w;
58    
59     /* a key is just a static key */
60     struct {
61     char *value;
62     } key_w;
63    
64     /* single checkbox */
65     struct {
66     gboolean def;
67     } check_w;
68    
69     };
70    
71     struct presets_widget_s *next;
72     } presets_widget_t;
73    
74     typedef struct presets_item_s {
75     char *name, *icon;
76     gboolean is_group;
77    
78     union {
79     presets_widget_t *widget;
80     struct presets_item_s *group;
81     };
82    
83     struct presets_item_s *next;
84     } presets_item_t;
85    
86     presets_item_t *josm_presets_load(void);
87     GtkWidget *josm_presets_select(appdata_t *appdata, tag_context_t *tag_context);
88     void josm_presets_free(presets_item_t *presets);
89     char *josm_icon_name_adjust(char *name);
90    
91     #endif // JOSM_PRESETS_H