platform_preview.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_WIDGET_PREVIEW_HPP 00010 #define ADOBE_WIDGET_PREVIEW_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <adobe/view_concept.hpp> 00015 #include <adobe/controller_concept.hpp> 00016 #include <adobe/future/macintosh_events.hpp> 00017 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp> 00018 #include <adobe/future/widgets/headers/widget_utils.hpp> 00019 #include <adobe/future/widgets/headers/sublayout.hpp> 00020 #include <adobe/macintosh_carbon_safe.hpp> 00021 00022 #include <boost/function.hpp> 00023 #include <boost/gil/gil_all.hpp> 00024 00025 /****************************************************************************************************/ 00026 00027 namespace adobe { 00028 00029 /****************************************************************************************************/ 00030 00041 struct preview_t 00042 { 00044 typedef dictionary_t controller_model_type; 00045 typedef boost::gil::rgba8_image_t view_model_type; 00046 typedef boost::function<void (const controller_model_type&)> setter_proc_type; 00047 00049 preview_t(const std::string& alt_text, 00050 theme_t theme); 00051 00058 void measure(extents_t& result); 00059 00060 void place(const place_data_t& place_data); 00062 00069 void display(const view_model_type& value); 00071 00078 void monitor(const setter_proc_type& proc); 00079 00080 void enable(bool make_enabled); 00082 00083 widget_node_t evaluate(const std::string& sheet_description, 00084 const std::string& layout_description, 00085 const dictionary_t& parameters, 00086 const widget_node_t& parent, 00087 const factory_token_t& token, 00088 const widget_factory_t& factory, 00089 const button_notifier_t& notifier, 00090 behavior_t behavior) 00091 { 00092 widget_node_t result(sublayout_m.evaluate(sheet_description, 00093 layout_description, 00094 parameters, 00095 parent, 00096 token, 00097 factory, 00098 notifier, 00099 behavior)); 00100 00101 sublayout_m.sublayout_sheet_update(); 00102 00103 return result; 00104 } 00105 00106 #ifndef ADOBE_NO_DOCUMENTATION 00107 auto_control_t control_m; 00108 view_model_type preview_image_m; 00109 std::string alt_text_m; 00110 sublayout_t sublayout_m; 00111 theme_t theme_m; 00112 mutable metric_extractor_t metrics_m; 00113 #endif 00114 }; 00115 00116 template <> 00117 struct controller_model_type<preview_t> 00118 { 00119 typedef preview_t::controller_model_type type; 00120 }; 00121 00122 template <> 00123 struct view_model_type<preview_t> 00124 { 00125 typedef preview_t::view_model_type type; 00126 }; 00127 00128 /****************************************************************************************************/ 00129 00130 } // namespace adobe 00131 00132 /****************************************************************************************************/ 00133 00134 #endif 00135 00136 /****************************************************************************************************/ |