Merge branch 'develop-1.7' of https://github.com/besh81/nana into besh81-develop-1.7

This commit is contained in:
Jinhao
2019-01-29 04:30:13 +08:00
3 changed files with 88 additions and 53 deletions

View File

@@ -46,7 +46,7 @@ namespace nana{ namespace widgets{ namespace detail
};
/// A component set placer used for specifying component position and size.
template<typename Component, typename ItemAttribute>
template<typename Component, typename ItemAttribute, typename WidgetScheme>
class compset_placer
{
public:
@@ -56,10 +56,22 @@ namespace nana{ namespace widgets{ namespace detail
/// A type of widget-defined item attribute.
typedef ItemAttribute item_attribute_t;
/// Widget scheme.
typedef WidgetScheme widget_scheme_t;
widget_scheme_t * wdg_scheme_ptr_{ nullptr };
public:
/// The destrcutor.
/// The destructor.
virtual ~compset_placer(){}
/// Init the scheme pointer
void init_scheme(widget_scheme_t* wdg_scheme_ptr)
{
wdg_scheme_ptr_ = wdg_scheme_ptr;
}
/// Enable/Disable the specified component.
virtual void enable(component_t, bool) = 0;
virtual bool enabled(component_t) const = 0;

View File

@@ -60,8 +60,26 @@ namespace nana
::std::string text;
};
struct scheme
: public widget_geometrics
{
color_proxy item_bg_selected{ static_cast<color_rgb>(0xD5EFFC) }; ///< item selected: background color
color_proxy item_fg_selected{ static_cast<color_rgb>(0x99DEFD) }; ///< item selected: foreground color
color_proxy item_bg_highlighted{ static_cast<color_rgb>(0xE8F5FD) }; ///< item highlighted: background color
color_proxy item_fg_highlighted{ static_cast<color_rgb>(0xD8F0FA) }; ///< item highlighted: foreground color
color_proxy item_bg_selected_and_highlighted{ static_cast<color_rgb>(0xC4E8FA) }; ///< item selected and highlighted: background color
color_proxy item_fg_selected_and_highlighted{ static_cast<color_rgb>(0xB6E6FB) }; ///< item selected and highlighted: foreground color
unsigned item_offset{ 16 }; ///< item position displacement in pixels
unsigned text_offset{ 4 }; ///< text position displacement in pixels
unsigned icon_size{ 16 }; ///< icon size in pixels
unsigned crook_size{ 16 }; ///< crook size in pixels (TODO: the function that draw the crook doesn't scale the shape)
unsigned indent_displacement{ 18 }; ///< children position displacement in pixels (def=18 (before was 10))
};
typedef widgets::detail::compset<component, node_attribute> compset_interface;
typedef widgets::detail::compset_placer<component, node_attribute> compset_placer_interface;
typedef widgets::detail::compset_placer<component, node_attribute, scheme> compset_placer_interface;
class renderer_interface
{
@@ -353,7 +371,7 @@ namespace nana
/// \brief Displays a hierarchical list of items, such as the files and directories on a disk.
/// See also in [documentation](http://nanapro.org/en-us/documentation/widgets/treebox.htm)
class treebox
:public widget_object < category::widget_tag, drawerbase::treebox::trigger, drawerbase::treebox::treebox_events>
:public widget_object <category::widget_tag, drawerbase::treebox::trigger, drawerbase::treebox::treebox_events, drawerbase::treebox::scheme>
{
public:
/// A type refers to the item and is also used to iterate through the nodes.