change textbox event text_position_changed in favor of text_exposed
This commit is contained in:
@@ -435,7 +435,7 @@ namespace nana{ namespace widgets
|
||||
|
||||
if (x > lnstr.size()) x = static_cast<unsigned>(lnstr.size());
|
||||
|
||||
unsigned text_w = editor_._m_pixels_by_char(lnstr, x);
|
||||
auto const text_w = editor_._m_pixels_by_char(lnstr, x);
|
||||
|
||||
unsigned area_w = editor_._m_text_area().width;
|
||||
|
||||
@@ -1918,11 +1918,6 @@ namespace nana{ namespace widgets
|
||||
return text_position_;
|
||||
}
|
||||
|
||||
void text_editor::set_text_position_changed(std::function<void(const std::vector<upoint>&)> fn)
|
||||
{
|
||||
text_position_function_.swap(fn);
|
||||
}
|
||||
|
||||
void text_editor::draw_corner()
|
||||
{
|
||||
if(text_area_.vscroll && text_area_.hscroll)
|
||||
@@ -1967,7 +1962,7 @@ namespace nana{ namespace widgets
|
||||
{
|
||||
text_position_.swap(text_pos);
|
||||
if (event_handler_)
|
||||
event_handler_->text_position_changed(text_position_);
|
||||
event_handler_->text_exposed(text_position_);
|
||||
}
|
||||
}
|
||||
else //Draw tip string
|
||||
|
||||
@@ -20,38 +20,32 @@
|
||||
|
||||
namespace nana
|
||||
{
|
||||
arg_textbox::arg_textbox(textbox& wdg)
|
||||
: widget(wdg)
|
||||
arg_textbox::arg_textbox(textbox& wdg, const std::vector<upoint>& text_pos)
|
||||
: widget(wdg), text_position(text_pos)
|
||||
{}
|
||||
|
||||
arg_textbox_text_position::arg_textbox_text_position(textbox& wdg, const std::vector<upoint>& text_pos)
|
||||
: widget(wdg),
|
||||
text_position(text_pos)
|
||||
{
|
||||
}
|
||||
|
||||
namespace drawerbase {
|
||||
namespace textbox
|
||||
{
|
||||
//class event_agent
|
||||
event_agent::event_agent(::nana::textbox& wdg)
|
||||
:widget_(wdg)
|
||||
event_agent::event_agent(::nana::textbox& wdg, const std::vector<upoint>& text_pos)
|
||||
:widget_(wdg), text_position_(text_pos)
|
||||
{}
|
||||
|
||||
void event_agent::first_change()
|
||||
{
|
||||
widget_.events().first_change.emit(::nana::arg_textbox{ widget_ });
|
||||
widget_.events().first_change.emit(::nana::arg_textbox{ widget_, text_position_ });
|
||||
}
|
||||
|
||||
void event_agent::text_changed()
|
||||
{
|
||||
widget_.events().text_changed.emit(::nana::arg_textbox{ widget_ });
|
||||
widget_.events().text_changed.emit(::nana::arg_textbox{ widget_, text_position_ });
|
||||
}
|
||||
|
||||
void event_agent::text_position_changed(const std::vector<upoint>& text_pos)
|
||||
void event_agent::text_exposed(const std::vector<upoint>& text_pos)
|
||||
{
|
||||
::nana::arg_textbox_text_position arg(widget_, text_pos);
|
||||
widget_.events().text_position_changed.emit(arg);
|
||||
::nana::arg_textbox arg(widget_, text_pos);
|
||||
widget_.events().text_exposed.emit(arg);
|
||||
}
|
||||
//end class event_agent
|
||||
|
||||
@@ -75,7 +69,7 @@ namespace drawerbase {
|
||||
{
|
||||
auto wd = wdg.handle();
|
||||
widget_ = &wdg;
|
||||
evt_agent_.reset(new event_agent(static_cast< ::nana::textbox&>(wdg)));
|
||||
evt_agent_.reset(new event_agent(static_cast<::nana::textbox&>(wdg), editor_->text_position()));
|
||||
|
||||
auto scheme = API::dev::get_scheme(wdg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user