add textbox::content_origin

This commit is contained in:
Jinhao
2017-07-25 07:57:48 +08:00
parent d5c01b3dd1
commit 27e1d7aff5
4 changed files with 20 additions and 1 deletions

View File

@@ -497,6 +497,7 @@ namespace nana{ namespace widgets
undoable<command> undo; //undo command
renderers customized_renderers;
std::vector<upoint> text_position; //positions of text since last rendering.
int text_position_origin{ -1 }; //origin when last text_exposed
skeletons::textbase<wchar_t> textbase;
@@ -1083,6 +1084,11 @@ namespace nana{ namespace widgets
return { 1, line_height() };
}
const point& text_editor::content_origin() const
{
return impl_->cview->origin();
}
void text_editor::set_highlight(const std::string& name, const ::nana::color& fgcolor, const ::nana::color& bgcolor)
{
if (fgcolor.invisible() && bgcolor.invisible())
@@ -1982,8 +1988,9 @@ namespace nana{ namespace widgets
if (text_pos.empty())
text_pos.emplace_back(upoint{});
if (text_pos != impl_->text_position)
if ((impl_->text_position_origin != impl_->cview->origin().y) || (text_pos != impl_->text_position))
{
impl_->text_position_origin = impl_->cview->origin().y;
impl_->text_position.swap(text_pos);
if (event_handler_)
event_handler_->text_exposed(impl_->text_position);