source: trunk/SL/CB/cb.h

Last change on this file was 16986, checked in by westram, 7 years ago

Update: continued by [17178]

File size: 2.4 KB
Line 
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
19class AW_root;
20class AW_window;
21class AW_awar;
22
23// generic callback parameter (used like a void*)
24typedef long AW_CL; // client data (casted from pointer or value)
25
26// simplest callback flavours of each type
27typedef AW_window *(*CreateWindowCallbackSimple)(AW_root*); // use makeCreateWindowCallback if you need parameters
28typedef void (*RootCallbackSimple)(AW_root*);               // use makeRootCallback if you need parameters
29typedef 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
40DECLARE_CBTYPE_FVV_AND_BUILDERS(RootCallback,         void,       AW_root*);   // generates makeRootCallback
41DECLARE_CBTYPE_FVV_AND_BUILDERS(TimedCallback,        unsigned,   AW_root*);   // generates makeTimedCallback (return value: 0->do not call again, else: call again after XXX ms)
42DECLARE_CBTYPE_FVV_AND_BUILDERS(WindowCallback,       void,       AW_window*); // generates makeWindowCallback
43DECLARE_CBTYPE_FVV_AND_BUILDERS(CreateWindowCallback, AW_window*, AW_root*);   // generates makeCreateWindowCallback
44
45DECLARE_CBTYPE_FVF_AND_BUILDERS(DatabaseCallback, void, GBDATA*, GB_CB_TYPE);    // generates makeDatabaseCallback
46
47DECLARE_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
Note: See TracBrowser for help on using the repository browser.