|
From: Foster B. <fos...@us...> - 2006-02-03 18:20:54
|
Update of /cvsroot/adobe-source/adobe-source/adobe/future/widgets/headers/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1031/adobe/future/widgets/headers/win32 Added Files: event_dispatcher.hpp metrics.hpp ui_core_implementation.hpp wincast.hpp Log Message: asl 1.0.13 --- NEW FILE: event_dispatcher.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 the event_dispatcher, a class which is used to send events /// to the correct control_t. It works by knowing about all control_t's and the /// child IDs of thier windows. When an event comes in, it finds out which child ID /// generated it and forwards the event to the owning control_t. /// /// It is also able to handle keyboard modifier events, before they get translated /// and dispatched by the message pump. When the currently pressed combination of /// modifiers changes all of the controls are informed, in case they need to change /// their titles. // /****************************************************************************************************/ #ifndef ADOBE_EVENT_DISPATCHER_HPP #define ADOBE_EVENT_DISPATCHER_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <map> #include <string> #include <windows.h> /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t; /****************************************************************************************************/ // /// The event_dispatcher keeps track of all control_t's and the child ids which /// they use. All control_t objects should contain a event_dispatcher::reference /// inside them. // class event_dispatcher { typedef std::map<int, control_t*> control_map_t; control_map_t control_map_m; ///< Mapping Child ID -> control_t* int current_id_m; ///< Child ID to next issue // /// This private constructor maintains the singleton nature of /// this class. // event_dispatcher(); friend class reference; public: // /// This reference class contains a reference to the event_dispatcher, /// and should be used by controls to subscribe and unsubscribe -- all /// controls should have one of these as a member variable. // class reference { int child_id_m; ///< The child ID for the owning control_t. public: // /// This constructor initializes all values to zero, and acquires a /// reference to the event_dispatcher. // reference(); // /// Unsubscribe any control which subscribed to the event_dispatcher /// and release the reference to the event_dispatcher. // ~reference(); // /// Subscribe the given control_t to the event_dispatcher. The returned /// value should be used as the child Id for the window which the given /// control will create. /// /// \param control the control to subscribe to events. /// \return the child id for the control to use. // HMENU subscribe(control_t* control); // /// Return the child ID. /// /// \return the child id to use for windows belonging to the subscribed /// control, or NULL if no control has subscribed through this /// reference. // HMENU child_id() const; }; // /// Dispatch an event through to the control which needs to process it. /// /// \param message The Windows message type. /// \param wParam The pointer parameter of the message. /// \param lParam the long parameter of the message. /// \param handled this reference bool is set to true if the message /// was dispatched to a child, or to false if no child /// could be found. /// \return the result of the event. // static LRESULT event(UINT message, WPARAM wParam, LPARAM lParam, bool& handled); // /// Examine the given keyboard message and send any required modifier events /// to controls. /// /// \param message The Windows message type. /// \param wParam The WPARAM value from the Windows message. // static void keyboard(UINT message, WPARAM wParam); }; /****************************************************************************************************/ } /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: wincast.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_WINCAST_HPP #define ADOBE_WINCAST_HPP #include <adobe/config.hpp> /****************************************************************************************************/ namespace { /****************************************************************************************************/ namespace hackery { /****************************************************************************************************/ template <typename T, typename U> inline T cast(U u) { // REVISIT (fbrereto) : This function circumvents an issue where MSVC won't allow for the casting // of a primitive of smaller type to one of larger type. Please use sparingly, // but when this type of cast must be made use this function so it can be // pulled out easily. #pragma warning ( push ) #pragma warning ( disable : 4311 ) // typecast pointer truncation from type to type #pragma warning ( disable : 4312 ) // typecast conversion from type to type of greater size #pragma warning ( disable : 4800 ) // conversion to true/false performance warning return (T)(u); #pragma warning ( pop ) } /****************************************************************************************************/ } // namespace hackery /****************************************************************************************************/ } // namespace /****************************************************************************************************/ #endif /****************************************************************************************************/ --- NEW FILE: ui_core_implementation.hpp --- /* Copyright 2005-2006 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /****************************************************************************************************/ #ifndef ADOBE_UI_CORE_IMPLEMENTATION_HPP #define ADOBE_UI_CORE_IMPLEMENTATION_HPP /****************************************************************************************************/ #include <adobe/config.hpp> #include <windows.h> #include <Commctrl.h> #include "ui_core.hpp" #include "event_dispatcher.hpp" #include <adobe/future/memory.hpp> #include <adobe/extents.hpp> #include <adobe/dictionary_fwd.hpp> /****************************************************************************************************/ #define ADOBE_DELETE_PTR_SPECIALIZATION(type, func) \ template <> \ struct adobe::delete_ptr<##type> \ { \ void operator()(##type x) const \ { if (x) func(x); } \ } /****************************************************************************************************/ extern const RECT initial_bounds_g; /****************************************************************************************************/ namespace adobe { /****************************************************************************************************/ struct control_t : boost::equality_comparable<control_t> { control_t(); control_t(theme_t theme); control_t(const control_t& rhs); virtual ~control_t(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_name(const std::string& name); virtual void set_theme(theme_t theme); void adorn_theme(theme_t theme); void unadorn_theme(theme_t theme); void set_active(bool make_active); void set_visible(bool make_visible); void set_focused(bool make_focused); bool is_focused(); void signal_focus(const implementation::control_focus_proc_t& proc); void trap_window_proc(WNDPROC new_window_proc); // /// This function is invoked when the parent window of this control recieves a message /// generated by the control's window. /// /// \param message Windows message code. /// \param wParam pointer parameter. /// \param lParam long parameter. // virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); // /// This function is invoked when one of the modifier keys is pressed or released. /// /// \param modifiers the modifier keys currently pressed. // virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::control_t); 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; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; // saving set_bounds param for widget framing int uxtheme_type_m; static HWND invisible_parent_m; // an invisible window used as the initial parent for all controls. event_dispatcher::reference event_dispatcher_m; // ref. to singleton event dispatcher. HMENU child_id_m; // this control_m's child id. }; /****************************************************************************************************/ struct window_t::implementation_t : boost::equality_comparable<window_t::implementation_t> { implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const std::string& name, const RECT& bounds, window_style_t style, window_attributes_t attributes, window_modality_t modality); void initialize( const std::string& name, const RECT& bounds, DWORD style); extents_t measure(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_size(const point_2d_t& size); void reposition(window_reposition_t position); void set_visible(bool make_visible); void draw_controls(); void signal_resize_complete(const implementation::window_resize_complete_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::window_t::implementation_t); dictionary_t essentials() const; HWND window_m; extents_t geometry_m; // saving set_bounds param for essentials point_2d_t position_m; implementation::window_resize_complete_proc_t resize_complete_proc_m; bool debounce_m; std::pair<long, long> min_size_m; }; /****************************************************************************************************/ struct number_formatter_t::implementation_t { implementation_t(); implementation_t(const implementation_t& rhs); void initialize(); void set_format(const std::string& format); std::string get_format() const; std::string format(const value_t& x); value_t parse(const std::string& str, value_t the_type); std::string format_m; }; /****************************************************************************************************/ struct group_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name); virtual extents_t best_bounds(); virtual void set_theme(theme_t theme); virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::group_t::implementation_t); virtual dictionary_t essentials() const; }; /****************************************************************************************************/ struct tab_group_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<tab_group_t::tab_t> tab_set_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const tab_group_t::tab_t* first, const tab_group_t::tab_t* last); virtual void set_theme(theme_t theme); virtual extents_t best_bounds(); void set_value(const value_t& new_value); void signal_value_change(const implementation::tab_group_value_proc_t& proc); virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::tab_group_t::implementation_t); virtual dictionary_t essentials() const; implementation::tab_group_value_proc_t value_proc_m; tab_set_t items_m; }; /****************************************************************************************************/ struct panel_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::panel_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct button_t::implementation_t : control_t { typedef control_t _super; typedef std::vector<state_descriptor_t> state_set_t; implementation_t(); implementation_t(const implementation_t& rhs); ~implementation_t(); void initialize( const RECT& bounds, const button_t::state_descriptor_t* first, const button_t::state_descriptor_t* last); void set_default(bool is_default); void set_cancel(bool is_cancel); void set_value(modifiers_t modifiers, const value_t& value); void set_contributing(modifiers_t modifiers, const std::pair<dictionary_t, array_t>& value); virtual void modify(modifiers_t modifiers); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); state_set_t state_set_m; modifiers_t modifiers_m; //EventHandlerRef handler_ref_m; }; /****************************************************************************************************/ struct radio_button_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& set_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::radio_button_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::radio_button_hit_proc_t hit_proc_m; adobe::value_t last_m; adobe::value_t set_value_m; }; /****************************************************************************************************/ struct checkbox_t::implementation_t : control_t { typedef control_t _super; implementation_t( const std::string& name, const adobe::value_t& true_value, const adobe::value_t& false_value, theme_t theme); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); virtual extents_t measure(); void place(const point_2d_t& position, const extents_t& extents); void enable(bool make_enabled); void set(const adobe::value_t& value); void monitor(const implementation::checkbox_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::checkbox_t::implementation_t); virtual dictionary_t essentials() const; virtual void user_hit(); implementation::checkbox_hit_proc_t hit_proc_m; adobe::value_t true_value_m; adobe::value_t false_value_m; adobe::value_t current_value_m; }; /****************************************************************************************************/ struct link_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_value(bool value); void set_visible(bool make_visible); void set_active(bool make_active); void signal_hit(const implementation::link_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::link_t::implementation_t); virtual dictionary_t essentials() const; implementation::link_hit_proc_t hit_proc_m; guide_set_t prongs_m; bool value_m; bool visible_m; bool active_m; }; /****************************************************************************************************/ struct progress_bar_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, pb_style_t bar_style, bool is_vertical); virtual extents_t best_bounds(); void set_min_value(long min_value); void set_max_value(long max_value); void set_value(long value); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::progress_bar_t::implementation_t); virtual dictionary_t essentials() const; bool is_vertical_m; pb_style_t bar_style_m; }; /****************************************************************************************************/ struct separator_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::separator_t::implementation_t); virtual dictionary_t essentials() const; void initialize(const RECT& bounds); }; /****************************************************************************************************/ struct static_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); long best_height_given_width(long width); void set_name(const std::string& name); void signal_hit(const implementation::static_text_hit_proc_t& proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::static_text_t::implementation_t); virtual dictionary_t essentials() const; implementation::static_text_hit_proc_t hit_proc_m; }; /****************************************************************************************************/ struct edit_text_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); virtual ~implementation_t(); void initialize( const RECT& bounds, const std::string& name, bool scrollable, bool password, long cols, long rows); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& text); void set_field_text(const std::string& text); void set_static_disabled(bool is_static_disabled); void set_selection(long start_char, long end_char); void signal_pre_edit(const implementation::edit_text_pre_edit_proc_t& proc); void signal_post_edit(const implementation::edit_text_post_edit_proc_t& proc); void signal_label_hit(const implementation::edit_text_label_hit_proc_t& proc); // /// Recalculate the style which should be given as the Window style /// of the edit control. /// /// \return the window style which should be applied to control_m. // long get_window_style() const; virtual LRESULT event(UINT msg, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::edit_text_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; std::wstring field_text_m; static_text_t static_disabled_text_m; //HWND scroll_control_m; bool static_disabled_m; bool using_label_m; long rows_m; long cols_m; bool scrollable_m; bool password_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; implementation::edit_text_label_hit_proc_t label_hit_proc_m; }; /****************************************************************************************************/ struct popup_t::implementation_t : control_t { typedef control_t _super; typedef std::pair<std::string, value_t> menu_item_t; typedef std::vector<menu_item_t> menu_items_t; implementation_t(); implementation_t(const implementation_t& rhs); void initialize(const RECT& bounds, const std::string& name); static_text_t& get_label(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_name(const std::string& name); void set_static_disabled(bool is_static_disabled); void add_menu_item(const std::string& name, const value_t& value); void clear_menu_items(); void set_current_menu_item(const value_t& item); void select_with_text(const std::string& text); void signal_value_change(const implementation::popup_value_proc_t& proc); virtual LRESULT event(UINT message, WPARAM wParam, LPARAM lParam); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::popup_t::implementation_t); virtual dictionary_t essentials() const; static_text_t name_m; 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; menu_items_t menu_items_m; }; /****************************************************************************************************/ struct unit_edit_text_t::implementation_t : edit_text_t::implementation_t { typedef edit_text_t::implementation_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT& bounds, const std::string& name, bool using_popup, long cols, long rows); popup_t& get_popup(); virtual extents_t best_bounds(); void set_bounds(const point_2d_t& position, const extents_t& geometry); void set_active(bool active); virtual void set_theme(theme_t theme); void set_static_disabled(bool is_static_disabled); void add_popup_menu_item(const std::string& name, const adobe::value_t& value); void select_popup_with_text(const std::string& text); void signal_popup_value_change(implementation::popup_value_proc_t proc); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::unit_edit_text_t::implementation_t); virtual dictionary_t essentials() const; popup_t popup_m; bool using_popup_m; long popup_height_m; long popup_baseline_m; long edit_height_m; long edit_baseline_m; }; /****************************************************************************************************/ struct slider_t::implementation_t : control_t { typedef control_t _super; implementation_t(); implementation_t(const implementation_t& rhs); void initialize( const RECT* bounds, bool is_vertical, slider_style_t style, long num_tick_marks); virtual extents_t best_bounds(); 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); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_FRIEND_DECLARATION(adobe::slider_t::implementation_t); virtual dictionary_t essentials() const; implementation::slider_value_proc_t value_proc_m; bool is_vertical_m; slider_style_t style_m; long num_tick_marks_m; }; /****************************************************************************************************/ ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::window_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::control_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::tab_group_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::panel_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::radio_button_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::checkbox_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::link_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::progress_bar_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::separator_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::static_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::popup_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::unit_edit_text_t::implementation_t); ADOBE_SERIALIZABLE_EQUALITY_COMPARABLE_BOILERPLATE_DECLARATION(adobe::slider_t::implementation_t); /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif /****************************************************************************************************/ --- 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 <adobe/config.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; // /// Get the text margins for a button widget. This call is specific /// to a button widget, but is only available with Visual Styles on /// Windows XP (hence is grouped in with the other metrics functions /// of similar availability). /// /// \param widget_type the UXTheme type of button /// \param out_margins a rectangle containing the margins /// /// \return true if the margins were returned successfully, false /// if the margins could not be found. // virtual bool get_button_text_margins(int widget_type, RECT& out_margins) const = 0; // /// Return true if visual styles are currently in use, false if they /// are not being used. /// /// \return true if visual styles are in use, false otherwise. // virtual bool using_styles() const = 0; // /// Use the current style to draw the background of the parent control /// of the given window using the given DC. This function is useful for /// drawing the background of controls which appear on top of tab controls, /// or other places where the color isn't regulation. /// /// \param window the window to draw the parent background of. /// \param dc the DC to draw with. This DC does not have to be /// drawing onto the given window. // virtual void draw_parent_background(HWND window, HDC dc) = 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; virtual ~metrics_t() { } }; /****************************************************************************************************/ } // namespace adobe /****************************************************************************************************/ #endif |