1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright (C) 1999-2008 Jody Goldberg (jody@gnome.org)
6 * Copyright (C) 2002-2008 Morten Welinder (terra@gnome.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) version 3.
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
23 #ifndef GNM_COMMAND_IMPL_H
24 #define GNM_COMMAND_IMPL_H
27 #include <gsf/gsf-impl-utils.h>
28 #include <glib-object.h>
34 /* primary sheet associated with command, or NULL. */
37 /* See truncate_undo_info. */
40 /* A string to put in the menu */
41 char const *cmd_descriptor
;
43 /* State of workbook before the commands was undo. */
44 gboolean workbook_modified_before_do
;
47 typedef gboolean (* UndoCmd
) (GnmCommand
*self
, WorkbookControl
*wbc
);
48 typedef gboolean (* RedoCmd
) (GnmCommand
*self
, WorkbookControl
*wbc
);
49 typedef void (* RepeatCmd
) (GnmCommand
const *orig
, WorkbookControl
*wbc
);
52 GObjectClass parent_class
;
59 GType
gnm_command_get_type (void);
60 void gnm_command_finalize (GObject
*obj
);
61 gboolean
gnm_command_push_undo (WorkbookControl
*wbc
, GObject
*obj
);
63 #define GNM_COMMAND_TYPE (gnm_command_get_type ())
64 #define MAKE_GNM_COMMAND(type, func, repeat) \
66 func ## _undo (GnmCommand *me, WorkbookControl *wbc); \
68 func ## _redo (GnmCommand *me, WorkbookControl *wbc); \
70 func ## _finalize (GObject *object); \
72 func ## _class_init (GnmCommandClass *parent) \
74 parent->undo_cmd = (UndoCmd)& func ## _undo; \
75 parent->redo_cmd = (RedoCmd)& func ## _redo; \
76 parent->repeat_cmd = repeat; \
77 parent->parent_class.finalize = & func ## _finalize; \
79 typedef GnmCommandClass type ## Class; \
80 static GSF_CLASS (type, func, \
81 func ## _class_init, NULL, GNM_COMMAND_TYPE)
85 #endif /* GNM_COMMAND_IMPL_H */