| 218 | } |
| 219 | |
| 220 | void Graphics::drawUIString(const std::string& str, gfx::Color fg, gfx::Color bg, const gfx::Point& pt, |
| 221 | bool drawUnderscore) |
| 222 | { |
| 223 | she::SurfaceLock lock(m_surface); |
| 224 | base::utf8_const_iterator it(str.begin()), end(str.end()); |
| 225 | int x = m_dx+pt.x; |
| 226 | int y = m_dy+pt.y; |
| 227 | int underscored_x = 0; |
| 228 | int underscored_w = -1; |
| 229 | |
| 230 | while (it != end) { |
| 231 | if (*it == '&') { |
| 232 | ++it; |
| 233 | if (it != end && *it != '&') { |
| 234 | underscored_x = x; |
| 235 | underscored_w = m_font->charWidth(*it); |
| 236 | } |
| 237 | } |
| 238 | m_surface->drawChar(m_font.get(), fg, bg, x, y, *it); |
| 239 | x += m_font->charWidth(*it); |
| 240 | ++it; |
| 241 | } |
| 242 | |
| 243 | y += m_font->height(); |
| 244 | if (drawUnderscore && underscored_w > 0) { |
| 245 | m_surface->fillRect(fg, |
| 246 | gfx::Rect(underscored_x, y, underscored_w, guiscale())); |
| 247 | y += guiscale(); |
| 248 | } |
| 249 | |
| 250 | dirty(gfx::Rect(pt, gfx::Point(x, y))); |
| 251 | } |
| 252 | |
| 253 | void Graphics::drawAlignedUIString(const std::string& str, gfx::Color fg, gfx::Color bg, const gfx::Rect& rc, int align) |
| 254 | { |
no test coverage detected