00001 "-//W3C//DTD HTML 4.0 Transitional//EN"> 00002 00003 00004 00005 "Content-Type" content="text/html;charset=iso-8859-1"> 00006csasyncappview.cpp Source File 00007 "style.css" rel="stylesheet" type="text/css"> 00008 00009 00010
"100%" height="1">"2" color="#000000" face="Arial, Helvetica, sans-serif">
00012 S60 5th Edition SDK Example Applications Guide |
class="fragment">"l00001">00001 class="comment">/* 00021 00002 * ============================================================================== 00022 00003 * Name : csasyncappview.cpp 00023 00004 * Part of : CSAsync 00024 00005 * Interface : 00025 00006 * Description : 00026 00007 * Version : 00027 00008 * 00028 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00029 00010 * This material, including documentation and any related 00030 00011 * computer programs, is protected by copyright controlled by 00031 00012 * Nokia Corporation. 00032 00013 * ============================================================================== 00033 00014 */ 00034 "l00015">00015 00035 "l00016">00016 00036 "l00017">00017 class="comment">// INCLUDE FILES 00037 "l00018">00018 class="preprocessor">#include <coemain.h> 00038 "l00019">00019 class="preprocessor">#include <eikenv.h> 00039 "l00020">00020 class="preprocessor">#include <avkon.rsg> 00040 "l00021">00021 00041 "l00022">00022 class="preprocessor">#include "CSAsyncAppView.h" 00042 "l00023">00023 class="preprocessor">#include "CSAsyncDocument.h" 00043 "l00024">00024 00044 "l00025">00025 class="comment">// ========================= MEMBER FUNCTIONS ================================== 00045 "l00026">00026 00046 "l00027">00027 class="comment">// ----------------------------------------------------------------------------- 00047 "l00028">00028 class="comment">// CCSAsyncAppView::NewL() 00048 "l00029">00029 class="comment">// Two-phased constructor. 00049 "l00030">00030 class="comment">// ----------------------------------------------------------------------------- 00050 "l00031">00031 class="comment">// 00051 "l00032">class="code" href="class_c_c_s_async_app_view.html#113d3c41dfbbbaf3bd2d6d1213cc9f32">00032 class="code" href="class_c_c_s_async_app_view.html">CCSAsyncAppView* class="code" href="class_c_c_s_async_app_view.html#113d3c41dfbbbaf3bd2d6d1213cc9f32">CCSAsyncAppView::NewL( class="keyword">const TRect& aRect, 00052 "l00033">00033 class="code" href="class_c_c_s_async_document.html">CCSAsyncDocument& aDocument ) 00053 "l00034">00034 { 00054 "l00035">00035 class="code" href="class_c_c_s_async_app_view.html">CCSAsyncAppView* class="keyword">self = class="code" href="class_c_c_s_async_app_view.html#588da7d8e5db2570654e9ffbaf355a8c">CCSAsyncAppView::NewLC( aRect, aDocument ); 00055 "l00036">00036 CleanupStack::Pop( class="keyword">self ); 00056 "l00037">00037 class="keywordflow">return class="keyword">self; 00057 "l00038">00038 } 00058 "l00039">00039 00059 "l00040">00040 class="comment">// ----------------------------------------------------------------------------- 00060 "l00041">00041 class="comment">// CCSAsyncAppView::NewLC() 00061 "l00042">00042 class="comment">// Two-phased constructor. 00062 "l00043">00043 class="comment">// ----------------------------------------------------------------------------- 00063 "l00044">00044 class="comment">// 00064 "l00045">class="code" href="class_c_c_s_async_app_view.html#588da7d8e5db2570654e9ffbaf355a8c">00045 class="code" href="class_c_c_s_async_app_view.html">CCSAsyncAppView* class="code" href="class_c_c_s_async_app_view.html#588da7d8e5db2570654e9ffbaf355a8c">CCSAsyncAppView::NewLC( class="keyword">const TRect& aRect, 00065 "l00046">00046 class="code" href="class_c_c_s_async_document.html">CCSAsyncDocument& aDocument ) 00066 "l00047">00047 { 00067 "l00048">00048 class="code" href="class_c_c_s_async_app_view.html">CCSAsyncAppView* class="keyword">self = class="keyword">new ( ELeave ) class="code" href="class_c_c_s_async_app_view.html#9d54bf5a4c895f88b39af815379c7c30">CCSAsyncAppView( aDocument ); 00068 "l00049">00049 CleanupStack::PushL( class="keyword">self ); 00069 "l00050">00050 class="keyword">self->ConstructL( aRect ); 00070 "l00051">00051 class="keywordflow">return class="keyword">self; 00071 "l00052">00052 } 00072 "l00053">00053 00073 "l00054">00054 class="comment">// ----------------------------------------------------------------------------- 00074 "l00055">00055 class="comment">// CCSAsyncAppView::ConstructL() 00075 "l00056">00056 class="comment">// Symbian 2nd phase constructor can leave. 00076 "l00057">00057 class="comment">// ----------------------------------------------------------------------------- 00077 "l00058">00058 class="comment">// 00078 "l00059">class="code" href="class_c_c_s_async_app_view.html#bf31593b337cbf3fb671382cf773281c">00059 class="keywordtype">void class="code" href="class_c_c_s_async_app_view.html#bf31593b337cbf3fb671382cf773281c">CCSAsyncAppView::ConstructL( class="keyword">const TRect& aRect ) 00079 "l00060">00060 { 00080 "l00061">00061 class="comment">// Create a window for this application view 00081 "l00062">00062 CreateWindowL(); 00082 "l00063">00063 00083 "l00064">00064 class="comment">// Set the windows size 00084 "l00065">00065 SetRect( aRect ); 00085 "l00066">00066 00086 "l00067">00067 class="comment">// Activate the window, which makes it ready to be drawn 00087 "l00068">00068 ActivateL(); 00088 "l00069">00069 } 00089 "l00070">00070 00090 "l00071">00071 class="comment">// ----------------------------------------------------------------------------- 00091 "l00072">00072 class="comment">// CCSAsyncAppView::CCSAsyncAppView() 00092 "l00073">00073 class="comment">// C++ default constructor can NOT contain any code, that might leave. 00093 "l00074">00074 class="comment">// ----------------------------------------------------------------------------- 00094 "l00075">00075 class="comment">// 00095 "l00076">class="code" href="class_c_c_s_async_app_view.html#9d54bf5a4c895f88b39af815379c7c30">00076 class="code" href="class_c_c_s_async_app_view.html#9d54bf5a4c895f88b39af815379c7c30">CCSAsyncAppView::CCSAsyncAppView( class="code" href="class_c_c_s_async_document.html">CCSAsyncDocument& aDocument ) 00096 "l00077">00077 : iDocument( aDocument ) 00097 "l00078">00078 { 00098 "l00079">00079 class="comment">// No implementation required 00099 "l00080">00080 } 00100 "l00081">00081 00101 "l00082">00082 class="comment">// ----------------------------------------------------------------------------- 00102 "l00083">00083 class="comment">// CCSAsyncAppView::~CCSAsyncAppView() 00103 "l00084">00084 class="comment">// Destructor. 00104 "l00085">00085 class="comment">// ----------------------------------------------------------------------------- 00105 "l00086">00086 class="comment">// 00106 "l00087">class="code" href="class_c_c_s_async_app_view.html#d5974766a4157fe782fe6de6cd6b3d2e">00087 class="code" href="class_c_c_s_async_app_view.html#d5974766a4157fe782fe6de6cd6b3d2e">CCSAsyncAppView::~CCSAsyncAppView() 00107 "l00088">00088 { 00108 "l00089">00089 class="comment">// No implementation required 00109 "l00090">00090 } 00110 "l00091">00091 00111 "l00092">00092 class="comment">// ----------------------------------------------------------------------------- 00112 "l00093">00093 class="comment">// CCSAsyncAppView::Draw() 00113 "l00094">00094 class="comment">// Draws this CCSAsyncAppView to the screen. 00114 "l00095">00095 class="comment">// ----------------------------------------------------------------------------- 00115 "l00096">00096 class="comment">// 00116 "l00097">class="code" href="class_c_c_s_async_app_view.html#67f946ca7848ec78de4961c5bcefdb72">00097 class="keywordtype">void class="code" href="class_c_c_s_async_app_view.html#67f946ca7848ec78de4961c5bcefdb72">CCSAsyncAppView::Draw( class="keyword">const TRect& class="comment">/*aRect*/ )class="keyword"> const 00117 "l00098">00098 class="keyword"> { 00118 "l00099">00099 00119 "l00100">00100 class="comment">// Clear the screen 00120 "l00101">00101 CWindowGc& gc = SystemGc(); 00121 "l00102">00102 gc.Clear( Rect() ); 00122 "l00103">00103 00123 "l00104">00104 TBuf<30> des; 00124 "l00105">00105 class="keyword">const TTime& time = class="code" href="class_c_c_s_async_app_view.html#e24f321b44666c7b289373e12f1453ee">iDocument.class="code" href="class_c_c_s_async_document.html#abd5ca40d94b3e8941d79e5362c038b2">Time(); 00125 "l00106">00106 00126 "l00107">00107 class="comment">// Read time format string from AVKON resource 00127 "l00108">00108 HBufC* timeFormatString = iEikonEnv->AllocReadResourceLC(R_QTN_TIME_LONG); 00128 "l00109">00109 class="comment">// It would also be possible to define your own format string instead, 00129 "l00110">00110 class="comment">// for example like this: 00130 "l00111">00111 class="comment">// _LIT( KHoursMinsSecs, "%-B%:0%J%:1%T%:2%S%:3%+B" ); 00131 "l00112">00112 00132 "l00113">00113 TRAPD( err, time.FormatL( des, *timeFormatString ) ); 00133 "l00114">00114 CleanupStack::PopAndDestroy(); class="comment">// timeFormatString 00134 "l00115">00115 00135 "l00116">00116 class="keywordflow">if ( err == KErrNone ) 00136 "l00117">00117 { 00137 "l00118">00118 class="keyword">const CFont* font = iEikonEnv->NormalFont(); 00138 "l00119">00119 gc.UseFont( font ); 00139 "l00120">00120 gc.DrawText( des, TPoint( 10,20 ) ); 00140 "l00121">00121 } 00141 "l00122">00122 } 00142 "l00123">00123 00143 "l00124">00124 00144 "l00125">00125 class="comment">// End of File 00145 "l00126">00126 00146
"width: 50%;
00161 padding-right: 10px;
00162 padding-left: 10px;
00163 border-right-style: None;
00164 border-left-style: None;
00165 border-top-style: None;
00166 border-bottom-style: None;"
00167 width=50%>
00168 "font-family: Arial;">"font-size: smaller;"> Nokia 2009 |
00169 "width: 50%;
00170 padding-right: 10px;
00171 padding-left: 10px;
00172 border-top-style: None;
00173 border-bottom-style: None;
00174 border-right-style: None;"
00175 width=50%>
00176 "text-align: right; margin-right: -4px;"
00177 align=right>"font-weight: bold;">"#Top"
00178 title="Back to top"> |