Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
idispatcher.h
Go to the documentation of this file.
1 /* Libmacro - A multi-platform, extendable macro and hotkey C library
2  Copyright (C) 2013 Jonathan Pelletier, New Paradigm Software
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
26 #ifndef MCR_BASE_IDISPATCHER_H_
27 #define MCR_BASE_IDISPATCHER_H_
28 
29 #include "mcr/base/types.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
36 #define mcr_DispatchReceiver_compare mcr_ref_compare
37 
43 typedef int (*mcr_IDispatcher_fnc)(struct mcr_IDispatcher *idispPt);
57 typedef int (*mcr_IDispatcher_add_fnc)(struct mcr_IDispatcher *idispPt,
58  struct mcr_Signal *sigPt, void *receiver,
59  mcr_dispatch_receive_fnc receiverFnc);
66 typedef void (*mcr_IDispatcher_remove_fnc)(struct mcr_IDispatcher *idispPt,
67  void *remReceiver);
75 typedef bool(*mcr_IDispatcher_dispatch_fnc)(struct mcr_IDispatcher *idispPt,
76  struct mcr_Signal *sigPt, unsigned int mods);
83 typedef void (*mcr_IDispatcher_modify_fnc)(struct mcr_IDispatcher *idispPt,
84  struct mcr_Signal *sigPt, unsigned int *modsPt);
85 
93  struct mcr_context *ctx;
94 
96  void (*deinit)(struct mcr_IDispatcher *);
100  void (*clear)(struct mcr_IDispatcher *);
108  void (*trim)(struct mcr_IDispatcher *);
109 };
110 
121 MCR_API void mcr_IDispatcher_ctor(struct mcr_IDispatcher *idispPt,
122  struct mcr_context *ctx,
123  void (*deinit)(struct mcr_IDispatcher *),
127  void (*trim)(struct mcr_IDispatcher *));
128 
136  *ctx, size_t signalTypeId);
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif
void(* mcr_IDispatcher_remove_fnc)(struct mcr_IDispatcher *idispPt, void *remReceiver)
Definition: idispatcher.h:66
Forward declaration of types.
void(* mcr_IDispatcher_modify_fnc)(struct mcr_IDispatcher *idispPt, struct mcr_Signal *sigPt, unsigned int *modsPt)
Definition: idispatcher.h:83
bool(* mcr_dispatch_receive_fnc)(struct mcr_DispatchReceiver *dispatchReceiver, struct mcr_Signal *dispatchSignal, unsigned int mods)
Definition: types.h:50
mcr_IDispatcher_modify_fnc modifier
Definition: idispatcher.h:104
int(* mcr_IDispatcher_fnc)(struct mcr_IDispatcher *idispPt)
Definition: idispatcher.h:43
MCR_API void mcr_IDispatcher_ctor(struct mcr_IDispatcher *idispPt, struct mcr_context *ctx, void(*deinit)(struct mcr_IDispatcher *), mcr_IDispatcher_add_fnc add, void(*clear)(struct mcr_IDispatcher *), mcr_IDispatcher_dispatch_fnc dispatch, mcr_IDispatcher_modify_fnc modifier, mcr_IDispatcher_remove_fnc remove, void(*trim)(struct mcr_IDispatcher *))
void(* deinit)(struct mcr_IDispatcher *)
Definition: idispatcher.h:96
mcr_IDispatcher_dispatch_fnc dispatch
Definition: idispatcher.h:102
MCR_API struct mcr_IDispatcher * mcr_IDispatcher_from_id(struct mcr_context *ctx, size_t signalTypeId)
struct mcr_context * ctx
Definition: idispatcher.h:93
int(* mcr_IDispatcher_add_fnc)(struct mcr_IDispatcher *idispPt, struct mcr_Signal *sigPt, void *receiver, mcr_dispatch_receive_fnc receiverFnc)
Definition: idispatcher.h:57
bool(* mcr_IDispatcher_dispatch_fnc)(struct mcr_IDispatcher *idispPt, struct mcr_Signal *sigPt, unsigned int mods)
Definition: idispatcher.h:75
void(* clear)(struct mcr_IDispatcher *)
Definition: idispatcher.h:100
void(* trim)(struct mcr_IDispatcher *)
Definition: idispatcher.h:108
mcr_IDispatcher_add_fnc add
Definition: idispatcher.h:98