S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : helloworldbasicappview.cpp 00004 * Part of : Helloworldbasic 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2005-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include <coemain.h> 00018 #include "HelloWorldBasicAppView.h" 00019 00020 // ============================ MEMBER FUNCTIONS =============================== 00021 00022 // ----------------------------------------------------------------------------- 00023 // CHelloWorldBasicAppView::NewL() 00024 // Two-phased constructor. 00025 // ----------------------------------------------------------------------------- 00026 // 00027 CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewL( const TRect& aRect ) 00028 { 00029 CHelloWorldBasicAppView* self = CHelloWorldBasicAppView::NewLC( aRect ); 00030 CleanupStack::Pop( self ); 00031 return self; 00032 } 00033 00034 // ----------------------------------------------------------------------------- 00035 // CHelloWorldBasicAppView::NewLC() 00036 // Two-phased constructor. 00037 // ----------------------------------------------------------------------------- 00038 // 00039 CHelloWorldBasicAppView* CHelloWorldBasicAppView::NewLC( const TRect& aRect ) 00040 { 00041 CHelloWorldBasicAppView* self = new ( ELeave ) CHelloWorldBasicAppView; 00042 CleanupStack::PushL( self ); 00043 self->ConstructL( aRect ); 00044 return self; 00045 } 00046 00047 // ----------------------------------------------------------------------------- 00048 // CHelloWorldBasicAppView::ConstructL() 00049 // Symbian 2nd phase constructor can leave. 00050 // ----------------------------------------------------------------------------- 00051 // 00052 void CHelloWorldBasicAppView::ConstructL( const TRect& aRect ) 00053 { 00054 // Create a window for this application view 00055 CreateWindowL(); 00056 00057 // Set the windows size 00058 SetRect( aRect ); 00059 00060 // Activate the window, which makes it ready to be drawn 00061 ActivateL(); 00062 } 00063 00064 // ----------------------------------------------------------------------------- 00065 // CHelloWorldBasicAppView::CHelloWorldBasicAppView() 00066 // C++ default constructor can NOT contain any code, that might leave. 00067 // ----------------------------------------------------------------------------- 00068 // 00069 CHelloWorldBasicAppView::CHelloWorldBasicAppView() 00070 { 00071 // No implementation required 00072 } 00073 00074 00075 // ----------------------------------------------------------------------------- 00076 // CHelloWorldBasicAppView::~CHelloWorldBasicAppView() 00077 // Destructor. 00078 // ----------------------------------------------------------------------------- 00079 // 00080 CHelloWorldBasicAppView::~CHelloWorldBasicAppView() 00081 { 00082 // No implementation required 00083 } 00084 00085 00086 // ----------------------------------------------------------------------------- 00087 // CHelloWorldBasicAppView::Draw() 00088 // Draws the display. 00089 // ----------------------------------------------------------------------------- 00090 // 00091 void CHelloWorldBasicAppView::Draw( const TRect& /*aRect*/ ) const 00092 { 00093 // Get the standard graphics context 00094 CWindowGc& gc = SystemGc(); 00095 00096 // Gets the control's extent 00097 TRect drawRect( Rect()); 00098 00099 // Clears the screen 00100 gc.Clear( drawRect ); 00101 00102 } 00103 00104 // ----------------------------------------------------------------------------- 00105 // CHelloWorldBasicAppView::SizeChanged() 00106 // Called by framework when the view size is changed. 00107 // ----------------------------------------------------------------------------- 00108 // 00109 void CHelloWorldBasicAppView::SizeChanged() 00110 { 00111 DrawNow(); 00112 } 00113 // End of File 00114
© Nokia 2006 |