rename API::is_focus_window to API::is_focus_ready

This commit is contained in:
Jinhao
2015-05-01 16:36:12 +08:00
parent a64354900c
commit 4154c8e132
6 changed files with 14 additions and 12 deletions

View File

@@ -239,7 +239,7 @@ namespace API
cursor window_cursor(window); cursor window_cursor(window);
void activate_window(window); void activate_window(window);
bool is_focus_window(window); bool is_focus_ready(window);
window focus_window(); window focus_window();
void focus_window(window); void focus_window(window);

View File

@@ -796,7 +796,7 @@ namespace API
return cursor::arrow; return cursor::arrow;
} }
bool is_focus_window(window wd) bool is_focus_ready(window wd)
{ {
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd); auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
internal_scope_guard lock; internal_scope_guard lock;

View File

@@ -18,6 +18,7 @@
#include <numeric> #include <numeric>
#include <cwctype> #include <cwctype>
#include <set> #include <set>
#include <algorithm>
namespace nana{ namespace widgets namespace nana{ namespace widgets
{ {
@@ -688,7 +689,7 @@ namespace nana{ namespace widgets
} }
} }
else else
editor_.render(API::is_focus_window(editor_.window_)); editor_.render(API::is_focus_ready(editor_.window_));
} }
void render(const ::nana::color& fgcolor) override void render(const ::nana::color& fgcolor) override
@@ -1447,7 +1448,7 @@ namespace nana{ namespace widgets
move_caret(upoint{}); move_caret(upoint{});
_m_scrollbar(); _m_scrollbar();
render(API::is_focus_window(window_)); render(API::is_focus_ready(window_));
return true; return true;
} }
return false; return false;
@@ -1465,7 +1466,7 @@ namespace nana{ namespace widgets
_m_reset(); _m_reset();
behavior_->pre_calc_lines(width_pixels()); behavior_->pre_calc_lines(width_pixels());
render(API::is_focus_window(window_)); render(API::is_focus_ready(window_));
_m_scrollbar(); _m_scrollbar();
return true; return true;
} }
@@ -1716,7 +1717,7 @@ namespace nana{ namespace widgets
//Set caret position through text coordinate //Set caret position through text coordinate
void text_editor::move_caret(const upoint& crtpos) void text_editor::move_caret(const upoint& crtpos)
{ {
if (!API::is_focus_window(window_)) if (!API::is_focus_ready(window_))
return; return;
const unsigned line_pixels = line_height(); const unsigned line_pixels = line_height();
@@ -1758,7 +1759,7 @@ namespace nana{ namespace widgets
void text_editor::show_caret(bool isshow) 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); API::caret_visible(window_, isshow);
} }
@@ -1923,7 +1924,7 @@ namespace nana{ namespace widgets
{ {
behavior_->adjust_caret_into_screen(); behavior_->adjust_caret_into_screen();
reset_caret(); reset_caret();
render(API::is_focus_window(window_)); render(API::is_focus_ready(window_));
_m_scrollbar(); _m_scrollbar();
points_.xpos = points_.caret.x; points_.xpos = points_.caret.x;

View File

@@ -14,6 +14,7 @@
#include <nana/gui/widgets/skeletons/text_editor.hpp> #include <nana/gui/widgets/skeletons/text_editor.hpp>
#include <nana/gui/element.hpp> #include <nana/gui/element.hpp>
#include <nana/gui/timer.hpp> #include <nana/gui/timer.hpp>
#include <algorithm>
namespace nana namespace nana
{ {
@@ -328,7 +329,7 @@ namespace nana
void render() 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_); _m_draw_spins(spin_stated_);
} }
@@ -420,7 +421,7 @@ namespace nana
if (!editor_) if (!editor_)
return; return;
if (API::is_focus_window(editor_->window_handle())) if (API::is_focus_ready(editor_->window_handle()))
editor_->text(range_->value()); editor_->text(range_->value());
else else
editor_->text(modifier_.prefix + range_->value() + modifier_.suffix); editor_->text(modifier_.prefix + range_->value() + modifier_.suffix);

View File

@@ -83,7 +83,7 @@ namespace drawerbase {
void drawer::refresh(graph_reference graph) 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) void drawer::focus(graph_reference graph, const arg_focus& arg)

View File

@@ -101,7 +101,7 @@ namespace nana
bool widget::focused() const bool widget::focused() const
{ {
return API::is_focus_window(handle()); return (API::focus_window() == handle());
} }
void widget::show() void widget::show()