src/NPRAppView.cpp
changeset 0 0049171ecffb
equal deleted inserted replaced
-1:000000000000 0:0049171ecffb
       
     1 /*
       
     2  ============================================================================
       
     3  Name		: NPRAppView.cpp
       
     4  Author	  : John Kern
       
     5  Copyright (c) 2009 Symbian Foundation Ltd
       
     6  This component and the accompanying materials are made available
       
     7  under the terms of the License "Eclipse Public License v1.0"
       
     8  which accompanies this distribution, and is available
       
     9  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 
       
    11  Initial Contributors:
       
    12  Symbian Foundation Ltd - initial contribution.
       
    13  
       
    14  Contributors: John Kern
       
    15  Description : Application view implementation
       
    16  ============================================================================
       
    17  */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <coemain.h>
       
    21 #include "NPRAppView.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CNPRAppView::NewL()
       
    27 // Two-phased constructor.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CNPRAppView* CNPRAppView::NewL(const TRect& aRect)
       
    31 	{
       
    32 	CNPRAppView* self = CNPRAppView::NewLC(aRect);
       
    33 	CleanupStack::Pop(self);
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CNPRAppView::NewLC()
       
    39 // Two-phased constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CNPRAppView* CNPRAppView::NewLC(const TRect& aRect)
       
    43 	{
       
    44 	CNPRAppView* self = new (ELeave) CNPRAppView;
       
    45 	CleanupStack::PushL(self);
       
    46 	self->ConstructL(aRect);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CNPRAppView::ConstructL()
       
    52 // Symbian 2nd phase constructor can leave.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void CNPRAppView::ConstructL(const TRect& aRect)
       
    56 	{
       
    57 	// Create a window for this application view
       
    58 	CreateWindowL();
       
    59 
       
    60 	// Set the windows size
       
    61 	SetRect(aRect);
       
    62 
       
    63 	// Activate the window, which makes it ready to be drawn
       
    64 	ActivateL();
       
    65 	}
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CNPRAppView::CNPRAppView()
       
    69 // C++ default constructor can NOT contain any code, that might leave.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CNPRAppView::CNPRAppView()
       
    73 	{
       
    74 	// No implementation required
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CNPRAppView::~CNPRAppView()
       
    79 // Destructor.
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CNPRAppView::~CNPRAppView()
       
    83 	{
       
    84 	// No implementation required
       
    85 	}
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CNPRAppView::Draw()
       
    89 // Draws the display.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CNPRAppView::Draw(const TRect& /*aRect*/) const
       
    93 	{
       
    94 	// Get the standard graphics context
       
    95 	CWindowGc& gc = SystemGc();
       
    96 
       
    97 	// Gets the control's extent
       
    98 	TRect drawRect(Rect());
       
    99 
       
   100 	// Clears the screen
       
   101 	gc.Clear(drawRect);
       
   102 
       
   103 	}
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CNPRAppView::SizeChanged()
       
   107 // Called by framework when the view size is changed.
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CNPRAppView::SizeChanged()
       
   111 	{
       
   112 	DrawNow();
       
   113 	}
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CNPRAppView::HandlePointerEventL()
       
   117 // Called by framework to handle pointer touch events.
       
   118 // Note: although this method is compatible with earlier SDKs, 
       
   119 // it will not be called in SDKs without Touch support.
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void CNPRAppView::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   123 	{
       
   124 
       
   125 	// Call base class HandlePointerEventL()
       
   126 	CCoeControl::HandlePointerEventL(aPointerEvent);
       
   127 	}
       
   128 
       
   129 // End of File