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 <windows.h>
00015 
00016 #include <adobe/dictionary.hpp>
00017 #include <adobe/future/windows_message_handler.hpp>
00018 #include <adobe/memory.hpp>
00019 #include <adobe/layout_attributes.hpp>
00020 
00021 #include <boost/function.hpp>
00022 #include <boost/gil/gil_all.hpp>
00023 #include <boost/noncopyable.hpp>
00024 
00025 #include <string>
00026 
00027 /****************************************************************************************************/
00028 
00029 namespace adobe {
00030 
00031 /****************************************************************************************************/
00032 
00033 struct image_t : boost::noncopyable
00034 {
00036     typedef dictionary_t                                         controller_model_type;
00037     typedef boost::gil::rgba8_image_t                            view_model_type;
00038     typedef boost::function<void (const controller_model_type&)> setter_proc_type;
00039 
00040     image_t(const view_model_type& image);
00041 
00042     LRESULT handle_event(HWND window, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC next_proc);
00043 
00044     void display(const view_model_type& value);
00045 
00046     void monitor(const setter_proc_type& proc);
00047     void enable(bool make_enabled);
00048 
00049     HWND                               window_m;
00050     view_model_type                    image_m;
00051     setter_proc_type                   callback_m;
00052     dictionary_t                       metadata_m;
00053     bool                               enabled_m;
00054 
00055     // mouse tracking stuff
00056     adobe::auto_ptr<message_handler_t> handler_m;
00057     HWND                               prev_capture_m;
00058     bool                               tracking_m;
00059     POINTS                             last_point_m;
00060     std::pair<long, long>              origin_m;
00061 };
00062 
00063 /****************************************************************************************************/
00064 
00065 void initialize(image_t& value, HWND parent);
00066 
00067 inline HWND get_display(image_t& widget)
00068 { return widget.window_m; }
00069 
00070 /****************************************************************************************************/
00071 
00072 void measure(image_t& value, extents_t& result);
00073 
00074 void measure_vertical(image_t& value, extents_t& calculated_horizontal, 
00075                       const place_data_t& placed_horizontal);
00076 
00077 void place(image_t& value, const place_data_t& place_data);
00078 
00079 void enable(image_t& value, bool make_enabled);
00080 
00081 /****************************************************************************************************/
00082 
00083 template <typename T> struct controller_model_type;
00084 template <>
00085 struct controller_model_type<adobe::image_t>
00086 { typedef adobe::image_t::controller_model_type type; };
00087 
00088 template <typename T> struct view_model_type;
00089 template <>
00090 struct view_model_type<adobe::image_t>
00091 { typedef adobe::image_t::view_model_type type; };
00092 
00093 /****************************************************************************************************/
00094 
00095 } // namespace adobe
00096 
00097 /****************************************************************************************************/
00098 
00099 #endif 
00100 
00101 /****************************************************************************************************/

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