fix bug that _m_paste_children wouldn't work well in refresh_tree

added contributor information
This commit is contained in:
Jinhao 2017-07-15 11:53:06 +08:00
parent 8fa2cf13f5
commit 887554b1b9
4 changed files with 20 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Window Layout Implementation * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -72,9 +72,17 @@ namespace detail
static void make_bground(core_window_t* const); static void make_bground(core_window_t* const);
private: private:
//_m_paste_children /// _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); * 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); static void _m_paint_glass_window(core_window_t*, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other);

View File

@ -211,7 +211,7 @@ namespace nana{ namespace widgets
bool mouse_enter(bool entering); bool mouse_enter(bool entering);
bool mouse_move(bool left_button, const point& screen_pos); bool mouse_move(bool left_button, const point& screen_pos);
void mouse_pressed(const arg_mouse& arg); void mouse_pressed(const arg_mouse& arg);
bool select_word(const arg_mouse& arg); bool select_word(const arg_mouse& arg);
skeletons::textbase<char_type>& textbase(); skeletons::textbase<char_type>& textbase();
const skeletons::textbase<char_type>& textbase() const; const skeletons::textbase<char_type>& textbase() const;

View File

@ -1,7 +1,7 @@
/* /*
* Window Layout Implementation * Window Layout Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -266,8 +266,6 @@ namespace nana
wd->effect.bground->take_effect(reinterpret_cast<window>(wd), glass_buffer); wd->effect.bground->take_effect(reinterpret_cast<window>(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) 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; nana::rectangle rect;
@ -287,12 +285,10 @@ namespace nana
{ {
if (overlap(nana::rectangle{ child->pos_root, child->dimension }, parent_rect, rect)) 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 (category::flags::lite_widget != child->other.category)
{ {
if (req_refresh_children && (false == child->flags.refreshing)) if (req_refresh_children && (false == child->flags.refreshing))
{ {
have_child_refreshed = true;
child->flags.refreshing = true; child->flags.refreshing = true;
child->drawer.refresh(); child->drawer.refresh();
child->flags.refreshing = false; 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), 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)); 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 else

View File

@ -8,7 +8,7 @@
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
* *
* @file: nana/gui/widgets/skeletons/text_editor.cpp * @file: nana/gui/widgets/skeletons/text_editor.cpp
* @contributors: Ariel Vina-Rodriguez * @contributors: Ariel Vina-Rodriguez, Oleg Smolsky
*/ */
#include <nana/gui/widgets/skeletons/text_editor.hpp> #include <nana/gui/widgets/skeletons/text_editor.hpp>
#include <nana/gui/widgets/skeletons/textbase_export_interface.hpp> #include <nana/gui/widgets/skeletons/textbase_export_interface.hpp>
@ -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) bool text_editor::select_word(const arg_mouse& arg)
{ {
if(!attributes_.enable_caret) if(!attributes_.enable_caret)