stlab.adobe.com Adobe Systems Incorporated

sequence_hooks.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2008 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_SEQUENCE_HOOKS
00010 #define ADOBE_SEQUENCE_HOOKS
00011 
00012 /******************************************************************************/
00013 
00014 #include <adobe/sequence_model.hpp>
00015 #include <adobe/future/assemblage.hpp>
00016 
00017 /******************************************************************************/
00018 
00019 namespace adobe {
00020 
00021 /******************************************************************************/
00025 template <typename SequenceModel, typename SequenceView>
00026 void attach_sequence_view_to_sequence_model(adobe::assemblage_t& assemblage,
00027                                             SequenceModel&       model,
00028                                             SequenceView&        view)
00029 {
00030     typedef typename SequenceModel::poly_sequence_view_type sequence_view_type;
00031 
00032     sequence_view_type* poly_view(new sequence_view_type(boost::ref(view)));
00033 
00034     assemblage_cleanup_ptr(assemblage, poly_view);
00035 
00036     model.attach_view(*poly_view);
00037 
00038     assemblage.cleanup(boost::bind(&SequenceModel::detach_view,
00039                                    boost::ref(model), 
00040                                    boost::ref(*poly_view)));
00041 }
00042 
00043 /******************************************************************************/
00047 template <typename SequenceModel, typename SequenceController>
00048 void attach_sequence_controller_to_sequence_model(adobe::assemblage_t& assemblage,
00049                                                   SequenceModel&       model,
00050                                                   SequenceController&  controller)
00051 {
00052     typedef typename SequenceModel::poly_sequence_controller_type sequence_controller_type;
00053 
00054     sequence_controller_type* poly_controller(new sequence_controller_type(boost::ref(controller)));
00055 
00056     assemblage_cleanup_ptr(assemblage, poly_controller);
00057 
00058     model.attach_controller(*poly_controller);
00059 
00060     assemblage.cleanup(boost::bind(&SequenceModel::detach_controller,
00061                                    boost::ref(model), 
00062                                    boost::ref(*poly_controller)));
00063 }
00064 
00065 /******************************************************************************/
00069 template <typename SequenceModel, typename SequenceWidget>
00070 inline void attach_sequence_widget_to_sequence_model(adobe::assemblage_t& assemblage,
00071                                                      SequenceModel&       model,
00072                                                      SequenceWidget&      widget)
00073 {
00074     attach_sequence_view_to_sequence_model(assemblage, model, widget);
00075 
00076     attach_sequence_controller_to_sequence_model(assemblage, model, widget);
00077 }
00078 
00079 /******************************************************************************/
00080 
00081 } // namespace adobe
00082 
00083 /******************************************************************************/
00084 // ADOBE_SEQUENCE_HOOKS
00085 #endif
00086 /******************************************************************************/

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