|
Nokia N97 SDK Example Applications Guide |
#include <MyViewView2.h>
Inheritance diagram for CMyViewView2:

Definition at line 38 of file MyViewView2.h.
Public Member Functions |
|
| void | ConstructL () |
| ~CMyViewView2 () | |
| TUid | Id () const |
| void | HandleCommandL (TInt aCommand) |
| void | HandleClientRectChange () |
Private Member Functions |
|
| void | DoActivateL (const TVwsViewId &aPrevViewId, TUid aCustomMessageId, const TDesC8 &aCustomMessage) |
| void | DoDeactivate () |
Private Attributes |
|
| CMyViewContainer2 * | iContainer |
|
|
Destructor. Definition at line 49 of file MyViewView2.cpp. References iContainer. 00050 { 00051 if ( iContainer ) 00052 { 00053 AppUi()->RemoveFromViewStack( *this, iContainer ); 00054 } 00055 00056 delete iContainer; 00057 }
|
|
|
EPOC default constructor. Definition at line 39 of file MyViewView2.cpp.
|
|
|
Return Uid Definition at line 64 of file MyViewView2.cpp.
|
|
|
Handle Commands Definition at line 75 of file MyViewView2.cpp. 00076 { 00077 switch ( aCommand ) 00078 { 00079 case EAknSoftkeyOk: 00080 { 00081 break; 00082 } 00083 case EAknSoftkeyExit: 00084 { 00085 AppUi()->HandleCommandL(EEikCmdExit); 00086 break; 00087 } 00088 case EMyViewCmdView2Cmd1: 00089 { 00090 // Open calendar application in month view. 00091 // If other than month view is defined as default view, 00092 // month view will open only if calendar application is running on background. 00093 // If calendar is not running, user defined default view will open instead. 00094 // This is done by framework, when calendar gets focus, the default view will open. 00095 const TUid KCalendarUid = { 0x10005901 }; // Application Uid 00096 const TUid KCalendarViewUid = { 1 }; // View Uid of the external application 00097 AppUi()->ActivateViewL(TVwsViewId(KCalendarUid, KCalendarViewUid)); 00098 00099 break; 00100 } 00101 case EMyViewCmdView2Cmd2: 00102 { 00103 00104 //Open Messagin to main view 00105 const TUid KMessagingUid = { 0x100058C5 }; // Application Uid 00106 const TUid KInboxViewUid = { 1 }; // View Uid of the external application 00107 AppUi()->ActivateViewL(TVwsViewId(KMessagingUid, KInboxViewUid)); 00108 00109 break; 00110 } 00111 case EMyViewCmdView2Cmd3: 00112 { 00113 00114 const TUid KRecorderUid = { 0x100058CA }; // Application Uid 00115 00116 // Start recorder in recorder view and have it start immeditately 00117 const TUid KRecorderViewUid = { 1 }; // View Uid of the external application 00118 const TUid KRecorderMessageUid = { 2 }; // MessageUid of the external application 00119 AppUi()->ActivateViewL(TVwsViewId(KRecorderUid, KRecorderViewUid), KRecorderMessageUid, 00120 KNullDesC8); 00121 00122 break; 00123 } 00124 case EMyViewCmdView2Cmd4: 00125 { 00126 // Open phonebook application with focused view 00127 const TUid appUid = { 0x101f4cce }; // Application Uid 00128 const TUid KExtViewUid= { 4 }; // Contact Info View Uid of Phonebook Application 00129 00130 TInt contact = 1; 00131 CAknNumberQueryDialog *dlg = CAknNumberQueryDialog::NewL(contact); 00132 if (dlg->ExecuteLD(R_CONTACT_NUMBER_QUERY)) 00133 { 00134 // ok pressed 00135 00136 // Costruct a message for Phonebook application 00137 CPbkViewState* pbkViewParam = CPbkViewState::NewLC(); 00138 00139 // Focus on contact with specified id-number. You have to have 00140 // the specified contact for this to work. 00141 pbkViewParam->SetFocusedContactId(contact); 00142 // Package and return object in a buffer. 00143 HBufC8* paramBuf = pbkViewParam->PackLC(); 00144 00145 // Activate the view 00146 AppUi()->ActivateViewL(TVwsViewId(appUid, KExtViewUid), CPbkViewState::Uid(), 00147 *paramBuf); 00148 00149 // Cleanup 00150 CleanupStack::PopAndDestroy(paramBuf); 00151 CleanupStack::PopAndDestroy(pbkViewParam); 00152 } 00153 break; 00154 } 00155 00156 default: 00157 { 00158 AppUi()->HandleCommandL( aCommand ); 00159 break; 00160 } 00161 } 00162 }
|
|
|
Handle size change Definition at line 168 of file MyViewView2.cpp. References iContainer. 00169 { 00170 if ( iContainer ) 00171 { 00172 iContainer->SetRect( ClientRect() ); 00173 } 00174 }
|
|
||||||||||||||||
|
From AknView, activates view Definition at line 182 of file MyViewView2.cpp. References CMyViewContainer2::ConstructL(), and iContainer. 00185 { 00186 00187 // Create Container 00188 if (!iContainer) 00189 { 00190 iContainer = new (ELeave) CMyViewContainer2; 00191 iContainer->SetMopParent(this); 00192 iContainer->ConstructL( ClientRect() ); 00193 AppUi()->AddToStackL( *this, iContainer ); 00194 } 00195 00196 00197 // Check aCustomMessageId to handle aCustomMessage 00198 // You could check aPrevViewId if you were curious to know 00199 // from where this view was called from. 00200 const TUid KLocalComparisionUid= {2}; 00201 if (aCustomMessageId==KLocalComparisionUid) 00202 { 00203 TBuf8<255> customMessage; 00204 customMessage.Copy(aCustomMessage); 00205 00206 // do something with aCustomMessage 00207 if (customMessage==KNullDesC8) 00208 iEikonEnv->InfoMsg(_L("MessageUid passed")); 00209 else 00210 iEikonEnv->InfoMsg(_L("Message and Uid passed")); 00211 00212 } 00213 }
|
|
|
From AknView, deactivates view Definition at line 221 of file MyViewView2.cpp. References iContainer. 00222 { 00223 if ( iContainer ) 00224 { 00225 AppUi()->RemoveFromViewStack( *this, iContainer ); 00226 } 00227 00228 delete iContainer; 00229 iContainer = NULL; 00230 }
|
|
© Nokia 2009 |