| 219 | |
| 220 | private: |
| 221 | void Refresh() { |
| 222 | if (texts.empty()) { |
| 223 | bitmap.reset(); |
| 224 | return; |
| 225 | } |
| 226 | |
| 227 | int width = 0; |
| 228 | int height = 0; |
| 229 | |
| 230 | const FontRef& font = Font::Default(); |
| 231 | |
| 232 | for (auto& t : texts) { |
| 233 | PendingMessage pm(CommandCodeInserter); |
| 234 | pm.PushLine(t); |
| 235 | t = pm.GetLines().front(); |
| 236 | |
| 237 | Rect r = Text::GetSize(*font, t); |
| 238 | width = std::max(width, r.width); |
| 239 | height += r.height + 2; |
| 240 | } |
| 241 | |
| 242 | bitmap = Bitmap::Create(width, height, true); |
| 243 | |
| 244 | height = 0; |
| 245 | for (auto& t : texts) { |
| 246 | bitmap->TextDraw(0, height, color, t); |
| 247 | height += Text::GetSize(*font, t).height + 2; |
| 248 | } |
| 249 | |
| 250 | SetPictureId(pic_id); |
| 251 | } |
| 252 | |
| 253 | std::vector<std::string> texts; |
| 254 | BitmapRef bitmap; |