| 153 | } |
| 154 | |
| 155 | bool 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 | |
| 190 | bool CStatic::SetText(const char* text) |
| 191 | { |
nothing calls this directly
no test coverage detected