platform_popup.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_UI_CORE_POPUP_HPP 00010 #define ADOBE_UI_CORE_POPUP_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <adobe/config.hpp> 00015 00016 #include <boost/noncopyable.hpp> 00017 #include <adobe/any_regular.hpp> 00018 #include <adobe/future/widgets/headers/platform_label.hpp> 00019 #include <adobe/future/widgets/headers/widget_utils.hpp> 00020 #include <adobe/future/widgets/headers/popup_common_fwd.hpp> 00021 #include <adobe/future/debounce.hpp> 00022 00023 /****************************************************************************************************/ 00024 00025 namespace adobe { 00026 00027 /****************************************************************************************************/ 00028 00029 struct popup_t : boost::noncopyable 00030 { 00031 typedef std::pair<std::string, any_regular_t> menu_item_t; 00032 typedef std::vector<menu_item_t> menu_item_set_t; 00033 00034 typedef any_regular_t model_type; 00035 typedef popup_setter_type setter_type; 00036 typedef popup_extended_setter_type extended_setter_type; 00037 00038 popup_t(const std::string& name, 00039 const std::string& alt_text, 00040 const std::string& custom_item_name, 00041 const menu_item_t* first, 00042 const menu_item_t* last, 00043 theme_t theme); 00044 00045 void reset_menu_item_set(const menu_item_t* first, const menu_item_t* last); 00046 00047 inline void reset_menu_item_set(const menu_item_set_t& menu_item_set) 00048 { 00049 if (menu_item_set.empty()) 00050 reset_menu_item_set(0, 0); 00051 else 00052 reset_menu_item_set(&menu_item_set[0], &menu_item_set[0] + menu_item_set.size()); 00053 } 00054 00055 void select_with_text(const std::string& text); 00056 00057 void measure(extents_t& result); 00058 00059 void place(const place_data_t& place_data); 00060 00061 void display(const any_regular_t& item); 00062 00063 void monitor(const setter_type& proc); 00064 00065 void monitor_extended(const extended_setter_type& proc); 00066 00067 void enable(bool make_enabled); 00068 00069 HWND control_m; 00070 theme_t theme_m; 00071 label_t name_m; 00072 std::string alt_text_m; 00073 long static_baseline_m; 00074 long static_height_m; 00075 long popup_baseline_m; 00076 long popup_height_m; 00077 bool using_label_m; 00078 setter_type value_proc_m; 00079 extended_setter_type extended_value_proc_m; 00080 menu_item_set_t menu_items_m; 00081 model_type last_m; 00082 bool type_2_debounce_m; 00083 bool custom_m; 00084 std::string custom_item_name_m; 00085 00086 private: 00087 void display_custom(); 00088 }; 00089 00090 /****************************************************************************************************/ 00091 00092 namespace view_implementation { 00093 00094 /****************************************************************************************************/ 00095 00096 inline void set_value_from_model(popup_t& value, const any_regular_t& new_value) 00097 { value.display(new_value); } 00098 00099 /****************************************************************************************************/ 00100 00101 } // namespace view_implementation 00102 00103 /****************************************************************************************************/ 00104 00105 } // namespace adobe 00106 00107 /****************************************************************************************************/ 00108 00109 #endif 00110 00111 /****************************************************************************************************/ |