add a method to textbox

a method to get bounds of a text selection
This commit is contained in:
Jinhao
2016-09-12 00:01:12 +08:00
parent d6cb631bc2
commit 422f2c768b
4 changed files with 46 additions and 27 deletions

View File

@@ -151,6 +151,8 @@ namespace nana{ namespace widgets
bool selected() const;
bool select(bool);
bool get_select_points(nana::upoint&, nana::upoint&) const;
/// Sets the end position of a selected string.
void set_end_caret();
@@ -233,7 +235,6 @@ namespace nana{ namespace widgets
//@brief: redraw whole line specified by caret pos.
//@return: true if caret overs the border
bool _m_update_caret_line(std::size_t secondary_before);
bool _m_get_sort_select_points(nana::upoint&, nana::upoint&) const;
void _m_offset_y(int y);

View File

@@ -184,7 +184,7 @@ namespace nana
bool editable() const;
textbox& editable(bool);
/// Enables the caret if the textbox current is not editable
/// Enables the caret if the textbox currently is not editable
textbox& enable_caret();
void set_accept(std::function<bool(wchar_t)>);
@@ -200,6 +200,12 @@ namespace nana
/// Selects/unselects all text.
void select(bool);
/// Returns the bounds of a text selection
/**
* @return no selection if pair.first == pair.second.
*/
std::pair<upoint, upoint> selection() const;
void copy() const; ///< Copies the selected text into shared memory, such as clipboard under Windows.
void paste(); ///< Pastes the text from shared memory.
void del();