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