S60 5th Edition SDK
Example Applications Guide

CHelloWorldBasicAppView Class Reference

Inheritance diagram for CHelloWorldBasicAppView:

List of all members.

Detailed Description

Definition at line 23 of file helloworldbasicappview.h.

Public Member Functions

virtual ~CHelloWorldBasicAppView ()
TDes & GetText ()
void Draw (const TRect &aRect) const
virtual void SizeChanged ()

Static Public Member Functions

static CHelloWorldBasicAppViewNewL (const TRect &aRect)
static CHelloWorldBasicAppViewNewLC (const TRect &aRect)

Private Member Functions

void ConstructL (const TRect &aRect)
 CHelloWorldBasicAppView ()

Private Attributes

const CFont * iFont
TBuf< 24 > iText


Constructor & Destructor Documentation

CHelloWorldBasicAppView::~CHelloWorldBasicAppView  )  [virtual]
 

~CHelloWorldBasicAppView Virtual Destructor.

Definition at line 86 of file helloworldbasicappview.cpp.

00087     {
00088     // No implementation required
00089     }

CHelloWorldBasicAppView::CHelloWorldBasicAppView  )  [private]
 

CHelloWorldBasicAppView. C++ default constructor.

Definition at line 75 of file helloworldbasicappview.cpp.

00076     {
00077     // No implementation required
00078     }


Member Function Documentation

CHelloWorldBasicAppView * CHelloWorldBasicAppView::NewL const TRect &  aRect  )  [static]
 

NewL. Two-phased constructor. Create a CHelloWorldBasicAppView object, which will draw itself to aRect.

Parameters:
aRect The rectangle this view will be drawn to.
Returns:
a pointer to the created instance of CHelloWorldBasicAppView.

Definition at line 28 of file helloworldbasicappview.cpp.

References NewLC().

Referenced by CHelloWorldBasicAppUi::ConstructL().

00029     {
00030     CHelloWorldBasicAppView* self = CHelloWorldBasicAppView::NewLC( aRect );
00031     CleanupStack::Pop( self );
00032     return self;
00033     }

CHelloWorldBasicAppView * CHelloWorldBasicAppView::NewLC const TRect &  aRect  )  [static]
 

NewLC. Two-phased constructor. Create a CHelloWorldBasicAppView object, which will draw itself to aRect.

Parameters:
aRect Rectangle this view will be drawn to.
Returns:
A pointer to the created instance of CHelloWorldBasicAppView.

Definition at line 40 of file helloworldbasicappview.cpp.

References ConstructL().

Referenced by NewL().

00041     {
00042     CHelloWorldBasicAppView* self = new ( ELeave ) CHelloWorldBasicAppView;
00043     CleanupStack::PushL( self );
00044     self->ConstructL( aRect );
00045     return self;
00046     }

TDes & CHelloWorldBasicAppView::GetText  ) 
 

GetText

Returns:
modifiable reference to the descriptor, which stores user-given text

Definition at line 138 of file helloworldbasicappview.cpp.

References iText.

Referenced by CHelloWorldBasicAppUi::HandleCommandL().

00139     {
00140     return iText;
00141     }

void CHelloWorldBasicAppView::Draw const TRect &  aRect  )  const
 

From CCoeControl, Draw Draw this CHelloWorldBasicAppView to the screen. If the user has given a text, it is also printed to the center of the screen.

Parameters:
aRect the rectangle of this view that needs updating

Definition at line 97 of file helloworldbasicappview.cpp.

References iFont, and iText.

00098     {
00099     // note that the whole screen is drawn everytime, so aRect-parameter
00100     // is ignored
00101 
00102     // Get the standard graphics context
00103     CWindowGc& gc = SystemGc();
00104     gc.SetPenStyle( CGraphicsContext::ENullPen );
00105     gc.SetBrushColor( KRgbWhite);
00106     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00107 
00108     // Gets the control's extent
00109     TRect rect( Rect());
00110 
00111     // draw also text, if user has given it via dialog
00112     if (iText.Length() > 0)
00113         {
00114         gc.UseFont(iFont);
00115         gc.DrawText(iText, rect, Rect().Height()/3, CGraphicsContext::ECenter );
00116         gc.DiscardFont();
00117         }
00118     else
00119         {
00120         gc.Clear( rect );
00121         }
00122     }

void CHelloWorldBasicAppView::SizeChanged  )  [virtual]
 

From CoeControl, SizeChanged. Called by framework when the view size is changed.

Definition at line 129 of file helloworldbasicappview.cpp.

00130     {
00131     }

void CHelloWorldBasicAppView::ConstructL const TRect &  aRect  )  [private]
 

ConstructL 2nd phase constructor. Perform the second phase construction of a CHelloWorldBasicAppView object.

Parameters:
aRect The rectangle this view will be drawn to.

Definition at line 53 of file helloworldbasicappview.cpp.

References iFont, and iText.

Referenced by NewLC().

00054     {
00055     // Create a window for this application view
00056     CreateWindowL();
00057 
00058     // set the font
00059     iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont);
00060 
00061     iText.Zero();
00062 
00063     // Set the windows size
00064     SetRect( aRect );
00065 
00066     // Activate the window, which makes it ready to be drawn
00067     ActivateL();
00068     }


Member Data Documentation

const CFont* CHelloWorldBasicAppView::iFont [private]
 

font used, when printing user-given text to the screen

Definition at line 98 of file helloworldbasicappview.h.

Referenced by ConstructL(), and Draw().

TBuf<24> CHelloWorldBasicAppView::iText [private]
 

descriptor storing the user-given text

Definition at line 103 of file helloworldbasicappview.h.

Referenced by ConstructL(), Draw(), and GetText().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top