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/future/widgets/headers/widget_utils.hpp> 00015 #include <adobe/future/widgets/headers/sublayout.hpp> 00016 #include <adobe/view_concept.hpp> 00017 #include <adobe/controller_concept.hpp> 00018 00019 #include <boost/function.hpp> 00020 #include <boost/gil/gil_all.hpp> 00021 00022 /****************************************************************************************************/ 00023 00024 namespace adobe { 00025 00026 /****************************************************************************************************/ 00027 00038 struct preview_t 00039 { 00041 typedef dictionary_t controller_model_type; 00042 typedef boost::gil::rgba8_image_t view_model_type; 00043 typedef boost::function<void (const controller_model_type&)> setter_proc_type; 00044 00046 preview_t(const std::string& alt_text, 00047 theme_t theme); 00048 00055 void measure(extents_t& result); 00056 00057 void place(const place_data_t& place_data); 00059 00066 void display(const view_model_type& value); 00068 00075 void monitor(const setter_proc_type& proc); 00076 00077 void enable(bool make_enabled); 00079 00080 widget_node_t evaluate(const std::string& sheet_description, 00081 const std::string& layout_description, 00082 const dictionary_t& parameters, 00083 const widget_node_t& parent, 00084 const factory_token_t& token, 00085 const widget_factory_t& factory, 00086 const button_notifier_t& notifier, 00087 behavior_t& behavior) 00088 { 00089 widget_node_t result(sublayout_m.evaluate(sheet_description, 00090 layout_description, 00091 parameters, 00092 parent, 00093 token, 00094 factory, 00095 notifier, 00096 behavior)); 00097 00098 sublayout_m.sublayout_sheet_update(); 00099 00100 return result; 00101 } 00102 00103 #ifndef ADOBE_NO_DOCUMENTATION 00104 view_model_type preview_image_m; 00105 std::string alt_text_m; 00106 sublayout_t sublayout_m; 00107 theme_t theme_m; 00108 #endif 00109 }; 00110 00111 template <> 00112 struct controller_model_type<preview_t> 00113 { 00114 typedef preview_t::controller_model_type type; 00115 }; 00116 00117 template <> 00118 struct view_model_type<preview_t> 00119 { 00120 typedef preview_t::view_model_type type; 00121 }; 00122 00123 /****************************************************************************************************/ 00124 00125 } // namespace adobe 00126 00127 /****************************************************************************************************/ 00128 00129 #endif 00130 00131 /****************************************************************************************************/ |