From 887554b1b94a2f1ab0528f4cad67a730390533ea Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 15 Jul 2017 11:53:06 +0800 Subject: [PATCH] fix bug that _m_paste_children wouldn't work well in refresh_tree added contributor information --- include/nana/gui/detail/window_layout.hpp | 16 ++++++++++++---- .../nana/gui/widgets/skeletons/text_editor.hpp | 2 +- source/gui/detail/window_layout.cpp | 10 ++++------ source/gui/widgets/skeletons/text_editor.cpp | 4 +++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/include/nana/gui/detail/window_layout.hpp b/include/nana/gui/detail/window_layout.hpp index da099cf5..9d628946 100644 --- a/include/nana/gui/detail/window_layout.hpp +++ b/include/nana/gui/detail/window_layout.hpp @@ -1,6 +1,6 @@ /* * Window Layout Implementation - * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -72,9 +72,17 @@ namespace detail static void make_bground(core_window_t* const); private: - //_m_paste_children - //@brief:paste children window to the root graphics directly. just paste the visual rectangle - static void _m_paste_children(core_window_t*, bool have_refreshed, bool request_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos); + /// _m_paste_children + /** + * Pastes children window to the root graphics directly. just paste the visual rectangle + * @param window A handle to the window whose child windows will be pasted to the graph. + * @param has_refreshed Indicates whethere the window has been refreshed. + * @param request_refresh_children A flag indicates whether to refresh its child windows. + * @param parent_rect The child windows which are overlapped with the rectangle will be pasted + * @param graph A graphics object to which the child windows are pasted. + * @param graph_rpos The reference point to the graph. + */ + static void _m_paste_children(core_window_t* window, bool has_refreshed, bool request_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos); static void _m_paint_glass_window(core_window_t*, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other); diff --git a/include/nana/gui/widgets/skeletons/text_editor.hpp b/include/nana/gui/widgets/skeletons/text_editor.hpp index e0113fed..fbd4d428 100644 --- a/include/nana/gui/widgets/skeletons/text_editor.hpp +++ b/include/nana/gui/widgets/skeletons/text_editor.hpp @@ -211,7 +211,7 @@ namespace nana{ namespace widgets bool mouse_enter(bool entering); bool mouse_move(bool left_button, const point& screen_pos); void mouse_pressed(const arg_mouse& arg); - bool select_word(const arg_mouse& arg); + bool select_word(const arg_mouse& arg); skeletons::textbase& textbase(); const skeletons::textbase& textbase() const; diff --git a/source/gui/detail/window_layout.cpp b/source/gui/detail/window_layout.cpp index 2596f67e..72195e66 100644 --- a/source/gui/detail/window_layout.cpp +++ b/source/gui/detail/window_layout.cpp @@ -1,7 +1,7 @@ /* * Window Layout Implementation * Nana C++ Library(http://www.nanapro.org) -* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) +* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -266,8 +266,6 @@ namespace nana wd->effect.bground->take_effect(reinterpret_cast(wd), glass_buffer); } - //_m_paste_children - //@brief:paste children window to the root graphics directly. just paste the visual rectangle void window_layout::_m_paste_children(core_window_t* wd, bool have_refreshed, bool req_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos) { nana::rectangle rect; @@ -287,12 +285,10 @@ namespace nana { if (overlap(nana::rectangle{ child->pos_root, child->dimension }, parent_rect, rect)) { - bool have_child_refreshed = false; if (category::flags::lite_widget != child->other.category) { if (req_refresh_children && (false == child->flags.refreshing)) { - have_child_refreshed = true; child->flags.refreshing = true; child->drawer.refresh(); child->flags.refreshing = false; @@ -301,7 +297,9 @@ namespace nana graph.bitblt(nana::rectangle(rect.x - graph_rpos.x, rect.y - graph_rpos.y, rect.width, rect.height), child->drawer.graphics, nana::point(rect.x - child->pos_root.x, rect.y - child->pos_root.y)); } - _m_paste_children(child, req_refresh_children, have_child_refreshed, rect, graph, graph_rpos); + //req_refresh_children determines whether the child has been refreshed, and also determines whether + //the children of child to be refreshed. + _m_paste_children(child, req_refresh_children, req_refresh_children, rect, graph, graph_rpos); } } else diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 8832cc25..1331322f 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -8,7 +8,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/gui/widgets/skeletons/text_editor.cpp - * @contributors: Ariel Vina-Rodriguez + * @contributors: Ariel Vina-Rodriguez, Oleg Smolsky */ #include #include @@ -1580,6 +1580,8 @@ namespace nana{ namespace widgets } } + //Added Windows-style mouse double-click to the textbox(https://github.com/cnjinhao/nana/pull/229) + //Oleg Smolsky bool text_editor::select_word(const arg_mouse& arg) { if(!attributes_.enable_caret)