Nokia N97 SDK
Example Applications Guide

CFocusEventAppView Class Reference

Inheritance diagram for CFocusEventAppView:

List of all members.

Detailed Description

Definition at line 32 of file focuseventappview.h.


Public Member Functions

virtual  ~CFocusEventAppView ()
void  ShowTextOnScreen (const TDesC &aText)
void  Print (const TDesC &aText)
void  PrintNewLineL ()

Static Public Member Functions

static CFocusEventAppView *  NewL (const TRect &aRect)
static CFocusEventAppView *  NewLC (const TRect &aRect)

Private Member Functions

void  Draw (const TRect &aRect) const
virtual void  HandleResourceChange (TInt aType)
void  ConstructL (const TRect &aRect)
  CFocusEventAppView ()

Private Attributes

RArray< TTextLine >  iTextLines


Constructor & Destructor Documentation

CFocusEventAppView::~CFocusEventAppView (   )  [virtual]
 

~CFocusEventAppView. Virtual Destructor.

Definition at line 86 of file focuseventappview.cpp.

References iTextLines.

00087     {
00088     iTextLines.Close();
00089     }

CFocusEventAppView::CFocusEventAppView (   )  [private]
 

CFocusEventAppView. C++ default constructor.

Definition at line 31 of file focuseventappview.cpp.

00032     {
00033     // No implementation required
00034     }


Member Function Documentation

CFocusEventAppView * CFocusEventAppView::NewL (  const TRect &  aRect  )  [static]
 

NewL. Two-phased constructor. Create a CFocusEventAppView 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 CFocusEventAppView.

Definition at line 41 of file focuseventappview.cpp.

References NewLC().

Referenced by CFocusEventAppUi::ConstructL().

00042     {
00043     CFocusEventAppView* self = NewLC( aRect );
00044     CleanupStack::Pop( self );
00045     return self;
00046     }

CFocusEventAppView * CFocusEventAppView::NewLC (  const TRect &  aRect  )  [static]
 

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

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

Definition at line 53 of file focuseventappview.cpp.

References ConstructL().

Referenced by NewL().

00054     {
00055     CFocusEventAppView* self = new ( ELeave ) CFocusEventAppView;
00056     CleanupStack::PushL( self );
00057     self->ConstructL( aRect );
00058     return self;
00059     }

void CFocusEventAppView::ShowTextOnScreen (  const TDesC &  aText  ) 
 

ShowTextOnScreen. Display text on the screen.

Parameters:
aText  the text to display

Definition at line 134 of file focuseventappview.cpp.

References iTextLines.

Referenced by Print().

00135     {
00136     // Add the text line onto the last line
00137     TInt lastTextLine = iTextLines.Count() - 1;
00138 
00139     // Make sure the text line doesn't get too long for the buffer.
00140     // This should really clip rather than not do anything
00141     // if the line is too long.
00142     if ( aText.Length() + iTextLines[ lastTextLine ].Length()
00143                                   <= KTestFrameworkMaxScreenMessageLength )
00144         {
00145         iTextLines[ lastTextLine ].Append( aText );
00146         DrawNow();
00147         }
00148     }

void CFocusEventAppView::Print (  const TDesC &  aText  ) 
 

Print. Display/Write text via the selected methods.

Parameters:
aText  the text to display

Definition at line 124 of file focuseventappview.cpp.

References ShowTextOnScreen().

Referenced by CFocusEventAppUi::HandleForegroundEventL().

00125     {
00126     ShowTextOnScreen( aText );
00127     }

void CFocusEventAppView::PrintNewLineL (   ) 
 

PrintNewLineL. Display/Write a new line via the selected methods.

Definition at line 155 of file focuseventappview.cpp.

References iTextLines.

Referenced by CFocusEventAppUi::HandleForegroundEventL().

00156     {
00157     // Add a new line onto the array
00158     // If the array is already at the maximum size,
00159     // delete the first line of text
00160     if ( iTextLines.Count() >= KMaxTextLines )
00161         {
00162         iTextLines.Remove( 0 );
00163         }
00164     User::LeaveIfError( iTextLines.Append( KNullDesC() ) );
00165     DrawNow();
00166     }

void CFocusEventAppView::Draw (  const TRect &  aRect  )  const [private]
 

Draw. Draw this CFocusEventAppView to the screen.

Parameters:
aRect  the rectangle of this view that needs updating

Definition at line 96 of file focuseventappview.cpp.

References iTextLines.

00097     {
00098 
00099     // Get the standard graphics context
00100     CWindowGc& gc = SystemGc();
00101 
00102     // Gets the control's extent
00103     TRect drawRect=Rect();
00104     gc.UseFont( NEikonEnvironment::EikEnv().AnnotationFont() );
00105 
00106     // Clears the screen
00107     gc.Clear( drawRect );
00108 
00109     // Draw all lines of text
00110     TInt count;
00111     for ( count = 0; count < iTextLines.Count(); count++ )
00112         {
00113         gc.DrawText( iTextLines[ count ],
00114         TPoint( KTextXMargin, KTextMinY+
00115                                      ( count*KTextDistanceBetweenLines ) ) );
00116         }
00117     }

void CFocusEventAppView::HandleResourceChange (  TInt  aType  )  [private, virtual]
 

From CoeControl, HandleResourceChange. Called by framework when the view layout is changed.

Definition at line 173 of file focuseventappview.cpp.

00174     {
00175     CCoeControl::HandleResourceChange(aType);
00176 
00177     // ADDED FOR SCALABLE UI SUPPORT
00178     // *****************************
00179     if ( aType==KEikDynamicLayoutVariantSwitch )
00180         {
00181         TRect rect;
00182         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
00183         SetRect(rect);
00184         }
00185     }

void CFocusEventAppView::ConstructL (  const TRect &  aRect  )  [private]
 

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

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

Definition at line 66 of file focuseventappview.cpp.

References iTextLines.

Referenced by NewLC().

00067     {
00068     // Create a window for this application view
00069     CreateWindowL();
00070 
00071     // Set the windows size
00072     SetRect( aRect );
00073 
00074     // Activate the window, which makes it ready to be drawn
00075     ActivateL();
00076 
00077     // Add the first blank line to the array of text lines
00078     User::LeaveIfError( iTextLines.Append( KNullDesC() ) );
00079     }


Member Data Documentation

RArray<TTextLine> CFocusEventAppView::iTextLines [private]
 

iTextLines The lines of text being displayed on the screen

Definition at line 118 of file focuseventappview.h.

Referenced by ConstructL(), Draw(), PrintNewLineL(), ShowTextOnScreen(), and ~CFocusEventAppView().


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

© Nokia 2009

Back to top