mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
Add Select All functionality, closes #19
This commit is contained in:
@@ -91,6 +91,9 @@ class ValueEditor {
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
|
||||
virtual bool canSelectAll() const { return false; }
|
||||
virtual void doSelectAll() {}
|
||||
|
||||
/// Select the specified range (if it makes sense)
|
||||
virtual void select(size_t start, size_t end) {}
|
||||
/// Determine the selected range
|
||||
|
||||
@@ -1165,6 +1165,15 @@ bool TextValueEditor::isWordBoundary(size_t pos_i) const {
|
||||
}
|
||||
}
|
||||
|
||||
void TextValueEditor::doSelectAll() {
|
||||
size_t old_selection_start_i = selection_start_i;
|
||||
size_t old_selection_end_i = selection_end_i;
|
||||
selection_start_i = 0;
|
||||
selection_end_i = value().value().size();
|
||||
fixSelection(TYPE_INDEX);
|
||||
redrawSelection(old_selection_start_i, old_selection_end_i, dropDownShown());
|
||||
}
|
||||
|
||||
void TextValueEditor::select(size_t start, size_t end) {
|
||||
selection_start = start;
|
||||
selection_end = end;
|
||||
|
||||
@@ -71,7 +71,9 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
|
||||
virtual void doFormat(int type);
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
|
||||
|
||||
virtual bool canSelectAll() const { return true; }
|
||||
virtual void doSelectAll();
|
||||
virtual void select(size_t start, size_t end);
|
||||
virtual size_t selectionStart() const { return selection_start; }
|
||||
virtual size_t selectionEnd() const { return selection_end; }
|
||||
|
||||
Reference in New Issue
Block a user