GnuCash  5.6-150-g038405b370+
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 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43 
45 typedef gint QofEventId;
46 
58 #define QOF_MAKE_EVENT(x) (1<<(x))
59 
62 #define QOF_EVENT_BASE 8
63 
72 #define QOF_EVENT_NONE (0)
73 #define QOF_EVENT_CREATE QOF_MAKE_EVENT(0)
74 #define QOF_EVENT_MODIFY QOF_MAKE_EVENT(1)
75 #define QOF_EVENT_DESTROY QOF_MAKE_EVENT(2)
76 #define QOF_EVENT_ADD QOF_MAKE_EVENT(3)
77 #define QOF_EVENT_REMOVE QOF_MAKE_EVENT(4)
78 #define QOF_EVENT__LAST QOF_MAKE_EVENT(QOF_EVENT_BASE-1)
79 #define QOF_EVENT_ALL (0xff)
80 
89 typedef void (*QofEventHandler) (QofInstance *ent, QofEventId event_type,
90  gpointer handler_data, gpointer event_data);
91 
99 gint qof_event_register_handler (QofEventHandler handler, gpointer handler_data);
100 
105 void qof_event_unregister_handler (gint handler_id);
106 
128 void qof_event_gen (QofInstance *entity, QofEventId event_type,
129  gpointer event_data);
130 
137 void qof_event_suspend (void);
138 
140 void qof_event_resume (void);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif
147 
void(* QofEventHandler)(QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data)
Handler invoked when an event is generated.
Definition: qofevent.h:89
gint qof_event_register_handler(QofEventHandler handler, gpointer handler_data)
Register a handler for events.
Definition: qofevent.cpp:73
gint QofEventId
Define the type of events allowed.
Definition: qofevent.h:45
void qof_event_unregister_handler(gint handler_id)
Unregister an event handler.
Definition: qofevent.cpp:103
void qof_event_suspend(void)
Suspend all engine events.
Definition: qofevent.cpp:145
void qof_event_resume(void)
Resume engine event generation.
Definition: qofevent.cpp:156
void qof_event_gen(QofInstance *entity, QofEventId event_type, gpointer event_data)
Invoke all registered event handlers using the given arguments.
Definition: qofevent.cpp:231