Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
itrigger.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 
25 #ifndef MCR_BASE_ITRIGGER_H_
26 #define MCR_BASE_ITRIGGER_H_
27 
28 #include "mcr/base/interface.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef bool (*mcr_Trigger_receive_fnc)(struct mcr_Trigger *triggerPt,
35  struct mcr_Signal *dispatchSignal, unsigned int mods);
37 struct mcr_ITrigger {
44  mcr_Trigger_receive_fnc receive;
45 };
46 
51 MCR_API void mcr_ITrigger_init(struct mcr_ITrigger *itrigPt);
65 MCR_API void mcr_ITrigger_ctor(struct mcr_ITrigger *itrigPt,
66  struct mcr_context *context, size_t dataSize, void *(*allocate)(),
68  mcr_compare_fnc compare, mcr_copy_fnc copy, mcr_Trigger_receive_fnc receiveFnc);
74 MCR_API void mcr_ITrigger_deinit(struct mcr_ITrigger *itrigPt);
75 
77 MCR_API struct mcr_IRegistry *mcr_ITrigger_registry(struct mcr_context *ctx);
83 MCR_API size_t mcr_ITrigger_id(struct mcr_ITrigger *itrigPt);
89 MCR_API struct mcr_ITrigger *mcr_ITrigger_from_id(struct mcr_context *ctx,
90  size_t id);
96 MCR_API const char *mcr_ITrigger_name(struct mcr_context *ctx,
97  struct mcr_ITrigger *itrigPt);
103 MCR_API struct mcr_ITrigger *mcr_ITrigger_from_name(struct mcr_context *ctx,
104  const char *name);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif
int(* mcr_compare_fnc)(const void *lhsPt, const void *rhsPt)
Definition: comparison.h:53
struct mcr_context * context
Definition: interface.h:42
mcr_compare_fnc compare
Definition: interface.h:55
void *(* allocate)()
Definition: interface.h:47
MCR_API void mcr_ITrigger_deinit(struct mcr_ITrigger *itrigPt)
MCR_API void mcr_ITrigger_init(struct mcr_ITrigger *itrigPt)
MCR_API size_t mcr_ITrigger_id(struct mcr_ITrigger *itrigPt)
int(* mcr_data_fnc)(void *dataPt)
Definition: comparison.h:39
MCR_API const char * mcr_ITrigger_name(struct mcr_context *ctx, struct mcr_ITrigger *itrigPt)
mcr_Interface
mcr_copy_fnc copy
Definition: interface.h:58
mcr_Trigger_receive_fnc receive
Definition: itrigger.h:44
mcr_data_fnc deinit
Definition: interface.h:53
void(* deallocate)(void *)
Definition: interface.h:49
int(* mcr_copy_fnc)(void *destinationPt, const void *sourcePt)
Definition: comparison.h:46
MCR_API struct mcr_ITrigger * mcr_ITrigger_from_id(struct mcr_context *ctx, size_t id)
struct mcr_Interface interface
Definition: itrigger.h:39
mcr_data_fnc init
Definition: interface.h:51
MCR_API void mcr_ITrigger_ctor(struct mcr_ITrigger *itrigPt, struct mcr_context *context, size_t dataSize, void *(*allocate)(), void(*deallocate)(void *), mcr_data_fnc init, mcr_data_fnc deinit, mcr_compare_fnc compare, mcr_copy_fnc copy, mcr_Trigger_receive_fnc receiveFnc)
MCR_API struct mcr_ITrigger * mcr_ITrigger_from_name(struct mcr_context *ctx, const char *name)
MCR_API struct mcr_IRegistry * mcr_ITrigger_registry(struct mcr_context *ctx)