stlab.adobe.com Adobe Systems Incorporated

platform_image.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-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_IMAGE_T_HPP
00010 #define ADOBE_IMAGE_T_HPP
00011 
00012 /****************************************************************************************************/
00013 
00014 #include <adobe/future/widgets/headers/widget_utils.hpp>
00015 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp>
00016 
00017 #include <adobe/eve.hpp>
00018 #include <adobe/future/image_slurp.hpp>
00019 #include <adobe/future/widgets/headers/widget_factory.hpp>
00020 #include <adobe/macintosh_carbon_safe.hpp>
00021 
00022 /****************************************************************************************************/
00023 
00024 namespace adobe {
00025 
00026 /****************************************************************************************************/
00027 #ifndef ADOBE_NO_DOCUMENTATION
00028 struct sheet_t;
00029 struct assemblage_t;
00030 struct image_t;
00031 #endif
00032 /****************************************************************************************************/
00033 
00034 struct image_event_handler_t
00035 {
00036     explicit image_event_handler_t(image_t& widget);
00037 
00038     event_handler_t handler_m;
00039     image_t&        widget_m;
00040 };
00041 
00042 /****************************************************************************************************/
00043 
00053 struct image_t
00054 {
00056     typedef dictionary_t                                         controller_model_type;
00057     typedef boost::gil::rgba8_image_t                            view_model_type;
00058     typedef boost::function<void (const controller_model_type&)> setter_proc_type;
00059 
00061     image_t(const view_model_type& image);
00062 
00069     void measure(extents_t& result);
00070         
00071     void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal);
00072     
00073     void place(const place_data_t& place_data);
00075     
00076     void display(const view_model_type& value);
00077 
00078     void monitor(const setter_proc_type& proc);
00079     void enable(bool make_enabled);
00080 
00081     ::OSStatus handle_event(::EventHandlerCallRef next, ::EventRef event);
00082 
00083 #ifndef ADOBE_NO_DOCUMENTATION
00084     auto_control_t             control_m;
00085     mutable metric_extractor_t metrics_m;
00086     view_model_type            image_m;
00087     setter_proc_type           callback_m;
00088     bool                       enabled_m;
00089     image_event_handler_t      handler_m;
00090     dictionary_t               metadata_m;
00091     std::pair<long, long>      origin_m;
00092 #endif
00093 };
00094 
00095 /****************************************************************************************************/
00096 
00097 inline image_event_handler_t::image_event_handler_t(image_t& widget) :
00098     widget_m(widget)
00099 {
00100     handler_m.insert(kEventClassControl, kEventControlClick);
00101 
00102     handler_m.monitor_proc_m = boost::bind(&image_t::handle_event, boost::ref(widget_m), _1, _2);
00103 }
00104 
00105 /****************************************************************************************************/
00106 
00107 template <>
00108 struct controller_model_type<image_t>
00109 { typedef image_t::controller_model_type type; };
00110 
00111 template <>
00112 struct view_model_type<image_t>
00113 { typedef image_t::view_model_type type; };
00114 
00115 /****************************************************************************************************/
00116 
00117 } // namespace adobe
00118 
00119 /****************************************************************************************************/
00120 
00121 #endif
00122 
00123 /****************************************************************************************************/

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