| 260 | } |
| 261 | |
| 262 | void RichEmbedItem::Draw(HDC hdc, RECT& messageRect, MessageList* pList) |
| 263 | { |
| 264 | RECT rc = messageRect; |
| 265 | rc.right = rc.left + m_size.cx + ScaleByDPI(4); |
| 266 | rc.bottom = rc.top + m_size.cy; |
| 267 | |
| 268 | assert(m_size.cx && m_size.cy); |
| 269 | |
| 270 | RECT rcGradient = rc, rcLine = rc; |
| 271 | rcLine.right = rcLine.left + ScaleByDPI(4); |
| 272 | rcGradient.left += ScaleByDPI(4); |
| 273 | COLORREF oldColor = SetBkColor(hdc, pList->GetDarkerBackgroundColor()); |
| 274 | if (GetLocalSettings()->GetMessageStyle() == MS_GRADIENT) { |
| 275 | FillGradientColors(hdc, &rcGradient, GetSysColor(COLOR_WINDOWFRAME), CLR_NONE, true); |
| 276 | } |
| 277 | else { |
| 278 | COLORREF oldClr = ri::SetDCBrushColor(hdc, pList->GetDarkerBackgroundColor()); |
| 279 | FillRect(hdc, &rcGradient, ri::GetDCBrush()); |
| 280 | ri::SetDCBrushColor(hdc, oldClr); |
| 281 | } |
| 282 | |
| 283 | COLORREF oldCol = ri::SetDCBrushColor(hdc, m_color); |
| 284 | FillRect(hdc, &rcLine, ri::GetDCBrush()); |
| 285 | ri::SetDCBrushColor(hdc, oldCol); |
| 286 | |
| 287 | // Draw the thing |
| 288 | const int borderSize = ScaleByDPI(10); |
| 289 | const int gap = ScaleByDPI(5); |
| 290 | int sizeY = 0; |
| 291 | rc.left += ScaleByDPI(4); |
| 292 | rc.left += borderSize; |
| 293 | rc.top += borderSize; |
| 294 | rc.right -= borderSize; |
| 295 | rc.bottom -= borderSize; |
| 296 | HGDIOBJ oldObj = SelectObject(hdc, GetStockFont(ANSI_VAR_FONT)); |
| 297 | COLORREF windowTextColor = pList->InvertIfNeeded(GetSysColor(COLOR_WINDOWTEXT)); |
| 298 | |
| 299 | if (m_providerSize.cy) { |
| 300 | SelectObject(hdc, g_ReplyTextFont); |
| 301 | if (sizeY) sizeY += gap; |
| 302 | RECT rcText = rc; |
| 303 | rcText.top = rc.top + sizeY; |
| 304 | rcText.bottom = rcText.top + m_providerSize.cy; |
| 305 | DrawText(hdc, m_providerName.GetWrapped(), -1, &rcText, DT_SINGLELINE | ri::GetWordEllipsisFlag() | DT_CALCRECT); |
| 306 | DrawText(hdc, m_providerName.GetWrapped(), -1, &rcText, DT_SINGLELINE | ri::GetWordEllipsisFlag()); |
| 307 | m_providerRect = rcText; |
| 308 | sizeY += m_providerSize.cy; |
| 309 | } |
| 310 | if (m_authorSize.cy) { |
| 311 | SelectObject(hdc, g_DateTextFont); |
| 312 | if (sizeY) sizeY += gap; |
| 313 | RECT rcText = rc; |
| 314 | rcText.top = rc.top + sizeY; |
| 315 | rcText.bottom = rcText.top + m_authorSize.cy; |
| 316 | DrawText(hdc, m_authorName.GetWrapped(), -1, &rcText, DT_SINGLELINE | ri::GetWordEllipsisFlag() | DT_CALCRECT); |
| 317 | DrawText(hdc, m_authorName.GetWrapped(), -1, &rcText, DT_SINGLELINE | ri::GetWordEllipsisFlag()); |
| 318 | m_authorRect = rcText; |
| 319 | sizeY += m_authorSize.cy; |
no test coverage detected