]> git.street.me.uk Git - andy/viking.git/blame - src/uibuilder.h
Fix printing of DEBUG message since glib 2.32
[andy/viking.git] / src / uibuilder.h
CommitLineData
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
26/* Parameters (for I/O and Properties) */
27
28typedef union {
29 gdouble d;
30 guint32 u;
31 gint32 i;
32 gboolean b;
33 const gchar *s;
34 GdkColor c;
35 GList *sl;
36} VikLayerParamData;
37
38typedef struct {
39 const gchar *name;
40 guint8 type;
41 gint16 group;
42 const gchar *title;
43 guint8 widget_type;
44 gpointer widget_data;
45 gpointer extra_widget_data;
46} VikLayerParam;
47
48enum {
49VIK_LAYER_NOT_IN_PROPERTIES=-2,
50VIK_LAYER_GROUP_NONE=-1
51};
52
53enum {
54VIK_LAYER_WIDGET_CHECKBUTTON=0,
55VIK_LAYER_WIDGET_RADIOGROUP,
56VIK_LAYER_WIDGET_RADIOGROUP_STATIC,
57VIK_LAYER_WIDGET_SPINBUTTON,
58VIK_LAYER_WIDGET_ENTRY,
d9d1084e 59VIK_LAYER_WIDGET_PASSWORD,
f33aa4e0 60VIK_LAYER_WIDGET_FILEENTRY,
79672b85 61VIK_LAYER_WIDGET_FOLDERENTRY,
f33aa4e0
EB
62VIK_LAYER_WIDGET_HSCALE,
63VIK_LAYER_WIDGET_COLOR,
64VIK_LAYER_WIDGET_COMBOBOX,
65VIK_LAYER_WIDGET_FILELIST,
66};
67
68typedef struct {
69 gdouble min;
70 gdouble max;
71 gdouble step;
72 guint8 digits;
73} VikLayerParamScale;
74
75/* id is index */
76enum {
77VIK_LAYER_PARAM_DOUBLE=1,
78VIK_LAYER_PARAM_UINT,
79VIK_LAYER_PARAM_INT,
17a1f8f9
EB
80
81/* in my_layer_set_param, if you want to use the string, you should dup it
82 * in my_layer_get_param, the string returned will NOT be free'd, you are responsible for managing it (I think) */
f33aa4e0
EB
83VIK_LAYER_PARAM_STRING,
84VIK_LAYER_PARAM_BOOLEAN,
85VIK_LAYER_PARAM_COLOR,
86
17a1f8f9 87/* NOTE: string list works uniquely: data.sl should NOT be free'd when
f33aa4e0
EB
88 * the internals call get_param -- i.e. it should be managed w/in the layer.
89 * The value passed by the internals into set_param should also be managed
90 * by the layer -- i.e. free'd by the layer.
91 */
92
93VIK_LAYER_PARAM_STRING_LIST,
94};
95
96GtkWidget *a_uibuilder_new_widget ( VikLayerParam *param, VikLayerParamData data );
97VikLayerParamData a_uibuilder_widget_get_value ( GtkWidget *widget, VikLayerParam *param );
13fde155 98gint a_uibuilder_properties_factory ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
158b3642
RN
99 guint16 params_count, gchar **groups, guint8 groups_count,
100 gboolean (*setparam) (gpointer,guint16,VikLayerParamData,gpointer,gboolean),
101 gpointer pass_along1, gpointer pass_along2,
102 VikLayerParamData (*getparam) (gpointer,guint16,gboolean),
103 gpointer pass_along_getparam );
104 /* pass_along1 and pass_along2 are for set_param first and last params */
f33aa4e0
EB
105
106
13fde155 107VikLayerParamData *a_uibuilder_run_dialog ( const gchar *dialog_name, GtkWindow *parent, VikLayerParam *params,
f33aa4e0
EB
108 guint16 params_count, gchar **groups, guint8 groups_count,
109 VikLayerParamData *params_defaults );
110
111/* frees data from last (if ness) */
112void a_uibuilder_free_paramdatas ( VikLayerParamData *paramdatas, VikLayerParam *params, guint16 params_count );
113
114#endif