|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : IMOpenAPIExampleContainer.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 IMOPENAPIEXAMPLECONTAINER_H 00017 #define IMOPENAPIEXAMPLECONTAINER_H 00018 00019 // INCLUDES 00020 #include <coecntrl.h> 00021 #include <aknview.h> 00022 #include <e32base.h> 00023 #include <stringloader.h> 00024 #include <EIKMENUB.H> 00025 #include <IMOpenAPIExample.rsg> 00026 #include "IMOpenAPIExamplemsg.h" 00027 00028 // FORWARD DECLARATIONS 00029 class CEikLabel; 00030 class CIMOpenAPIExampleGrid; 00031 class CIMOpenAPIExamplemodel; 00032 00033 // CLASS DECLARATION 00034 00035 /** 00036 * CIMOpenAPIExampleContainer container control class. Most important aspect 00037 * of the class is holding a graphical grid, which displays game actions 00038 * 00039 */ 00040 class CIMOpenAPIExampleContainer : public CCoeControl, MCoeControlObserver 00041 { 00042 public: // Constructors and destructor 00043 00044 /** 00045 * EPOC default constructor. 00046 * @param aRect Frame rectangle for container. 00047 */ 00048 void ConstructL(const TRect& aRect); 00049 00050 /** 00051 * Destructor. 00052 */ 00053 ~CIMOpenAPIExampleContainer(); 00054 00055 public: // Own Functions 00056 00057 /** 00058 * SetCellSign. 00059 * Sets the graphical sign of given cell, either empty,cross or circle 00060 * @param aCellSign sign of the cell 00061 * aCellIndex position of the cell in the matrix 0 to 8 00062 */ 00063 void SetCellSign(const TGameSign aCellSign, const TInt aCellIndex); 00064 00065 /** 00066 * SetMySign. 00067 * Sets the players own graphical sign either cross or zero 00068 * @param aMySign Users own sign 00069 */ 00070 void SetMySign(const TGameSign aMySign); 00071 00072 /** 00073 * SetGameView. 00074 * Sets the complete game view according the the give state of the game 00075 * @param aDesiredView state of the game 00076 */ 00077 void SetGameView(const TGameState aDesiredView); 00078 00079 /** 00080 * SetModel. 00081 * Sets the pointer to model 00082 * @param aModel pointer to CIMOpenAPIExamplemodel 00083 */ 00084 void SetModel(CIMOpenAPIExamplemodel* aModel); 00085 00086 /** 00087 * PlayMove. 00088 * Plays a move at focused grid index only if that position is empty 00089 */ 00090 void PlayMove(); 00091 00092 public: // Functions from base classes 00093 00094 /** 00095 * ActivateL. 00096 * From CCoeControl 00097 */ 00098 void ActivateL(); 00099 00100 /** 00101 * From CoeControl,SizeChanged. 00102 */ 00103 void SizeChanged(); 00104 00105 /** 00106 * From CoeControl,CountComponentControls. 00107 */ 00108 TInt CountComponentControls() const; 00109 00110 /** 00111 * From CCoeControl,ComponentControl. 00112 */ 00113 CCoeControl* ComponentControl(TInt aIndex) const; 00114 00115 /** 00116 * From CCoeControl,Draw. 00117 */ 00118 void Draw(const TRect& aRect) const; 00119 00120 00121 /** 00122 * From MCoeControlObserver 00123 * Acts upon changes in the hosted control's state. 00124 * 00125 * @param aControl The control changing its state 00126 * @param aEventType The type of control event 00127 */ 00128 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); 00129 00130 /** 00131 * From CCoeControl. 00132 * Sets the complete game view according the the give state of the game 00133 */ 00134 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 00135 TEventCode aType); 00136 00137 private: // own methods 00138 00139 /** 00140 * LoadMySignBMPL. 00141 * Load the MBM file with given filename. MBM file contains images 00142 * used in this application 00143 * @param aImageFile filename 00144 */ 00145 void LoadMySignBMPL(const TDesC& aImageFile); 00146 00147 00148 private: //data 00149 00150 /** 00151 * iTurnIndicator. 00152 * Pointer to CEikLabel, a text label which shows whos turn it is 00153 */ 00154 CEikLabel* iTurnIndicator; 00155 00156 /** 00157 * iSignIndicator. 00158 * Pointer to CEikLabel, shows the players own sign text label 00159 */ 00160 CEikLabel* iSignIndicator; 00161 00162 /** 00163 * iCrossSign. 00164 * Pointer to CFbsBitmap, Graphic of cross sign 00165 */ 00166 CFbsBitmap* iCrossSign; 00167 00168 /** 00169 * iZeroSign. 00170 * Pointer to CFbsBitmap, Graphic of circle sign 00171 */ 00172 CFbsBitmap* iZeroSign; 00173 00174 /** 00175 * iEmptySign. 00176 * Pointer to CFbsBitmap, Graphic of an empty sign 00177 */ 00178 CFbsBitmap* iEmptySign; 00179 00180 /** 00181 * iMySignBMP. 00182 * Pointer to CFbsBitmap, Graphic of user's own sign, cross or circle 00183 */ 00184 CFbsBitmap* iMySignBMP; 00185 00186 /** 00187 * iMySign. 00188 * User's own sign in enum format 00189 */ 00190 TGameSign iMySign; 00191 00192 /** 00193 * iImageFileName. 00194 * Name of the image file where images used by this application are stored 00195 */ 00196 TFileName iImageFileName; 00197 00198 /** 00199 * iModel. 00200 * Pointer to CIMOpenAPIExamplemodel 00201 */ 00202 CIMOpenAPIExamplemodel* iModel; 00203 00204 /** 00205 * iGamesGrid. 00206 * Pointer to CIMOpenAPIExampleGrid, container hold this object 00207 */ 00208 CIMOpenAPIExampleGrid* iGamesGrid; 00209 00210 /** 00211 * iCba. 00212 * To help draw screen correctly 00213 */ 00214 CEikButtonGroupContainer* iCba; 00215 }; 00216 00217 00218 00219 #endif //IMOPENAPIEXAMPLECONTAINER_H 00220 00221 // End of File 00222
|
© Nokia 2006 |