4 * Copyright (C) 1999-2008 Jody Goldberg (jody@gnome.org)
5 * Copyright (C) 2002-2008 Morten Welinder (terra@gnome.org)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) version 3.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 #ifndef GNM_COMMAND_IMPL_H
23 #define GNM_COMMAND_IMPL_H
26 #include <gsf/gsf-impl-utils.h>
27 #include <glib-object.h>
33 /* primary sheet associated with command, or NULL. */
36 /* See truncate_undo_info. */
39 /* A string to put in the menu */
40 char const *cmd_descriptor
;
42 /* State of workbook before the commands was undo. */
43 gboolean workbook_modified_before_do
;
46 typedef gboolean (* UndoCmd
) (GnmCommand
*self
, WorkbookControl
*wbc
);
47 typedef gboolean (* RedoCmd
) (GnmCommand
*self
, WorkbookControl
*wbc
);
48 typedef void (* RepeatCmd
) (GnmCommand
const *orig
, WorkbookControl
*wbc
);
51 GObjectClass parent_class
;
58 GType
gnm_command_get_type (void);
59 void gnm_command_finalize (GObject
*obj
);
60 gboolean
gnm_command_push_undo (WorkbookControl
*wbc
, GObject
*obj
);
62 #define GNM_COMMAND_TYPE (gnm_command_get_type ())
63 #define MAKE_GNM_COMMAND(type, func, repeat) \
65 func ## _undo (GnmCommand *me, WorkbookControl *wbc); \
67 func ## _redo (GnmCommand *me, WorkbookControl *wbc); \
69 func ## _finalize (GObject *object); \
71 func ## _class_init (GnmCommandClass *parent) \
73 parent->undo_cmd = (UndoCmd)& func ## _undo; \
74 parent->redo_cmd = (RedoCmd)& func ## _redo; \
75 parent->repeat_cmd = repeat; \
76 parent->parent_class.finalize = & func ## _finalize; \
78 typedef GnmCommandClass type ## Class; \
79 static GSF_CLASS (type, func, \
80 func ## _class_init, NULL, GNM_COMMAND_TYPE)
84 #endif /* GNM_COMMAND_IMPL_H */