ARB
cb.h
Go to the documentation of this file.
1 // ================================================================= //
2 // //
3 // File : cb.h //
4 // Purpose : define typesafe callback-factories for common types //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in September 2010 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // ================================================================= //
11 
12 #ifndef CB_H
13 #define CB_H
14 
15 #ifndef ARBDB_BASE_H
16 #include <arbdb_base.h>
17 #endif
18 
19 class AW_root;
20 class AW_window;
21 class AW_awar;
22 
23 // generic callback parameter (used like a void*)
24 typedef long AW_CL; // client data (casted from pointer or value)
25 
26 // simplest callback flavours of each type
27 typedef AW_window *(*CreateWindowCallbackSimple)(AW_root*); // use makeCreateWindowCallback if you need parameters
28 typedef void (*RootCallbackSimple)(AW_root*); // use makeRootCallback if you need parameters
29 typedef void (*WindowCallbackSimple)(AW_window*); // use makeWindowCallback if you need parameters
30 
31 // ---------------------------
32 // typesafe callbacks
33 
34 #ifndef CBTYPES_H
35 #include <cbtypes.h>
36 #endif
37 
38 // @@@ the definition of some of these cb-types may be moved into WINDOW
39 
40 DECLARE_CBTYPE_FVV_AND_BUILDERS(RootCallback, void, AW_root*); // generates makeRootCallback
41 DECLARE_CBTYPE_FVV_AND_BUILDERS(TimedCallback, unsigned, AW_root*); // generates makeTimedCallback (return value: 0->do not call again, else: call again after XXX ms)
42 DECLARE_CBTYPE_FVV_AND_BUILDERS(WindowCallback, void, AW_window*); // generates makeWindowCallback
43 DECLARE_CBTYPE_FVV_AND_BUILDERS(CreateWindowCallback, AW_window*, AW_root*); // generates makeCreateWindowCallback
44 
45 DECLARE_CBTYPE_FVF_AND_BUILDERS(DatabaseCallback, void, GBDATA*, GB_CB_TYPE); // generates makeDatabaseCallback
46 
47 DECLARE_CBTYPE_FFV_AND_BUILDERS(TreeAwarCallback, void, AW_awar*, bool); // generates makeTreeAwarCallback
48 
49 // Note: For rarely used callback-types a simpler idiom can be used.
50 // see e.g. ../../AWT/awt_modules.hxx@UNTYPED
51 
52 #else
53 #error cb.h included twice
54 #endif // CB_H
void(* WindowCallbackSimple)(AW_window *)
Definition: cb.h:29
void(* RootCallbackSimple)(AW_root *)
Definition: cb.h:28
DECLARE_CBTYPE_FVV_AND_BUILDERS(RootCallback, void, AW_root *)
DECLARE_CBTYPE_FFV_AND_BUILDERS(TreeAwarCallback, void, AW_awar *, bool)
long AW_CL
Definition: cb.h:21
DECLARE_CBTYPE_FVF_AND_BUILDERS(DatabaseCallback, void, GBDATA *, GB_CB_TYPE)
GB_CB_TYPE
Definition: arbdb_base.h:46