Added header_fgcolor and item_highlighted to color scheme.
menu:
Added change_text function.
This commit is contained in:
dankan1890 2016-10-14 01:14:55 +02:00
parent 8fe39df8b4
commit d7b7a4d45f
4 changed files with 11 additions and 3 deletions

View File

@ -1149,9 +1149,11 @@ namespace nana
: public widget_geometrics : public widget_geometrics
{ {
color_proxy header_bgcolor{static_cast<color_rgb>(0xf1f2f4)}; color_proxy header_bgcolor{static_cast<color_rgb>(0xf1f2f4)};
color_proxy header_fgcolor{ static_cast<color_rgb>(0x000000) };
color_proxy header_grabbed{ static_cast<color_rgb>(0x8BD6F6)}; color_proxy header_grabbed{ static_cast<color_rgb>(0x8BD6F6)};
color_proxy header_floated{ static_cast<color_rgb>(0xBABBBC)}; color_proxy header_floated{ static_cast<color_rgb>(0xBABBBC)};
color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) }; color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) };
color_proxy item_highlighted{ static_cast<color_rgb>(0xD5EFFC) };
/// The max column width which is generated by fit_content is allowed. It is ignored when it is 0, or a max value is passed to fit_content. /// The max column width which is generated by fit_content is allowed. It is ignored when it is 0, or a max value is passed to fit_content.
unsigned max_fit_content{ 0 }; unsigned max_fit_content{ 0 };
@ -1454,7 +1456,7 @@ the nana::detail::basic_window member pointer scheme
export_options& def_export_options(); export_options& def_export_options();
private: private:
drawerbase::listbox::essence & _m_ess() const; drawerbase::listbox::essence & _m_ess() const;
nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const; nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const override;
drawerbase::listbox::category_t* _m_assoc(std::shared_ptr<nana::detail::key_interface>, bool create_if_not_exists); drawerbase::listbox::category_t* _m_assoc(std::shared_ptr<nana::detail::key_interface>, bool create_if_not_exists);
void _m_erase_key(nana::detail::key_interface*); void _m_erase_key(nana::detail::key_interface*);
}; };

View File

@ -144,6 +144,7 @@ namespace nana
/// Closes the menu. It does not destroy the menu; just close the window for the menu. /// Closes the menu. It does not destroy the menu; just close the window for the menu.
void close(); void close();
void image(std::size_t pos, const paint::image& icon); void image(std::size_t pos, const paint::image& icon);
void change_text(std::size_t pos, const std::string& text);
void check_style(std::size_t pos, checks); void check_style(std::size_t pos, checks);
void checked(std::size_t pos, bool); void checked(std::size_t pos, bool);
bool checked(std::size_t pos) const; bool checked(std::size_t pos) const;

View File

@ -3393,7 +3393,7 @@ namespace nana
const auto border_color = essence_->scheme_ptr->header_bgcolor.get_color().blend(colors::black, 0.8); const auto border_color = essence_->scheme_ptr->header_bgcolor.get_color().blend(colors::black, 0.8);
int text_top = (r.height - essence_->scheme_ptr->text_height) / 2 + r.y; int text_top = (r.height - essence_->scheme_ptr->text_height) / 2 + r.y;
auto text_color = essence_->lister.wd_ptr()->fgcolor(); auto text_color = essence_->scheme_ptr->header_fgcolor.get_color();
auto state = item_state::normal; auto state = item_state::normal;
//check whether grabing an item, if item_spliter_ != npos, that indicates the grab item is a spliter. //check whether grabing an item, if item_spliter_ != npos, that indicates the grab item is a spliter.
@ -3784,7 +3784,7 @@ namespace nana
if (item.flags.selected) if (item.flags.selected)
bgcolor = bgcolor.blend(colors::black, 0.98); // or "selected" bgcolor = bgcolor.blend(colors::black, 0.98); // or "selected"
else else
bgcolor = bgcolor.blend(essence_->scheme_ptr->item_selected, 0.7); /// \todo create a parametre for amount of blend bgcolor = bgcolor.blend(essence_->scheme_ptr->item_highlighted, 0.7); /// \todo create a parametre for amount of blend
} }
unsigned show_w = (std::min)(content_r.width, width - essence_->scroll.x_offset()); unsigned show_w = (std::min)(content_r.width, width - essence_->scroll.x_offset());

View File

@ -1158,6 +1158,11 @@ namespace nana
impl_->mbuilder.data().items.at(index).image = img; impl_->mbuilder.data().items.at(index).image = img;
} }
void menu::change_text(std::size_t index, const std::string& text)
{
impl_->mbuilder.data().items.at(index).text = text;
}
bool menu::link(std::size_t index, menu& menu_obj) bool menu::link(std::size_t index, menu& menu_obj)
{ {
if(impl_->mbuilder.set_sub_menu(index, menu_obj.impl_->mbuilder.data())) if(impl_->mbuilder.set_sub_menu(index, menu_obj.impl_->mbuilder.data()))