stlab.adobe.com Adobe Systems Incorporated

platform_label.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_LABEL_T_HPP
00010 #define ADOBE_WIDGET_LABEL_T_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/future/macintosh_events.hpp>
00019 #include <adobe/future/widgets/headers/widget_factory.hpp>
00020 #include <adobe/macintosh_carbon_safe.hpp>
00021 
00022 /****************************************************************************************************/
00023 
00024 namespace adobe {
00025 
00026 /****************************************************************************************************/
00027 #ifndef ADOBE_NO_DOCUMENTATION
00028 struct sheet_t;
00029 struct assemblage_t;
00030 
00031 /****************************************************************************************************/
00032 
00033 enum label_subevent_t
00034 {
00035     subevent_none_s = 0,
00036     subevent_mouse_down_s,
00037     subevent_mouse_up_s,
00038     subevent_mouse_in_s,
00039     subevent_mouse_out_s
00040 };
00041 
00042 typedef boost::function<void (label_subevent_t)> label_subevent_callback_t;
00043 
00044 struct label_subevent_handler_t
00045 {
00046     label_subevent_handler_t() :
00047         control_m(0)
00048     {
00049         handler_m.insert(kEventClassControl, kEventControlClick);
00050         handler_m.insert(kEventClassControl, kEventControlHit);
00051         handler_m.insert(kEventClassControl, kEventControlTrackingAreaEntered);
00052         handler_m.insert(kEventClassControl, kEventControlTrackingAreaExited);
00053 
00054         handler_m.monitor_proc_m = boost::bind(&label_subevent_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     label_subevent_callback_t callback_m;
00063     ::ControlRef              control_m;
00064 };
00065 #endif
00066 /****************************************************************************************************/
00067 
00076 struct label_t : boost::equality_comparable<label_t>
00077 {
00079     typedef std::string model_type;
00080 
00082     label_t(const std::string& name,
00083             const std::string& alt_text,
00084             std::size_t        characters,
00085             theme_t            theme);
00086 
00087 #ifndef ADOBE_NO_DOCUMENTATION
00088     auto_control_t             control_m;
00089     std::string                name_m;
00090     std::string                alt_text_m;
00091     theme_t                    theme_m;
00092     mutable metric_extractor_t metrics_m;
00093     std::size_t                characters_m;
00094     label_subevent_handler_t   subevent_m;
00095 #endif
00096 };
00097 
00098 /****************************************************************************************************/
00099 
00108 void measure(label_t& value, extents_t& result);
00109 
00110 void measure_vertical(label_t& value, extents_t& calculated_horizontal, 
00111                         const place_data_t& placed_horizontal);
00112 
00113 void place(label_t& value, const place_data_t& place_data);
00115 
00116 /****************************************************************************************************/
00117 #ifndef ADOBE_NO_DOCUMENTATION
00118 
00119 /****************************************************************************************************/
00120 
00121 void enable(label_t& value, bool make_enabled);
00122 bool operator==(const label_t& x, const label_t& y);
00123 
00124 /****************************************************************************************************/
00125 
00126 namespace implementation {
00127 
00128 /****************************************************************************************************/
00129 
00130 template <>
00131 std::string get_name<label_t>(const label_t& widget);
00132 
00133 /****************************************************************************************************/
00134 
00135 template <>
00136 void set_name< label_t >(label_t& control, const std::string& name);
00137 #endif
00138 /****************************************************************************************************/
00139 
00140 } // namespace implementation
00141 
00142 /****************************************************************************************************/
00143 #ifndef ADOBE_NO_DOCUMENTATION
00144 void measure_label_text(const std::string& text, theme_t theme, extents_t& result);
00145 #endif
00146 /****************************************************************************************************/
00147 
00148 } // namespace adobe
00149 
00150 /****************************************************************************************************/
00151 
00152 #endif
00153 
00154 /****************************************************************************************************/

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