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.

IMPORT_C virtual void Draw(const TRect& aRect) const;<br />

...<br />

};<br />

Use the functions as follows:<br />

� You have to activate a control using ActivateL() as the final part of its secondphase<br />

construction. Assuming that by the time ActivateL() is called, the control's<br />

extent is in place and its model is fully initialized makes the control ready for drawing.<br />

You can use IsActivated() to test whether ActivateL() has been called.<br />

� You can set a control to be visible or not – Draw() is not called for invisible controls.<br />

� IsReadyToDraw() returns ETrue if the control is both activated and visible.<br />

� SetBlank() is an obscure function that only affects controls that don't override<br />

Draw(). If you don't SetBlank(), then CCoeControl::Draw() does nothing. If you<br />

do SetBlank(), then CCoeControl::Draw() blanks the control.<br />

� We have already seen that Draw() is the fundamental drawing function. DrawNow()<br />

initiates the correct drawing sequence to draw a control and all its components.<br />

� DrawDeferred() simply invalidates the control's extent so that the window server will<br />

send a redraw message, causing a redraw later. This guarantees that a redraw will be<br />

called on the control at the earliest available opportunity, rather than forcing it now.<br />

� ActivateL(), MakeVisible(), and DrawNow() recurse as appropriate through<br />

component controls.<br />

� SystemGc() returns a windowed GC for drawing. ActivateGc(), ResetGc(), and<br />

DeactivateGc() perform the GC preparation functions needed for redrawing.<br />

Important Always use these functions, rather than directly calling<br />

SystemGc.Activate(Window()). It's more convenient and it<br />

allows control contexts to be supported properly.<br />

11.7 Special Effects<br />

The window server provides many useful special effects to application programs. These<br />

include:<br />

� Shadows<br />

� Backed-up-behind Windows<br />

� Animation<br />

� Use of debug keys<br />

� Using a control context<br />

� Scrolling.<br />

We'll examine each of these in turn.<br />

Important<br />

Note that the availability of these special effects depends on the<br />

implementation that you are using. UIQ for example, does not use<br />

shadows; instead it fades the background.<br />

11.7.1 Shadows<br />

Shadows can be used in many circumstances – behind dialogs, behind menus, behind<br />

popup choice lists and so on. Not all Symbian OS implementations use shadows. UIQ, for<br />

example, fades the background behind a window and so does not implement shadows.<br />

You have to specify that you want a window to cast a shadow and say how 'high' the window<br />

is. The shadow actually falls on the window(s) behind the one that you specify to cast<br />

shadows. To implement a shadow when it is cast, the window server asks the BITGDI to dim

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

Saved successfully!

Ooh no, something went wrong!