Added an overload to getline to allow an offset from the beginning of the line.

Added a clear undo method.
Added an overload to selected to get the selected bounds.
This commit is contained in:
PeterAddy960
2016-10-28 00:17:59 -05:00
parent 78c3527f10
commit 8e84383a7b
2 changed files with 40 additions and 1 deletions

View File

@@ -318,6 +318,25 @@ namespace drawerbase {
return false;
}
bool textbox::getline(std::size_t line_index,std::size_t start_point,std::string& text) const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if(editor)
{
std::wstring line_text;
if(editor->getline(line_index,line_text))
{
if(line_text.length() >= start_point)
{
text = to_utf8(line_text.substr(start_point));
return true;
}
}
}
return false;
}
/// Gets the caret position
bool textbox::caret_pos(point& pos, bool text_coordinate) const
{
@@ -451,6 +470,13 @@ namespace drawerbase {
return (editor ? editor->selected() : false);
}
bool textbox::selected(nana::upoint &a,nana::upoint &b) const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
return (editor ? editor->selected(a,b) : false);
}
void textbox::select(bool yes)
{
internal_scope_guard lock;
@@ -517,6 +543,11 @@ namespace drawerbase {
return *this;
}
void textbox::clear_undo()
{
get_drawer_trigger().editor()->clear_undo();
}
void textbox::set_highlight(const std::string& name, const ::nana::color& fgcolor, const ::nana::color& bgcolor)
{
internal_scope_guard lock;