mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-22 15:39:52 +00:00
Widget::textLength() returns the number of (Unicode) characters in the text field
This commit is contained in:
parent
fb6a1481f9
commit
29f6db6f35
@ -13,6 +13,7 @@
|
||||
#include "ui/widget.h"
|
||||
|
||||
#include "base/memory.h"
|
||||
#include "base/string.h"
|
||||
#include "she/display.h"
|
||||
#include "she/font.h"
|
||||
#include "she/surface.h"
|
||||
@ -124,6 +125,11 @@ double Widget::textDouble() const
|
||||
return strtod(m_text.c_str(), NULL);
|
||||
}
|
||||
|
||||
int Widget::textLength() const
|
||||
{
|
||||
return base::utf8_length(text());
|
||||
}
|
||||
|
||||
void Widget::setText(const std::string& text)
|
||||
{
|
||||
setTextQuiet(text);
|
||||
|
@ -82,7 +82,7 @@ namespace ui {
|
||||
const std::string& text() const { return m_text; }
|
||||
int textInt() const;
|
||||
double textDouble() const;
|
||||
std::size_t textLength() const { return m_text.size(); }
|
||||
int textLength() const;
|
||||
void setText(const std::string& text);
|
||||
void setTextf(const char* text, ...);
|
||||
void setTextQuiet(const std::string& text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user