Compilation: don't compile dialogs separately.
[gnumeric.git] / src / sheet-object-impl.h
blobe055ee04cb0931d8468d001be26af2c1ad80ff42
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_SHEET_OBJECT_IMPL_H_
3 # define _GNM_SHEET_OBJECT_IMPL_H_
5 G_BEGIN_DECLS
7 #include "sheet-object.h"
8 #include <goffice/goffice.h>
9 #include <gsf/gsf-libxml.h>
10 #include <libxml/tree.h>
11 #include <glib-object.h>
12 #include <gtk/gtk.h>
14 typedef enum {
15 SHEET_OBJECT_IS_VISIBLE = 1 << 0, /* user selectable */
16 SHEET_OBJECT_PRINT = 1 << 1,
17 SHEET_OBJECT_CAN_PRESS = 1 << 2,
18 SHEET_OBJECT_CAN_RESIZE = 1 << 3,
19 SHEET_OBJECT_CAN_EDIT = 1 << 4,
21 /* Gnumeric specific properties */
22 SHEET_OBJECT_MOVE_WITH_CELLS = 1 << 16,
23 SHEET_OBJECT_SIZE_WITH_CELLS = 1 << 17,
24 SHEET_OBJECT_OBSCURED = 1 << 18 /* cells associated with region are hidden */
25 } SheetObjectFlags;
27 struct _SheetObject {
28 GObject parent_object;
29 Sheet *sheet;
30 GList *realized_list;
31 SheetObjectAnchor anchor;
32 SheetObjectFlags flags;
33 char *name;
36 typedef void (*SheetObjectActionFunc) (SheetObject *so, SheetControl *sc);
37 typedef gboolean (*SheetObjectEnableActionFunc) (SheetObject const *so);
38 typedef struct {
39 char const *icon; /* optionally NULL */
40 char const *label; /* NULL for separators */
41 char const *msg_domain; /* for plugins to specify translations */
42 int submenu; /* > 1 starts a menu, < 1 end one */
43 SheetObjectActionFunc func;
44 SheetObjectEnableActionFunc enable_func;
45 } SheetObjectAction;
47 typedef struct {
48 GObjectClass parent_class;
50 /* Signals */
51 void (*bounds_changed) (SheetObject *so);
52 void (*unrealized) (SheetObject *so);
53 void (*signal_pad1) (void);
54 void (*signal_pad2) (void);
56 /* Virtual methods */
57 gboolean (*remove_from_sheet) (SheetObject *so);
58 gboolean (*assign_to_sheet) (SheetObject *so,
59 Sheet *sheet);
61 SheetObjectView *(*new_view) (SheetObject *so,
62 SheetObjectViewContainer *container);
63 void (*populate_menu) (SheetObject *so,
64 GPtrArray *actions);
65 void (*user_config) (SheetObject *so,
66 SheetControl *s_control);
67 void (*prep_sax_parser) (SheetObject *so,
68 GsfXMLIn *xin, xmlChar const **attrs,
69 GnmConventions const *convs);
70 void (*write_xml_sax) (SheetObject const *so,
71 GsfXMLOut *output,
72 GnmConventions const *convs);
73 void (*copy) (SheetObject *dst,
74 SheetObject const *src);
76 void (*default_size) (SheetObject const *so,
77 double *w, double *h);
79 void (*draw_cairo) (SheetObject const *so, cairo_t *cr,
80 double width, double height);
82 void (*foreach_dep) (SheetObject *so,
83 SheetObjectForeachDepFunc func,
84 gpointer user);
86 void (*func_pad1) (void);
87 void (*func_pad2) (void);
90 * If false, we draw a rectangle where the object is going to
91 * be layed out If true, we draw the object while laying
92 * it out on the sheet.
94 gboolean rubber_band_directly;
97 * If FALSE, a mouse click will select the object.
99 gboolean interactive;
101 char const *xml_export_name;
103 void *data_pad1;
104 void *data_pad2;
105 void *data_pad3;
106 void *data_pad4;
107 } SheetObjectClass;
108 #define GNM_SO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNM_SO_TYPE, SheetObjectClass))
110 /***************************************************************************/
112 struct _SheetObjectView {
113 GocGroup base;
115 GnmSOResizeMode resize_mode;
118 typedef struct {
119 GocGroupClass base;
121 void (*active) (SheetObjectView *sov, gboolean is_active);
122 void (*set_bounds) (SheetObjectView *sov,
123 double const *coords, gboolean visible);
124 } SheetObjectViewClass;
126 #define GNM_SO_VIEW_TYPE (sheet_object_view_get_type ())
127 #define GNM_SO_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNM_SO_VIEW_TYPE, SheetObjectView))
128 #define GNM_IS_SO_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNM_SO_VIEW_TYPE))
129 #define GNM_SO_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNM_SO_VIEW_TYPE, SheetObjectViewIface))
130 #define GNM_IS_SO_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GNM_SO_VIEW_TYPE))
131 #define GNM_SO_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNM_SO_VIEW_TYPE, SheetObjectViewClass))
133 GType sheet_object_view_get_type (void);
134 SheetObject *sheet_object_view_get_so (SheetObjectView *sov);
135 void sheet_object_view_set_bounds (SheetObjectView *sov,
136 double const *coords,
137 gboolean visible);
139 /***************************************************************************/
141 typedef struct {
142 GTypeInterface base;
144 /* Map between anchors and un-normalized coordinates */
145 void (*anchor_to_coords) (SheetObjectViewContainer *sovc,
146 SheetObjectAnchor const *input, double *output);
147 void (*coords_to_anchor) (SheetObjectViewContainer *sovc,
148 double const *input, SheetObjectAnchor *output);
149 } SheetObjectViewContainerIface;
151 #if 0
152 void so_vc_anchor_to_coords (SheetObjectViewContainer *sovc,
153 SheetObjectAnchor const *input, double *output);
154 void so_vc_coords_to_anchor (SheetObjectViewContainer *sovc,
155 double const *input, SheetObjectAnchor *output);
156 #endif
158 /***************************************************************************/
160 typedef struct {
161 GTypeInterface base;
163 GtkTargetList *(*get_target_list) (SheetObject const *so);
164 void (*write_image) (SheetObject const *so,
165 char const *format,
166 double resolution,
167 GsfOutput *output,
168 GError **err);
169 } SheetObjectImageableIface;
171 /***************************************************************************/
173 typedef struct {
174 GTypeInterface base;
176 GtkTargetList *(*get_target_list) (SheetObject const *so);
177 void (*write_object) (SheetObject const *so,
178 char const *format,
179 GsfOutput *output, GError **err,
180 GnmConventions const *convs);
181 } SheetObjectExportableIface;
183 G_END_DECLS
185 #endif /* _GNM_SHEET_OBJECT_IMPL_H_ */