#include "headers.h" void CSkinImage::LoadFromXml(HXML hXml) { CSkinObject::LoadFromXml(hXml); m_source = xi.getAttrValue(hXml, _T("src")); m_hbmp = m_ds->GetBitmap(m_source); GetObject(m_hbmp, sizeof(m_bi), &m_bi); } void CSkinImage::Measure(SkinRenderParams *params) { SetRect(¶ms->rc, 0, 0, 0, 0); if (m_width == 0) params->rc.right = m_bi.bmWidth; else if (m_width < 0) params->rc.right = 0; else params->rc.right = m_width; if (m_height == 0) params->rc.bottom = m_bi.bmHeight; else if (m_height < 0) params->rc.bottom = 0; else params->rc.bottom = m_height; } void CSkinImage::Paint(SkinRenderParams *params) { HDC hdc = CreateCompatibleDC(params->hdc); SelectObject(hdc, m_hbmp); BLENDFUNCTION bf = {0}; bf.AlphaFormat = AC_SRC_ALPHA; bf.BlendOp = AC_SRC_OVER; bf.SourceConstantAlpha = 255; AlphaBlend(params->hdc, m_rcPosition.left, m_rcPosition.top, m_rcPosition.right - m_rcPosition.left, m_rcPosition.bottom - m_rcPosition.top, hdc, 0, 0, m_bi.bmWidth, abs(m_bi.bmHeight), bf); DeleteDC(hdc); } void CSkinIcon::LoadFromXml(HXML hXml) { CSkinObject::LoadFromXml(hXml); m_source = xi.getAttrValue(hXml, _T("src")); } void CSkinIcon::Measure(SkinRenderParams *params) { SetRect(¶ms->rc, 0, 0, 16, 16); } void CSkinIcon::Paint(SkinRenderParams *params) { DrawIconEx(params->hdc, (m_rcPosition.left + m_rcPosition.right - 16) / 2, (m_rcPosition.top + m_rcPosition.bottom - 16) / 2, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), 16, 16, 0, NULL, DI_NORMAL); } void CSkinText::LoadFromXml(HXML hXml) { CSkinObject::LoadFromXml(hXml); m_text = xi.getAttrValue(hXml, _T("text")); } void CSkinText::Measure(SkinRenderParams *params) { LPCTSTR text = m_ds ? m_ds->GetText(m_text) : m_text; DrawText(params->hdc, text, lstrlen(text), ¶ms->rc, DT_NOPREFIX|DT_WORDBREAK|DT_CALCRECT); } void CSkinText::Paint(SkinRenderParams *params) { LPCTSTR text = m_ds ? m_ds->GetText(m_text) : m_text; SetTextColor(params->hdc, RGB(255, 255, 255)); SetBkMode(params->hdc, TRANSPARENT); DrawText(params->hdc, text, lstrlen(text), &m_rcPosition, DT_NOPREFIX|DT_WORDBREAK); }