From 57aa0498b352c675d0496fb29ce0d0e51fbc5f95 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sun, 16 Oct 2016 07:07:44 +0800 Subject: [PATCH] some modifications for pr(#154) update contributor info --- include/nana/gui/widgets/listbox.hpp | 9 ++------- include/nana/gui/widgets/menu.hpp | 7 ++++--- source/gui/widgets/listbox.cpp | 4 +++- source/gui/widgets/menu.cpp | 11 ++++++----- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index 36b2ffb9..19fe1093 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -8,12 +8,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/gui/widgets/listbox.hpp - * @contributors: - * Hiroshi Seki - * Ariel Vina-Rodriguez - * leobackes(pr#86,pr#97) - * Benjamin Navarro(pr#81) - * besh81(pr#130) + * */ #ifndef NANA_GUI_WIDGETS_LISTBOX_HPP @@ -1149,7 +1144,7 @@ namespace nana : public widget_geometrics { color_proxy header_bgcolor{static_cast(0xf1f2f4)}; - color_proxy header_fgcolor{ static_cast(0x000000) }; + color_proxy header_fgcolor{ colors::black }; color_proxy header_grabbed{ static_cast(0x8BD6F6)}; color_proxy header_floated{ static_cast(0xBABBBC)}; color_proxy item_selected{ static_cast(0xD5EFFC) }; diff --git a/include/nana/gui/widgets/menu.hpp b/include/nana/gui/widgets/menu.hpp index c6bc81a7..b010f6d4 100644 --- a/include/nana/gui/widgets/menu.hpp +++ b/include/nana/gui/widgets/menu.hpp @@ -1,13 +1,14 @@ /** * A Menu implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2009-2014 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2009-2016 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/gui/widgets/menu.hpp + * */ #ifndef NANA_GUI_WIDGETS_MENU_HPP @@ -138,13 +139,13 @@ namespace nana ~menu(); /// Appends an item to the menu. - item_proxy append(const std::string& text, const event_fn_t& callback= event_fn_t()); + item_proxy append(std::string text_utf8, const event_fn_t& callback= event_fn_t()); void append_splitter(); void clear(); ///< Erases all of the items. /// Closes the menu. It does not destroy the menu; just close the window for the menu. void close(); void image(std::size_t pos, const paint::image& icon); - void change_text(std::size_t pos, const std::string& text); + void text(std::size_t pos, std::string text_utf8); void check_style(std::size_t pos, checks); void checked(std::size_t pos, bool); bool checked(std::size_t pos) const; diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index ce211cc4..80fe2ed6 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -14,7 +14,8 @@ * leobackes(pr#86,pr#97) * Benjamin Navarro(pr#81) * besh81(pr#130) - * + * dankan1890(pr#154) + * */ #include @@ -3394,6 +3395,7 @@ namespace nana int text_top = (r.height - essence_->scheme_ptr->text_height) / 2 + r.y; auto text_color = essence_->scheme_ptr->header_fgcolor.get_color(); + auto state = item_state::normal; //check whether grabing an item, if item_spliter_ != npos, that indicates the grab item is a spliter. diff --git a/source/gui/widgets/menu.cpp b/source/gui/widgets/menu.cpp index e3addb5c..c3814214 100644 --- a/source/gui/widgets/menu.cpp +++ b/source/gui/widgets/menu.cpp @@ -1,7 +1,7 @@ /* * A Menu implementation * Nana C++ Library(http://www.nanapro.org) -* Copyright(C) 2009-2015 Jinhao(cnjinhao@hotmail.com) +* Copyright(C) 2009-2016 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -10,6 +10,7 @@ * @file: nana/gui/widgets/menu.cpp * @contributors: * kmribti(pr#102) +* dankan1890(pr#154) */ #include @@ -1120,9 +1121,9 @@ namespace nana delete impl_; } - auto menu::append(const std::string& text, const menu::event_fn_t& f) -> item_proxy + auto menu::append(std::string text_utf8, const menu::event_fn_t& f) -> item_proxy { - impl_->mbuilder.data().items.emplace_back(text, f); + impl_->mbuilder.data().items.emplace_back(std::move(text_utf8), f); return item_proxy(size() - 1, impl_->mbuilder.data().items.back()); } @@ -1158,9 +1159,9 @@ namespace nana impl_->mbuilder.data().items.at(index).image = img; } - void menu::change_text(std::size_t index, const std::string& text) + void menu::text(std::size_t index, std::string text_utf8) { - impl_->mbuilder.data().items.at(index).text = text; + impl_->mbuilder.data().items.at(index).text.swap(text_utf8); } bool menu::link(std::size_t index, menu& menu_obj)