void sMultipleChoiceDialog::OnPaint2D() { sRect t,b,r,l; Item *item; sInt h; sFont2D *font = sGui->PropFont; sClipPush(); t = b = Client; t.x1 = b.x0 = Client.x0 + Client.SizeX()*2/3; t.Extend(-4); font->SetColor(sGC_TEXT,sGC_BACK); font->Print(sF2P_OPAQUE|sF2P_LEFT|sF2P_TOP|sF2P_MULTILINE,t,Text); sClipExclude(t); b.Extend(-4); h = font->GetHeight()*2; sFORALL(Items,item) { r = b; r.y0 = b.y0 + (_i+0)*h; r.y1 = b.y0 + (_i+1)*h-4; item->Rect = r; sGui->PaintButtonBorder(r,_i==PressedItem && PressedOk); l = r; l.x1 = r.x0 = sMin(r.x1,r.x0+font->GetWidth(L" ")+font->GetWidth(item->Text)); font->SetColor(sGC_TEXT,sGC_BUTTON); font->Print(sF2P_OPAQUE|sF2P_SPACE|sF2P_LEFT,l,item->Text); sString<64> buffer; sButtonControl::MakeShortcut(buffer,item->Shortcut); font->Print(sF2P_OPAQUE|sF2P_SPACE|sF2P_RIGHT,r,buffer); font->SetColor(sGC_TEXT,sGC_BACK); sClipExclude(item->Rect); }
void sButtonControl::OnPaint2D() { if(Style & sBCS_NOBORDER) { sInt bp = sGC_BACK; if(BackColor) { sSetColor2D(0,BackColor); bp = 0; } if ((Flags&sWF_HOVER)&&!(Style&sBCS_STATIC)) bp=sGC_SELECT; sGui->PropFont->SetColor(sGC_TEXT,bp); sRect r = Client; if(Style & sBCS_CHECKMARK) { sRect r2 = r; sRect r3; sInt w = 5; r.x0 = r2.x1 = r2.x0+r2.SizeY(); r3.x0 = r2.CenterX()-w; r3.x1 = r3.x0 + w*2; r3.y0 = r2.CenterY()-w; r3.y1 = r3.y0 + w*2; sClipPush(); sBool select = 0; if(Style & sBCS_TOGGLEBIT) { select = *RadioPtr & RadioValue; } else { select = *RadioPtr==RadioValue; } if(select) { sRect r4=r3; r4.Extend(-2); sRect2D(r4,sGC_DRAW); sClipExclude(r4); } sRect2D(r3,bp); sClipPop(); sGui->RectHL(r3,sTRUE); sRectHole2D(r2,r3,bp); } sGui->PropFont->Print(sF2P_OPAQUE|sF2P_LEFT|sF2P_SPACE,r,Label,LabelLength); if(Shortcut) { sString<64> buffer; MakeShortcut(buffer,Shortcut); sGui->PropFont->Print(sF2P_RIGHT|sF2P_SPACE,r,buffer); } SetToolTipIfNarrow(Label,LabelLength); } else { sInt f = Pressed ? sGPB_DOWN : 0; if(RadioPtr) { if(Style & sBCS_TOGGLEBIT) f = (*RadioPtr & RadioValue) ? 1 : 0; else f = (*RadioPtr == RadioValue); } if(Style & sBCS_STATIC) f |= sGPB_GRAY; if(Style & sBCS_SHOWSELECT) f |= sGPB_DOWN; sGui->PaintButton(Client,Label,f,LabelLength,BackColor); SetToolTipIfNarrow(Label,LabelLength); if(Flags & sWF_CHILDFOCUS) { sRect r(Client); r.Extend(-3); sRectFrame2D(r,sGC_DOC); } } }