GnuCash
5.6-150-g038405b370+
|
Files | |
file | gnc-event.h |
Additional event handling code. | |
file | qofevent.h |
QOF event handling interface. | |
Data Structures | |
struct | GncEventData |
Macros | |
#define | GNC_EVENT_ITEM_ADDED QOF_MAKE_EVENT(QOF_EVENT_BASE+0) |
These events are used when a split is added to an account. More... | |
#define | GNC_EVENT_ITEM_REMOVED QOF_MAKE_EVENT(QOF_EVENT_BASE+1) |
#define | GNC_EVENT_ITEM_CHANGED QOF_MAKE_EVENT(QOF_EVENT_BASE+2) |
#define | QOF_MAKE_EVENT(x) (1<<(x)) |
Allow application-specific events to be created. More... | |
#define | QOF_EVENT_BASE 8 |
Allow scope for more defaults in future. More... | |
#define | QOF_EVENT_NONE (0) |
Default events for backwards compatibility. More... | |
#define | QOF_EVENT_CREATE QOF_MAKE_EVENT(0) |
#define | QOF_EVENT_MODIFY QOF_MAKE_EVENT(1) |
#define | QOF_EVENT_DESTROY QOF_MAKE_EVENT(2) |
#define | QOF_EVENT_ADD QOF_MAKE_EVENT(3) |
#define | QOF_EVENT_REMOVE QOF_MAKE_EVENT(4) |
#define | QOF_EVENT__LAST QOF_MAKE_EVENT(QOF_EVENT_BASE-1) |
#define | QOF_EVENT_ALL (0xff) |
Typedefs | |
typedef gint | QofEventId |
Define the type of events allowed. More... | |
typedef void(* | QofEventHandler) (QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data) |
Handler invoked when an event is generated. More... | |
Functions | |
const char * | qofeventid_to_string (QofEventId id) |
Convert the given QofEventId (an integer number) to a string that is usable in debugging output. More... | |
gint | qof_event_register_handler (QofEventHandler handler, gpointer handler_data) |
Register a handler for events. More... | |
void | qof_event_unregister_handler (gint handler_id) |
Unregister an event handler. More... | |
void | qof_event_gen (QofInstance *entity, QofEventId event_type, gpointer event_data) |
Invoke all registered event handlers using the given arguments. More... | |
void | qof_event_suspend (void) |
Suspend all engine events. More... | |
void | qof_event_resume (void) |
Resume engine event generation. More... | |
#define GNC_EVENT_ITEM_ADDED QOF_MAKE_EVENT(QOF_EVENT_BASE+0) |
These events are used when a split is added to an account.
The event subject is the Account, the Object is the Split.
Definition at line 45 of file gnc-event.h.
#define QOF_EVENT_BASE 8 |
Allow scope for more defaults in future.
Additional event identifiers must be based on this when using QOF_MAKE_EVENT().
Definition at line 62 of file qofevent.h.
#define QOF_EVENT_NONE (0) |
Default events for backwards compatibility.
These defaults merely replicate previous behaviour, any process can define their own events.
Definition at line 72 of file qofevent.h.
#define QOF_MAKE_EVENT | ( | x | ) | (1<<(x)) |
Allow application-specific events to be created.
Used together with QOF_EVENT_BASE to simplify creation of application events without interfering with any new events added within QOF.
#define APP_EVENT_A QOF_MAKE_EVENT(QOF_EVENT_BASE+0) #define APP_EVENT_B QOF_MAKE_EVENT(QOF_EVENT_BASE+1)
Definition at line 58 of file qofevent.h.
typedef void(* QofEventHandler) (QofInstance *ent, QofEventId event_type, gpointer handler_data, gpointer event_data) |
Handler invoked when an event is generated.
ent | Entity generating the event |
event_type | The id of the event, including additional identifiers and the older defaults. |
handler_data | data supplied when handler was registered. |
event_data | data to be supplied when handler is invoked. |
Definition at line 89 of file qofevent.h.
typedef gint QofEventId |
Define the type of events allowed.
Definition at line 45 of file qofevent.h.
void qof_event_gen | ( | QofInstance * | entity, |
QofEventId | event_type, | ||
gpointer | event_data | ||
) |
Invoke all registered event handlers using the given arguments.
Certain default events are used by QOF:
QOF_EVENT_DEFAULT_DESTROY events should be called before the object has been destroyed or removed from the entity table.
Any other events are entirely the concern of the application.
entity | the entity generating the event |
event_type | the name of the event. |
event_data | Data to be passed to the event handler just for this one event. Can be NULL. |
Definition at line 231 of file qofevent.cpp.
gint qof_event_register_handler | ( | QofEventHandler | handler, |
gpointer | handler_data | ||
) |
Register a handler for events.
handler | handler to register |
handler_data | data provided when handler is invoked |
Definition at line 73 of file qofevent.cpp.
void qof_event_resume | ( | void | ) |
void qof_event_suspend | ( | void | ) |
Suspend all engine events.
This function may be called multiple times. To resume event generation, an equal number of calls to qof_event_resume must be made.
Definition at line 145 of file qofevent.cpp.
void qof_event_unregister_handler | ( | gint | handler_id | ) |
Unregister an event handler.
handler_id | the id of the handler to unregister |
Definition at line 103 of file qofevent.cpp.
const char* qofeventid_to_string | ( | QofEventId | id | ) |
Convert the given QofEventId (an integer number) to a string that is usable in debugging output.
Definition at line 24 of file gnc-event.c.