|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <SIPExLogContainer.h>
Public Member Functions | |
| CSIPExLogContainer (CSIPExEngine &aEngine) | |
| void | ConstructL (const TRect &aRect) |
| ~CSIPExLogContainer () | |
| void | ShowInfoL () |
| AknLayoutUtils::SAknLayoutTextMultiline | GetEditorLayout (const TRect &aRect) const |
| TInt | FontHeightInPixels () const |
| TInt | FontTotalHeightInPixels () const |
| TInt | NumOfFittingEditorLines (const TRect &aRect) const |
Private Member Functions | |
| void | SizeChanged () |
| TInt | CountComponentControls () const |
| CCoeControl * | ComponentControl (TInt aIndex) const |
| void | Draw (const TRect &aRect) const |
| void | HandleControlEventL (CCoeControl *aControl, TCoeEvent aEventType) |
| TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| void | HandleResourceChange (TInt aType) |
| TTypeUid::Ptr | MopSupplyObject (TTypeUid aId) |
Private Attributes | |
| CEikGlobalTextEditor * | iEditor |
| CAknsBasicBackgroundControlContext * | iBgContext |
| CSIPExEngine & | iEngine |
Definition at line 34 of file SIPExLogContainer.h.
|
|
C++ default constructor
Definition at line 45 of file SIPExLogContainer.cpp. 00046 : iEngine( aEngine ) 00047 { 00048 // no implementation required 00049 }
|
|
|
Destructor. Definition at line 112 of file SIPExLogContainer.cpp. References iBgContext, and iEditor. 00113 { 00114 delete iEditor; 00115 delete iBgContext; 00116 }
|
|
|
EPOC default constructor.
Definition at line 56 of file SIPExLogContainer.cpp. References GetEditorLayout(), iBgContext, iEditor, NumOfFittingEditorLines(), and ShowInfoL(). 00057 { 00058 CreateWindowL(); 00059 00060 iBgContext = 00061 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, 00062 aRect, 00063 ETrue ); 00064 00065 // Create editor in which info texts are shown (log window) 00066 // 00067 iEditor = new ( ELeave ) CEikGlobalTextEditor(); 00068 00069 TInt flags( EEikEdwinNoAutoSelection | 00070 EEikEdwinJustAutoCurEnd | 00071 EEikEdwinLineCursor | 00072 EEikEdwinNoHorizScrolling ); 00073 00074 TRect editorRect( aRect ); 00075 editorRect.Shrink( KEditorDistanceFromScreenEdge, 00076 KEditorDistanceFromScreenEdge ); 00077 00078 iEditor->ConstructL( this, 00079 NumOfFittingEditorLines( editorRect ), 00080 KEditorMaxLength, 00081 flags, 00082 EGulFontControlAll, 00083 EGulAllFonts ); 00084 00085 iEditor->SetContainerWindowL( *this ); 00086 00087 00088 00089 AknLayoutUtils::LayoutEdwin( iEditor, 00090 editorRect, 00091 GetEditorLayout( editorRect ) ); 00092 00093 iEditor->CreateScrollBarFrameL(); 00094 iEditor->ScrollBarFrame()->SetScrollBarVisibilityL( 00095 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); 00096 00097 00098 SetRect( aRect ); 00099 00100 iEditor->ActivateL(); 00101 00102 ShowInfoL(); 00103 00104 ActivateL(); 00105 }
|
|
|
From CoeControl,SizeChanged. Definition at line 123 of file SIPExLogContainer.cpp. References GetEditorLayout(), and iEditor. 00124 { 00125 TRect editorRect( Rect() ); 00126 editorRect.Shrink( KEditorDistanceFromScreenEdge, 00127 KEditorDistanceFromScreenEdge ); 00128 00129 AknLayoutUtils::LayoutEdwin( iEditor, 00130 editorRect, 00131 GetEditorLayout( editorRect ) ); 00132 }
|
|
|
From CoeControl,CountComponentControls. Definition at line 138 of file SIPExLogContainer.cpp.
|
|
|
From CCoeControl,ComponentControl. Definition at line 147 of file SIPExLogContainer.cpp. References iEditor. 00148 { 00149 switch( aIndex ) 00150 { 00151 case 0: 00152 return iEditor; 00153 default: 00154 { 00155 _LIT( KPanicCntx, "SIP Example" ); 00156 __ASSERT_ALWAYS( EFalse, User::Panic( KPanicCntx(), KErrArgument ) ); 00157 } 00158 } 00159 return NULL; 00160 }
|
|
|
From CCoeControl,Draw. Definition at line 166 of file SIPExLogContainer.cpp. References iEditor. 00167 { 00168 CWindowGc& gc = SystemGc(); 00169 00170 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); 00171 gc.SetBrushColor( KRgbWhite ); 00172 gc.Clear(); 00173 00174 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); 00175 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); 00176 00177 AknsDrawUtils::Background( skin, cc, this, gc, aRect ); 00178 00179 // Draw editor border 00180 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); 00181 gc.SetPenStyle( CGraphicsContext::ESolidPen ); 00182 gc.SetPenColor( TRgb( 174, 186, 227 ) ); 00183 00184 TRect editorRect( iEditor->Rect() ); 00185 editorRect.Grow( KEditorBorderGrow, KEditorBorderGrow ); 00186 gc.DrawRect( editorRect ); 00187 }
|
|
||||||||||||
|
From CCoeControl, HandleControlEventL. Definition at line 194 of file SIPExLogContainer.cpp.
|
|
||||||||||||
|
From CCoeControl, OfferKeyEvent. Definition at line 205 of file SIPExLogContainer.cpp. References iEditor. 00208 { 00209 if( aType == EEventKeyUp ) 00210 { 00211 switch( aKeyEvent.iScanCode ) 00212 { 00213 case EStdKeyUpArrow: 00214 iEditor->MoveCursorL( TCursorPosition::EFPageUp, EFalse ); 00215 return EKeyWasConsumed; 00216 00217 case EStdKeyDownArrow: 00218 iEditor->MoveCursorL( TCursorPosition::EFPageDown, EFalse ); 00219 return EKeyWasConsumed; 00220 00221 default: 00222 return EKeyWasNotConsumed; 00223 } 00224 } 00225 00226 return EKeyWasNotConsumed; 00227 }
|
|
|
From CCoeControl, HandleResourceChange. Definition at line 234 of file SIPExLogContainer.cpp. References iBgContext. 00235 { 00236 CCoeControl::HandleResourceChange( aType ); 00237 00238 if ( aType == KEikDynamicLayoutVariantSwitch ) 00239 { 00240 TRect mainPaneRect; 00241 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 00242 mainPaneRect ); 00243 if ( iBgContext ) 00244 { 00245 iBgContext->SetRect( mainPaneRect ); 00246 } 00247 00248 SetRect( mainPaneRect ); 00249 DrawNow(); 00250 } 00251 }
|
|
|
From CCoeControl, MopSupplyObject. Definition at line 258 of file SIPExLogContainer.cpp. References iBgContext. 00259 { 00260 if ( aId.iUid == MAknsControlContext::ETypeId ) 00261 { 00262 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); 00263 } 00264 return CCoeControl::MopSupplyObject( aId ); 00265 }
|
|
|
Show current info text in editor Definition at line 272 of file SIPExLogContainer.cpp. References iEditor. 00273 { 00274 // Read info text from document and set it to editor. 00275 // Current way is not the most optimal. 00276 CEikDocument* doc = 00277 static_cast< CEikAppUi* >( CEikonEnv::Static()->AppUi() )->Document(); 00278 00279 CGlobalText* globalText = iEditor->GlobalText(); 00280 globalText->Reset(); 00281 globalText->InsertL( 0, static_cast< CSIPExDoc* >( doc )->InfoText() ); 00282 00283 TCharFormat charFormat; 00284 TCharFormatMask charMask; 00285 iEditor->ApplyCharFormatL( charFormat, charMask ); 00286 00287 iEditor->MoveCursorL( TCursorPosition::EFPageDown, EFalse ); 00288 00289 DrawDeferred(); 00290 }
|
|
|
Gets appropriate layout for editor Definition at line 297 of file SIPExLogContainer.cpp. References FontHeightInPixels(), FontTotalHeightInPixels(), and NumOfFittingEditorLines(). 00299 { 00300 /* 00301 SAknLayoutTextMultiline struct: 00302 00303 @param iFont font id, ELatinPlain12, ELatinBold12, ELatinBold13 etc.. 00304 @param iC colour index, 0..255 00305 @param iL left margin 00306 @param iR right margin 00307 @param iB Baseline from top of the parent rectangle 00308 @param iW text width in pixels 00309 @param iJ justification. ELayoutAlignNone; ELayoutAlignCenter; 00310 ELayoutAlignLeft; ELayoutAlignRight; ELayoutAlignBidi 00311 00312 @param iNumberOfLinesShown 00313 @param iNextLineB baseline of 2nd line for multi-line labels/editors 00314 */ 00315 TInt fontHeight( FontHeightInPixels() ); 00316 TInt fontTotalHeight( FontTotalHeightInPixels() ); 00317 00318 AknLayoutUtils::SAknLayoutTextMultiline editorLayout; 00319 editorLayout.iFont = EAknLogicalFontSecondaryFont; 00320 editorLayout.iC = KFontColorIndexBlue; 00321 editorLayout.iL = KEditorDistanceFromScreenEdge; 00322 editorLayout.iR = KEditorDistanceFromScreenEdge; 00323 editorLayout.iB = KEditorDistanceFromScreenEdge + fontHeight; 00324 editorLayout.iW = aRect.Width() - editorLayout.iL - editorLayout.iR; 00325 editorLayout.iJ = ELayoutAlignLeft; 00326 editorLayout.iNumberOfLinesShown = NumOfFittingEditorLines( aRect ); 00327 editorLayout.iNextLineB = editorLayout.iB + fontTotalHeight; 00328 return editorLayout; 00329 }
|
|
© Nokia 2006 |