platform_display_number.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_DISPLAY_NUMBER_HPP 00010 #define ADOBE_DISPLAY_NUMBER_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <windows.h> 00015 #include <adobe/memory.hpp> 00016 #include <boost/operators.hpp> 00017 #include <adobe/layout_attributes.hpp> 00018 #include <adobe/widget_attributes.hpp> 00019 #include <string> 00020 #include <boost/noncopyable.hpp> 00021 #include <adobe/future/widgets/headers/number_unit.hpp> 00022 00023 /****************************************************************************************************/ 00024 00025 namespace adobe { 00026 00027 /****************************************************************************************************/ 00028 00029 struct display_number_t : boost::noncopyable 00030 { 00031 typedef double model_type; 00032 00033 typedef std::vector<unit_t> unit_set_t; 00034 00035 template <class ForwardIterator> 00036 display_number_t(const std::string& name, 00037 const std::string& alt_text, 00038 ForwardIterator first, 00039 ForwardIterator last, 00040 theme_t theme, 00041 int characters); 00042 00043 HWND window_m; 00044 WNDPROC default_window_proc_m; 00045 RECT bounds_m; 00046 std::string name_m; 00047 std::string alt_text_m; 00048 unit_set_t unit_set_m; 00049 theme_t theme_m; 00050 std::wstring::size_type label_chars_m; 00051 int characters_m; 00052 00053 void initialize(HWND parent); 00054 00055 void measure(extents_t& result); 00056 void measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal); 00057 00058 void place(const place_data_t& place_data); 00059 00060 void display(const model_type& value); 00061 }; 00062 00063 /****************************************************************************************************/ 00064 00065 template <typename ForwardIterator> 00066 display_number_t::display_number_t( 00067 const std::string& name, 00068 const std::string& alt_text, 00069 ForwardIterator first, 00070 ForwardIterator last, 00071 theme_t theme, 00072 int characters) 00073 : name_m(name), 00074 alt_text_m(alt_text), 00075 unit_set_m(first, last), 00076 theme_m(theme), 00077 label_chars_m(0), 00078 characters_m(characters) 00079 { } 00080 00081 /****************************************************************************************************/ 00082 00083 inline HWND get_display(const display_number_t& widget) 00084 { return widget.window_m; } 00085 00086 /****************************************************************************************************/ 00087 00088 } // namespace adobe 00089 00090 /****************************************************************************************************/ 00091 00092 #endif 00093 00094 /****************************************************************************************************/ |