stlab.adobe.com Adobe Systems Incorporated

platform_reveal.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_REVEAL_HPP
00010 #define ADOBE_WIDGET_REVEAL_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/eve.hpp>
00018 #include <adobe/macintosh_carbon_safe.hpp>
00019 #include <adobe/future/macintosh_events.hpp>
00020 #include <adobe/future/widgets/headers/widget_factory.hpp>
00021 
00022 #include <adobe/future/widgets/headers/platform_label.hpp>
00023 
00024 #include <boost/function.hpp>
00025 #include <boost/operators.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 reveal_t;
00039 
00040 /****************************************************************************************************/
00041 
00042 typedef boost::function<void (const any_regular_t&)> reveal_setter_type;
00043 
00044 /****************************************************************************************************/
00045 
00046 struct reveal_hit_handler_t
00047 {
00048     explicit reveal_hit_handler_t(reveal_t& widget) :
00049         widget_m(widget)
00050     {
00051         handler_m.insert(kEventClassControl, kEventControlHit);
00052 
00053         handler_m.monitor_proc_m = boost::bind(&reveal_hit_handler_t::handle_event,
00054                                                boost::ref(*this), _1, _2);
00055     }
00056 
00057     ::OSStatus handle_event(::EventHandlerCallRef next,
00058                             ::EventRef            event);
00059 
00060     event_handler_t    handler_m;
00061     reveal_setter_type setter_m;
00062     reveal_t&          widget_m;
00063 };
00064 #endif
00065 /****************************************************************************************************/
00066 
00076 struct reveal_t
00077 {
00079     typedef any_regular_t model_type;
00080 
00082     typedef boost::function<void (const model_type&)> setter_type;
00083 
00084 #ifndef ADOBE_NO_DOCUMENTATION
00085     BOOST_STATIC_ASSERT((boost::is_same<setter_type, reveal_setter_type>::value));
00086 #endif
00087 
00098     reveal_t(const std::string&     name,
00099              const any_regular_t&   show_value,
00100              theme_t                theme,
00101              const std::string&     alt_text);
00102 
00109     void measure(extents_t& result);
00110 
00111     void place(const place_data_t& place_data);
00113 
00128     void display(const any_regular_t& to_value);
00129 
00136     inline void display(const bool& to_value)
00137         { display(any_regular_t(to_value)); }
00139 
00146     void monitor(setter_type proc);
00147 
00148     void enable(bool make_enabled);
00150 
00151 #ifndef ADOBE_NO_DOCUMENTATION
00152     auto_control_t              control_m;
00153     theme_t                     theme_m;
00154     std::string                 name_m;
00155     mutable metric_extractor_t  metrics_m;
00156     reveal_hit_handler_t        hit_handler_m;
00157     any_regular_t               last_m;
00158     any_regular_t               show_value_m;
00159     std::string                 alt_text_m;
00160 #endif
00161 };
00162 
00163 /****************************************************************************************************/
00164 
00165 namespace view_implementation {
00166 
00167 /****************************************************************************************************/
00168 #ifndef ADOBE_NO_DOCUMENTATION
00169 inline void set_value_from_model(reveal_t& value, const any_regular_t& new_value)
00170 { value.display(new_value); }
00171 #endif
00172 /****************************************************************************************************/
00173 
00174 } // namespace view_implementation
00175 
00176 /****************************************************************************************************/
00177 
00178 } // namespace adobe
00179 
00180 /****************************************************************************************************/
00181 
00182 #endif
00183 
00184 /****************************************************************************************************/

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