sublayout.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2006 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_SUBLAYOUT_HPP 00010 #define ADOBE_SUBLAYOUT_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <adobe/adam.hpp> 00015 #include <adobe/future/widgets/headers/factory.hpp> 00016 #include <adobe/future/widgets/headers/virtual_machine_extension.hpp> 00017 #include <adobe/future/widgets/headers/widget_factory_registry.hpp> 00018 00019 #include <adobe/future/widgets/headers/platform_panel.hpp> 00020 00021 /****************************************************************************************************/ 00022 00023 namespace adobe { 00024 00025 /****************************************************************************************************/ 00026 00027 class sublayout_t 00028 { 00029 public: 00030 explicit sublayout_t(theme_t theme = theme_normal_s) : 00031 root_m(any_regular_t(true), theme) 00032 { 00033 vm_lookup_m.attach_to(sublayout_sheet_m); 00034 vm_lookup_m.attach_to(sublayout_sheet_m.machine_m); 00035 } 00036 00037 sublayout_t(const sublayout_t& rhs) : 00038 root_m(any_regular_t(true), rhs.root_m.theme_m) 00039 { } 00040 00041 sublayout_t& operator=(const sublayout_t& /*rhs*/) 00042 { return *this; } 00043 00044 widget_node_t evaluate(const std::string& sheet_description, 00045 const std::string& layout_description, 00046 const dictionary_t& parameters, 00047 const widget_node_t& parent, 00048 const factory_token_t& token, 00049 const widget_factory_t& factory, 00050 const button_notifier_t& notifier, 00051 behavior_t& behavior); 00052 00053 template <typename T> 00054 void sublayout_sheet_set(name_t cell, const T& value); 00055 00056 void sublayout_sheet_set(name_t cell, const any_regular_t& value) 00057 { sublayout_sheet_m.set(cell, value); } 00058 00059 void sublayout_sheet_update() 00060 { sublayout_sheet_m.update(); } 00061 00062 template <typename T> 00063 void sublayout_sheet_set_update(name_t cell, const T& value) 00064 { 00065 sublayout_sheet_set(cell, value); 00066 sublayout_sheet_update(); 00067 } 00068 00075 void measure(extents_t& result) 00076 { 00077 std::pair<long, long> eval_result = 00078 sublayout_holder_m->eve_m.evaluate(eve_t::evaluate_nested); 00079 00080 result.width() = eval_result.first; 00081 result.height() = eval_result.second; 00082 } 00083 00084 void place(const place_data_t& place_data) 00085 { 00086 root_m.place(place_data); 00087 00088 sublayout_holder_m->eve_m.adjust(eve_t::evaluate_nested, 00089 width(place_data), 00090 height(place_data)); 00091 } 00093 00094 private: 00095 // order of destruction matters here, so please make sure 00096 // you know what you're doing when you go to reorder these. 00097 00098 sheet_t sublayout_sheet_m; 00099 auto_ptr<eve_client_holder> sublayout_holder_m; 00100 panel_t root_m; 00101 vm_lookup_t vm_lookup_m; 00102 }; 00103 00104 /****************************************************************************************************/ 00105 00106 template <typename T> 00107 void sublayout_t::sublayout_sheet_set(name_t cell, const T& value) 00108 { sublayout_sheet_set(cell, any_regular_t(value)); } 00109 00110 /****************************************************************************************************/ 00111 00112 } // namespace adobe 00113 00114 /****************************************************************************************************/ 00115 00116 #endif 00117 00118 /****************************************************************************************************/ |