diff --git a/include/nana/gui/widgets/skeletons/text_editor.hpp b/include/nana/gui/widgets/skeletons/text_editor.hpp index e8afb9b9..976c168d 100644 --- a/include/nana/gui/widgets/skeletons/text_editor.hpp +++ b/include/nana/gui/widgets/skeletons/text_editor.hpp @@ -157,8 +157,8 @@ namespace nana{ namespace widgets void set_accept(std::function); void set_accept(accepts); - bool respone_char(char_type); - bool respone_key(char_type); + bool respond_char(char_type); + bool respond_key(char_type); void typeface_changed(); diff --git a/source/gui/widgets/combox.cpp b/source/gui/widgets/combox.cpp index bf6a03e7..b1d401f5 100644 --- a/source/gui/widgets/combox.cpp +++ b/source/gui/widgets/combox.cpp @@ -685,7 +685,7 @@ namespace nana { case keyboard::os_arrow_left: case keyboard::os_arrow_right: - drawer_->editor()->respone_key(arg.key); + drawer_->editor()->respond_key(arg.key); drawer_->editor()->reset_caret(); break; case keyboard::os_arrow_up: @@ -714,14 +714,14 @@ namespace nana } } if (call_other_keys) - drawer_->editor()->respone_key(arg.key); + drawer_->editor()->respond_key(arg.key); API::lazy_refresh(); } void trigger::key_char(graph_reference graph, const arg_keyboard& arg) { - if (drawer_->editor()->respone_char(arg.key)) + if (drawer_->editor()->respond_char(arg.key)) API::lazy_refresh(); } //end class trigger diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 0cb39750..da01d92e 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -1326,7 +1326,7 @@ namespace nana{ namespace widgets attributes_.acceptive = acceptive; } - bool text_editor::respone_keyboard(char_type key) //key is a character of ASCII code + bool text_editor::respond_char(char_type key) //key is a character of ASCII code { switch (key) { @@ -1377,6 +1377,24 @@ namespace nana{ namespace widgets return false; } + bool text_editor::respond_key(char_type key) + { + switch (key) + { + case keyboard::os_arrow_left: move_left(); break; + case keyboard::os_arrow_right: move_right(); break; + case keyboard::os_arrow_up: move_ns(true); break; + case keyboard::os_arrow_down: move_ns(false); break; + case keyboard::os_del: + if (this->attr().editable) + del(); + break; + default: + return false; + } + return true; + } + void text_editor::typeface_changed() { behavior_->pre_calc_lines(width_pixels()); @@ -2105,25 +2123,6 @@ namespace nana{ namespace widgets } - bool text_editor::move(nana::char_t key) - { - switch(key) - { - case keyboard::os_arrow_left: move_left(); break; - case keyboard::os_arrow_right: move_right(); break; - case keyboard::os_arrow_up: move_ns(true); break; - case keyboard::os_arrow_down: move_ns(false); break; - case keyboard::os_del: - if (this->attr().editable) - del(); - break; - default: - return false; - } - return true; - } - - void text_editor::move_ns(bool to_north) { const bool redraw_required = _m_cancel_select(0); diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index c3720fdc..ebbf006e 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -559,7 +559,7 @@ namespace nana void drawer::key_press(graph_reference, const arg_keyboard& arg) { - if (impl_->editor()->respone_key(arg.key)) + if (impl_->editor()->respond_key(arg.key)) { impl_->editor()->reset_caret(); impl_->draw_spins(); @@ -569,7 +569,7 @@ namespace nana void drawer::key_char(graph_reference, const arg_keyboard& arg) { - if (impl_->editor()->respone_char(arg.key)) + if (impl_->editor()->respond_char(arg.key)) { if (!impl_->value(impl_->editor()->text())) impl_->draw_spins(); diff --git a/source/gui/widgets/textbox.cpp b/source/gui/widgets/textbox.cpp index e7030baa..aabb494e 100644 --- a/source/gui/widgets/textbox.cpp +++ b/source/gui/widgets/textbox.cpp @@ -136,7 +136,7 @@ namespace drawerbase { void drawer::key_press(graph_reference, const arg_keyboard& arg) { - if(editor_->respone_key(arg.key)) + if(editor_->respond_key(arg.key)) { editor_->reset_caret(); API::lazy_refresh(); @@ -145,7 +145,7 @@ namespace drawerbase { void drawer::key_char(graph_reference, const arg_keyboard& arg) { - if (editor_->respone_char(arg.key)) + if (editor_->respond_char(arg.key)) API::lazy_refresh(); }