TMDClientData.h
Go to the documentation of this file.00001
00010 #ifndef __TMDCLIENTDATA_H__
00011 #define __TMDCLIENTDATA_H__
00012
00013 #include <boost/shared_ptr.hpp>
00014 #include <wx/clntdata.h>
00015
00023 template<typename T> class TMDClientData : public wxClientData
00024 {
00025 public:
00026 TMDClientData(T * obj) : m_pObj(obj){}
00027 T * get(void) {
00028 return m_pObj.get();
00029 }
00030 T operator*() {
00031 return *m_pObj;
00032 }
00033 protected:
00034 boost::shared_ptr<T> m_pObj;
00035 };
00036
00037
00038 #define DECLARE_CLIENT_DATA(c) \
00039 typedef TMDClientData< c > c##CD; \
00040 typedef c##CD * c##CDPtr
00041
00042
00043 #define GET_FROM_CONTROL( type, control, index ) \
00044 dynamic_cast< type##CDPtr >( control->GetClientObject(index))->get()
00045
00046 #endif