00001 /* 00002 * Copyright (c) 2009 Nokia Corporation. 00003 */ 00004 00005 #ifndef __CLIENT_APPVIEW_H__ 00006 #define __CLIENT_APPVIEW_H__ 00007 00008 #include <coecntrl.h> 00009 #include <eikrted.h> 00010 #include "ClientEngine.h" 00011 00012 /* 00013 * 00014 * Applications' view. Contains two CEikRichTextEditors for displaying received 00015 * data and status events. 00016 * 00017 */ 00018 class CClientAppView : public CCoeControl, 00019 public MCoeControlObserver, 00020 public MClientObserver 00021 { 00022 public: 00023 /* 00024 * NewL() 00025 * 00026 * Create a CClientEngine object. 00027 * 00028 * Params: 00029 * aRect: Extents of the view. 00030 * 00031 * Returns: 00032 * A pointer to the created instance of CClientAppView 00033 * 00034 */ 00035 static CClientAppView* NewL(const TRect& aRect); 00036 00037 /* 00038 * NewLC() 00039 * 00040 * Create a CClientEngine object. 00041 * 00042 * Params: 00043 * aRect: Extents of the view. 00044 * 00045 * Returns: 00046 * A pointer to the created instance of CClientAppView 00047 * 00048 */ 00049 static CClientAppView* NewLC(const TRect& aRect); 00050 00051 /* 00052 * ~CClientAppView() 00053 * 00054 * Destructor of CClientAppView. 00055 * 00056 * Params: 00057 * - 00058 * 00059 * Returns: 00060 * - 00061 * 00062 */ 00063 ~CClientAppView(); 00064 00065 /* 00066 * ResetL() 00067 * 00068 * Resets contents of the view; clears CEikRichTextEditors. 00069 * 00070 * Params: 00071 * - 00072 * 00073 * Returns: 00074 * - 00075 * 00076 */ 00077 void ResetL(); 00078 00079 // Switches focus between the two rich text editors. 00080 void SwitchFocus(); 00081 00082 // Returns the width (breadth) of the scrollbar for a particular editor 00083 TInt GetScrollbarWidth(CEikRichTextEditor* aEditor) const; 00084 00085 /* 00086 * From CCoeControl 00087 */ 00088 public: 00089 /* 00090 * Draw() 00091 * 00092 * Draws the view. 00093 * 00094 * Params: 00095 * aRect: 00096 * 00097 * Returns: 00098 * - 00099 * 00100 */ 00101 void Draw(const TRect& aRect) const; 00102 00103 /* 00104 * GetHelpContext() 00105 * Identify the help context so that the framework can look up 00106 * the corresponding help topic 00107 * @param aContext Returns the help context 00108 */ 00109 void GetHelpContext(TCoeHelpContext& aContext) const; 00110 00111 private: 00112 void HandleResourceChange(TInt aType); 00113 00114 /* 00115 * From MCoeControlObserver 00116 */ 00117 private: 00118 /* 00119 * CountComponentControls() 00120 * 00121 * Gets the number of controls contained in this compound control. 00122 * 00123 * Params: 00124 * - 00125 * 00126 * Returns: 00127 * Number of controls. 00128 * 00129 */ 00130 TInt CountComponentControls() const; 00131 00132 /* 00133 * ComponentControl() 00134 * 00135 * Gets the specified component of a compound control. 00136 * 00137 * Params: 00138 * aIndex: 00139 * 00140 * Returns: 00141 * Pointer to control with index aIndex. 00142 * 00143 */ 00144 CCoeControl* ComponentControl(TInt aIndex) const; 00145 00146 /* 00147 * OfferKeyEventL() 00148 * 00149 * Handles key events passed to this control (view). 00150 * 00151 * Params: 00152 * aKeyEvent: The key event. 00153 * aType: The type of key event: EEventKey, EEventKeyUp or 00154 * EEventKeyDown. 00155 * 00156 * Returns: 00157 * - 00158 * 00159 */ 00160 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); 00161 00162 /* 00163 * HandleControlEventL() 00164 * 00165 * Handles control events. 00166 * 00167 * Params: 00168 * aControl: Control 00169 * aEventType: Event type 00170 * 00171 * Returns: 00172 * - 00173 * 00174 */ 00175 void HandleControlEventL( CCoeControl* /* aControl */, 00176 TCoeEvent /* aEventType */ ); 00177 00178 void SizeChanged(); 00179 00180 /* 00181 * From MClientObserver (see ClientEngine.h) 00182 */ 00183 public: 00184 void ClientEvent(const TDesC& aEventDescription); 00185 void ClientBodyReceived(const TDesC8& aBodyData); 00186 00187 private: 00188 /* 00189 * ConstructL() 00190 * 00191 * Perform the second phase construction of a CClientAppView object. 00192 * 00193 * Params: 00194 * aRect: Extents of the view. 00195 * 00196 * Returns: 00197 * - 00198 * 00199 */ 00200 void ConstructL(const TRect& aRect); 00201 00202 /* 00203 * CClientAppView() 00204 * 00205 * Perform the first phase of two phase construction. 00206 * 00207 * Params: 00208 * - 00209 * 00210 * Returns: 00211 * - 00212 * 00213 */ 00214 CClientAppView(); 00215 00216 /* 00217 * AddToOutputWindowL() 00218 * 00219 * Adds given text to output window (CEikRichTextEditor, iOutputWindow) 00220 * Does not format the added text. 00221 * 00222 * Params: 00223 * aText: Text to be added. 00224 * 00225 * Returns: 00226 * - 00227 * 00228 */ 00229 void AddToOutputWindowL(const TDesC8& aText); 00230 00231 /* 00232 * AddToStatusWindowL() 00233 * 00234 * Adds given text to status window (CEikRichTextEditor, iStatusWindow) 00235 * 00236 * Params: 00237 * aText: A single line of text to be added. 00238 * 00239 * Returns: 00240 * - 00241 * 00242 */ 00243 void AddToStatusWindowL(const TDesC& aText); 00244 00245 private: 00246 CEikRichTextEditor* iOutputWindow; 00247 CEikRichTextEditor* iStatusWindow; 00248 }; 00249 00250 00251 #endif // __CLIENT_APPVIEW_H__
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.