add a method to show caret for the uneditable textbox

When an uneditable textbox has a caret, user can select the text and copy
it.
This commit is contained in:
Jinhao
2016-09-03 07:46:43 +08:00
parent 0f951d6b3e
commit d6cb631bc2
6 changed files with 41 additions and 16 deletions

View File

@@ -118,7 +118,13 @@ namespace nana{ namespace widgets
const attributes & attr() const;
bool multi_lines(bool);
void editable(bool);
/// Enables/disables the editability of text_editor
/**
* @param enable Indicates whether to enable or disable the editability
* @param enable_cart Indicates whether to show or hide the caret when the text_editor is not editable. It is ignored if enable is false.
*/
void editable(bool enable, bool enable_caret);
void enable_background(bool);
void enable_background_counterpart(bool);
@@ -255,6 +261,7 @@ namespace nana{ namespace widgets
bool line_wrapped{false};
bool multi_lines{true};
bool editable{true};
bool enable_caret{ true }; ///< Indicates whether to show or hide caret when text_editor is not editable
bool enable_background{true};
}attributes_;

View File

@@ -184,6 +184,9 @@ namespace nana
bool editable() const;
textbox& editable(bool);
/// Enables the caret if the textbox current is not editable
textbox& enable_caret();
void set_accept(std::function<bool(wchar_t)>);
textbox& tip_string(::std::string);