|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : helpfulform.cpp 00004 * Part of : Help example 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2004 - 2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include <AknAppUi.h> 00018 #include <Avkon.rsg> 00019 #include <eikmenup.h> 00020 00021 #include "HelpfulForm.h" 00022 #include "HelpExampleApplication.h" 00023 #include "HelpExample.hrh" 00024 #include "HelpExample.hlp.hrh" 00025 00026 // ============================ MEMBER FUNCTIONS =============================== 00027 00028 // ----------------------------------------------------------------------------- 00029 // CHelpfulForm::NewL() 00030 // Two-phased constructor. 00031 // ----------------------------------------------------------------------------- 00032 // 00033 CHelpfulForm* CHelpfulForm::NewL( TInt aMenuResource ) 00034 { 00035 CHelpfulForm* self = NewLC( aMenuResource ); 00036 CleanupStack::Pop( self ); 00037 return self; 00038 } 00039 00040 // ----------------------------------------------------------------------------- 00041 // CHelpfulForm::NewLC() 00042 // Two-phased constructor. 00043 // ----------------------------------------------------------------------------- 00044 // 00045 CHelpfulForm* CHelpfulForm::NewLC( TInt aMenuResource ) 00046 { 00047 CHelpfulForm* self = new ( ELeave ) CHelpfulForm(); 00048 CleanupStack::PushL( self ); 00049 self->ConstructL( aMenuResource ); 00050 return self; 00051 } 00052 00053 // ----------------------------------------------------------------------------- 00054 // CHelpfulForm::ConstructL() 00055 // Symbian 2nd phase constructor can leave. 00056 // ----------------------------------------------------------------------------- 00057 // 00058 void CHelpfulForm::ConstructL( TInt aMenuResource ) 00059 { 00060 // Ensure the base class construction is complete or some of the form's 00061 // features will not work 00062 CAknForm::ConstructL( aMenuResource ); 00063 } 00064 00065 // ----------------------------------------------------------------------------- 00066 // CHelpfulForm::GetHelpContext() 00067 // Gets the control's help context. Returns a NULL context by default. 00068 // ----------------------------------------------------------------------------- 00069 // 00070 void CHelpfulForm::GetHelpContext( TCoeHelpContext& aContext ) const 00071 { 00072 // Get any special help context for the control with focus, else a default 00073 aContext.iMajor = KUidHelpFile; 00074 00075 switch ( IdOfFocusControl() ) 00076 { 00077 case EHelpExampleEdwin1: 00078 // Provide special help context if first control has focus 00079 aContext.iContext = KContextEdwin1; 00080 break; 00081 00082 case EHelpExampleEdwin2: 00083 // Provide special help context if second control has focus 00084 aContext.iContext = KContextEdwin2; 00085 break; 00086 00087 default: 00088 // Provide default help context for this dialog otherwise 00089 aContext.iContext = KContextHelpfulForm; 00090 break; 00091 } 00092 } 00093 00094 // ----------------------------------------------------------------------------- 00095 // CHelpfulForm::ProcessCommandL 00096 // Processes user commands. 00097 // ----------------------------------------------------------------------------- 00098 // 00099 void CHelpfulForm::ProcessCommandL( TInt aCommandId ) 00100 { 00101 switch ( aCommandId ) 00102 { 00103 case ELaunchHelpForContext : 00104 // Pass it back to the AppUi to deal with 00105 iAvkonAppUi->HandleCommandL( aCommandId ); 00106 break; 00107 default : 00108 break; 00109 } 00110 00111 // Need to do this in all cases or menu does not disappear after 00112 // a selection is made 00113 CAknForm::ProcessCommandL( aCommandId ); 00114 } 00115 00116 // ----------------------------------------------------------------------------- 00117 // CHelpfulForm::DynInitMenuPaneL 00118 // Dynamically initialises a menu pane. 00119 // ----------------------------------------------------------------------------- 00120 // 00121 void CHelpfulForm::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) 00122 { 00123 CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); 00124 if ( aResourceId == R_AVKON_FORM_MENUPANE ) 00125 { 00126 // Override the default form options. N/A in this case 00127 aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); 00128 aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); 00129 aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); 00130 aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue ); 00131 } 00132 } 00133 00134 // End of File
|
© Nokia 2009 |