00001 typedef void (NDKDlgControl::*NDKPNOTIFFN)(int);
00002 typedef void (NDKDlgControl::*NDKPCMDFN)();
00003
00004 struct BINDING
00005 {
00006 BINDING(int w,int from,int to,NDKPNOTIFFN pf)
00007 :what(w)
00008 ,ctrl_id(from)
00009 ,last_ctrl_id(to)
00010 ,p_notif_fn(pf)
00011 {};
00012
00013 BINDING(int w,int from,int to,NDKPCMDFN pf)
00014 :what(w)
00015 ,ctrl_id(from)
00016 ,last_ctrl_id(to)
00017 ,p_cmd_fn(pf)
00018 {};
00019
00020 int what;
00021 int ctrl_id;
00022 int last_ctrl_id;
00023 union{
00024 NDKPNOTIFFN p_notif_fn;
00025 NDKPCMDFN p_cmd_fn;
00026 };
00027 bool pfn()const {return (p_notif_fn || p_cmd_fn);};
00028 };
00029
00030 template <class T>
00031 class BINDING_IMPL
00032 {
00033 public:
00034 T pfn;
00035
00036 BINDING_IMPL(int w,int from_id,int to_id, T fn)
00037
00038 :pfn(fn)
00039 { f=pfn;}
00040
00041
00042
00043
00044
00045
00046 };
00047
00048 typedef BINDING_IMPL< NDKPNOTIFFN > NotificationBind;
00049 typedef BINDING_IMPL< NDKPCMDFN > CommandBind;
00050
00051 struct BINDING_MAP{
00052 const BINDING_MAP *base_map;
00053 const BINDING * pEntries;
00054 };
00055
00056 #define DECLARE_BINDINGS() \
00057 private: \
00058 static const BINDING _bindingEntries[]; \
00059 protected: \
00060 static const BINDING_MAP bindingMap; \
00061 virtual const BINDING_MAP* get_binding_map() const; \
00062
00063 #define BEGIN_FIRST_BINDINGS(theClass) \
00064 const BINDING_MAP* theClass::get_binding_map() const \
00065 { return &theClass::bindingMap; } \
00066 const BINDING_MAP theClass::bindingMap = \
00067 { 0, &theClass::_bindingEntries[0] }; \
00068 const BINDING theClass::_bindingEntries[] = \
00069 { \
00070
00071 #define BEGIN_BINDINGS(theClass, baseClass) \
00072 const BINDING_MAP* theClass::get_binding_map() const \
00073 { return &theClass::bindingMap; } \
00074 const BINDING_MAP theClass::bindingMap = \
00075 { &baseClass::bindingMap, &theClass::_bindingEntries[0] }; \
00076 const BINDING theClass::_bindingEntries[] = \
00077 { \
00078
00079 #define END_BINDINGS() \
00080 BINDING(0,0,0,(NDKPCMDFN)0) \
00081 }; \
00082
00083
00084 #define ON_COMMAND(id, memberFxn) \
00085 BINDING(0, id, id, (NDKPCMDFN) &memberFxn) ,
00086
00087
00088
00089 #define ON_COMMAND_RANGE(id, idLast, memberFxn) \
00090 BINDING(0,id, idLast, (NDKPCMDFN) &memberFxn) ,
00091
00092
00093
00094 #define ON_NOTIFY(wNotifyCode, id, memberFxn) \
00095 BINDING(wNotifyCode, id, id, (NDKPNOTIFFN) &memberFxn) ,
00096
00097 #define ON_NOTIFY_RANGE(wNotifyCode, id, idLast, memberFxn) \
00098 BINDING(wNotifyCode, id, idLast, (NDKPNOTIFFN) &memberFxn) ,
00099
00100
00101 #define ON_CONTROL(wNotifyCode, id, memberFxn) \
00102 BINDING(wNotifyCode, id, id ,(NDKPNOTIFFN) &memberFxn ),
00103