S60 3rd Edition SDK for Symbian OS
Example Applications Guide

IMOpenAPIExampleAppUi.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : IMOpenAPIExampleAppUi.h
00004 *  Part of     : IMOpenAPIExample
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-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 #ifndef IMOPENAPIEXAMPLEAPPUI_H
00017 #define IMOPENAPIEXAMPLEAPPUI_H
00018 
00019 // INCLUDES
00020 #include <eikapp.h>
00021 #include <eikdoc.h>
00022 #include <e32std.h>
00023 #include <coeccntx.h>
00024 #include <aknviewappui.h>
00025 #include <AgentDialog.h>
00026 
00027 #include "IMOpenAPIExamplemsg.h"
00028 #include "IMOpenAPIExample.hrh"
00029 
00030 
00031 // FORWARD DECLARATIONS
00032 class CIMOpenAPIExampleContainer;
00033 class CIMOpenAPIExampleDocument;
00034 class CAknWaitDialog;
00035 
00036 // CLASS DECLARATION
00037 
00038 /**
00039 * Application UI class.
00040 * Provides support for the following features:
00041 * - EIKON control architecture
00042 * 
00043 */
00044 class CIMOpenAPIExampleAppUi : public CAknViewAppUi
00045     {
00046         public: // Constructor and Destructor
00047 
00048         /**
00049         * EPOC default constructor.
00050         */      
00051         void ConstructL();
00052 
00053         /**
00054         * Destructor.
00055         */      
00056         ~CIMOpenAPIExampleAppUi();
00057         
00058         public: // Own functions
00059 
00060                 /**
00061         * SetGameState.
00062         * Set the UI according to current game state
00063         * @param aState current game state
00064         */
00065                 void SetGameState(TGameState const aState);
00066                 
00067                 /**
00068         * GetGameState.
00069         * Get the current game state
00070         * @return Current game state
00071         */
00072                 TGameState GetGameState() const;
00073 
00074                 /**
00075         * HandleMessageErrorFromModel.
00076         * handle error messages from Model. Model calls this function
00077         * @param aIntegerInfo Error information as string
00078         * aStringInfo Error information in string
00079         */
00080                 void HandleMessageErrorFromModel(       const TInt aIntegerInfo,
00081                                                                                         const TDesC& aStringInfo );
00082 
00083                 /**
00084         * HandleMessageFromModel.
00085         * handle messages from Model. Model calls this function
00086         * @param aMsgID internal message id, used inside application
00087         * aIntegerInfo information as string
00088         * aStringInfo Error information in string
00089         */
00090                 void HandleMessageFromModel(const TInternalMsgID aMsgID, 
00091                                                                                         const TInt aIntegerInfo,
00092                                                                                         const TDesC& aStringInfo );
00093                                                                                         
00094                 /**
00095         * HandleChallengeRec.
00096         * handle challenge from Model. Model calls this function when some
00097         * challenge comes
00098         * @param aUserID reference to the challenger User Id
00099         */
00100         void HandleChallengeRec(const TDesC& aUserID );
00101         
00102                 /**
00103         * HandleMessageIMConnectionFromModel.
00104         * handle connection related messages from Model. Model calls this 
00105         * function
00106         * @param aMsgID Internal message id, used inside application
00107         * aIntegerInfo Information as string
00108         */
00109                 void HandleMessageIMConnectionFromModel(const TInternalMsgID aMsgID, 
00110                                                                                         const TInt aIntegerInfo );
00111                                                                                         
00112                 /**
00113         * DisplayInfoMessage.
00114         * Displays the information message to user with given resource id
00115         * @param aResourceID resource id of the message
00116         */
00117         void DisplayInfoMessage(TInt aResourceID);
00118 
00119                 /**
00120         * PlayedIndex.
00121         * This functions gets the index position in the matrix where opponent
00122         * has marked cross or circle.
00123         * @param aIntegerInfo position in the 3*3 matrix, 0 to 8
00124         */
00125         void PlayedIndex(const TInt aIntegerInfo);
00126         
00127 
00128     private: // Functions from base classes
00129         /**
00130         * PlayedIndex.
00131         * From MEikMenuObserver
00132         */
00133         void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
00134 
00135         /**
00136         * From CEikAppUi, takes care of command handling.
00137         * @param aCommand command to be handled
00138         */
00139         void HandleCommandL(TInt aCommand);
00140 
00141         /**
00142         * From CEikAppUi, handles key events.
00143         * @param aKeyEvent Event to handled.
00144         * @param aType Type of the key event. 
00145         * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
00146         */
00147         virtual TKeyResponse HandleKeyEventL(
00148             const TKeyEvent& aKeyEvent,TEventCode aType);
00149             
00150             
00151     private: // Own functions
00152 
00153                 /**
00154         * Challenge.
00155         * Display a query dialog for User ID of the opponent to be challenged
00156         * @return ETrue if user accepts to send challenge
00157         */
00158         TBool Challenge();
00159         
00160                 /**
00161         * LoginSettings.
00162         * Do the login settings. Displays query dialogs for user id, password
00163         * server address and access points and saves to internal variables
00164         */
00165         void LoginSettings();
00166 
00167                 /**
00168         * Document.
00169         * Returns a reference to the application document
00170         * @return reference to CIMOpenAPIExampleDocument
00171         */
00172         CIMOpenAPIExampleDocument& Document() const;
00173         
00174         /**
00175         * SelectAccessPoint
00176         * Display a selection list of access points to user
00177         * and stores selected access point to iAPNumber
00178         * @return none
00179         */
00180         void SelectAccessPoint(); 
00181 
00182     private: // data
00183     
00184                 /**
00185         * iAppContainer.
00186         * Pointer to application container
00187         */
00188         CIMOpenAPIExampleContainer* iAppContainer;
00189         
00190                 /**
00191         * iWaitDialog.
00192         * Pointer to wait dialog
00193         */
00194                 CAknWaitDialog*     iWaitDialog;
00195                 
00196                 /**
00197         * iDisplayMessage.
00198         * Buffer for holding message to be displayed to the user
00199         */
00200         TBuf<KMaxInfoMsgLength> iDisplayMessage;
00201         
00202                 /**
00203         * iUserID.
00204         * Buffer for holding user id for login
00205         */
00206         TBuf<KMaxChallengeIDLength>     iUserID;
00207         
00208                 /**
00209         * iUserID.
00210         * Buffer for holding server address for login
00211         */
00212         TBuf<KMaxServerAddressLength>   iServerAddress;
00213         
00214                 /**
00215         * iPassword.
00216         * Buffer for holding password for login
00217         */
00218                 TBuf<KMaxPasswordLength>                iPassword;
00219                 
00220                 /**
00221         * iAPNumber.
00222         * Integer for holding access point for login
00223         */
00224                 TUint32                                                 iAPNumber;
00225                 
00226                 /**
00227                 * iDlgSrv
00228                 * Dialog server for access point selection
00229                 */
00230                 RGenConAgentDialogServer iDlgSrv;
00231                 
00232                 /**
00233                 * iStatus
00234                 * Request status for requests made to RGenConAgentDialogServer
00235                 */      
00236                 TRequestStatus iStatus;
00237     };
00238 
00239 #endif //IMOPENAPIEXAMPLEAPPUI_H
00240 
00241 // End of File
00242 

© Nokia 2006

Back to top