QOF: qofevent.h Source File

QOF 0.7.5

qofevent.h
Go to the documentation of this file.
1 /********************************************************************
2 * qofevent.h -- QOF event handling interface *
3 * Copyright 2000 Dave Peticolas <dave@krondo.com> *
4 * Copyright 2006 Neil Williams <linux@codehelp.co.uk> *
5 * *
6 * This program is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU General Public License as *
8 * published by the Free Software Foundation; either version 2 of *
9 * the License, or (at your option) any later version. *
10 * *
11 * This program 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 *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License*
17 * along with this program; if not, contact: *
18 * *
19 * Free Software Foundation Voice: +1-617-542-5942 *
20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21 * Boston, MA 02110-1301, USA gnu@gnu.org *
22 * *
23 ********************************************************************/
24
34 #ifndef QOF_EVENT_H
35 #define QOF_EVENT_H
36
37 #include "qof.h"
38
40 typedef gint QofEventId;
41
53 #define QOF_MAKE_EVENT(x) (1<<(x))
54
57 #define QOF_EVENT_BASE 8
58
69 #define QOF_EVENT_NONE (0)
70
71 #define QOF_EVENT_CREATE QOF_MAKE_EVENT(0)
72
79 #define QOF_EVENT_MODIFY QOF_MAKE_EVENT(1)
80
81 #define QOF_EVENT_DESTROY QOF_MAKE_EVENT(2)
82 #define QOF_EVENT_ADD QOF_MAKE_EVENT(3)
83 #define QOF_EVENT_REMOVE QOF_MAKE_EVENT(4)
84
92 #define QOF_EVENT_COMMIT QOF_MAKE_EVENT(5)
93 #define QOF_EVENT__LAST QOF_MAKE_EVENT(QOF_EVENT_BASE-1)
94 #define QOF_EVENT_ALL (0xff)
95
104 typedef void (*QofEventHandler) (QofEntity * ent, QofEventId event_type,
105 gpointer handler_data, gpointer event_data);
106
114 gint qof_event_register_handler (QofEventHandler handler,
115 gpointer handler_data);
116
121 void qof_event_unregister_handler (gint handler_id);
122
144 void qof_event_gen (QofEntity * entity, QofEventId event_type,
145 gpointer event_data);
146
153 void qof_event_suspend (void);
154
156 void qof_event_resume (void);
157
158 #endif
159
QofEntity_s
Definition: qofid.h:147
QofEventHandler
void(* QofEventHandler)(QofEntity *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:104
qof_event_gen
void qof_event_gen(QofEntity *entity, QofEventId event_type, gpointer event_data)
Invoke all registered event handlers using the given arguments.
Definition: qofevent.c:292
qof_event_register_handler
gint qof_event_register_handler(QofEventHandler handler, gpointer handler_data)
Register a handler for events.
Definition: qofevent.c:108
QofEventId
gint QofEventId
Definition: qofevent.h:40
qof_event_unregister_handler
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
Definition: qofevent.c:139
qof_event_suspend
void qof_event_suspend(void)
Suspend all engine events.
Definition: qofevent.c:189
qof_event_resume
void qof_event_resume(void)
Definition: qofevent.c:200