add a method to return textbox caret position

This commit is contained in:
Jinhao
2015-08-05 00:33:16 +08:00
parent f4924ef2f8
commit aef37436b0
4 changed files with 34 additions and 5 deletions

View File

@@ -231,8 +231,9 @@ namespace nana{ namespace widgets
void move_ns(bool to_north); //Moves up and down
void move_left();
void move_right();
nana::upoint mouse_caret(const point& screen_pos);
nana::upoint caret() const;
upoint mouse_caret(const point& screen_pos);
upoint caret() const;
point caret_screen_pos() const;
bool scroll(bool upwards, bool vertical);
bool mouse_enter(bool);
bool mouse_down(::nana::mouse, const point& screen_pos);

View File

@@ -144,7 +144,10 @@ namespace nana
bool saved() const;
/// Read the text from a specified line. It returns true for success.
bool getline(std::size_t line_index, nana::string&) const;
bool getline(std::size_t pos, nana::string&) const;
/// Gets the caret position
bool caret_pos(point& pos, bool text_coordinate) const;
/// Appends an string. If `at_caret` is `true`, the string is inserted at the position of caret, otherwise, it is appended at end of the textbox.
textbox& append(const nana::string& text, bool at_caret);