add new methods to textbox for line count

This commit is contained in:
Jinhao
2017-06-18 05:08:51 +08:00
parent 33321d73de
commit b5db21567f
4 changed files with 41 additions and 0 deletions

View File

@@ -1872,6 +1872,14 @@ namespace nana{ namespace widgets
select_.move_to_end = move_to_end;
}
std::size_t text_editor::line_count(bool text_lines) const
{
if (text_lines)
return textbase().lines();
return impl_->capacities.behavior->take_lines();
}
void text_editor::draw_corner()
{
impl_->cview->draw_corner(graph_);

View File

@@ -720,6 +720,26 @@ namespace drawerbase {
editor->set_undo_queue_length(len);
}
std::size_t textbox::display_line_count() const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if (editor)
return editor->line_count(false);
return 0;
}
std::size_t textbox::text_line_count() const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if (editor)
return editor->line_count(true);
return 0;
}
//Override _m_caption for caption()
auto textbox::_m_caption() const throw() -> native_string_type
{