platform_window.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_WINDOW_HPP 00010 #define ADOBE_WIDGET_WINDOW_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <adobe/eve.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/future/widgets/headers/window_helper.hpp> 00019 #include <adobe/macintosh_carbon_safe.hpp> 00020 00021 /****************************************************************************************************/ 00022 00023 namespace adobe { 00024 00025 /****************************************************************************************************/ 00026 #ifndef ADOBE_NO_DOCUMENTATION 00027 struct window_t; 00028 00029 /****************************************************************************************************/ 00030 00031 struct window_resize_handler_t 00032 { 00033 explicit window_resize_handler_t(window_t& window) : 00034 window_m(window) 00035 { 00036 handler_m.insert(kEventClassWindow, kEventWindowBoundsChanged); 00037 00038 handler_m.monitor_proc_m = boost::bind(&window_resize_handler_t::handle_event, 00039 boost::ref(*this), _1, _2); 00040 } 00041 00042 ::OSStatus handle_event(::EventHandlerCallRef next, 00043 ::EventRef event); 00044 00045 event_handler_t handler_m; 00046 window_resize_proc_t callback_m; 00047 window_t& window_m; 00048 }; 00049 00050 /****************************************************************************************************/ 00051 00052 struct window_close_handler_t 00053 { 00054 explicit window_close_handler_t(window_t& window) : 00055 window_m(window) 00056 { 00057 handler_m.insert(kEventClassWindow, kEventWindowClose); 00058 00059 handler_m.monitor_proc_m = boost::bind(&window_close_handler_t::handle_event, 00060 boost::ref(*this), _1, _2); 00061 } 00062 00063 ::OSStatus handle_event(::EventHandlerCallRef next, 00064 ::EventRef event); 00065 00066 event_handler_t handler_m; 00067 window_close_proc_t callback_m; 00068 window_t& window_m; 00069 }; 00070 #endif 00071 /****************************************************************************************************/ 00077 struct window_t 00078 { 00080 window_t(const std::string& name, 00081 window_style_t style, 00082 window_attributes_t attributes, 00083 window_modality_t modality, 00084 theme_t theme); 00085 00087 ~window_t(); 00088 00095 void measure(extents_t& result); 00096 00097 void place(const place_data_t& place_data); 00099 00100 #ifndef ADOBE_NO_DOCUMENTATION 00101 void set_visible(bool make_visible); 00102 00103 void set_size(const point_2d_t& size); 00104 00105 void reposition(window_reposition_t position); 00106 00107 void monitor_resize(const window_resize_proc_t& proc); 00108 00109 any_regular_t underlying_handler() { return any_regular_t(window_m); } 00110 00111 bool handle_key(key_type /*key*/, bool /*pressed*/, modifiers_t /*modifiers*/) 00112 { return false; } 00113 00114 ::WindowRef window_m; 00115 ::ControlRef root_control_m; 00116 std::string name_m; 00117 window_style_t style_m; 00118 window_attributes_t attributes_m; 00119 window_modality_t modality_m; 00120 theme_t theme_m; 00121 mutable metric_extractor_t metrics_m; 00122 point_2d_t dimensions_m; 00123 bool debounce_m; // for resizing transition 00124 window_resize_handler_t resize_handler_m; 00125 window_close_handler_t close_handler_m; 00126 bool placed_once_m; 00127 #endif 00128 }; 00129 00130 /****************************************************************************************************/ 00131 00132 } // namespace adobe 00133 00134 /****************************************************************************************************/ 00135 00136 #endif 00137 00138 /****************************************************************************************************/ |