Codechange: use std::string instead of char* for original editor strings

This commit is contained in:
Rubidium
2023-05-10 21:05:19 +02:00
committed by rubidium42
parent 7e1123c731
commit 6d1586dd49
3 changed files with 9 additions and 23 deletions

View File

@@ -27,7 +27,7 @@ struct QueryString {
int ok_button; ///< Widget button of parent window to simulate when pressing OK in OSK.
int cancel_button; ///< Widget button of parent window to simulate when pressing CANCEL in OSK.
Textbuf text;
const char *orig;
std::optional<std::string> orig;
bool handled;
/**
@@ -35,18 +35,10 @@ struct QueryString {
* @param size Maximum size in bytes.
* @param chars Maximum size in chars.
*/
QueryString(uint16 size, uint16 chars = UINT16_MAX) : ok_button(ACTION_NOTHING), cancel_button(ACTION_DESELECT), text(size, chars), orig(nullptr)
QueryString(uint16 size, uint16 chars = UINT16_MAX) : ok_button(ACTION_NOTHING), cancel_button(ACTION_DESELECT), text(size, chars)
{
}
/**
* Make sure everything gets freed.
*/
~QueryString()
{
free(this->orig);
}
public:
void DrawEditBox(const Window *w, int wid) const;
void ClickEditBox(Window *w, Point pt, int wid, int click_count, bool focus_changed);