10 #include <gvarprop.hpp>
25 GText* toText()
override {
return this;}
26 bool isString()
const override {
return true;}
37 GText& operator=(GString
const& str) {
set(str,
false);
return *
this;}
38 GText& operator=(GText
const& text) {
set(text(),
false);
return *
this;}
39 GText& operator=(GInt
const& num);
40 GText& operator=(GFloat
const& num);
42 GText& operator+=(GText
const& text) {append(text.value_);
return *
this;}
43 GText& operator+=(GString
const& str) {append(str);
return *
this;}
44 GText& operator+=(GInt
const& num);
45 GText& operator+=(GFloat
const& num);
48 void set(GString
const& str)
override {
set(str,
false);}
55 bool setByteAt(
int bytepos,
char ch);
60 int compare(GString
const& str)
const noexcept;
61 int compare(
GText const& txt)
const noexcept {
return compare(txt.value_);}
63 size_t find(GString
const& str,
size_t pos = 0) const noexcept;
64 size_t rfind(GString const& str,
size_t pos = GString::npos) const noexcept;
66 bool append(GString const& str);
67 bool append(GText const& txt) {
return append(txt.value_);}
69 bool insert(
size_t pos, GString
const& str);
70 bool insert(
size_t pos, GString
const& str,
size_t subpos,
size_t sublen);
71 bool insert(
size_t pos, GText
const& t) {
return insert(pos, t.value_);}
73 bool erase(
size_t pos = 0,
size_t len = GString::npos);
74 GString substr(
size_t pos = 0,
size_t len = GString::npos)
const;
77 void read(std::istream&)
override;
80 GDim
textSize(GFont&,
bool richtext,
bool multilines,
81 GTextAttributes
const* =
nullptr)
const;
87 ssize_t
posToIndex(ssize_t charpos,
bool richtext)
const;
88 ssize_t indexToPos(ssize_t bytepos,
bool richtext)
const;
94 ssize_t
nextIndex(ssize_t bytepos,
bool richtext)
const;
95 ssize_t previousIndex(ssize_t bytepos,
bool richtext)
const;
98 using GType = GPropType_<GText,GProp>;
100 GType& type()
const override {
return Type();}
102 bool doChange(GString
const& v)
override;
105 void apply(Gadget*, GRender&,
Specif)
override;
106 bool onAdd(Gadget*)
override;
108 void updateGadget(Gadget&)
override;
109 virtual bool edit(GString
const& newval);
112 GString operator+(GString
const& str, GText
const& text);
113 GString operator+(GText
const& text, GString
const& str);
114 GString operator+(GText
const& text, GInt& num);
115 GString operator+(GText
const& text, GFloat& num);
120 GText& Text(GString
const& value);
132 GRegText(GString
const& value =
"");
136 using GText::operator<<=;
139 GRegText& operator=(GString
const& val);
142 void setFormat(GString
const& regex);
143 void setTimeFormat();
144 void setDateFormat();
145 void setNameFormat();
146 void setPhoneFormat();
149 static GType& Type();
150 GType& type()
const override {
return Type();}
152 bool isValid(GString
const& v)
const override;
161 GRegText& RegText(GString
const& value);
170 GTip(GString
const& value =
"") :
GText(value) {}
171 GTip*
clone(
bool copy_value)
const override;
174 static GType& Type();
175 GType& type()
const override {
return Type();}
179 void updateGadget(
Gadget&)
override {}
182 void addModes(GadgetModes&)
override;
183 void removeModes(GadgetModes&)
override;
189 GTip& Tip(GString
const& value);
201 static GType& Type();
202 GType& type()
const override {
return Type();}
212 GTextData& TextData();
213 GTextData& TextData(GString
const& value);