stlab.adobe.com Adobe Systems Incorporated

platform_presets.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_PRESETS_HPP
00010 #define ADOBE_WIDGET_PRESETS_HPP
00011 
00012 /****************************************************************************************************/
00013 
00014 #include <adobe/future/widgets/headers/widget_utils.hpp>
00015 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp>
00016 #include <adobe/future/widgets/headers/platform_popup.hpp>
00017 
00018 #include <adobe/eve.hpp>
00019 #include <adobe/future/macintosh_events.hpp>
00020 #include <adobe/future/widgets/headers/widget_factory.hpp>
00021 #include <adobe/macintosh_carbon_safe.hpp>
00022 
00023 #include <boost/function.hpp>
00024 #include <boost/operators.hpp>
00025 #include <boost/filesystem/path.hpp>
00026 #include <boost/type_traits.hpp>
00027 #include <boost/static_assert.hpp>
00028 
00029 /****************************************************************************************************/
00030 
00031 namespace adobe {
00032 
00033 /****************************************************************************************************/
00034 #ifndef ADOBE_NO_DOCUMENTATION
00035 struct sheet_t;
00036 struct assemblage_t;
00037 
00038 struct presets_t;
00039 
00040 /****************************************************************************************************/
00041 
00042 typedef boost::function<dictionary_t ()> model_snapshot_proc_t;
00043 typedef popup_t::setter_type                    preset_setter_type;
00044 
00045 /****************************************************************************************************/
00046 
00047 struct presets_hit_handler_t
00048 {
00049     explicit presets_hit_handler_t(presets_t& widget) :
00050         widget_m(widget)
00051     {
00052         handler_m.insert(kEventClassControl, kEventControlClick);
00053 
00054         handler_m.monitor_proc_m = boost::bind(&presets_hit_handler_t::handle_event,
00055                                                boost::ref(*this), _1, _2);
00056     }
00057 
00058     ::OSStatus handle_event(::EventHandlerCallRef next,
00059                             ::EventRef            event);
00060 
00061     event_handler_t    handler_m;
00062     preset_setter_type setter_m;
00063     presets_t&         widget_m;
00064 };
00065 #endif
00066 /****************************************************************************************************/
00067 
00080 struct presets_t
00081 {
00083     typedef dictionary_t model_type;
00084 
00086     typedef preset_setter_type setter_type;
00087 
00102     presets_t(const std::string&         name,
00103               const std::string&         domain,
00104               const std::string&         alt_text,
00105               const array_t&      bind_set,
00106               const dictionary_t& localization_set,
00107               theme_t                    theme);
00108 
00109 #ifndef ADOBE_NO_DOCUMENTATION
00110     presets_t(const presets_t& rhs);
00111 
00112     presets_t& operator=(const presets_t& rhs);
00113 #endif
00114 
00121     void measure(extents_t& result);
00122 
00123     void place(const place_data_t& place_data);
00125 
00132     void display(const model_type& value);
00134 
00141     void display_additional_preset_set(const array_t& value);
00143 
00150     void monitor(const setter_type& proc)
00151     { proc_m = proc; }
00153 
00157     void snapshot_callback(const model_snapshot_proc_t& proc)
00158     { snapshot_proc_m = proc; }
00159 
00160 #ifndef ADOBE_NO_DOCUMENTATION
00161     ::ControlRef               control_m;        // the preset icon
00162     popup_t                    category_popup_m; // the category popup
00163     popup_t                    popup_m;          // the actual preset popup
00164     theme_t                    theme_m;
00165     mutable metric_extractor_t metrics_m;
00166     presets_hit_handler_t      hit_handler_m;    // hit handler for the preset icon
00167     array_t             bind_set_m;       // the set of parameters to be stored in the preset
00168     std::string                name_m;
00169     std::string                domain_m;
00170     std::string                alt_text_m;
00171     bool                       selected_m;       // whether or not the preset icon is pushed
00172     model_snapshot_proc_t      snapshot_proc_m;
00173     long                       popup_height_m;
00174     dictionary_t        localization_set_m;
00175     dictionary_t        last_m;
00176     bool                       type_2_debounce_m;
00177     setter_type                proc_m;
00178     bool                       custom_m;
00179 
00180     // these store the various preset sources as arrays
00181     array_t             dynamic_preset_set_m;
00182     array_t             default_preset_set_m;
00183     array_t             user_preset_set_m;
00184     array_t             composite_m;
00185 
00186     void do_imbue(const popup_t::model_type& value);
00187 
00188 private:
00189     void display_custom();
00190 #endif
00191 };
00192 
00193 /****************************************************************************************************/
00194 #ifndef ADOBE_NO_DOCUMENTATION
00195 inline ::HIViewRef get_display(presets_t& widget)
00196     { return widget.control_m; }
00197 #endif
00198 /****************************************************************************************************/
00199 
00208 void enable(presets_t& value, bool make_enabled);
00210 
00211 /****************************************************************************************************/
00212 #ifndef ADOBE_NO_DOCUMENTATION
00213 bool operator==(const presets_t& x, const presets_t& y);
00214 #endif
00215 /****************************************************************************************************/
00216 
00217 } // namespace adobe
00218 
00219 /****************************************************************************************************/
00220 
00221 #endif
00222 
00223 /****************************************************************************************************/

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