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

Public Member Functions | |
| ~CChatContainer () | |
| TBool | ContainsEntries () |
| void | ClearMessageListL () |
| void | ShowDataQueryL (const TInt aQueryResourceId, const TInt aTextResourceId, const TInt aPromptResoureId, const TInt aMaxLength, const TBool aDisplayFlag, TDes &aText) |
| void | LogL (const TDesC &aText) |
| void | LogL (const TDesC &aText, const TDesC &aExtraText) |
| void | LogL (const TDesC &aText, TInt aNumber) |
| TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| TInt | CountComponentControls () const |
| CCoeControl * | ComponentControl (TInt aIndex) const |
Static Public Member Functions | |
| static CChatContainer * | NewL (const TRect &aRect) |
| static CChatContainer * | NewLC (const TRect &aRect) |
Private Member Functions | |
| void | SizeChanged () |
| void | ConstructL (const TRect &aRect) |
| CChatContainer () | |
Private Attributes | |
| TBool | iDisplayDialog |
| CAknQueryDialog * | iQueryDialog |
| CEikLabel * | iLabelResultMessage |
| CEikTextListBox * | iListBox |
| CDesCArrayFlat * | iMessageList |
| TInt | iMsgIndex |
Definition at line 38 of file ChatContainer.h.
|
|
Destructor. Definition at line 104 of file ChatContainer.cpp. References iListBox. 00105 { 00106 // iMessageList not deleted as it is owned by iListBox->Model() 00107 delete iListBox; 00108 iListBox = NULL; 00109 }
|
|
|
CBTPointToPointAppView() Perform the first phase of two phase construction Definition at line 94 of file ChatContainer.cpp.
|
|
|
NewL() Create a CChatContainer object, which will draw itself to aRect
Definition at line 29 of file ChatContainer.cpp. References NewLC(). 00030 { 00031 CChatContainer* self = CChatContainer::NewLC( aRect ); 00032 CleanupStack::Pop( self ); 00033 return self; 00034 }
|
|
|
NewLC() Create a CChatContainer object, which will draw itself to aRect
Definition at line 41 of file ChatContainer.cpp. References ConstructL(). 00042 { 00043 CChatContainer* self = new ( ELeave ) CChatContainer; 00044 CleanupStack::PushL( self ); 00045 self->ConstructL( aRect ); 00046 return self; 00047 }
|
|
Definition at line 215 of file ChatContainer.cpp. References iListBox. 00216 { 00217 return iListBox->Model()->NumberOfItems() != 0; 00218 }
|
|
|
ClearMessageListL() Clear the list of messages. Definition at line 116 of file ChatContainer.cpp. References iListBox, and iMessageList. 00117 { 00118 iMessageList->Reset(); 00119 00120 iListBox->HandleItemRemovalL(); 00121 iListBox->Reset(); 00122 00123 // tell the control about the change 00124 iListBox->HandleItemAdditionL(); 00125 }
|
|
||||||||||||||||||||||||||||
|
ShowDataQueryL() Show data query.
Definition at line 226 of file ChatContainer.cpp. References iDisplayDialog, iListBox, and iMessageList. 00233 { 00234 00235 iDisplayDialog = ETrue; 00236 00237 TBuf<KChatTextBufLength> textData; 00238 00239 if ( aTextResourceId ) 00240 { 00241 iCoeEnv->ReadResourceL( textData, aTextResourceId ); 00242 } 00243 00244 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( 00245 textData, CAknQueryDialog::ENoTone ); 00246 CleanupStack::PushL( dlg ); 00247 00248 if ( aPromptResoureId ) 00249 { 00250 TBuf<KChatTextBufLength> prompt; 00251 iCoeEnv->ReadResourceL( prompt, aTextResourceId ); 00252 dlg->SetPromptL( prompt ); 00253 } 00254 00255 if ( aMaxLength ) 00256 { 00257 dlg->SetMaxLength( aMaxLength ); 00258 } 00259 00260 CleanupStack::Pop( dlg ); 00261 TBool answer( dlg->ExecuteLD( aQueryResourceId ) ); 00262 00263 if ( aDisplayFlag && answer ) 00264 { 00265 HBufC* buffer = HBufC::NewLC( KMessageHeaderLen + 00266 textData.Length() ); 00267 00268 buffer->Des().Append( '<' ); 00269 buffer->Des().Append( '\t' ); 00270 buffer->Des().Append( textData ); 00271 00272 // add the message to the list 00273 iMessageList->AppendL( *buffer ); 00274 CleanupStack::PopAndDestroy( buffer ); 00275 00276 // tell the control about the change 00277 iListBox->HandleItemAdditionL(); 00278 } 00279 00280 iDisplayDialog = EFalse; 00281 00282 // get message 00283 aText = textData; 00284 00285 DrawNow(); 00286 }
|
|
|
LogL() Add an entry to the log.
Implements MLog. Definition at line 164 of file ChatContainer.cpp. 00165 { 00166 LogL( aText, KNullDesC ); 00167 }
|
|
||||||||||||
|
LogL() Add an entry to the log.
Implements MLog. Definition at line 192 of file ChatContainer.cpp. References iListBox, and iMessageList. 00194 { 00195 HBufC* buffer = HBufC::NewLC( KMessageHeaderLen + aText.Length() + 00196 aExtraText.Length() ); 00197 00198 buffer->Des().Append( aExtraText ); 00199 buffer->Des().Append( '\t' ); 00200 buffer->Des().Append( aText ); 00201 00202 // add the message to the list 00203 iMessageList->AppendL( *buffer ); 00204 CleanupStack::PopAndDestroy( buffer ); 00205 00206 // tell the control about the change 00207 iListBox->HandleItemAdditionL(); 00208 }
|
|
||||||||||||
|
LogL() Add an entry to the log.
Implements MLog. Definition at line 174 of file ChatContainer.cpp. References LogL(). 00175 { 00176 TBuf<KMessageHeaderLen> numberString; 00177 HBufC* buffer = HBufC::NewLC( KMessageHeaderLen + aText.Length() + 00178 numberString.Length() ); 00179 numberString.Num( aNumber ); 00180 buffer->Des().Append( aText ); 00181 buffer->Des().Append( ' ' ); 00182 buffer->Des().Append( numberString ); 00183 LogL( buffer->Des(), KNullDesC ); 00184 CleanupStack::PopAndDestroy( buffer ); 00185 }
|
|
||||||||||||
|
OfferKeyEventL() Offer the key event to the list box
Definition at line 154 of file ChatContainer.cpp. 00155 { 00156 return iListBox->OfferKeyEventL( aKeyEvent, aType ); 00157 }
|
|
|
CountComponentControls() Return the number of component controls
Definition at line 132 of file ChatContainer.cpp.
|
|
|
ComponentControl() Return a component control
Definition at line 142 of file ChatContainer.cpp. References iListBox. 00143 { 00144 __ASSERT_ALWAYS( aIndex == 0, Panic( EChatInvalidControlIndex ) ); 00145 return iListBox; // Return the component 00146 }
|
|
|
From CoeControl,SizeChanged. Definition at line 294 of file ChatContainer.cpp. References iListBox. 00295 { 00296 if ( iListBox ) 00297 { 00298 iListBox-> SetRect( iAvkonAppUi->ApplicationRect() ); 00299 } 00300 }
|
|
|
ConstructL() Perform the second phase construction
Definition at line 54 of file ChatContainer.cpp. References iListBox, and iMessageList. 00055 { 00056 // Create a window for this application view 00057 CreateWindowL(); 00058 00059 // Set the windows size 00060 SetRect( aRect ); 00061 00062 // Create a control to display a list of messages 00063 iListBox = new ( ELeave ) CAknSingleNumberStyleListBox; 00064 iListBox->SetContainerWindowL( *this ); 00065 iListBox->ConstructL( this, 0 ); 00066 00067 iListBox->SetRect( aRect.Size() ); 00068 00069 iListBox->ActivateL(); 00070 iListBox->CreateScrollBarFrameL( ETrue ); 00071 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 00072 CEikScrollBarFrame::EOn, 00073 CEikScrollBarFrame::EAuto ); 00074 00075 // Create an array to hold the messages 00076 iMessageList = new ( ELeave ) CDesCArrayFlat( KMessageListLen ); 00077 00078 // Give it to the control 00079 CTextListBoxModel* model = iListBox->Model(); 00080 model->SetItemTextArray( iMessageList ); 00081 00082 // transfer ownership of iMessageList 00083 model->SetOwnershipType( ELbmOwnsItemArray ); 00084 00085 // Activate the window, which makes it ready to be drawn 00086 ActivateL(); 00087 }
|
|
|
iDisplayDialog boolean for Display Dialog Definition at line 182 of file ChatContainer.h. |
|
|
iQueryDialog Definition at line 187 of file ChatContainer.h. |
|
|
iLabelResultMessage Definition at line 192 of file ChatContainer.h. |
|
|
iListBox the control used to display the results Owned by CCChatContainer Definition at line 198 of file ChatContainer.h. |
|
|
iMessageList the list of messages to display Not owned by CChatContainer Definition at line 204 of file ChatContainer.h. |
|
|
iMsgIndex the id for the next message in the list Definition at line 210 of file ChatContainer.h. |
|
© Nokia 2006 |