MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SetText

Method SetText

engine/Poseidon/UI/Controls/UIControls.cpp:155–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155bool CStatic::SetText(RString text)
156{
157 const int type = _style & ST_TYPE;
158 const RString visibleText = (type == ST_PICTURE || type == ST_TILE_PICTURE) ? text : DecodeControlText(text);
159 if (_text && !strcmp(_text, visibleText))
160 {
161 return false;
162 }
163
164 // Explicit SetText diverges the control from its resource text; stop
165 // auto-refreshing from _textCls on subsequent language changes.
166 _textCls = nullptr;
167
168 _text = visibleText;
169 if (type == ST_PICTURE || type == ST_TILE_PICTURE)
170 {
171 text = Poseidon::FindPicture(text);
172 text.Lower();
173 _texture = GlobLoadTexture(text);
174 if (_texture)
175 {
176 _texture->SetMaxSize(1024); // no limits
177 }
178 }
179 else if (type == ST_MULTI)
180 {
181 FormatText();
182 float height = _scale * _size;
183 float maxLine = NLines() - _h / height;
184 saturateMax(maxLine, 0);
185 saturate(_firstLine, 0, toIntCeil(maxLine));
186 }
187 return true;
188}
189
190bool CStatic::SetText(const char* text)
191{

Callers

nothing calls this directly

Calls 15

DecodeControlTextFunction · 0.85
FindPictureFunction · 0.85
GlobLoadTextureFunction · 0.85
saturateMaxFunction · 0.85
saturateFunction · 0.85
SetTextFunction · 0.85
GetLangIDFunction · 0.85
CountTextElementsFunction · 0.85
saturateMinFunction · 0.85
LowerMethod · 0.80
SetMaxSizeMethod · 0.80

Tested by

no test coverage detected