|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================ 00003 * Name : CRTEAppUi from RichTextEditorAppUi.cpp 00004 * Part of : RichTextEditor 00005 * Created : 05/08/2006 by Forum Nokia 00006 * Version : 2.0 00007 * 00008 * Copyright (c) 2006 - 2007 Nokia Corporation. 00009 * This material, including documentation and any related 00010 * computer programs, is protected by copyright controlled by 00011 * Nokia Corporation. 00012 * ============================================================================ 00013 */ 00014 00015 // INCLUDE FILES 00016 #include "RichTextEditorAppUi.h" 00017 #include "RichTextEditorContainer.h" 00018 #include <RichTextEditor.rsg> 00019 #ifdef __SERIES60_3X__ 00020 #include <avkon.hrh> //Font ids 00021 #else 00022 #include <AknUtils.h> //Defined font name 00023 #endif 00024 #include "RichTextEditor.hrh" 00025 00026 #define KEnableSkinFlag 0x1000 00027 #define KLayoutAwareApp 0x08 00028 00029 // ================= MEMBER FUNCTIONS ======================= 00030 // 00031 // ---------------------------------------------------------- 00032 // CRTEAppUi::ConstructL() 00033 // 00034 // ---------------------------------------------------------- 00035 // 00036 void CRTEAppUi::ConstructL() 00037 { 00038 #ifdef __SERIES60_3X__ 00039 BaseConstructL(EAknEnableSkin); 00040 #else 00041 BaseConstructL(KEnableSkinFlag | KLayoutAwareApp); 00042 #endif 00043 iAppContainer = new (ELeave) CRTEContainer; 00044 iAppContainer->SetMopParent(this); 00045 iAppContainer->ConstructL( ClientRect() ); 00046 AddToStackL( iAppContainer ); 00047 } 00048 00049 // ---------------------------------------------------- 00050 // CRTEAppUi::~CRTEAppUi() 00051 // Destructor 00052 // Frees reserved resources 00053 // ---------------------------------------------------- 00054 // 00055 CRTEAppUi::~CRTEAppUi() 00056 { 00057 if (iAppContainer) 00058 { 00059 RemoveFromStack( iAppContainer ); 00060 delete iAppContainer; 00061 } 00062 } 00063 00064 // ---------------------------------------------------- 00065 // CRTEAppUi::HandleCommandL(TInt aCommand) 00066 // 00067 // ---------------------------------------------------- 00068 // 00069 void CRTEAppUi::HandleCommandL(TInt aCommand) 00070 { 00071 switch ( aCommand ) 00072 { 00073 case EAknSoftkeyBack: 00074 case EEikCmdExit: 00075 { 00076 Exit(); 00077 break; 00078 } 00079 case ERichTextCmdAppSetbold: 00080 iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EBold); 00081 break; 00082 case ERichTextCmdAppSetItalic: 00083 iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EItalic); 00084 break; 00085 case ERichTextCmdAppSetUnderline: 00086 iAppContainer->SetCharacterBIUAttribL(CEikGlobalTextEditor::EUnderline); 00087 break; 00088 // Font names defined at AknUtils.h in 1st and 2nd editions. 00089 // Font ids at avkon.hrh from 3rd Edition onwards. 00090 case ERichTextCmdAppFont1: 00091 #ifdef __SERIES60_3X__ 00092 iAppContainer->SetFont(EAknLogicalFontPrimaryFont); 00093 #else 00094 iAppContainer->SetFont(LatinPlain12()); 00095 #endif 00096 break; 00097 case ERichTextCmdAppFont2: 00098 #ifdef __SERIES60_3X__ 00099 iAppContainer->SetFont(EAknLogicalFontSecondaryFont); 00100 #else 00101 // default font at Typo application startup in 1st and 2nd edition. 00102 iAppContainer->SetFont(LatinBold12()); 00103 #endif 00104 break; 00105 case ERichTextCmdAppFont3: 00106 #ifdef __SERIES60_3X__ 00107 iAppContainer->SetFont(EAknLogicalFontPrimarySmallFont); 00108 #else 00109 iAppContainer->SetFont(LatinBold19()); 00110 #endif 00111 break; 00112 case ERichTextCmdAppSetStrikethrough: 00113 iAppContainer->Strike(); 00114 break; 00115 case ERichTextCmdAppLeft: 00116 iAppContainer->SetAlignment(CParaFormat::ELeftAlign); 00117 break; 00118 case ERichTextCmdAppCenter: 00119 iAppContainer->SetAlignment(CParaFormat::ECenterAlign); 00120 break; 00121 case ERichTextCmdAppRight: 00122 iAppContainer->SetAlignment(CParaFormat::ERightAlign); 00123 break; 00124 case ERichTextCmdAppSetRed: 00125 iAppContainer->SetColor(KRgbRed); 00126 break; 00127 case ERichTextCmdAppSetGreen: 00128 iAppContainer->SetColor(KRgbGreen); 00129 break; 00130 case ERichTextCmdAppSetBlue: 00131 iAppContainer->SetColor(KRgbBlue); 00132 break; 00133 case ERichTextCmdAppSetBlack: 00134 iAppContainer->SetColor(KRgbBlack); 00135 break; 00136 case ERichTextCmdAppDemo: 00137 iAppContainer->DemoL(); 00138 break; 00139 default: 00140 break; 00141 } 00142 } 00143 00144 // ----------------------------------------------------------------------------- 00145 // Called by framework when layout is changed. 00146 // Passes the new client rectangle to the AppContainer 00147 // ----------------------------------------------------------------------------- 00148 // 00149 void CRTEAppUi::HandleResourceChangeL( TInt aType ) 00150 { 00151 // base-class call also 00152 CAknAppUi::HandleResourceChangeL(aType); 00153 if (aType == KEikDynamicLayoutVariantSwitch) 00154 { 00155 if(iAppContainer) 00156 iAppContainer->SetRect( ClientRect() ); 00157 } 00158 } 00159 00160 // End of File
|
© Nokia 2009 |