stlab.adobe.com Adobe Systems Incorporated

drag_and_drop.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_HPP
00010 #define ADOBE_DRAG_AND_DROP_HPP
00011 
00012 /**************************************************************************************************/
00013 
00014 #include <adobe/config.hpp>
00015 
00016 #include <adobe/future/drag_and_drop_fwd.hpp>
00017 #include <adobe/future/platform_drag_and_drop_data.hpp>
00018 
00019 #include <iterator>
00020 #include <set>
00021 #include <typeinfo>
00022 
00023 #include <boost/cstdint.hpp>
00024 
00025 /**************************************************************************************************/
00026 
00027 namespace adobe {
00028 
00029 /**************************************************************************************************/
00038 template <typename SourceType, typename TargetType>
00039 class drag_and_drop_handler
00040 {
00041 public:
00042     typedef SourceType                                                    source_type;
00043     typedef TargetType                                                    target_type;
00044     typedef drag_and_drop_handler_platform_data<source_type, target_type> platform_data_type;
00045     typedef boost::function<void (const target_type&)>                    client_callback_proc_t;
00046 
00047     drag_and_drop_handler()
00048     {
00049         data_m.init();
00050     }
00051 
00052     template <typename InputIterator>
00053     drag_and_drop_handler(InputIterator first, InputIterator last) :
00054         data_m(first, last)
00055     {
00056         data_m.init();
00057     }
00058 
00059     ~drag_and_drop_handler()
00060     {
00061         data_m.detach();
00062     }
00063 
00064     template <typename Client>
00065     inline void attach(const Client& client, const client_callback_proc_t& proc)
00066     {
00067         data_m.attach(client, proc);
00068     }
00069 
00070     inline void insert_flavor(boost::uint32_t flavor)
00071     {
00072         data_m.insert_flavor(flavor);
00073     }
00074 
00075     inline void erase_flavor(boost::uint32_t flavor)
00076     {
00077         data_m.erase_flavor(flavor);
00078     }
00079 
00080     platform_data_type data_m;
00081 };
00082 
00083 /**************************************************************************************************/
00084 
00085 } // namespace adobe
00086 
00087 /**************************************************************************************************/
00088 
00089 // ADOBE_DRAG_AND_DROP_HPP
00090 #endif
00091 
00092 /**************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google