03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DeactivateGc();<br />

}<br />

This code has exact parallels to the code we saw in DrawTilesNow(): the activate and<br />

begin-redraw brackets are needed to set everything up correctly. However, CONE doesn't<br />

need to call Invalidate()here because the whole point of the redraw is that a region is<br />

already known to be invalid. In fact, if CONE did call Invalidate() on the rectangle, it<br />

would potentially extend the invalid region, which would waste processing time.<br />

Inside the activate and begin-redraw brackets, CONE draws the control using Draw() and<br />

passing the bounding rectangle. Then, CONE draws every component owned by this control<br />

using DrawComponents(), which is coded as follows:<br />

void CCoeControl::DrawComponents(const TRect& aRect) const<br />

{<br />

const TInt count = CountComponentControls();<br />

for(TInt ii = 0; ii < count; ii++)<br />

}<br />

{<br />

const CCoeControl* ctrl = ComponentControl(ii);<br />

if(!(ctrl->OwnsWindow()) && ctrl->IsVisible())<br />

}<br />

{<br />

TRect rect;<br />

const TRect* pRect = (&aRect);<br />

if(!((ctrl->Flags()) & ECanDrawOutsideRect))<br />

{<br />

rect = ctrl->Rect();<br />

rect.Intersection(aRect);<br />

if(rect.IsEmpty())<br />

continue;<br />

pRect = (&rect);<br />

}<br />

ResetGc();<br />

ctrl->Draw(*pRect);<br />

ctrl->DrawComponents(*pRect);<br />

}<br />

CONE simply redraws every visible lodger component whose rectangle intersects the invalid<br />

rectangle and then its components in turn. CONE adjusts the bounding invalid rectangle<br />

appropriately for each component control.<br />

Note<br />

CONE also makes an allowance for a rare special case: controls that can<br />

potentially draw outside their own rectangle.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!