diff --git a/include/nana/gui/programming_interface.hpp b/include/nana/gui/programming_interface.hpp index 09bb1c84..c2430ccd 100644 --- a/include/nana/gui/programming_interface.hpp +++ b/include/nana/gui/programming_interface.hpp @@ -239,7 +239,7 @@ namespace API cursor window_cursor(window); void activate_window(window); - bool is_focus_window(window); + bool is_focus_ready(window); window focus_window(); void focus_window(window); diff --git a/source/gui/programming_interface.cpp b/source/gui/programming_interface.cpp index c2db60b8..f9409904 100644 --- a/source/gui/programming_interface.cpp +++ b/source/gui/programming_interface.cpp @@ -796,7 +796,7 @@ namespace API return cursor::arrow; } - bool is_focus_window(window wd) + bool is_focus_ready(window wd) { auto iwd = reinterpret_cast(wd); internal_scope_guard lock; diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index eceda23e..0a2f9261 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace nana{ namespace widgets { @@ -688,7 +689,7 @@ namespace nana{ namespace widgets } } else - editor_.render(API::is_focus_window(editor_.window_)); + editor_.render(API::is_focus_ready(editor_.window_)); } void render(const ::nana::color& fgcolor) override @@ -1447,7 +1448,7 @@ namespace nana{ namespace widgets move_caret(upoint{}); _m_scrollbar(); - render(API::is_focus_window(window_)); + render(API::is_focus_ready(window_)); return true; } return false; @@ -1465,7 +1466,7 @@ namespace nana{ namespace widgets _m_reset(); behavior_->pre_calc_lines(width_pixels()); - render(API::is_focus_window(window_)); + render(API::is_focus_ready(window_)); _m_scrollbar(); return true; } @@ -1716,7 +1717,7 @@ namespace nana{ namespace widgets //Set caret position through text coordinate void text_editor::move_caret(const upoint& crtpos) { - if (!API::is_focus_window(window_)) + if (!API::is_focus_ready(window_)) return; const unsigned line_pixels = line_height(); @@ -1758,7 +1759,7 @@ namespace nana{ namespace widgets void text_editor::show_caret(bool isshow) { - if(isshow == false || API::is_focus_window(window_)) + if(isshow == false || API::is_focus_ready(window_)) API::caret_visible(window_, isshow); } @@ -1923,7 +1924,7 @@ namespace nana{ namespace widgets { behavior_->adjust_caret_into_screen(); reset_caret(); - render(API::is_focus_window(window_)); + render(API::is_focus_ready(window_)); _m_scrollbar(); points_.xpos = points_.caret.x; diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index ebbf006e..6be8deb2 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace nana { @@ -328,7 +329,7 @@ namespace nana void render() { - editor_->render(API::is_focus_window(editor_->window_handle())); + editor_->render(API::is_focus_ready(editor_->window_handle())); _m_draw_spins(spin_stated_); } @@ -420,7 +421,7 @@ namespace nana if (!editor_) return; - if (API::is_focus_window(editor_->window_handle())) + if (API::is_focus_ready(editor_->window_handle())) editor_->text(range_->value()); else editor_->text(modifier_.prefix + range_->value() + modifier_.suffix); diff --git a/source/gui/widgets/textbox.cpp b/source/gui/widgets/textbox.cpp index 840a1762..4bb6a670 100644 --- a/source/gui/widgets/textbox.cpp +++ b/source/gui/widgets/textbox.cpp @@ -83,7 +83,7 @@ namespace drawerbase { void drawer::refresh(graph_reference graph) { - editor_->render(API::is_focus_window(*widget_)); + editor_->render(API::is_focus_ready(*widget_)); } void drawer::focus(graph_reference graph, const arg_focus& arg) diff --git a/source/gui/widgets/widget.cpp b/source/gui/widgets/widget.cpp index f573c6b6..07e81946 100644 --- a/source/gui/widgets/widget.cpp +++ b/source/gui/widgets/widget.cpp @@ -101,7 +101,7 @@ namespace nana bool widget::focused() const { - return API::is_focus_window(handle()); + return (API::focus_window() == handle()); } void widget::show()