MCPcopy Create free account
hub / github.com/SOUI2/soui / OnPaint

Method OnPaint

SOUI/src/control/SListView.cpp:198–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198 void SListView::OnPaint(IRenderTarget *pRT)
199 {
200 if(m_bDataSetInvalidated)
201 {
202 UpdateVisibleItems();
203 m_bDataSetInvalidated = FALSE;
204 }
205
206 SPainter duiDC;
207 BeforePaint(pRT,duiDC);
208
209
210 int iFirst = m_iFirstVisible;
211 if(iFirst!=-1)
212 {
213 CRect rcClient;
214 GetClientRect(&rcClient);
215 pRT->PushClipRect(&rcClient,RGN_AND);
216
217 CRect rcClip,rcInter;
218 pRT->GetClipBox(&rcClip);
219
220 int nOffset = m_lvItemLocator->Item2Position(iFirst)-m_siVer.nPos;
221
222 CRect rcItem(rcClient);
223 rcItem.bottom = rcItem.top + nOffset;
224
225 SPOSITION pos= m_lstItems.GetHeadPosition();
226 int i=0;
227 for(;pos;i++)
228 {
229 ItemInfo ii = m_lstItems.GetNext(pos);
230 rcItem.top=rcItem.bottom;
231 rcItem.bottom = rcItem.top + m_lvItemLocator->GetItemHeight(iFirst+i);
232 rcInter.IntersectRect(&rcClip,&rcItem);
233 if(!rcInter.IsRectEmpty())
234 ii.pItem->Draw(pRT,rcItem);
235 rcItem.top = rcItem.bottom;
236 rcItem.bottom += m_lvItemLocator->GetDividerSize();
237 if(m_pSkinDivider)
238 {//绘制分隔线
239 m_pSkinDivider->Draw(pRT,rcItem,0);
240 }
241 }
242
243 pRT->PopClip();
244 }
245 AfterPaint(pRT,duiDC);
246 }
247
248 BOOL SListView::OnScroll(BOOL bVertical,UINT uCode,int nPos)
249 {

Callers

nothing calls this directly

Calls 12

GetClientRectFunction · 0.85
GetHeadPositionMethod · 0.80
IntersectRectMethod · 0.80
IsRectEmptyMethod · 0.80
GetDividerSizeMethod · 0.80
PushClipRectMethod · 0.45
GetClipBoxMethod · 0.45
Item2PositionMethod · 0.45
GetNextMethod · 0.45
GetItemHeightMethod · 0.45
DrawMethod · 0.45
PopClipMethod · 0.45

Tested by

no test coverage detected