stlab.adobe.com Adobe Systems Incorporated

platform_checkbox.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_CHECKBOX_HPP
00010 #define ADOBE_WIDGET_CHECKBOX_HPP
00011 
00012 /****************************************************************************************************/
00013 
00014 #include <adobe/future/widgets/headers/widget_utils.hpp>
00015 #include <adobe/future/widgets/headers/macintosh_metric_extractor.hpp>
00016 
00017 #include <adobe/macintosh_carbon_safe.hpp>
00018 #include <adobe/future/macintosh_events.hpp>
00019 
00020 #include <boost/function.hpp>
00021 #include <boost/operators.hpp>
00022 #include <boost/type_traits.hpp>
00023 #include <boost/static_assert.hpp>
00024 
00025 /****************************************************************************************************/
00026 
00027 namespace adobe {
00028 
00029 /****************************************************************************************************/
00030 #ifndef ADOBE_NO_DOCUMENTATION
00031 struct checkbox_t;
00032 
00033 /****************************************************************************************************/
00034 
00035 typedef boost::function<void (const any_regular_t&)> checkbox_setter_type;
00036 
00037 /****************************************************************************************************/
00038 
00039 struct checkbox_hit_handler_t
00040 {
00041     explicit checkbox_hit_handler_t(checkbox_t& widget) :
00042         widget_m(widget)
00043     {
00044         handler_m.insert(kEventClassControl, kEventControlHit);
00045 
00046         handler_m.monitor_proc_m = boost::bind(&checkbox_hit_handler_t::handle_event,
00047                                                boost::ref(*this), _1, _2);
00048     }
00049 
00050     ::OSStatus handle_event(::EventHandlerCallRef next, ::EventRef event);
00051 
00052     event_handler_t      handler_m;
00053     checkbox_setter_type setter_m;
00054     checkbox_t&          widget_m;
00055 };
00056 #endif
00057 /****************************************************************************************************/
00058 
00075 struct checkbox_t
00076 {
00078     typedef any_regular_t                      model_type;
00079 
00081     typedef boost::function<void (const model_type&)> setter_type;
00082 
00083 #ifndef ADOBE_NO_DOCUMENTATION
00084     BOOST_STATIC_ASSERT((boost::is_same<setter_type, checkbox_setter_type>::value));
00085 #endif
00086 
00098     checkbox_t( const std::string&          name,
00099                 const any_regular_t& true_value,
00100                 const any_regular_t& false_value,
00101                 theme_t                     theme,
00102                 const std::string&          alt_text);
00103 
00110     void measure(extents_t& result);
00111 
00112     void place(const place_data_t& place_data);
00114 
00129     void display(const any_regular_t& value);
00131 
00138     void enable(bool make_enabled);
00139 
00151     void monitor(setter_type proc);
00153 
00154 #ifndef ADOBE_NO_DOCUMENTATION
00155     friend bool operator==(const checkbox_t& x, const checkbox_t& y);
00156 
00157     ::ControlRef               control_m;
00158     theme_t                    theme_m;
00159     mutable metric_extractor_t metrics_m;
00160     checkbox_hit_handler_t     hit_handler_m;
00161     any_regular_t       true_value_m;
00162     any_regular_t       false_value_m;
00163     std::string                alt_text_m;
00164     std::string                name_m;
00165 #endif
00166 };
00167 
00168 /****************************************************************************************************/
00169 
00170 #ifndef ADOBE_NO_DOCUMENTATION
00171 bool operator==(const checkbox_t& x, const checkbox_t& y);
00172 #endif
00173 
00174 /****************************************************************************************************/
00175 
00176 } // namespace adobe
00177 
00178 /****************************************************************************************************/
00179 
00180 #endif
00181 
00182 /****************************************************************************************************/

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