stlab.adobe.com Adobe Systems Incorporated

platform_link.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_LINK_HPP
00010 #define ADOBE_WIDGET_LINK_HPP
00011 
00012 /****************************************************************************************************/
00013 
00014 #include <adobe/future/macintosh_events.hpp>
00015 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp>
00016 #include <adobe/future/widgets/headers/widget_utils.hpp>
00017 #include <adobe/macintosh_carbon_safe.hpp>
00018 
00019 #include <boost/function.hpp>
00020 
00021 /****************************************************************************************************/
00022 
00023 namespace adobe {
00024 
00025 /****************************************************************************************************/
00026 #ifndef ADOBE_NO_DOCUMENTATION
00027 struct link_t;
00028 
00029 /****************************************************************************************************/
00030 
00031 typedef boost::function<void (const any_regular_t&)> link_setter_type;
00032 
00033 /****************************************************************************************************/
00034 
00035 struct link_hit_handler_t
00036 {
00037     explicit link_hit_handler_t(link_t& widget) :
00038         widget_m(widget)
00039     {
00040         handler_m.insert(kEventClassControl, kEventControlClick);
00041 
00042         handler_m.monitor_proc_m = boost::bind(&link_hit_handler_t::handle_event,
00043                                                boost::ref(*this), _1, _2);
00044     }
00045 
00046     ::OSStatus handle_event(::EventHandlerCallRef next,
00047                             ::EventRef            event);
00048 
00049     event_handler_t  handler_m;
00050     link_setter_type setter_m;
00051     link_t&          widget_m;
00052 };
00053 #endif
00054 /****************************************************************************************************/
00055 
00064 struct link_t
00065 {
00067     typedef any_regular_t model_type;
00068 
00070     typedef boost::function<void (const model_type&)> setter_type;
00071 
00072 #ifndef ADOBE_NO_DOCUMENTATION
00073     BOOST_STATIC_ASSERT((boost::is_same<setter_type, link_setter_type>::value));
00074 #endif
00075 
00077     link_t(const std::string&          alt_text,
00078            const any_regular_t& on_value,
00079            const any_regular_t& off_value,
00080            long                        count,
00081            theme_t                     theme);
00082 
00089     void measure(extents_t& result);
00090 
00091     void place(const place_data_t& place_data);
00093 
00100     void display(const any_regular_t& to_value);
00102 
00109     void enable(bool make_enabled);
00110 
00111     void monitor(const setter_type& proc);
00113 
00114 #ifndef ADOBE_NO_DOCUMENTATION
00115     ::ControlRef               control_m;
00116     std::string                alt_text_m;
00117     any_regular_t       on_value_m;
00118     any_regular_t       off_value_m;
00119     long                       count_m;
00120     theme_t                    theme_m;
00121     link_hit_handler_t         hit_handler_m;
00122     mutable metric_extractor_t metrics_m;
00123     guide_set_t                prongs_m;
00124     any_regular_t       value_m;
00125 #endif
00126 };
00127 
00128 /****************************************************************************************************/
00129 
00130 } // namespace adobe
00131 
00132 /****************************************************************************************************/
00133 
00134 #endif
00135 
00136 /****************************************************************************************************/

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