Skip to content

Commit

Permalink
textbox ctrl+a
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Feb 22, 2024
1 parent 19b3c34 commit 636ea26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/frontend/gui/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,17 @@ void TextBox::keyPressed(int key) {
paste(util::str2wstr_utf8(text));
}
}
// Select/deselect all
if (key == keycode::A) {
if (selectionStart == selectionEnd) {
selectionStart = 0;
selectionEnd = input.length();
selectionOrigin = 0;
setCaret(selectionEnd);
} else {
resetSelection();
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/frontend/gui/controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ namespace gui {
virtual glm::vec4 getFocusedColor() const;
virtual void setErrorColor(glm::vec4 color);
virtual glm::vec4 getErrorColor() const;
/* Get TextBox content text or placeholder if empty */
/// @brief Get TextBox content text or placeholder if empty
virtual std::wstring getText() const;
/* Set TextBox content text */
/// @brief Set TextBox content text
virtual void setText(std::wstring value);
virtual std::wstring getPlaceholder() const;
virtual void setPlaceholder(const std::wstring&);
Expand Down

0 comments on commit 636ea26

Please sign in to comment.