|
From: Foster B. <fos...@us...> - 2005-04-02 05:48:06
|
Update of /cvsroot/adobe-source/adobe-source/adobe/test/visual/headers/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17172/adobe/test/visual/headers/win Modified Files: ui_core_implementation.hpp Added Files: metrics.hpp Log Message: asl 1.0.2 --- NEW FILE: metrics.hpp --- /* Copyright 2005 Ralph Thomas Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ // // This header defines a class which can return various widget metrics // on Windows systems. When available the UXTHEME library is used to // discover metrics. When UXTHEME is not available some reasonable // defaults (precalculated on a system with UXTHEME) are returned. // /****************************************************************************************************/ #ifndef ADOBE_METRICS_HPP #define ADOBE_METRICS_HPP /****************************************************************************************************/ #include <windows.h> #include <uxtheme.h> #include <tmschema.h> #include <string> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ // /// The metrics_t class is a singleton which can fetch information /// on ideal widget sizes. There are two possible designs here: /// <ol> /// <li>Provide simple metric and text information.</li> /// <li>Provide ideal sizes for specific widgets.</li> /// </ol> /// It has been chosen to take design (1), the calculation of /// individual widget ideal sizes belongs in the ui_core_implementation /// code. This class is a singleton, a reference to it has to be /// obtained using metrics_t::getInstance . /// /// All of the functions which return metrics require the widget type /// and state of the widget. A table of all the part and state names /// is available here: /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/topics/partsandstates.asp // class metrics_t { public: // /// Return a reference to the single instance of metrics_t. /// /// \return a reference to the single instance of metrics_t. // static metrics_t& get_instance(); // /// Get the correct font to use for the given widget. This font must /// be used for the font metrics to be correct. /// /// \param widget_type the type of the widget. /// \param out_font a reference filled with the requested font. /// /// \return true if the font was returned successfully, false if /// the font could not be returned. // virtual bool get_font(int widget_type, LOGFONTW& out_font) const = 0; // /// Get the metrics for the font which should be used in the given widget. /// /// \param widget_type the type of the widget. /// \param out_metrics a reference filled with the text metrics. /// /// \return true if the font metrics were returned successfully, false /// if the metrics could not be returned. // virtual bool get_font_metrics(int widget_type, TEXTMETRIC& out_metrics) const = 0; // /// Get the extents for the given text string, to be contained in the /// specified widget. /// /// \param widget_type the type of the widget. /// \param text the string to return the extents for. /// \param out_extents a reference filled with the text extents. /// /// \return true if the text extents were returned successfully, false /// if the metrics could not be returned. // virtual bool get_text_extents(int widget_type, std::wstring text, RECT& out_extents) const = 0; // /// Get the specified measurement for the given widget when in the /// given state. /// /// \param widget_type the type of the widget. /// \param measurement the required measurement. /// \param out_val a reference filled with the requested value. /// /// \return true if the value was returned successfully, false /// if the value could not be found. // virtual bool get_integer(int widget_type, int measurement, int& out_val) const = 0; // /// Get the size of the specified widget. /// /// \param widget_type the type of the widget. /// \param measurement the size to get: TS_MIN, TS_TRUE, or TS_DRAW. /// \param out_size a reference filled with the requested rectangle. /// /// \return true if the rectangle was returned successfully, false /// if the rectangle could not be found. // virtual bool get_size(int widget_type, THEMESIZE measurement, SIZE& out_size) const = 0; // /// Get the margins for the specified widget. Typically the margins /// describe space which must be added around the text rectangle for /// controls with a caption. /// /// \param widget_type the type of the widget. /// \param out_margins a reference filled with the margins of the widget. /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_margins(int widget_type, MARGINS& out_margins) const = 0; // /// Before any of the other functions can be called, the theme data must be /// loaded from the window. This function should also be called any time the /// window recieves a WM_THEMECHANGED message. /// /// \param window the window to get the theme from. Note that it is not /// important which window is used, it does not have to /// be the same window every time. /// /// \return true if the theme was obtained from the window, false if the /// theme could not be obtained from the window. // virtual bool set_window(HWND window) = 0; }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif Index: ui_core_implementation.hpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/test/visual/headers/win/ui_core_implementation.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ui_core_implementation.hpp 23 Mar 2005 18:51:36 -0000 1.3 --- ui_core_implementation.hpp 2 Apr 2005 05:47:39 -0000 1.4 *************** *** 45,80 **** /****************************************************************************************************/ - // REVISIT (fbrereto) : I'd like to be able to set this up 1) so the fudges can be made on a - // per-OS-version basis, 2) so they can be adjusted without requiring - // a recompile, and 3) so they are dynamic based on the widget's theme settings. - - struct fudge_t : private rectangle_slices_t - { - struct slice_t - { - pair_long_t geometry_m; // affects the position and the length - }; - - boost::array<slice_t, 2> slice_m; - long baseline_m; - - fudge_t() : - baseline_m(0) - { } - - long& top() { return slice_m[vertical].geometry_m.first; } - const long& top() const { return slice_m[vertical].geometry_m.first; } - - long& left() { return slice_m[horizontal].geometry_m.first; } - const long& left() const { return slice_m[horizontal].geometry_m.first; } - - long& bottom() { return slice_m[vertical].geometry_m.second; } - const long& bottom() const { return slice_m[vertical].geometry_m.second; } - - long& right() { return slice_m[horizontal].geometry_m.second; } - const long& right() const { return slice_m[horizontal].geometry_m.second; } - }; - - /****************************************************************************************************/ #ifndef NDEBUG --- 45,48 ---- *************** *** 127,133 **** bool is_focused(); void signal_focus(const implementation::control_focus_proc_t& proc); ! void set_min_value(long value); ! void set_max_value(long value); ! void set_value(long value); ADOBE_SERIALIZABLE_TOTAL_ORDERING_BOILERPLATE_FRIEND_DECLARATION(adobe::control_t); --- 95,99 ---- bool is_focused(); void signal_focus(const implementation::control_focus_proc_t& proc); ! void trap_window_proc(WNDPROC new_window_proc); ADOBE_SERIALIZABLE_TOTAL_ORDERING_BOILERPLATE_FRIEND_DECLARATION(adobe::control_t); *************** *** 135,144 **** virtual dictionary_t essentials() const; HWND control_m; theme_t theme_m; implementation::control_focus_proc_t focus_proc_m; - //EventHandlerRef focus_callback_ref_m; rectangle_t geometry_m; // saving set_bounds param for essentials ! fudge_t fudges_m; // added in best_bounds (apply_fudges); subtracted in set_bounds (shed_fudges) }; --- 101,116 ---- virtual dictionary_t essentials() const; + virtual void user_hit(); + HWND control_m; + WNDPROC default_window_proc_m; theme_t theme_m; implementation::control_focus_proc_t focus_proc_m; rectangle_t geometry_m; // saving set_bounds param for essentials ! point_t position_m; // saving set_bounds param for widget framing ! int uxtheme_type_m; ! #ifndef NDEBUG ! bool placed_m; // used in the framing rect code to make sure the widget is placed first ! #endif }; *************** *** 193,197 **** value_t parse(const std::string& str, value_t the_type); ! //auto_resource<CFNumberFormatterRef> formatter_m; }; --- 165,169 ---- value_t parse(const std::string& str, value_t the_type); ! std::string format_m; }; *************** *** 211,216 **** virtual dictionary_t essentials() const; - - virtual rectangle_t best_bounds(); }; --- 183,186 ---- *************** *** 272,276 **** const button_t::state_descriptor_t* first, const button_t::state_descriptor_t* last); - virtual rectangle_t best_bounds(); void set_default(bool is_default); void set_cancel(bool is_cancel); --- 242,245 ---- *************** *** 282,285 **** --- 251,256 ---- virtual dictionary_t essentials() const; + virtual void user_hit(); + state_set_t state_set_m; //EventHandlerRef handler_ref_m; *************** *** 296,300 **** void initialize(const RECT& bounds, const std::string& name); ! virtual rectangle_t best_bounds(); void signal_hit(const implementation::radio_button_hit_proc_t& proc); --- 267,271 ---- void initialize(const RECT& bounds, const std::string& name); ! virtual void set_value(std::size_t is_checked); void signal_hit(const implementation::radio_button_hit_proc_t& proc); *************** *** 303,307 **** virtual dictionary_t essentials() const; ! implementation::radio_button_hit_proc_t hit_proc_m; }; --- 274,281 ---- virtual dictionary_t essentials() const; ! virtual void user_hit(); ! ! implementation::radio_button_hit_proc_t hit_proc_m; ! bool is_checked_m; }; *************** *** 316,321 **** void initialize(const RECT& bounds, const std::string& name); ! virtual rectangle_t best_bounds(); ! void signal_hit(const implementation::radio_button_hit_proc_t& proc); ADOBE_SERIALIZABLE_TOTAL_ORDERING_BOILERPLATE_FRIEND_DECLARATION(adobe::checkbox_t::implementation_t); --- 290,295 ---- void initialize(const RECT& bounds, const std::string& name); ! virtual void set_value(std::size_t is_checked); ! void signal_hit(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_TOTAL_ORDERING_BOILERPLATE_FRIEND_DECLARATION(adobe::checkbox_t::implementation_t); *************** *** 323,327 **** virtual dictionary_t essentials() const; ! implementation::checkbox_hit_proc_t hit_proc_m; }; --- 297,304 ---- virtual dictionary_t essentials() const; ! virtual void user_hit(); ! ! implementation::checkbox_hit_proc_t hit_proc_m; ! bool is_checked_m; }; *************** *** 366,369 **** --- 343,349 ---- bool is_vertical); virtual rectangle_t best_bounds(); + void set_min_value(long min_value); + void set_max_value(long max_value); + void set_value(long value); ADOBE_SERIALIZABLE_TOTAL_ORDERING_BOILERPLATE_FRIEND_DECLARATION(adobe::progress_bar_t::implementation_t); *************** *** 401,405 **** void initialize(const RECT& bounds, const std::string& name); - virtual rectangle_t best_bounds(); long best_height_given_width(long width); void set_name(const std::string& name); --- 381,384 ---- *************** *** 454,460 **** long rows_m; long cols_m; ! long static_width_m; long static_height_m; - long static_adjust_m; implementation::edit_text_pre_edit_proc_t pre_edit_proc_m; implementation::edit_text_post_edit_proc_t post_edit_proc_m; --- 433,440 ---- long rows_m; long cols_m; ! long edit_baseline_m; ! long edit_height_m; ! long static_baseline_m; long static_height_m; implementation::edit_text_pre_edit_proc_t pre_edit_proc_m; implementation::edit_text_post_edit_proc_t post_edit_proc_m; *************** *** 494,500 **** static_text_t static_disabled_text_m; bool static_disabled_m; ! long static_width_m; long static_height_m; ! long static_adjust_m; bool using_label_m; implementation::popup_value_proc_t value_proc_m; --- 474,481 ---- static_text_t static_disabled_text_m; bool static_disabled_m; ! long static_baseline_m; long static_height_m; ! long popup_baseline_m; ! long popup_height_m; bool using_label_m; implementation::popup_value_proc_t value_proc_m; *************** *** 534,541 **** popup_t popup_m; bool using_popup_m; - long popup_width_m; long popup_height_m; ! long popup_adjust_m; ! long edit_width_m; }; --- 515,522 ---- popup_t popup_m; bool using_popup_m; long popup_height_m; ! long popup_baseline_m; ! long edit_height_m; ! long edit_baseline_m; }; *************** *** 555,558 **** --- 536,542 ---- virtual rectangle_t best_bounds(); void set_bounds(const point_t& position, const rectangle_t& geometry); + void set_min_value(long min_value); + void set_max_value(long max_value); + void set_value(long value); void signal_value_change(const implementation::slider_value_proc_t& proc); *************** *** 586,589 **** --- 570,574 ---- void set_bevel_amount(bevel_button_bevel_amount_t amount); void set_current_menu_item(const value_t& item); + void set_value(bool) { /* stubbed out */ } void signal_hit(const implementation::bevel_button_hit_proc_t& proc); void signal_value_change(const implementation::bevel_button_popup_value_proc_t& proc); |