]>
Commit | Line | Data |
---|---|---|
f33aa4e0 EB |
1 | /* |
2 | * viking -- GPS Data and Topo Analyzer, Explorer, and Manager | |
3 | * | |
4 | * Copyright (C) 2003-2007, Evan Battaglia <gtoevan@gmx.net> | |
5 | * | |
6 | * This program 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 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program 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 this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 | * | |
20 | */ | |
21 | #ifndef _VIKING_UIBUILDER_H | |
22 | #define _VIKING_UIBUILDER_H | |
23 | ||
24 | #include <gtk/gtk.h> | |
25 | ||
722b5481 RN |
26 | G_BEGIN_DECLS |
27 | ||
f33aa4e0 EB |
28 | /* Parameters (for I/O and Properties) */ |
29 | ||
30 | typedef union { | |
31 | gdouble d; | |
32 | guint32 u; | |
33 | gint32 i; | |
34 | gboolean b; | |
35 | const gchar *s; | |
36 | GdkColor c; | |
37 | GList *sl; | |
38 | } VikLayerParamData; | |
39 | ||
3671126d RN |
40 | /* id is index */ |
41 | typedef enum { | |
42 | VIK_LAYER_PARAM_DOUBLE=1, | |
43 | VIK_LAYER_PARAM_UINT, | |
44 | VIK_LAYER_PARAM_INT, | |
45 | ||
46 | /* in my_layer_set_param, if you want to use the string, you should dup it | |
47 | * in my_layer_get_param, the string returned will NOT be free'd, you are responsible for managing it (I think) */ | |
48 | VIK_LAYER_PARAM_STRING, | |
49 | VIK_LAYER_PARAM_BOOLEAN, | |
50 | VIK_LAYER_PARAM_COLOR, | |
51 | ||
52 | /* NOTE: string list works uniquely: data.sl should NOT be free'd when | |
53 | * the internals call get_param -- i.e. it should be managed w/in the layer. | |
54 | * The value passed by the internals into set_param should also be managed | |
55 | * by the layer -- i.e. free'd by the layer. | |
56 | */ | |
57 | ||
58 | VIK_LAYER_PARAM_STRING_LIST, | |
59 | } VikLayerParamType; | |
60 | ||
f33aa4e0 EB |
61 | typedef struct { |
62 | const gchar *name; | |
3671126d | 63 | VikLayerParamType type; |
f33aa4e0 EB |
64 | gint16 group; |
65 | const gchar *title; | |
66 | guint8 widget_type; | |
67 | gpointer widget_data; | |
68 | gpointer extra_widget_data; | |
e6994d8d | 69 | const gchar *tooltip; |
f33aa4e0 EB |
70 | } VikLayerParam; |
71 | ||
72 | enum { | |
73 | VIK_LAYER_NOT_IN_PROPERTIES=-2, | |
74 | VIK_LAYER_GROUP_NONE=-1 | |
75 | }; | |
76 | ||
77 | enum { | |
78 | VIK_LAYER_WIDGET_CHECKBUTTON=0, | |
79 | VIK_LAYER_WIDGET_RADIOGROUP, | |
80 | VIK_LAYER_WIDGET_RADIOGROUP_STATIC, | |
81 | VIK_LAYER_WIDGET_SPINBUTTON, | |
82 | VIK_LAYER_WIDGET_ENTRY, | |
d9d1084e | 83 | VIK_LAYER_WIDGET_PASSWORD, |
f33aa4e0 | 84 | VIK_LAYER_WIDGET_FILEENTRY, |
79672b85 | 85 | VIK_LAYER_WIDGET_FOLDERENTRY, |
f33aa4e0 EB |
86 | VIK_LAYER_WIDGET_HSCALE, |
87 | VIK_LAYER_WIDGET_COLOR, | |
88 | VIK_LAYER_WIDGET_COMBOBOX, | |
89 | VIK_LAYER_WIDGET_FILELIST, | |
90 | }; | |
91 | ||
92 | typedef struct { | |
93 | gdouble min; | |
94 | gdouble max; | |
95 | gdouble step; | |
96 | guint8 digits; | |
97 | } VikLayerParamScale; | |
98 | ||
17a1f8f9 | 99 | |
f33aa4e0 | 100 | |
f33aa4e0 | 101 | |
f33aa4e0 EB |
102 | |
103 | GtkWidget *a_uibuilder_new_widget ( VikLayerParam *param, VikLayerParamData data ); | |
104 | VikLayerParamData a_uibuilder_widget_get_value ( GtkWidget *widget, VikLayerParam *param ); | |
3671126d RN |
105 | gint a_uibuilder_properties_factory ( const gchar *dialog_name, |
106 | GtkWindow *parent, | |
107 | VikLayerParam *params, | |
108 | guint16 params_count, | |
109 | gchar **groups, | |
110 | guint8 groups_count, | |
111 | gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer,gboolean), | |
112 | gpointer pass_along1, | |
113 | gpointer pass_along2, | |
114 | VikLayerParamData (*getparam) (gpointer,guint16,gboolean), | |
115 | gpointer pass_along_getparam ); | |
158b3642 | 116 | /* pass_along1 and pass_along2 are for set_param first and last params */ |
f33aa4e0 | 117 | |
13fde155 | 118 | VikLayerParamData *a_uibuilder_run_dialog ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params, |
f33aa4e0 EB |
119 | guint16 params_count, gchar **groups, guint8 groups_count, |
120 | VikLayerParamData *params_defaults ); | |
121 | ||
122 | /* frees data from last (if ness) */ | |
123 | void a_uibuilder_free_paramdatas ( VikLayerParamData *paramdatas, VikLayerParam *params, guint16 params_count ); | |
124 | ||
722b5481 RN |
125 | G_END_DECLS |
126 | ||
f33aa4e0 | 127 | #endif |