Clipboard: check mime type before pasting image.
[gnumeric.git] / src / sheet-control.c
blob1e23806744d6f1c86c793f273867e5ed48a5459e
1 /* vim: set sw=8: */
3 /*
4 * sheet-control.c:
6 * Copyright (C) 2001 Jon K Hellan (hellan@acm.org)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 * USA
23 #include <gnumeric-config.h>
24 #include "gnumeric.h"
25 #include "sheet-control-priv.h"
26 #include "sheet-view.h"
28 #include <gsf/gsf-impl-utils.h>
30 #define SC_CLASS(o) SHEET_CONTROL_CLASS (G_OBJECT_GET_CLASS (o))
31 #define SC_VIRTUAL_FULL(func, handle, arglist, call) \
32 void sc_ ## func arglist \
33 { \
34 SheetControlClass *sc_class; \
36 g_return_if_fail (GNM_IS_SC (sc)); \
38 sc_class = SC_CLASS (sc); \
39 if (sc_class->handle != NULL) \
40 sc_class->handle call; \
42 #define SC_VIRTUAL(func, arglist, call) SC_VIRTUAL_FULL(func, func, arglist, call)
44 /*****************************************************************************/
46 static GObjectClass *parent_class;
48 static void
49 sc_finalize (GObject *obj)
51 /* Commented out until needed */
52 /* SheetControl *sc = GNM_SC (obj); */
53 parent_class->finalize (obj);
56 static void
57 sc_class_init (GObjectClass *object_class)
59 parent_class = g_type_class_peek_parent (object_class);
60 object_class->finalize = sc_finalize;
63 GSF_CLASS (SheetControl, sheet_control,
64 sc_class_init, NULL, G_TYPE_OBJECT)
66 /**
67 * sc_wbc:
68 * @sc: #SheetControl
70 * Returns: (transfer none): the workbook control.
71 **/
72 WorkbookControl *
73 sc_wbc (SheetControl const *sc)
75 g_return_val_if_fail (GNM_IS_SC (sc), NULL);
76 return sc->wbc;
79 /**
80 * sc_sheet:
81 * @sc: #SheetControl
83 * Returns: (transfer none): the sheet.
84 **/
85 Sheet *
86 sc_sheet (SheetControl const *sc)
88 g_return_val_if_fail (GNM_IS_SC (sc), NULL);
89 return sc->view ? sc->view->sheet : NULL;
92 /**
93 * sc_view:
94 * @sc: #SheetControl
96 * Returns: (transfer none): the sheet view.
97 **/
98 SheetView *
99 sc_view (SheetControl const *sc)
101 g_return_val_if_fail (GNM_IS_SC (sc), NULL);
102 return sc->view;
105 SC_VIRTUAL (resize, (SheetControl *sc, gboolean force_scroll), (sc, force_scroll))
107 SC_VIRTUAL (redraw_all, (SheetControl *sc, gboolean headers), (sc, headers))
108 SC_VIRTUAL (redraw_range,
109 (SheetControl *sc, GnmRange const *r),
110 (sc, r))
111 SC_VIRTUAL (redraw_headers,
112 (SheetControl *sc,
113 gboolean const col, gboolean const row, GnmRange const * r),
114 (sc, col, row, r))
116 SC_VIRTUAL (ant, (SheetControl *sc), (sc))
117 SC_VIRTUAL (unant, (SheetControl *sc), (sc))
119 SC_VIRTUAL (scrollbar_config, (SheetControl *sc), (sc))
121 SC_VIRTUAL (mode_edit, (SheetControl *sc), (sc))
123 SC_VIRTUAL (set_top_left,
124 (SheetControl *sc, int col, int row),
125 (sc, col, row))
126 SC_VIRTUAL (recompute_visible_region,
127 (SheetControl *sc, gboolean full_recompute),
128 (sc, full_recompute))
129 SC_VIRTUAL (make_cell_visible,
130 (SheetControl *sc, int col, int row, gboolean couple_panes),
131 (sc, col, row, couple_panes))
133 SC_VIRTUAL (cursor_bound, (SheetControl *sc, GnmRange const *r), (sc, r))
134 SC_VIRTUAL (set_panes, (SheetControl *sc), (sc))
136 SC_VIRTUAL (object_create_view, (SheetControl *sc, SheetObject *so), (sc, so))
137 SC_VIRTUAL (scale_changed, (SheetControl *sc), (sc))
139 SC_VIRTUAL (show_im_tooltip, (SheetControl *sc, GnmInputMsg *im, GnmCellPos *pos), (sc, im, pos))