|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <WebClientContainer.h>
Inheritance diagram for CWebClientContainer:

Public Member Functions | |
| ~CWebClientContainer () | |
| void | ResetL (const TDesC &aText) |
| void | HandleCommandL (TInt aCommand) |
| void | ClientEvent (const TDesC &aEventDescription) |
| void | ClientHeaderReceived (const TDesC &aHeaderData) |
| void | ClientBodyReceived (const TDesC8 &aBodyData) |
Static Public Member Functions | |
| static CWebClientContainer * | NewL (const TRect &aRect) |
| static CWebClientContainer * | NewLC (const TRect &aRect) |
Private Member Functions | |
| void | SizeChanged () |
| TInt | CountComponentControls () const |
| CCoeControl * | ComponentControl (TInt aIndex) const |
| void | Draw (const TRect &aRect) const |
| TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| void | HandleControlEventL (CCoeControl *, TCoeEvent) |
| void | ConstructL (const TRect &aRect) |
| CWebClientContainer () | |
| void | AddToHeaderWindowL (const TDesC &aText) |
| void | AddToSourceWindowL (const TDesC8 &aText) |
| void | AddToStatusWindowL (const TDesC &aText) |
Private Attributes | |
| CEikLabel * | iLabel |
| CEikRichTextEditor * | iHeaderWindow |
| CEikRichTextEditor * | iSourceWindow |
| CEikRichTextEditor * | iStatusWindow |
Definition at line 42 of file WebClientContainer.h.
|
|
~CWebClientContainer() Destructor of CWebClientContainer. Definition at line 111 of file WebClientContainer.cpp. References iHeaderWindow, iLabel, iSourceWindow, and iStatusWindow. 00112 { 00113 if ( iLabel ) 00114 { 00115 delete iLabel; 00116 iLabel = NULL; 00117 } 00118 if ( iHeaderWindow ) 00119 { 00120 delete iHeaderWindow; 00121 iHeaderWindow = NULL; 00122 } 00123 if ( iSourceWindow ) 00124 { 00125 delete iSourceWindow; 00126 iSourceWindow = NULL; 00127 } 00128 if ( iStatusWindow ) 00129 { 00130 delete iStatusWindow; 00131 iStatusWindow = NULL; 00132 } 00133 }
|
|
|
CWebClientContainer() Perform the first phase of two phase construction. Definition at line 55 of file WebClientContainer.cpp.
|
|
|
NewL() Create a CClientEngine object.
Definition at line 32 of file WebClientContainer.cpp. References NewLC(). 00033 { 00034 CWebClientContainer* self = CWebClientContainer::NewLC( aRect ); 00035 CleanupStack::Pop( self ); 00036 return self; 00037 }
|
|
|
NewLC() Create a CClientEngine object.
Definition at line 43 of file WebClientContainer.cpp. References ConstructL(). 00044 { 00045 CWebClientContainer* self = new (ELeave) CWebClientContainer; 00046 CleanupStack::PushL( self ); 00047 self->ConstructL( aRect ); 00048 return self; 00049 }
|
|
|
ResetL() Resets contents of the view. Sets given text to label and clears CEikRichTextEditors.
Definition at line 228 of file WebClientContainer.cpp. References iHeaderWindow, iLabel, iSourceWindow, and iStatusWindow. 00229 { 00230 iLabel->SetTextL( aText ); 00231 iLabel->DrawNow(); 00232 00233 iHeaderWindow->Text()->Reset(); 00234 iHeaderWindow->HandleTextChangedL(); 00235 iHeaderWindow->SetCursorPosL( 0, EFalse ); 00236 00237 iSourceWindow->Text()->Reset(); 00238 iSourceWindow->HandleTextChangedL(); 00239 iSourceWindow->SetCursorPosL( 0, EFalse ); 00240 00241 iStatusWindow->Text()->Reset(); 00242 iStatusWindow->HandleTextChangedL(); 00243 iStatusWindow->SetCursorPosL( 0, EFalse ); 00244 00245 iHeaderWindow->SetFocus( EFalse ); 00246 iSourceWindow->SetFocus( EFalse ); 00247 iStatusWindow->SetFocus( ETrue ); 00248 }
|
|
|
HandleCommandL() Handles user commands.
Definition at line 255 of file WebClientContainer.cpp. References iHeaderWindow, iSourceWindow, and iStatusWindow. 00256 { 00257 switch( aCommand ) 00258 { 00259 case EWebClientCmdHeader: 00260 { 00261 // Change focus to Header window and set cursor visible 00262 iHeaderWindow->SetFocus( ETrue ); 00263 iSourceWindow->SetFocus( EFalse ); 00264 iStatusWindow->SetFocus( EFalse ); 00265 iHeaderWindow->MoveCursorL( TCursorPosition::EFNoMovement, EFalse ); 00266 } 00267 break; 00268 case EWebClientCmdSource: 00269 { 00270 // Change focus to Source window and set cursor visible 00271 iSourceWindow->SetFocus( ETrue ); 00272 iHeaderWindow->SetFocus( EFalse ); 00273 iStatusWindow->SetFocus( EFalse ); 00274 iSourceWindow->MoveCursorL( TCursorPosition::EFNoMovement, EFalse ); 00275 } 00276 break; 00277 case EWebClientCmdStatus: 00278 { 00279 // Change focus to Status window and set cursor visible 00280 iStatusWindow->SetFocus( ETrue ); 00281 iHeaderWindow->SetFocus( EFalse ); 00282 iSourceWindow->SetFocus( EFalse ); 00283 iStatusWindow->MoveCursorL( TCursorPosition::EFNoMovement, EFalse ); 00284 } 00285 break; 00286 default: 00287 break; 00288 } 00289 }
|
|
|
From MWebClientObserver (see WebClientEngine.h) Implements MWebClientObserver. Definition at line 372 of file WebClientContainer.cpp. References AddToStatusWindowL(). 00373 { 00374 TRAPD( err, AddToStatusWindowL( aEventDescription )); 00375 if( err ) 00376 Panic( EClientView ); 00377 }
|
|
|
ClientHeaderReceived() Called when HTTP header is received.
Implements MWebClientObserver. Definition at line 384 of file WebClientContainer.cpp. References AddToHeaderWindowL(). 00385 { 00386 TRAPD( err, AddToHeaderWindowL( aHeaderData )); 00387 if( err ) 00388 Panic( EClientView ); 00389 }
|
|
|
ClientBodyReceived() Called when a part of the HTTP body is received.
Implements MWebClientObserver. Definition at line 396 of file WebClientContainer.cpp. References AddToSourceWindowL(). 00397 { 00398 TRAPD( err, AddToSourceWindowL( aBodyData )); 00399 if( err ) 00400 Panic( EClientView ); 00401 }
|
|
|
From CoeControl SizeChanged() Called by framework when the view size is changed. Definition at line 140 of file WebClientContainer.cpp. References iHeaderWindow, iLabel, iSourceWindow, and iStatusWindow. 00141 { 00142 TInt pointY = 0; 00143 TRect rect = Rect(); 00144 TInt width = rect.Width(); 00145 TInt height = rect.Height() - 4; // leave space for thin lines between windows 00146 TSize labelSize = iLabel->MinimumSize(); 00147 TInt dataWindowHeigth = (( height - labelSize.iHeight - KStatusWindowHeight ) / 2 ); 00148 labelSize.iWidth = width; 00149 00150 iLabel->SetExtent( TPoint( 0,pointY ), labelSize ); 00151 pointY = pointY + labelSize.iHeight + 1; 00152 iHeaderWindow->SetExtent( TPoint( 0,pointY ), 00153 TSize( width - KScrollBarWidth, dataWindowHeigth )); 00154 pointY = pointY + dataWindowHeigth + 1; 00155 iSourceWindow->SetExtent( TPoint( 0,pointY ), 00156 TSize( width - KScrollBarWidth, dataWindowHeigth )); 00157 pointY = pointY + dataWindowHeigth + 1; 00158 iStatusWindow->SetExtent( TPoint( 0,pointY ), 00159 TSize( width - KScrollBarWidth, KStatusWindowHeight )); 00160 00161 DrawNow(); 00162 }
|
|
|
From CCoeControl CountComponentControls() Gets the number of controls contained in this compound control.
Definition at line 184 of file WebClientContainer.cpp.
|
|
|
From CCoeControl ComponentControl() Gets the specified component of a compound control.
Definition at line 194 of file WebClientContainer.cpp. References iHeaderWindow, iLabel, iSourceWindow, and iStatusWindow. 00195 { 00196 switch( aIndex ) 00197 { 00198 case 0: 00199 return iLabel; 00200 case 1: 00201 return iHeaderWindow; 00202 case 2: 00203 return iSourceWindow; 00204 case 3: 00205 return iStatusWindow; 00206 default: 00207 Panic( EClientView ); 00208 return 0; 00209 } 00210 }
|
|
|
Draw() From CCoeControl Draws the view.
Definition at line 169 of file WebClientContainer.cpp. 00170 { 00171 CWindowGc& gc = SystemGc(); 00172 00173 gc.SetPenStyle( CGraphicsContext::ENullPen ); 00174 gc.SetBrushColor( KRgbGray ); 00175 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); 00176 gc.DrawRect( aRect ); 00177 }
|
|
||||||||||||
|
From CCoeControl OfferKeyEventL() Handles key events passed to this control (view).
Definition at line 296 of file WebClientContainer.cpp. References iHeaderWindow, iSourceWindow, and iStatusWindow. 00298 { 00299 // Redirect keyevents to controls 00300 if ( iHeaderWindow ) 00301 { 00302 if ( iHeaderWindow->IsFocused() ) 00303 return iHeaderWindow->OfferKeyEventL( aKeyEvent, aType ); 00304 } 00305 00306 if ( iSourceWindow ) 00307 { 00308 if ( iSourceWindow->IsFocused() ) 00309 return iSourceWindow->OfferKeyEventL( aKeyEvent, aType ); 00310 } 00311 00312 if ( iStatusWindow ) 00313 { 00314 if ( iStatusWindow->IsFocused() ) 00315 return iStatusWindow->OfferKeyEventL( aKeyEvent, aType ); 00316 } 00317 00318 return EKeyWasNotConsumed; 00319 }
|
|
||||||||||||
|
From MCoeControlObserver HandleControlEventL() Handles control events.
Definition at line 217 of file WebClientContainer.cpp.
|
|
|
ConstructL() Perform the second phase construction of a CWebClientContainer object.
Definition at line 65 of file WebClientContainer.cpp. References iHeaderWindow, iLabel, iSourceWindow, and iStatusWindow. 00066 { 00067 // Create a window for this application view 00068 CreateWindowL(); 00069 00070 iLabel = new (ELeave) CEikLabel; 00071 iLabel->SetContainerWindowL( *this ); 00072 iLabel->SetTextL( KHttpPrefix ); 00073 00074 // Create header window 00075 iHeaderWindow = new (ELeave) CEikRichTextEditor(); 00076 iHeaderWindow->SetContainerWindowL( *this ); 00077 iHeaderWindow->ConstructL( this, KNumberOfLines, KTextLimit, 00078 EEikEdwinReadOnly, EGulFontControlAll, EGulNoSymbolFonts ); 00079 iHeaderWindow->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 00080 CEikScrollBarFrame::EOn ); 00081 00082 // Create source window 00083 iSourceWindow = new (ELeave) CEikRichTextEditor(); 00084 iSourceWindow->SetContainerWindowL( *this ); 00085 iSourceWindow->ConstructL( this, KNumberOfLines, KTextLimit, 00086 EEikEdwinReadOnly, EGulFontControlAll, EGulNoSymbolFonts ); 00087 iSourceWindow->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 00088 CEikScrollBarFrame::EOn ); 00089 00090 // Create status window 00091 iStatusWindow = new (ELeave) CEikRichTextEditor(); 00092 iStatusWindow->SetContainerWindowL( *this ); 00093 iStatusWindow->ConstructL( this, KNumberOfLines, KTextLimit, 00094 EEikEdwinReadOnly, EGulFontControlAll, EGulNoSymbolFonts ); 00095 iStatusWindow->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, 00096 CEikScrollBarFrame::EOn ); 00097 iStatusWindow->SetFocus( ETrue ); 00098 00099 // Set the main window size 00100 SetRect( aRect ); 00101 00102 // Activate the window, which makes it ready to be drawn 00103 ActivateL(); 00104 }
|
|
|
AddToHeaderWindowL() Adds given text to header window (CEikRichTextEditor, iHeaderWindow) Does not format the added text.
Definition at line 326 of file WebClientContainer.cpp. References iHeaderWindow. 00327 { 00328 // Append aText to header window with line break 00329 CRichText* text = iHeaderWindow->RichText(); 00330 text->InsertL( text->DocumentLength(), aText ); 00331 text->InsertL( text->DocumentLength(), CEditableText::ELineBreak ); 00332 iHeaderWindow->HandleTextChangedL(); 00333 }
|
|
|
AddToSourceWindowL() Adds given text to Source window (CEikRichTextEditor, iSourceWindow) Does not format the added text.
Definition at line 340 of file WebClientContainer.cpp. References iSourceWindow. 00341 { 00342 // Convert 8-bit aText to 16-bit and append it to end of Source window 00343 HBufC* tempBuf = HBufC::NewL( aText.Length() ); 00344 CleanupStack::PushL( tempBuf ); 00345 tempBuf->Des().Copy( aText ); 00346 CRichText* text = iSourceWindow->RichText(); 00347 text->InsertL( text->DocumentLength(), *tempBuf ); 00348 iSourceWindow->HandleTextChangedL(); 00349 CleanupStack::PopAndDestroy( tempBuf ); 00350 }
|
|
|
AddToStatusWindowL() Adds given text to status window (CEikRichTextEditor, iStatusWindow)
Definition at line 357 of file WebClientContainer.cpp. References iStatusWindow. 00358 { 00359 // Append aText to status window with line break 00360 CRichText* text = iStatusWindow->RichText(); 00361 text->InsertL( text->DocumentLength(), aText ); 00362 text->InsertL( text->DocumentLength(), CEditableText::ELineBreak ); 00363 iStatusWindow->HandleTextChangedL(); 00364 iStatusWindow->MoveCursorL( TCursorPosition::EFLineDown, EFalse ); 00365 }
|
|
© Nokia 2006 |