1 /*
2  * gog-data-allocator.h :
3  *
4  * Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) version 3.
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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
19  * USA
20  */
21 
22 #ifndef GOG_DATA_ALLOCATOR_H
23 #define GOG_DATA_ALLOCATOR_H
24 
25 #include <goffice/goffice.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GOG_TYPE_DATA_EDITOR		(gog_data_editor_get_type ())
30 #define GOG_DATA_EDITOR(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_DATA_EDITOR, GogDataEditor))
31 #define GOG_IS_DATA_EDITOR(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_DATA_EDITOR))
32 #define GOG_DATA_EDITOR_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), GOG_TYPE_DATA_EDITOR, GogDataEditorClass))
33 #define GOG_IS_DATA_EDITOR_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GOG_TYPE_DATA_EDITOR))
34 #define GOG_DATA_EDITOR_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_INTERFACE ((o), GOG_TYPE_DATA_EDITOR, GogDataEditorClass))
35 
36 GType gog_data_editor_get_type (void);
37 
38 typedef struct {
39 	GTypeInterface		   base;
40 
41 	void     (*set_format)       (GogDataEditor *editor,
42 				      GOFormat const *fmt);
43 	void     (*set_value_double) (GogDataEditor *editor, double val,
44 				      GODateConventions const *date_conv);
45 } GogDataEditorClass;
46 
47 void gog_data_editor_set_format (GogDataEditor *editor,
48 				 GOFormat const *fmt);
49 void gog_data_editor_set_value_double (GogDataEditor *editor, double val,
50 				       GODateConventions const *date_conv);
51 
52 
53 
54 typedef struct {
55 	GTypeInterface		   base;
56 
57 	void	        (*allocate) (GogDataAllocator *a, GogPlot *plot);
58 	GogDataEditor * (*editor)   (GogDataAllocator *a, GogDataset *set,
59 				     int dim_i, GogDataType data_type);
60 } GogDataAllocatorClass;
61 
62 #define GOG_TYPE_DATA_ALLOCATOR		(gog_data_allocator_get_type ())
63 #define GOG_DATA_ALLOCATOR(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_DATA_ALLOCATOR, GogDataAllocator))
64 #define GOG_IS_DATA_ALLOCATOR(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_DATA_ALLOCATOR))
65 #define GOG_DATA_ALLOCATOR_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), GOG_TYPE_DATA_ALLOCATOR, GogDataAllocatorClass))
66 #define GOG_IS_DATA_ALLOCATOR_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GOG_TYPE_DATA_ALLOCATOR))
67 #define GOG_DATA_ALLOCATOR_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_INTERFACE ((o), GOG_TYPE_DATA_ALLOCATOR, GogDataAllocatorClass))
68 
69 GType gog_data_allocator_get_type (void);
70 
71 void	 gog_data_allocator_allocate (GogDataAllocator *dalloc, GogPlot *plot);
72 GogDataEditor *gog_data_allocator_editor (GogDataAllocator *dalloc,
73 					  GogDataset *set,
74 					  int dim_i, GogDataType data_type);
75 
76 G_END_DECLS
77 
78 #endif /* GOG_DATA_ALLOCATOR_H */
79