stlab.adobe.com Adobe Systems Incorporated

platform_radio_button.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_RADIO_BUTTON_HPP
00010 #define ADOBE_WIDGET_RADIO_BUTTON_HPP
00011 
00012 /****************************************************************************************************/
00013 
00014 #include <adobe/any_regular.hpp>
00015 #include <adobe/future/macintosh_events.hpp>
00016 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp>
00017 #include <adobe/future/widgets/headers/widget_utils.hpp>
00018 #include <adobe/macintosh_carbon_safe.hpp>
00019 
00020 #include <boost/function.hpp>
00021 
00022 /****************************************************************************************************/
00023 
00024 namespace adobe {
00025 
00026 /****************************************************************************************************/
00027 #ifndef ADOBE_NO_DOCUMENTATION
00028 struct radio_button_t;
00029 
00030 /****************************************************************************************************/
00031 
00032 typedef boost::function<void (const any_regular_t&)> radio_button_monitor_proc_t;
00033 
00034 /****************************************************************************************************/
00035 
00036 struct radio_button_hit_handler_t
00037 {
00038     explicit radio_button_hit_handler_t(radio_button_t& widget) :
00039         widget_m(widget)
00040     {
00041         handler_m.insert(kEventClassControl, kEventControlHit);
00042 
00043         handler_m.monitor_proc_m = boost::bind(&radio_button_hit_handler_t::handle_event,
00044                                                boost::ref(*this), _1, _2);
00045     }
00046 
00047     ::OSStatus handle_event(::EventHandlerCallRef next,
00048                             ::EventRef            event);
00049 
00050     event_handler_t             handler_m;
00051     radio_button_monitor_proc_t setter_m;
00052     radio_button_t&             widget_m;
00053 };
00054 #endif
00055 /****************************************************************************************************/
00056 
00065 struct radio_button_t
00066 {
00068     typedef any_regular_t model_type;
00069 
00076     radio_button_t(const std::string&          name,
00077                    const std::string&          alt_text,
00078                    const any_regular_t& value,
00079                    theme_t              theme);
00080 
00087     void measure(extents_t& result);
00088 
00089     void place(const place_data_t& place_data);
00091 
00105     void display(const model_type& value);
00107 
00124     void monitor(const radio_button_monitor_proc_t& proc);
00125 
00129     void enable(bool make_enabled);
00131 
00132 #ifndef ADOBE_NO_DOCUMENTATION
00133     ::ControlRef               control_m;
00134     std::string                name_m;
00135     std::string                alt_text_m;
00136     any_regular_t       set_value_m;
00137     theme_t                    theme_m;
00138     radio_button_hit_handler_t hit_handler_m;
00139     any_regular_t       last_m;
00140     mutable metric_extractor_t metrics_m;
00141 #endif
00142 };
00143 
00144 /****************************************************************************************************/
00145 
00146 } // namespace adobe
00147 
00148 /****************************************************************************************************/
00149 
00150 #endif
00151 
00152 /****************************************************************************************************/

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