| 272 | // ---------------------------------------------------------------------------------------- |
| 273 | |
| 274 | void label:: |
| 275 | draw ( |
| 276 | const canvas& c |
| 277 | ) const |
| 278 | { |
| 279 | rectangle area = rect.intersect(c); |
| 280 | if (area.is_empty() || text_.size() == 0) |
| 281 | return; |
| 282 | |
| 283 | using namespace std; |
| 284 | unsigned char r = text_color_.red; |
| 285 | unsigned char g = text_color_.green; |
| 286 | unsigned char b = text_color_.blue; |
| 287 | if (!enabled) |
| 288 | { |
| 289 | r = 128; |
| 290 | g = 128; |
| 291 | b = 128; |
| 292 | } |
| 293 | |
| 294 | rectangle text_rect(rect); |
| 295 | |
| 296 | string::size_type first, last; |
| 297 | first = 0; |
| 298 | last = text_.find_first_of('\n'); |
| 299 | mfont->draw_string(c,text_rect,text_,rgb_pixel(r,g,b),first,last); |
| 300 | |
| 301 | while (last != string::npos) |
| 302 | { |
| 303 | first = last+1; |
| 304 | last = text_.find_first_of('\n',first); |
| 305 | text_rect.set_top(text_rect.top()+mfont->height()); |
| 306 | mfont->draw_string(c,text_rect,text_,rgb_pixel(r,g,b),first,last); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | // ---------------------------------------------------------------------------------------- |
| 311 |
nothing calls this directly
no test coverage detected