Update to 14.0-beta1

This commit is contained in:
dP
2024-02-04 02:18:17 +05:30
parent 79037e2c65
commit 33ef333b57
1325 changed files with 138461 additions and 70983 deletions
+11 -50
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,61 +35,22 @@ 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_t size, uint16_t 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);
void HandleEditBox(Window *w, int wid);
void DrawEditBox(const Window *w, WidgetID wid) const;
void ClickEditBox(Window *w, Point pt, WidgetID wid, int click_count, bool focus_changed);
void HandleEditBox(Window *w, WidgetID wid);
Point GetCaretPosition(const Window *w, int wid) const;
Rect GetBoundingRect(const Window *w, int wid, const char *from, const char *to) const;
const char *GetCharAtPosition(const Window *w, int wid, const Point &pt) const;
/**
* Get the current text.
* @return Current text.
*/
const char *GetText() const
{
return this->text.buf;
}
/**
* Get the position of the caret in the text buffer.
* @return Pointer to the caret in the text buffer.
*/
const char *GetCaret() const
{
return this->text.buf + this->text.caretpos;
}
/**
* Get the currently marked text.
* @param[out] length Length of the marked text.
* @return Beginning of the marked area or nullptr if no text is marked.
*/
const char *GetMarkedText(size_t *length) const
{
if (this->text.markend == 0) return nullptr;
*length = this->text.markend - this->text.markpos;
return this->text.buf + this->text.markpos;
}
Point GetCaretPosition(const Window *w, WidgetID wid) const;
Rect GetBoundingRect(const Window *w, WidgetID wid, const char *from, const char *to) const;
ptrdiff_t GetCharAtPosition(const Window *w, WidgetID wid, const Point &pt) const;
};
void ShowOnScreenKeyboard(Window *parent, int button);
void UpdateOSKOriginalText(const Window *parent, int button);
bool IsOSKOpenedFor(const Window *w, int button);
void ShowOnScreenKeyboard(Window *parent, WidgetID button);
void UpdateOSKOriginalText(const Window *parent, WidgetID button);
bool IsOSKOpenedFor(const Window *w, WidgetID button);
#endif /* QUERYSTRING_GUI_H */