drag_and_drop_fwd.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2007 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 00007 /**************************************************************************************************/ 00008 00009 #ifndef ADOBE_DRAG_AND_DROP_FWD_HPP 00010 #define ADOBE_DRAG_AND_DROP_FWD_HPP 00011 00012 /**************************************************************************************************/ 00013 00014 #include <adobe/config.hpp> 00015 00016 #include <vector> 00017 00018 #include <boost/cstdint.hpp> 00019 #include <boost/function.hpp> 00020 00021 #include <adobe/any_regular.hpp> 00022 #include <adobe/dictionary.hpp> 00023 #include <adobe/future/poly_drag_and_drop_converter.hpp> 00024 00025 /**************************************************************************************************/ 00026 00027 namespace adobe { 00028 00029 /**************************************************************************************************/ 00033 extern const boost::uint32_t flavor_file_url; 00034 extern const boost::uint32_t flavor_file; 00035 extern const boost::uint32_t flavor_future_file; 00036 extern const boost::uint32_t flavor_image; 00037 extern const boost::uint32_t flavor_movie; 00038 extern const boost::uint32_t flavor_sound; 00039 extern const boost::uint32_t flavor_text_style; 00040 extern const boost::uint32_t flavor_text; 00041 extern const boost::uint32_t flavor_unicode_style; 00042 extern const boost::uint32_t flavor_unicode; 00043 00044 extern const boost::uint32_t flavor_invalid; 00045 00046 /**************************************************************************************************/ 00047 00048 void register_dnd_converter(boost::uint32_t flavor, 00049 const std::type_info& target_type_info, 00050 const poly_drag_and_drop_converter_t& converter); 00051 00052 template <typename T> 00053 inline void register_dnd_converter(boost::uint32_t flavor, 00054 const poly_drag_and_drop_converter_t& converter) 00055 { register_dnd_converter(flavor, typeid(T), converter); } 00056 00057 bool is_dnd_converter_registered(boost::uint32_t flavor, const std::type_info& target_type_info); 00058 00059 template <typename T> 00060 inline bool is_dnd_converter_registered(boost::uint32_t flavor) 00061 { return is_dnd_converter_registered(flavor, typeid(T)); } 00062 00063 /**************************************************************************************************/ 00064 00065 any_regular_t dnd_converter_invoke(boost::uint32_t flavor, 00066 const std::type_info& target_type_info, 00067 const any_regular_t& raw_value); 00068 00069 template <typename DestType, typename SourceType> 00070 inline DestType invoke_dnd_converter(boost::uint32_t flavor, const SourceType& raw_value) 00071 { 00072 return dnd_converter_invoke(flavor, 00073 typeid(DestType), 00074 any_regular_t(raw_value)).cast<DestType>(); 00075 } 00076 00077 template <typename DestType, typename SourceType> 00078 bool invoke_dnd_converter(boost::uint32_t flavor, const SourceType& raw_value, DestType& result) 00079 { 00080 return dnd_converter_invoke(flavor, 00081 typeid(DestType), 00082 any_regular_t(raw_value)).cast<DestType>(result); 00083 } 00084 00085 /**************************************************************************************************/ 00086 00087 std::vector<boost::uint32_t> registered_flavor_set(); 00088 00089 /**************************************************************************************************/ 00090 00101 typedef boost::function<any_regular_t (const dictionary_t&)> dnd_flavor_extractor_proc_t; 00102 00103 void register_dnd_extractor(boost::uint32_t flavor, 00104 const std::type_info& target_type_info, 00105 const dnd_flavor_extractor_proc_t& extractor); 00106 00107 template <typename T> 00108 inline void register_dnd_extractor(boost::uint32_t flavor, 00109 const dnd_flavor_extractor_proc_t& extractor) 00110 { register_dnd_extractor(flavor, typeid(T), extractor); } 00111 00112 bool is_dnd_extractor_registered(boost::uint32_t flavor, const std::type_info& target_type_info); 00113 00114 template <typename T> 00115 inline bool is_dnd_extractor_registered(boost::uint32_t flavor) 00116 { return is_dnd_extractor_registered(flavor, typeid(T)); } 00117 00118 any_regular_t dnd_extractor_invoke(boost::uint32_t flavor, 00119 const std::type_info& target_type_info, 00120 const dictionary_t& drag_parameters); 00121 00122 template <typename DestType> 00123 inline DestType invoke_dnd_extractor(boost::uint32_t flavor, const dictionary_t& drag_parameters) 00124 { 00125 return dnd_extractor_invoke(flavor, 00126 typeid(DestType), 00127 drag_parameters).cast<DestType>(); 00128 } 00129 00130 template <typename DestType> 00131 bool invoke_dnd_extractor(boost::uint32_t flavor, const dictionary_t& drag_parameters, DestType& result) 00132 { 00133 return dnd_extractor_invoke(flavor, 00134 typeid(DestType), 00135 drag_parameters).cast<DestType>(result); 00136 } 00137 00138 /**************************************************************************************************/ 00139 00140 } // namespace adobe 00141 00142 /**************************************************************************************************/ 00143 00144 // ADOBE_DRAG_AND_DROP_FWD_HPP 00145 #endif 00146 00147 /**************************************************************************************************/ |