ARB
awt_modules.hxx
Go to the documentation of this file.
1 // ============================================================= //
2 // //
3 // File : awt_modules.hxx //
4 // Purpose : small modules for GUI construction //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in April 2012 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // ============================================================= //
11 
12 #ifndef AWT_MODULES_HXX
13 #define AWT_MODULES_HXX
14 
15 #ifndef AW_BASE_HXX
16 #include <aw_base.hxx>
17 #endif
18 #ifndef ARBTOOLS_H
19 #include <arbtools.h>
20 #endif
21 
27 };
28 
31  ACM_FILL, // aka "add all"
34 };
35 
36 namespace UNTYPED {
37  typedef void(*awt_orderfun) (AW_window *aww, awt_reorder_mode pos, AW_CL cl_user);
38  typedef void(*awt_collectfun)(AW_window *aww, awt_collect_mode what, AW_CL cl_user);
39 
40  // implementation uses untyped (casted) callbacks:
41  void awt_create_order_buttons(AW_window *aws, awt_orderfun reorder_cb, AW_CL cl_user);
42  void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, awt_collectfun collect_cb, AW_CL cl_user);
43 };
44 
45 // provide interface with typed callbacks:
46 template<typename T>
47 inline void awt_create_order_buttons(AW_window *aws, void (*reorder_cb)(AW_window*, awt_reorder_mode, T), T t) {
50 }
51 inline void awt_create_order_buttons(AW_window *aws, void (*reorder_cb)(AW_window*, awt_reorder_mode)) {
53 }
54 
55 
56 template<typename T>
57 inline void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, void (*collect_cb)(AW_window*, awt_collect_mode, T), T t) {
59  UNTYPED::awt_create_collect_buttons(aws, collect_rightwards, CASTSIG(UNTYPED::awt_collectfun, collect_cb), AW_CL(t));
60 }
61 inline void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, void (*collect_cb)(AW_window*, awt_collect_mode)) {
62  UNTYPED::awt_create_collect_buttons(aws, collect_rightwards, CASTSIG(UNTYPED::awt_collectfun, collect_cb), 0);
63 }
64 
65 
66 #else
67 #error awt_modules.hxx included twice
68 #endif // AWT_MODULES_HXX
void(* awt_orderfun)(AW_window *aww, awt_reorder_mode pos, AW_CL cl_user)
Definition: awt_modules.hxx:37
#define CASTSIG(sig, cb)
Definition: arbtools.h:123
void(* awt_collectfun)(AW_window *aww, awt_collect_mode what, AW_CL cl_user)
Definition: awt_modules.hxx:38
void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, void(*collect_cb)(AW_window *, awt_collect_mode, T), T t)
Definition: awt_modules.hxx:57
awt_collect_mode
Definition: awt_modules.hxx:29
void awt_create_order_buttons(AW_window *aws, awt_orderfun reorder_cb, AW_CL cl_user)
Definition: AWT_modules.cxx:17
long AW_CL
Definition: cb.h:21
void awt_create_collect_buttons(AW_window *aws, bool collect_rightwards, awt_collectfun collect_cb, AW_CL cl_user)
Definition: AWT_modules.cxx:46
static void here()
Definition: arbtools.h:151
awt_reorder_mode
Definition: awt_modules.hxx:22
Definition: trnsprob.h:20
void awt_create_order_buttons(AW_window *aws, void(*reorder_cb)(AW_window *, awt_reorder_mode, T), T t)
Definition: awt_modules.hxx:47