Nokia N97 SDK
Example Applications Guide

HsWidgetAppView.cpp

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

© Nokia 2009

Back to top