1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* Authors: Iain Holmes <iain@gnome.org>
5
* Copyright 2002 - 2006 Iain Holmes
7
* This file is free software; you can redistribute it and/or
8
* modify it under the terms of version 2 of the GNU Library General Public
9
* License as published by the Free Software Foundation;
11
* This library 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 GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
23
#ifndef __KOTO_UNDO_MANAGER_H__
24
#define __KOTO_UNDO_MANAGER_H__
26
#include <glib-object.h>
29
#include "koto-undoable.h"
31
#define KOTO_TYPE_UNDO_MANAGER (koto_undo_manager_get_type ())
32
#define KOTO_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KOTO_TYPE_UNDO_MANAGER, KotoUndoManager))
33
#define KOTO_IS_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KOTO_TYPE_UNDO_MANAGER))
35
typedef struct _KotoUndoContext KotoUndoContext;
36
typedef struct _KotoUndoHistory {
39
gboolean current; /* Is this the position we are at in the history */
40
KotoUndoContext *ctxt;
43
typedef struct _KotoUndoManager KotoUndoManager;
44
typedef struct _KotoUndoManagerClass KotoUndoManagerClass;
45
typedef struct _KotoUndoManagerPrivate KotoUndoManagerPrivate;
47
struct _KotoUndoManager {
50
KotoUndoManagerPrivate *priv;
53
struct _KotoUndoManagerClass {
54
GObjectClass parent_class;
56
void (*changed) (KotoUndoManager *manager);
59
GType koto_undo_manager_get_type (void);
60
KotoUndoManager *koto_undo_manager_new (void);
62
gboolean koto_undo_manager_can_undo (KotoUndoManager *manager);
63
gboolean koto_undo_manager_can_redo (KotoUndoManager *manager);
65
KotoUndoContext *koto_undo_manager_context_begin (KotoUndoManager *manager,
68
koto_undo_manager_context_begin_formatted (KotoUndoManager *manager,
69
const char *format, ...);
71
void koto_undo_manager_context_end (KotoUndoManager *manager,
72
KotoUndoContext *ctxt);
73
void koto_undo_manager_context_cancel (KotoUndoManager *manager,
74
KotoUndoContext *ctxt);
76
void koto_undo_context_add (KotoUndoContext *context,
77
KotoUndoable *undoable);
78
const char *koto_undo_manager_get_undo_name (KotoUndoManager *manager);
79
const char *koto_undo_manager_get_redo_name (KotoUndoManager *manager);
81
void koto_undo_manager_undo (KotoUndoManager *manager);
82
void koto_undo_manager_redo (KotoUndoManager *manager);
84
GList *koto_undo_manager_get_history (KotoUndoManager *manager);