bool IGraphics::DrawIText(IText* pTxt, char* str, IRECT* pR) { if (!str || str[0] == '\0') { return true; } LICE_IFont* font = pTxt->mCached; if (!font) { font = CacheFont(pTxt); if (!font) return false; } LICE_pixel color = LiceColor(&pTxt->mColor); font->SetTextColor(color); UINT fmt = DT_NOCLIP; if (LICE_GETA(color) < 255) fmt |= LICE_DT_USEFGALPHA; if (pTxt->mAlign == IText::kAlignNear) fmt |= DT_LEFT; else if (pTxt->mAlign == IText::kAlignCenter) fmt |= DT_CENTER; else // if (pTxt->mAlign == IText::kAlignFar) fmt |= DT_RIGHT; RECT R = { pR->L, pR->T, pR->R, pR->B }; font->DrawText(mDrawBitmap, str, -1, &R, fmt); return true; }
bool IGraphics::DrawIText(IText* pTxt, char* str, IRECT* pR, bool measure) { if (!str || str[0] == '\0') { return true; } LICE_IFont* font = pTxt->mCached; if (!font) { font = CacheFont(pTxt); if (!font) return false; } LICE_pixel color = LiceColor(&pTxt->mColor); font->SetTextColor(color); UINT fmt = DT_NOCLIP; if (LICE_GETA(color) < 255) fmt |= LICE_DT_USEFGALPHA; if (pTxt->mAlign == IText::kAlignNear) fmt |= DT_LEFT; else if (pTxt->mAlign == IText::kAlignCenter) fmt |= DT_CENTER; else // if (pTxt->mAlign == IText::kAlignFar) fmt |= DT_RIGHT; if (measure) { fmt |= DT_CALCRECT; RECT R = {0,0,0,0}; font->DrawText(mDrawBitmap, str, -1, &R, fmt); if( pTxt->mAlign == IText::kAlignNear) { pR->R = R.right; } else if (pTxt->mAlign == IText::kAlignCenter) { pR->L = (int) pR->MW() - (R.right/2); pR->R = pR->L + R.right; } else // (pTxt->mAlign == IText::kAlignFar) { pR->L = pR->R - R.right; pR->R = pR->L + R.right; } pR->B = pR->T + R.bottom; } else { RECT R = { pR->L, pR->T, pR->R, pR->B }; font->DrawText(mDrawBitmap, str, -1, &R, fmt); } return true; }
bool IGraphics::DrawIText(IText* pTxt, char* str, IRECT* pR, bool measure) { if (!str || str[0] == '\0') { return true; } LICE_IFont* font = pTxt->mCached; if (!font) { font = CacheFont(pTxt); if (!font) return false; } LICE_pixel color = LiceColor(&pTxt->mColor); font->SetTextColor(color); #ifdef OS_WIN UINT fmt = DT_NOCLIP; #else // OS X doesn't have an ellipsis option. So we need another way to prevent // the text from leaving the rectangle. UINT fmt = 0; #endif if (LICE_GETA(color) < 255) fmt |= LICE_DT_USEFGALPHA; if (pTxt->mAlign == IText::kAlignNear) fmt |= DT_LEFT; else if (pTxt->mAlign == IText::kAlignCenter) fmt |= DT_CENTER; else // if (pTxt->mAlign == IText::kAlignFar) fmt |= DT_RIGHT; // Crop text on Windows if too long if (!measure) { fmt |= DT_END_ELLIPSIS; } if (measure) { fmt |= DT_CALCRECT; RECT R = {0,0,0,0}; font->DrawText(mDrawBitmap, str, -1, &R, fmt); if( pTxt->mAlign == IText::kAlignNear) { pR->R = R.right; } else if (pTxt->mAlign == IText::kAlignCenter) { pR->L = (int) pR->MW() - (R.right/2); pR->R = pR->L + R.right; } else // (pTxt->mAlign == IText::kAlignFar) { pR->L = pR->R - R.right; pR->R = pR->L + R.right; } pR->B = pR->T + R.bottom; } else { RECT R = { pR->L, pR->T, pR->R, pR->B }; font->DrawText(mDrawBitmap, str, -1, &R, fmt); } return true; }
int WDL_VirtualStaticText::GetCharFromCoord(int xpos, int ypos) { LICE_IFont *font = (m_didvert ? m_vfont : m_font); if (!font) return -1; const char* str = m_text.Get(); const int len = m_text.GetLength(); if (!len) return -1; // for align left/right, we could DT_CALCRECT with 1 char, then 2, etc, but that won't work for align center // so we'll just estimate RECT tr = { 0, 0, m_position.right-m_position.left, m_position.bottom-m_position.top }; font->DrawText(0, str, len, &tr, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); int tw = tr.right; int th = tr.bottom; RECT r = m_position; if (m_wantborder) { r.left++; r.top++; r.right--; r.bottom--; } r.left += m_margin_l; r.top += m_margin_t; r.right -= m_margin_r; r.bottom -= m_margin_b; int w = r.right-r.left; int h = r.bottom-r.top; if (m_didvert) { r.left += (w-tw)/2; r.right -= (w-tw)/2; } else { r.top += (h-th)/2; r.bottom -= (h-th)/2; } if (m_didalign < 0) { if (m_didvert) r.bottom = r.top+th; else r.right = r.left+tw; } else if (m_didalign > 0) { if (m_didvert) r.top = r.bottom-th; else r.left = r.right-tw; } else { if (m_didvert) { r.top += (h-th)/2; r.bottom -= (h-th)/2; } else { r.left += (w-tw)/2; r.right -= (w-tw)/2; } } int c=-1; if (m_didvert) { if (ypos < r.top) c=-1; else if (ypos > r.bottom) c=len; else c = (int)((double)len*(double)(ypos-r.top)/(double)(r.bottom-r.top)); } else { if (xpos < r.left) c=-1; else if (xpos > r.right) c=len; else c = (int)((double)len*(double)(xpos-r.left)/(double)(r.right-r.left)); } return c; }
void WDL_VirtualStaticText::OnPaint(LICE_IBitmap *drawbm, int origin_x, int origin_y, RECT *cliprect) { RECT r=m_position; r.left+=origin_x; r.right+=origin_x; r.top += origin_y; r.bottom += origin_y; if (m_bkbm && m_bkbm->bgimage) { WDL_VirtualWnd_ScaledBlitBG(drawbm,m_bkbm, r.left,r.top,r.right-r.left,r.bottom-r.top, r.left,r.top,r.right-r.left,r.bottom-r.top, 1.0,LICE_BLIT_MODE_COPY|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA); if (m_dotint && LICE_GETA(m_bg)) { float amt = LICE_GETA(m_bg)/255.0f; // todo: apply amt float rv=LICE_GETR(m_bg)/255.0f; float gv=LICE_GETG(m_bg)/255.0f; float bv=LICE_GETB(m_bg)/255.0f; float avg=(rv+gv+bv)*0.33333f; if (avg<0.05f)avg=0.05f; float sc=0.5f*amt; float sc2 = (amt-sc)/avg; float sc3=32.0f * amt; float sc4=64.0f*(avg-0.5f) * amt; // tint LICE_MultiplyAddRect(drawbm, r.left,r.top, r.right-r.left, r.bottom-r.top, sc+rv*sc2 + (1.0f-amt), sc+gv*sc2 + (1.0f-amt), sc+bv*sc2 + (1.0f-amt), 1.0f, (rv-avg)*sc3+sc4, (gv-avg)*sc3+sc4, (bv-avg)*sc3+sc4, 0.0f); } } else { if (LICE_GETA(m_bg)) { LICE_FillRect(drawbm,r.left,r.top,r.right-r.left,r.bottom-r.top,m_bg,LICE_GETA(m_bg)/255.0f,LICE_BLIT_MODE_COPY); } if (m_wantborder) { int cidx=COLOR_3DSHADOW; int pencol = GSC(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.left,r.bottom-1,r.left,r.top,pencol,1.0f,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.left,r.top,r.right-1,r.top,pencol,1.0f,LICE_BLIT_MODE_COPY,false); cidx=COLOR_3DHILIGHT; pencol = GSC(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.right-1,r.top,r.right-1,r.bottom-1,pencol,1.0f,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.right-1,r.bottom-1,r.left,r.bottom-1,pencol,1.0f,LICE_BLIT_MODE_COPY,false); r.left++; r.bottom--; r.top++; r.right--; } } if (m_text.Get()[0]) { r.left += m_margin_l; r.right -= m_margin_r; r.top += m_margin_t; r.bottom -= m_margin_b; m_didvert=m_vfont && (r.right-r.left)<(r.bottom-r.top)/2; LICE_IFont *font = m_didvert ? m_vfont : m_font; if (font) { font->SetBkMode(TRANSPARENT); m_didalign=m_align; if (m_didalign==0) { RECT r2={0,0,0,0}; font->DrawText(drawbm,m_text.Get(),-1,&r2,DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); if (m_didvert) { if (r2.bottom > r.bottom-r.top) m_didalign=-1; } else { if (r2.right > r.right-r.left) m_didalign=-1; } } int dtflags=DT_SINGLELINE|DT_NOPREFIX; if (m_didvert) { dtflags |= DT_CENTER; if (m_didalign < 0) dtflags |= DT_TOP; else if (m_didalign > 0) dtflags |= DT_BOTTOM; else dtflags |= DT_VCENTER; } else { dtflags|=DT_VCENTER; if (m_didalign < 0) dtflags |= DT_LEFT; else if (m_didalign > 0) dtflags |= DT_RIGHT; else dtflags |= DT_CENTER; } const char* txt=m_text.Get(); const int len = m_text.GetLength(); int abbrx=0; char abbrbuf[64]; abbrbuf[0]=0; if (m_wantabbr) { if (len && isdigit(txt[len-1])) { RECT tr = { 0, 0, 0, 0 }; font->DrawText(drawbm, txt, -1, &tr, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); if (m_didvert ? (tr.bottom > r.bottom-r.top) : (tr.right > r.right-r.left)) { strcpy(abbrbuf, ".."); int i; for (i=len-1; i >= 0; --i) { if (!isdigit(txt[i]) || len-i > 4) break; } strcat(abbrbuf, txt+i+1); int f=dtflags&~(DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT); RECT tr2 = { 0, 0, 0, 0 }; if (m_didvert) { font->DrawText(drawbm, abbrbuf, -1, &tr2, f|DT_CALCRECT); abbrx=tr2.bottom; } else { font->DrawText(drawbm, abbrbuf, -1, &tr2, f|DT_CALCRECT); abbrx=tr2.right; } } } } int tcol=m_fg ? m_fg : LICE_RGBA_FROMNATIVE(GSC(COLOR_BTNTEXT)); font->SetTextColor(tcol); if (m_fg && LICE_GETA(m_fg) != 0xff) font->SetCombineMode(LICE_BLIT_MODE_COPY,LICE_GETA(m_fg)/255.0f); if (abbrx && abbrbuf[0]) { if (m_didvert) { int f=dtflags&~(DT_TOP|DT_VCENTER|DT_BOTTOM); RECT r1 = { r.left, r.top, r.right, r.bottom-abbrx }; font->DrawText(drawbm, txt, -1, &r1, f|DT_TOP); RECT r2 = { r.left, r.bottom-abbrx, r.right, r.bottom }; font->DrawText(drawbm, abbrbuf, -1, &r2, f|DT_BOTTOM); } else { int f=dtflags&~(DT_LEFT|DT_CENTER|DT_RIGHT); RECT r1 = { r.left, r.top, r.right-abbrx, r.bottom }; font->DrawText(drawbm, txt, -1, &r1, f|DT_LEFT); RECT r2 = { r.right-abbrx, r.top, r.right, r.bottom }; font->DrawText(drawbm, abbrbuf, -1, &r2, f|DT_RIGHT); } } else { font->DrawText(drawbm,txt,-1,&r,dtflags); } if (m_fg && LICE_GETA(m_fg) != 0xff) font->SetCombineMode(LICE_BLIT_MODE_COPY,1.0f); } } WDL_VWnd::OnPaint(drawbm,origin_x,origin_y,cliprect); }
void WDL_VirtualIconButton::OnPaint(LICE_IBitmap *drawbm, int origin_x, int origin_y, RECT *cliprect) { int col; float alpha = (m_grayed ? 0.25f : 1.0f) * m_alpha; bool isdown = !!(m_pressed&1); bool ishover = !!(m_pressed&2); if (m_iconCfg && m_iconCfg->image && !m_iconCfg->image_issingle) { bool swapupdown = (m_checkstate > 0); bool isdownimg = (swapupdown != isdown); RECT r=m_position; int sx=0; int sy=0; int w=m_iconCfg->image->getWidth(); int h=m_iconCfg->image->getHeight(); if (w>0 && (m_iconCfg->image_ltrb_used.flags&2)) w-=2; w/=3; if (w>0 && h > 0) { if (m_is_button) { if (isdownimg) sx += w*2; else if (ishover) sx += w; } if (m_iconCfg->image_ltrb_used.flags&2) { WDL_VirtualWnd_BGCfg cfg={0,}; LICE_SubBitmap sb(m_iconCfg->image,sx+1,sy+1,w,h-2); cfg.bgimage = &sb; cfg.bgimage_lt[0] = m_iconCfg->image_ltrb_main[0]+1; // image_ltrb_main expects 1-based number cfg.bgimage_lt[1] = m_iconCfg->image_ltrb_main[1]+1; cfg.bgimage_rb[0] = m_iconCfg->image_ltrb_main[2]+1; cfg.bgimage_rb[1] = m_iconCfg->image_ltrb_main[3]+1; cfg.bgimage_noalphaflags=0; WDL_VirtualWnd_ScaledBlitBG(drawbm,&cfg, r.left+origin_x,r.top+origin_y,r.right-r.left,r.bottom-r.top, r.left+origin_x,r.top+origin_y,r.right-r.left,r.bottom-r.top, alpha,LICE_BLIT_MODE_COPY|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA); } else LICE_ScaledBlit(drawbm,m_iconCfg->image,r.left+origin_x,r.top+origin_y, r.right-r.left, r.bottom-r.top, (float)sx,(float)sy,(float)w,(float)h, alpha, LICE_BLIT_MODE_COPY|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA); } } else { RECT r=m_position; r.left+=origin_x; r.right+=origin_x; r.top+=origin_y; r.bottom+=origin_y; if (m_is_button) { if (WDL_STYLE_WantGlobalButtonBackground(&col)) { LICE_FillRect(drawbm,r.left,r.top,r.right-r.left,r.bottom-r.top,LICE_RGBA_FROMNATIVE(col,255),alpha,LICE_BLIT_MODE_COPY); } if (ishover || m_forceborder || WDL_STYLE_WantGlobalButtonBorders()) { int cidx=isdown?COLOR_3DSHADOW:COLOR_3DHILIGHT; int pencol = GSC(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.left,r.bottom-1,r.left,r.top,pencol,alpha,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.left,r.top,r.right-1,r.top,pencol,alpha,LICE_BLIT_MODE_COPY,false); cidx = isdown?COLOR_3DHILIGHT:COLOR_3DSHADOW; pencol = GSC(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.right-1,r.top,r.right-1,r.bottom-1,pencol,alpha,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.right-1,r.bottom-1,r.left,r.bottom-1,pencol,alpha,LICE_BLIT_MODE_COPY,false); } } if (m_iconCfg && m_iconCfg->image) { int sz=16,sz2=16; WDL_STYLE_ScaleImageCoords(&sz,&sz2); //if (m_position.right-m_position.left > 24) sz=m_position.right-m_position.left-8; int x=r.left+((r.right-r.left)-sz)/2; int y=r.top+((r.bottom-r.top)-sz2)/2; if (m_is_button) { if (isdown && ishover) { x++; y++; } } LICE_ScaledBlit(drawbm,m_iconCfg->image,x,y,sz,sz2,0.0f,0.0f, (float)m_iconCfg->image->getWidth(), (float)m_iconCfg->image->getHeight(),alpha,LICE_BLIT_MODE_COPY|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA); } } if (!m_iconCfg || m_forcetext) { RECT r2=m_position; r2.left+=origin_x; r2.right+=origin_x; r2.top+=origin_y; r2.bottom+=origin_y; if (m_checkstate>=0 && !m_iconCfg) { RECT tr=r2; int sz=tr.bottom-tr.top; r2.left+=sz+2; tr.top+=2; tr.bottom-=2; sz-=4; sz&=~1; LICE_FillRect(drawbm ,tr.left,tr.top,sz,sz,LICE_RGBA(255,255,255,255),alpha,LICE_BLIT_MODE_COPY); LICE_Line(drawbm,tr.left,tr.top,tr.left+sz,tr.top,LICE_RGBA(128,128,128,255),alpha,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,tr.left+sz,tr.top,tr.left+sz,tr.bottom,LICE_RGBA(128,128,128,255),alpha,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,tr.left+sz,tr.bottom,tr.left,tr.bottom,LICE_RGBA(128,128,128,255),alpha,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,tr.left,tr.bottom,tr.left,tr.top,LICE_RGBA(128,128,128,255),alpha,LICE_BLIT_MODE_COPY,false); int nl = (m_checkstate>0) ? 3:0; if (isdown) nl ^= 2; if (nl&1) LICE_Line(drawbm,tr.left+2,tr.bottom-2,tr.left+sz-2,tr.top+2,LICE_RGBA(0,0,0,255),alpha,LICE_BLIT_MODE_COPY,false); if (nl&2) LICE_Line(drawbm,tr.left+2,tr.top+2,tr.left+sz-2,tr.bottom-2,LICE_RGBA(0,0,0,255),alpha,LICE_BLIT_MODE_COPY,false); } LICE_IFont *font = m_textfont; bool isVert=false; if (font && m_textfontv && m_position.right-m_position.left < m_position.bottom - m_position.top) { isVert=true; font = m_textfontv; } // draw text if (font&&m_textlbl.Get()[0]) { int fgc=m_forcetext_color ? m_forcetext_color : LICE_RGBA_FROMNATIVE(GSC(COLOR_BTNTEXT),255); //font->SetCombineMode(LICE_BLIT_MODE_COPY, alpha); // this affects the glyphs that get cached font->SetBkMode(TRANSPARENT); font->SetTextColor(fgc); r2.left += m_margin_l; r2.right -= m_margin_r; r2.top += m_margin_t; r2.bottom -= m_margin_b; if (isdown) { if (m_textalign<0) r2.left+=1; else if (m_textalign>0) r2.right+=1; else r2.left+=2; r2.top+=2; } int f = DT_SINGLELINE|DT_NOPREFIX; if (isVert) { if (m_textalign == 0) { RECT mr={0,}; font->DrawText(drawbm,m_textlbl.Get(),-1,&mr,f|DT_CALCRECT); f |= (mr.bottom < r2.bottom-r2.top) ? DT_VCENTER : DT_TOP; } else f |= m_textalign<0?DT_TOP:DT_BOTTOM; f |= DT_CENTER; } else { if (m_textalign == 0) { RECT mr={0,}; font->DrawText(drawbm,m_textlbl.Get(),-1,&mr,f|DT_CALCRECT); f |= (mr.right < r2.right-r2.left) ? DT_CENTER : DT_LEFT; } else f |= m_textalign<0?DT_LEFT:DT_RIGHT; f |= DT_VCENTER; } font->DrawText(drawbm,m_textlbl.Get(),-1,&r2,f); } } if (m_bgcol1_msg) { int brcol=-100; SendCommand(m_bgcol1_msg,(INT_PTR)&brcol,GetID(),this); if (brcol != -100) { RECT r=m_position; int bh=(r.bottom-r.top)/5; if (bh<1) bh=1; int bw=(r.right-r.left)/5; if (bw<1) bw=1; LICE_FillRect(drawbm, r.left+origin_x,r.top+origin_y, r.right-r.left, bh,LICE_RGBA_FROMNATIVE(brcol,255),0.75,LICE_BLIT_MODE_COPY); LICE_FillRect(drawbm, r.left+origin_x,r.top+origin_y+bh, bw, r.bottom-r.top-bh*2,LICE_RGBA_FROMNATIVE(brcol,255),0.75,LICE_BLIT_MODE_COPY); LICE_FillRect(drawbm, r.right+origin_x-bw,r.top+origin_y+bh, bw, r.bottom-r.top-bh*2,LICE_RGBA_FROMNATIVE(brcol,255),0.75,LICE_BLIT_MODE_COPY); LICE_FillRect(drawbm, r.left+origin_x,r.bottom+origin_y-bh, r.right-r.left, bh,LICE_RGBA_FROMNATIVE(brcol,255),0.75,LICE_BLIT_MODE_COPY); } } }
void WDL_VirtualStaticText::OnPaint(LICE_IBitmap *drawbm, int origin_x, int origin_y, RECT *cliprect) { RECT r=m_position; r.left+=origin_x; r.right+=origin_x; r.top += origin_y; r.bottom += origin_y; if (m_bkbm && m_bkbm->bgimage) { WDL_VirtualWnd_ScaledBlitBG(drawbm,m_bkbm, r.left,r.top,r.right-r.left,r.bottom-r.top, r.left,r.top,r.right-r.left,r.bottom-r.top, 1.0,LICE_BLIT_MODE_COPY|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA); if (m_dotint && LICE_GETA(m_bg)) { float amt = LICE_GETA(m_bg)/255.0f; // todo: apply amt float rv=LICE_GETR(m_bg)/255.0f; float gv=LICE_GETG(m_bg)/255.0f; float bv=LICE_GETB(m_bg)/255.0f; float avg=(rv+gv+bv)*0.33333f; if (avg<0.05f)avg=0.05f; float sc=0.5f*amt; float sc2 = (amt-sc)/avg; float sc3=32.0f * amt; float sc4=64.0f*(avg-0.5f) * amt; // tint LICE_MultiplyAddRect(drawbm, r.left,r.top, r.right-r.left, r.bottom-r.top, sc+rv*sc2 + (1.0-amt), sc+gv*sc2 + (1.0-amt), sc+bv*sc2 + (1.0-amt), 1, (rv-avg)*sc3+sc4, (gv-avg)*sc3+sc4, (bv-avg)*sc3+sc4, 0); } } else { if (LICE_GETA(m_bg)) { LICE_FillRect(drawbm,r.left,r.top,r.right-r.left,r.bottom-r.top,m_bg,LICE_GETA(m_bg)/255.0f,LICE_BLIT_MODE_COPY); } if (m_wantborder) { int cidx=COLOR_3DSHADOW; int pencol = WDL_STYLE_GetSysColor(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.left,r.bottom-1,r.left,r.top,pencol,1.0f,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.left,r.top,r.right-1,r.top,pencol,1.0f,LICE_BLIT_MODE_COPY,false); cidx=COLOR_3DHILIGHT; pencol = WDL_STYLE_GetSysColor(cidx); pencol = LICE_RGBA_FROMNATIVE(pencol,255); LICE_Line(drawbm,r.right-1,r.top,r.right-1,r.bottom-1,pencol,1.0f,LICE_BLIT_MODE_COPY,false); LICE_Line(drawbm,r.right-1,r.bottom-1,r.left,r.bottom-1,pencol,1.0f,LICE_BLIT_MODE_COPY,false); r.left++; r.bottom--; r.top++; r.right--; } } if (m_text.Get()[0]) { r.left += m_margin_l; r.right -= m_margin_r; r.top += m_margin_t; r.bottom -= m_margin_b; m_didvert=m_vfont && (r.right-r.left)<(r.bottom-r.top); LICE_IFont *font = m_didvert ? m_vfont : m_font; if (font) { font->SetBkMode(TRANSPARENT); m_didalign=m_align; if (m_didalign==0) { RECT r2={0,0,0,0}; font->DrawText(drawbm,m_text.Get(),-1,&r2,DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_NOPREFIX|DT_CALCRECT); if (r2.right > r.right-r.left) m_didalign=-1; } int tcol=m_fg ? m_fg : LICE_RGBA_FROMNATIVE(WDL_STYLE_GetSysColor(COLOR_BTNTEXT)); font->SetTextColor(tcol); if (m_fg && LICE_GETA(m_fg) != 0xff) font->SetCombineMode(LICE_BLIT_MODE_COPY,LICE_GETA(m_fg)/255.0f); font->DrawText(drawbm,m_text.Get(),-1,&r,DT_SINGLELINE|DT_VCENTER|(m_didalign<0?DT_LEFT:m_didalign>0?DT_RIGHT:DT_CENTER)|DT_NOPREFIX); if (m_fg && LICE_GETA(m_fg) != 0xff) font->SetCombineMode(LICE_BLIT_MODE_COPY,1.0f); } } WDL_VWnd::OnPaint(drawbm,origin_x,origin_y,cliprect); }